NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

standards/44876: awk: incorrect return value of function srand()

>Number:         44876
>Category:       standards
>Synopsis:       awk: incorrect return value of function srand()
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    standards-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 18 12:40:00 +0000 2011
>Originator:     Aleksey Cheusov
>Release:        Linux 2.6.18-194.32.1.el5xen
<organization of PR author (multiple lines)>
NetBSD 5.1 NetBSD 5.1 (GENERIC) #0: Mon Jan 31 23:53:52 
EET 2011 
According to POSIX/SUS

    Set the seed value for rand to expr or use the time of day if expr
    is omitted. The previous seed value shall be returned.

awk from NetBSD returns new seed, gawk and mawk work correctly.

   0 cheusov>awk 'BEGIN {print srand(1), srand(2), srand(3)}'
   1 2 3
   0 cheusov>mawk 'BEGIN {print srand(1), srand(2), srand(3)}'
   1303130273 1 2
   0 cheusov>gawk 'BEGIN {print srand(1), srand(2), srand(3)}'
   1 1 2
   0 cheusov>



Home | Main Index | Thread Index | Old Index