[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#551133: sbcl: TIME sometimes endlessly spews zeroes

Package: sbcl
Version: 1:
Severity: normal

Sometimes (TIME x) prints #\0 endlessly.  It looks like the condition
is when the evaluation of x takes a whole number of wall-clock seconds
greater than 1 (+/- 1ms).

Examples (Ctrl+C successfully interrupts SBCL):

  sbcl --noinform --eval '(time (sleep 2))' --eval '(sb-ext:quit)'

  sbcl --noinform --eval '(time (sleep 9))' --eval '(sb-ext:quit)'

If you don't see the problem, it's probably because SLEEP took
e.g. 2.001 seconds instead of 2.000.  Keep trying.

Other cases of (TIME (SLEEP n)), where n is 0, 1 or not an integer,
don't suffer from the same problem.

It looks like the implementation of TIME uses FORMAT-MILLISECONDS,
which suffers from the same problem.  I tried finding the bug in
%FORMAT-DECIMAL (called by FORMAT-MILLISECONDS), but it looks like the
loop it's getting caught in (the one in the %ZEROES local function)
should terminate in all cases, so I couldn't pinpoint the error.

(SB-IMPL::FORMAT-MILLISECONDS *standard-output* 2001 nil nil)
>> 2.001 seconds
=> " seconds"

(SB-IMPL::FORMAT-MILLISECONDS *standard-output* 2000 nil nil)
>> 2.0000000000000...
=> (doesn't return)

Thanks for taking a look at this,

-- System Information:
Debian Release: 5.0.3
  APT prefers stable
  APT policy: (700, 'stable'), (650, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages sbcl depends on:
ii  common-lisp-controller        6.17       Common Lisp source and compiler ma
ii  libc6                         2.9-25     GNU C Library: Shared libraries

Versions of packages sbcl recommends:
pn  binfmt-support                <none>     (no description available)

Versions of packages sbcl suggests:
pn  sbcl-doc               <none>            (no description available)
pn  sbcl-source            <none>            (no description available)
ii  slime                  1:20080223.dfsg-1 Superior LISP Interaction Mode for

-- no debconf information

J.P. Larocque <jpl at thoughtcrime.us>

Reply to: