GNU bug report logs - #23537
timeout test gets false-positive for duration of -1.189731495357231765e+4932

Previous Next

Package: coreutils;

Reported by: Jim Meyering <jim <at> meyering.net>

Date: Sat, 14 May 2016 17:10:01 UTC

Severity: normal

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

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: bug-coreutils <at> gnu.org
Subject: timeout test gets false-positive for duration of
 -1.189731495357231765e+4932
Date: Sat, 14 May 2016 10:09:19 -0700
On systems with recent glibc, this abuse of timeout elicits the expected error:

  $ src/timeout -- -1.189731495357231765e+4932 sleep 0
  src/timeout: invalid time interval ‘-1.189731495357231765e+4932’
  Try 'src/timeout --help' for more information.

But with glibc-2.12's strtod, that input maps to a double-precision
value of 0 rather than to -inf, so timeout does this:

  $ src/timeout -- -1.189731495357231765e+4932 sleep 0; echo $?
  0

Similarly, the sleep.sh test fails because even without the leading "-",
that number ($LDBL_MAX) maps to 0:

  $ src/timeout 0.1 sleep 1.189731495357231765e+4932; echo $?
  0

which causes two tests to fail:

  tests/misc/timeout-parameters
  tests/misc/sleep

I see a couple of ways to avoid trouble.
Perhaps the most general is to make gnulib's strtod module detect and
compensate for these errors.
But that's CentOS6-era glibc, so maybe not worth it for such a corner case.




This bug report was last modified 9 years and 67 days ago.

Previous Next


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