Forum: Ruby-core [ruby-trunk - Bug #7870][Open] Time.now == "" causes an infinite loop

58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 drbrain (Eric Hodel) (Guest)
on 2013-02-17 01:11
(Received via mailing list)
Issue #7870 has been reported by drbrain (Eric Hodel).

----------------------------------------
Bug #7870: Time.now == "" causes an infinite loop
https://bugs.ruby-lang.org/issues/7870

Author: drbrain (Eric Hodel)
Status: Open
Priority: Urgent
Assignee:
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2013-02-08) [x86_64-darwin12.2.1]


=begin
This is a regression from 1.9.

2.0.0 branch:

  $ ./ruby20 -v ../branches/ruby_2_0_0/test.rb
  ruby 2.0.0dev (2013-02-08) [x86_64-darwin12.2.1]
  ../branches/ruby_2_0_0/test.rb:1: warning: possibly useless use of ==
in void context
  ../branches/ruby_2_0_0/test.rb:1: stack level too deep
(SystemStackError)

1.9:

  $ 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.

=end
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 drbrain (Eric Hodel) (Guest)
on 2013-02-17 01:23
(Received via mailing list)
Issue #7870 has been updated by drbrain (Eric Hodel).

Assignee set to nobu (Nobuyoshi Nakada)

r38044 is the culprit.

Previously Ruby would return nil if the other object did not have
to_str, now ruby calls other <=> self when other is not a String and
does not have <=> leading to the infinite loop.
----------------------------------------
Bug #7870: Time.now == "" causes an infinite loop
https://bugs.ruby-lang.org/issues/7870#change-36350

Author: drbrain (Eric Hodel)
Status: Open
Priority: Urgent
Assignee: nobu (Nobuyoshi Nakada)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2013-02-08) [x86_64-darwin12.2.1]


=begin
This is a regression from 1.9.

2.0.0 branch:

  $ ./ruby20 -v ../branches/ruby_2_0_0/test.rb
  ruby 2.0.0dev (2013-02-08) [x86_64-darwin12.2.1]
  ../branches/ruby_2_0_0/test.rb:1: warning: possibly useless use of ==
in void context
  ../branches/ruby_2_0_0/test.rb:1: stack level too deep
(SystemStackError)

1.9:

  $ 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.

=end
F24ff61beb80aa5f13371aa22a35619c?d=identicon&s=25 mame (Yusuke Endoh) (Guest)
on 2013-02-17 07:06
(Received via mailing list)
Issue #7870 has been updated by mame (Yusuke Endoh).

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 <mame@tsg.ne.jp>
----------------------------------------
Bug #7870: Time.now == "" causes an infinite loop
https://bugs.ruby-lang.org/issues/7870#change-36396

Author: drbrain (Eric Hodel)
Status: Open
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2013-02-08) [x86_64-darwin12.2.1]


=begin
This is a regression from 1.9.

2.0.0 branch:

  $ ./ruby20 -v ../branches/ruby_2_0_0/test.rb
  ruby 2.0.0dev (2013-02-08) [x86_64-darwin12.2.1]
  ../branches/ruby_2_0_0/test.rb:1: warning: possibly useless use of ==
in void context
  ../branches/ruby_2_0_0/test.rb:1: stack level too deep
(SystemStackError)

1.9:

  $ 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.

=end
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 drbrain (Eric Hodel) (Guest)
on 2013-02-17 09:41
(Received via mailing list)
Issue #7870 has been updated by drbrain (Eric Hodel).


Fog breaks due to this change (it is how I discovered it):

https://github.com/fog/fog/blob/master/lib/fog/cor...

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.
----------------------------------------
Bug #7870: Time.now == "" causes an infinite loop
https://bugs.ruby-lang.org/issues/7870#change-36414

Author: drbrain (Eric Hodel)
Status: Open
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2013-02-08) [x86_64-darwin12.2.1]


=begin
This is a regression from 1.9.

2.0.0 branch:

  $ ./ruby20 -v ../branches/ruby_2_0_0/test.rb
  ruby 2.0.0dev (2013-02-08) [x86_64-darwin12.2.1]
  ../branches/ruby_2_0_0/test.rb:1: warning: possibly useless use of ==
in void context
  ../branches/ruby_2_0_0/test.rb:1: stack level too deep
(SystemStackError)

1.9:

  $ 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.

=end
C4e88907313843cf07f6d85ba8162120?d=identicon&s=25 ko1 (Koichi Sasada) (Guest)
on 2013-02-17 10:25
(Received via mailing list)
Issue #7870 has been updated by ko1 (Koichi Sasada).

Priority changed from Normal to Urgent


----------------------------------------
Bug #7870: Time.now == "" causes an infinite loop
https://bugs.ruby-lang.org/issues/7870#change-36415

Author: drbrain (Eric Hodel)
Status: Open
Priority: Urgent
Assignee: nobu (Nobuyoshi Nakada)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2013-02-08) [x86_64-darwin12.2.1]


=begin
This is a regression from 1.9.

2.0.0 branch:

  $ ./ruby20 -v ../branches/ruby_2_0_0/test.rb
  ruby 2.0.0dev (2013-02-08) [x86_64-darwin12.2.1]
  ../branches/ruby_2_0_0/test.rb:1: warning: possibly useless use of ==
in void context
  ../branches/ruby_2_0_0/test.rb:1: stack level too deep
(SystemStackError)

1.9:

  $ 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.

=end
F24ff61beb80aa5f13371aa22a35619c?d=identicon&s=25 mame (Yusuke Endoh) (Guest)
on 2013-02-17 11:36
(Received via mailing list)
Issue #7870 has been updated by mame (Yusuke Endoh).

Status changed from Open to Assigned

drbrain, thank you!  That is terrible.

Nobu, please check and fix it!

--
Yusuke Endoh <mame@tsg.ne.jp>
----------------------------------------
Bug #7870: Time.now == "" causes an infinite loop
https://bugs.ruby-lang.org/issues/7870#change-36423

Author: drbrain (Eric Hodel)
Status: Assigned
Priority: Urgent
Assignee: nobu (Nobuyoshi Nakada)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2013-02-08) [x86_64-darwin12.2.1]


=begin
This is a regression from 1.9.

2.0.0 branch:

  $ ./ruby20 -v ../branches/ruby_2_0_0/test.rb
  ruby 2.0.0dev (2013-02-08) [x86_64-darwin12.2.1]
  ../branches/ruby_2_0_0/test.rb:1: warning: possibly useless use of ==
in void context
  ../branches/ruby_2_0_0/test.rb:1: stack level too deep
(SystemStackError)

1.9:

  $ 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.

=end
This topic is locked and can not be replied to.