Time.now == "" causes an infinite loop
|ruby -v:||ruby 2.0.0dev (2013-02-08) [x86_64-darwin12.2.1]||Backport:|
This is a regression from 1.9.
$ ./ruby20 -v ../branches/ruby200/test.rb
ruby 2.0.0dev (2013-02-08) [x8664-darwin12.2.1]
../branches/ruby200/test.rb:1: warning: possibly useless use of == in void context
../branches/ruby200/test.rb:1: stack level too deep (SystemStackError)
$ ruby19 -v test.rb
ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-darwin12.2.1]
test.rb:1: warning: possibly useless use of == in void context
This also reproduces in trunk.
#2 Updated by Yusuke Endoh about 1 year ago
- Priority changed from Urgent to Normal
I don't think that this is a showstopper, unless there is many or famous application depending on this behavior. Do you know anything?
After it is fixed in trunk, we may backport the patch to 2.0.0, but don't necessarily have to do so. I guess that it can be fixed 2.0.0-pXXX later (depending on Nagachika-san).
Yusuke Endoh email@example.com
#3 Updated by Eric Hodel about 1 year ago
Fog breaks due to this change (it is how I discovered it):
This compares a Time with the empty string leading to the infinite loop.
Fog provides an API for cloud services such as Amazon AWS, OpenStack, etc. It is fairly popular.
#6 Updated by Nobuyoshi Nakada about 1 year ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r39292.
Eric, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
compar.c: inversed comarison without infinite recursion
- compar.c (rb_invcmp): compare by inversed comarison, with preventing from infinite recursion. [Bug #7870]
- string.c (rbstrcmpm), time.c (timecmp): get rid of infinite recursion.