Ruby Issue Tracking System: Issueshttps://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112014-10-24T21:24:52ZRuby Issue Tracking System
Redmine Ruby master - Misc #10424 (Open): Error message when sorting NaNhttps://bugs.ruby-lang.org/issues/104242014-10-24T21:24:52Zjmthomas (Jason Thomas)
<p>When sorting an array of floats with a NaN you get a very confusing message:<br>
irb(main):001:0> [0.0/0.0,1.0,2.0].sort<br>
ArgumentError: comparison of Float with Float failed</p>
<p>Sorting a nil is much friendlier:<br>
irb(main):012:0> [nil,1.0,2.0].sort<br>
ArgumentError: comparison of NilClass with Float failed</p>
<p>This is confusing for many. Simply google for "comparison of Float with Float failed" and makes for a difficult debugging session for anyone who doesn't know that NaN produces this result. What I would expect is:<br>
irb(main):001:0> [0.0/0.0,1.0,2.0].sort<br>
ArgumentError: comparison of NaN with Float failed</p> Ruby master - Bug #6401 (Closed): Windows bug with File.poshttps://bugs.ruby-lang.org/issues/64012012-05-05T00:33:56Zjmthomas (Jason Thomas)
<p>On Windows since Ruby 1.9.3p125 there have been issues with File.pos and File.readline. Ruby 1.9.3p0 does not have this issue. I have created the following test:</p>
<p>def test_pos_with_readline<br>
t = make_tempfile<br>
random = Random.new(1234)<br>
open(t.path, "w") do |f|<br>
500.times do<br>
f.puts "X"*random.rand(80)<br>
end<br>
end<br>
i = 0<br>
lines = open(t.path,'r').read.split("\n")<br>
open(t.path, "r") do |f|<br>
lines.length.times do<br>
f.pos<br>
assert_equal lines[i], f.readline.chomp<br>
i += 1<br>
end<br>
end<br>
end</p>
<p>If you comment out the f.pos line this test case will pass. I originally submitted issue <a class="issue tracker-4 status-5 priority-4 priority-default closed" title="Backport: File::pos broken in Windows 1.9.3p125 (Closed)" href="https://bugs.ruby-lang.org/issues/6179">#6179</a> but the fixes applied there made things better but did not complete solve the problem. I apologize for the test case but it requires many lines with newlines to reproduce.</p> Backport193 - Backport #6179 (Closed): File::pos broken in Windows 1.9.3p125https://bugs.ruby-lang.org/issues/61792012-03-21T01:57:12Zjmthomas (Jason Thomas)
<p>Calling the pos method on a File in the Windows version of Ruby on 1.9.3p125 moves the file pointer. Thus it can not be called without side effect.</p> Backport191 - Bug #2763 (Closed): ruby-lex hangs if there is no newline at end of filehttps://bugs.ruby-lang.org/issues/27632010-02-19T07:47:20Zjmthomas (Jason Thomas)
<p>=begin<br>
When calling RubyLex.token in a while loop, the parser spins returning TkIDENTIFIER if there is no newline at the end of the file. This bug is related to the following issue in RubyForge: <a href="http://rubyforge.org/tracker/?group_id=426&atid=1698&func=detail&aid=1745" class="external">http://rubyforge.org/tracker/?group_id=426&atid=1698&func=detail&aid=1745</a>. This was fixed but seems to be reintroduced in Ruby 1.9.</p>
<p>ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32]<br>
=end</p>