NetBSD Problem Report #44876
From cheusov@tut.by Mon Apr 18 12:39:43 2011
Return-Path: <cheusov@tut.by>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id 5551F63C02F
for <gnats-bugs@gnats.netbsd.org>; Mon, 18 Apr 2011 12:39:43 +0000 (UTC)
Message-Id: <s9339lfd98e.fsf@centos.imb.invention.com>
Date: Mon, 18 Apr 2011 15:39:29 +0300
From: cheusov@tut.by
To: gnats-bugs@gnats.netbsd.org
Subject: awk: incorrect return value of function srand()
X-Send-Pr-Version: 3.113.1
X-GNATS-Notify:
>Number: 44876
>Category: standards
>Synopsis: awk: incorrect return value of function srand()
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: standards-manager
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Apr 18 12:40:00 +0000 2011
>Closed-Date: Mon Apr 18 20:56:33 +0000 2011
>Last-Modified: Mon Apr 18 20:56:33 +0000 2011
>Originator: Aleksey Cheusov
>Release: Linux 2.6.18-194.32.1.el5xen
>Organization:
<organization of PR author (multiple lines)>
>Environment:
NetBSD asrock.chizhovka.net 5.1 NetBSD 5.1 (GENERIC) #0: Mon Jan 31 23:53:52 EET 2011 cheusov@asrock.chizhovka.net:/srv/obj/sys/arch/amd64/compile/GENERIC amd64
>Description:
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>
>How-To-Repeat:
>Fix:
Unknown
>Release-Note:
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/44876 CVS commit: src/external/historical/nawk/dist
Date: Mon, 18 Apr 2011 11:23:29 -0400
Module Name: src
Committed By: christos
Date: Mon Apr 18 15:23:28 UTC 2011
Modified Files:
src/external/historical/nawk/dist: main.c run.c
Log Message:
PR/44876: Aleksey Cheusov: awk: incorrect return value of function srand()
Make it return the value of the previous random seed as the standard mandates.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/historical/nawk/dist/main.c
cvs rdiff -u -r1.2 -r1.3 src/external/historical/nawk/dist/run.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Aleksey Cheusov <cheusov@tut.by>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: PR/44876 CVS commit: src/external/historical/nawk/dist
Date: Mon, 18 Apr 2011 22:21:02 +0300
> cvs rdiff -u -r1.4 -r1.5 src/external/historical/nawk/dist/main.c
> cvs rdiff -u -r1.2 -r1.3 src/external/historical/nawk/dist/run.c
It looks good. Thanks!
--
Best regards, Aleksey Cheusov.
State-Changed-From-To: open->closed
State-Changed-By: christos@NetBSD.org
State-Changed-When: Mon, 18 Apr 2011 16:56:33 -0400
State-Changed-Why:
submitter verified it has been fixed.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.