Project

General

Profile

Bug #1396

Kernel.sleep fails with some Float values

Added by plambert (Paul Lambert) over 10 years ago. Updated about 2 months ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9]

Description

=begin
I'm on Mac OS X Leopard 10.5.6, running ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9]

irb(main):003:0> sleep (0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1)
Errno::EINVAL: Invalid argument - sleep
from (irb):3:in sleep'
from (irb):3
from :0
irb(main):004:0> x= (0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1)
=> 1.0
irb(main):005:0> x.inspect
=> "1.0"
irb(main):006:0> sleep x
Errno::EINVAL: Invalid argument - sleep
from (irb):6:in
sleep'
from (irb):6
from :0
irb(main):007:0> sleep (x+0.0)
Errno::EINVAL: Invalid argument - sleep
from (irb):7:in sleep'
from (irb):7
from :0
irb(main):018:0> sleep((x*100.0)/100.0)
Errno::EINVAL: Invalid argument - sleep
from (irb):18:in
sleep'
from (irb):18
from :0
irb(main):019:0> sleep((x*100.0).to_i/100.0)
=> 1
=end

Associated revisions

Revision f90333a7
Added by nobu (Nobuyoshi Nakada) over 10 years ago

  • time.c (time_timeval): check out-of-range. [ruby-core:23282] [Bug #1396]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision a397887e
Added by nobu (Nobuyoshi Nakada) over 10 years ago

  • time.c (time_timespec): check out-of-range. [ruby-core:23282] [Bug #1396]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 23260
Added by nobu (Nobuyoshi Nakada) over 10 years ago

  • time.c (time_timespec): check out-of-range. [ruby-core:23282] [Bug #1396]

Revision 23260
Added by nobu (Nobuyoshi Nakada) over 10 years ago

  • time.c (time_timespec): check out-of-range. [ruby-core:23282] [Bug #1396]

Revision 23260
Added by nobu (Nobuyoshi Nakada) over 10 years ago

  • time.c (time_timespec): check out-of-range. [ruby-core:23282] [Bug #1396]

Revision 23260
Added by nobu (Nobuyoshi Nakada) over 10 years ago

  • time.c (time_timespec): check out-of-range. [ruby-core:23282] [Bug #1396]

Revision 23260
Added by nobu (Nobuyoshi Nakada) over 10 years ago

  • time.c (time_timespec): check out-of-range. [ruby-core:23282] [Bug #1396]

Revision 23260
Added by nobu (Nobuyoshi Nakada) over 10 years ago

  • time.c (time_timespec): check out-of-range. [ruby-core:23282] [Bug #1396]

Revision 4fffacd9
Added by shyouhei (Shyouhei Urabe) over 10 years ago

merge revision(s) 23259,24059:
* time.c (time_timeval): check out-of-range. [ruby-core:23282]
[Bug #1396]
* time.c (time_timeval): rounds subsecond toward zero.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@24060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 52880
Added by hsbt (Hiroshi SHIBATA) almost 4 years ago

  • lib/rubygems: Update to RubyGems 2.5.0+ HEAD(fdab4c4). this version includes #1396, #1397, #1398, #1399
  • test/rubygems: ditto.

Revision 52880
Added by hsbt (Hiroshi SHIBATA) almost 4 years ago

  • lib/rubygems: Update to RubyGems 2.5.0+ HEAD(fdab4c4). this version includes #1396, #1397, #1398, #1399
  • test/rubygems: ditto.

Revision 52880
Added by hsbt (Hiroshi SHIBATA) almost 4 years ago

  • lib/rubygems: Update to RubyGems 2.5.0+ HEAD(fdab4c4). this version includes #1396, #1397, #1398, #1399
  • test/rubygems: ditto.

Revision 52880
Added by hsbt (Hiroshi SHIBATA) almost 4 years ago

  • lib/rubygems: Update to RubyGems 2.5.0+ HEAD(fdab4c4). this version includes #1396, #1397, #1398, #1399
  • test/rubygems: ditto.

Revision 52880
Added by hsbt (Hiroshi SHIBATA) almost 4 years ago

  • lib/rubygems: Update to RubyGems 2.5.0+ HEAD(fdab4c4). this version includes #1396, #1397, #1398, #1399
  • test/rubygems: ditto.

History

#1

Updated by znz (Kazuhiro NISHIYAMA) over 10 years ago

=begin
I can reproduce on powerpc Mac OS X.

ppc-mac-mini:~ kazu$ build/ruby/ruby_1_8_7/ruby/ruby-1.8.7 -ve 'sleep(0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1)'
ruby 1.8.7 (2009-01-07 patchlevel 79) [powerpc-darwin9.6.0]
-e:1:in `sleep': Invalid argument - sleep (Errno::EINVAL)
from -e:1
ppc-mac-mini:~ kazu$ gdb --args build/ruby/ruby_1_8_7/ruby/ruby-1.8.7 -ve 'sleep(0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1)'
GNU gdb 6.3.50-20050815 (Apple version gdb-768) (Tue Oct 2 04:11:19 UTC 2007)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "powerpc-apple-darwin"...Reading symbols for shared libraries ..... done

(gdb) b select
Breakpoint 1 at 0x9fc08
Breakpoint 2 at 0x68160
Breakpoint 3 at 0x64d14
Breakpoint 4 at 0x49fdc
Breakpoint 5 at 0x49f98
warning: Multiple breakpoints were set.
Use the "delete" command to delete unwanted breakpoints.
(gdb) r
Starting program: /Users/kazu/build/ruby/ruby_1_8_7/ruby/ruby-1.8.7 -ve sleep(0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1)
Reading symbols for shared libraries ++++... done
Breakpoint 1 at 0x92ebac18
Breakpoint 2 at 0x92e83180
Breakpoint 3 at 0x92e7fd14
Breakpoint 4 at 0x92e64fdc
Breakpoint 5 at 0x92e64fb8
ruby 1.8.7 (2009-01-07 patchlevel 79) [powerpc-darwin9.6.0]

Breakpoint 3, 0x92e7fd14 in select$DARWIN_EXTSN ()
(gdb) up
#1 0x00145854 in rb_thread_wait_for (time={tv_sec = 0, tv_usec = 1000000}) at /Users/kazu/wc/ruby/branches/ruby_1_8_7/eval.c:11239
11239 n = select(0, 0, 0, 0, &time);
(gdb) p time
$1 = {
tv_sec = 0,
tv_usec = 1000000
}
(gdb)

=end

#2

Updated by nobu (Nobuyoshi Nakada) over 10 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r23259.
=end

#3

Updated by shyouhei (Shyouhei Urabe) over 10 years ago

  • Status changed from Closed to Open
  • Assignee set to shyouhei (Shyouhei Urabe)

=begin

=end

#4

Updated by shyouhei (Shyouhei Urabe) over 10 years ago

  • Status changed from Open to Closed

=begin
Applied in changeset r24060.
=end

#5

Updated by shyouhei (Shyouhei Urabe) over 10 years ago

  • Status changed from Closed to Open
  • Assignee changed from shyouhei (Shyouhei Urabe) to wyhaines (Kirk Haines)

=begin

=end

#6

Updated by shyouhei (Shyouhei Urabe) about 9 years ago

  • Status changed from Open to Assigned

=begin

=end

#7

Updated by jeremyevans0 (Jeremy Evans) about 2 months ago

  • Backport set to 2.5: UNKNOWN, 2.6: UNKNOWN
  • ruby -v set to ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9]
  • Status changed from Assigned to Closed
  • Description updated (diff)
  • Project changed from Backport186 to Ruby master
  • Tracker changed from Backport to Bug

Also available in: Atom PDF