NetBSD Problem Report #14558
Received: (qmail 8343 invoked from network); 12 Nov 2001 13:48:28 -0000
Message-Id: <200111121328.fACDSXd00985@kaakeli.ssh.fi>
Date: Mon, 12 Nov 2001 15:28:33 +0200 (EET)
From: kivinen@ssh.fi
Reply-To: kivinen@ssh.fi
To: gnats-bugs@gnats.netbsd.org
Subject: Sleep 100000001 exits immediately with exit status 0
X-Send-Pr-Version: 3.95
>Number: 14558
>Category: bin
>Synopsis: Sleep 100000001 exits immediately with exit status 0
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Nov 12 13:49:00 +0000 2001
>Closed-Date: Mon Nov 12 14:57:06 +0000 2001
>Last-Modified: Sat Mar 31 11:45:00 +0000 2012
>Originator: Tero Kivinen
>Release: NetBSD 1.5Y
>Organization:
SSH Communications Security
>Environment:
System: NetBSD kaakeli.ssh.fi 1.5Y NetBSD 1.5Y (KAAKELI) #47: Wed Oct 31 02:45:43 EET 2001 kivinen@kaakeli.acr.fi:/usr/src/sys/arch/i386/compile/KAAKELI i386
Architecture: i386
Machine: i386
>Description:
$ /bin/sleep 100000000
^C
$ /bin/sleep 100000001
$ echo $?
0
$
I.e the first /bin/sleep will wait for 100000000 seconds
(interrupted), but the second will exit immediately without
returning any error.
This is because sleep.c does not check the return value of the
nanosleep. The nanonsleep man page says that it returns EINVAL
if the value is greater than 1000 million.
Actually the code in the kern_time.c inside the itimerfix will
return EINVAL if the value is greater than 100 million, not
1000 million given in the nanosleep man page.
>How-To-Repeat:
/bin/sleep 100000001
>Fix:
Fix the documentation of the nanosleep to have proper amount.
Check the return value of the nanosleep inside the sleep and
exit with error code if it fails. Also add text to the sleep
man page to document this bug.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: christos
State-Changed-When: Mon Nov 12 09:56:15 EST 2001
State-Changed-Why:
Fixed; sleep will now detect errors and exit properly, and nanosleep will
accept up to 1000 million seconds as the manual page suggested.
From: "Jukka Ruohonen" <jruoho@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/14558 CVS commit: src/tests/lib/libc/sys
Date: Sat, 31 Mar 2012 11:41:34 +0000
Module Name: src
Committed By: jruoho
Date: Sat Mar 31 11:41:33 UTC 2012
Modified Files:
src/tests/lib/libc/sys: t_nanosleep.c
Log Message:
Note PR bin/14558.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/sys/t_nanosleep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>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.