GNU bug report logs - #7877
sleep takes undocumented hex args

Previous Next

Package: coreutils;

Reported by: jidanni <at> jidanni.org

Date: Fri, 21 Jan 2011 00:09:02 UTC

Severity: normal

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jim Meyering <jim <at> meyering.net>
Cc: 7877 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: bug#7877: sleep 5 -4
Date: Tue, 25 Jan 2011 01:27:49 -0800
OK, so it's late, but I can't resist:

First, 'sleep' does accept one number that's negative
in an IEEE-754 sense, namely, "sleep -- -0.0".

Second, due to rounding error, 'sleep' does accept some
numbers that are negative in a mathematical sense, e.g.,
"sleep -- -1e1000" works.

Third, there's nothing intrinsically wrong with 'sleep'
accepting negative numbers.  All that POSIX
requires is that 'sleep' must sleep for at *least* the
amount of time specified.  So, if "sleep -- -1.0"
is treated like "sleep 0", then it's conforming to
that requirement of POSIX (obviously it doesn't
conform to the other requirement that the operand be
a nonnegative decimal integer; but it's a valid extension
that is consistent with POSIX).

(Have I written enough to tempt you to extend 'sleep'
to allow negative numbers?  :-)




This bug report was last modified 14 years and 119 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.