c***@tut.by
2011-04-18 12:40:11 UTC
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)>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
According to POSIX/SUS
(http://pubs.opengroup.org/onlinepubs/009695399/utilities/awk.html)
srand([expr])
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>
Unknown