Bugs found while writing specs
Our policy of dealing with bugs found in MRI
- Ruby-Core must be notified
- Use #ruby_bug guard for the spec code that breaks due to MRI bug
- Add the bug to this page below
- MRI specific bug should be filed (optional, but highly desirable)
Bugs in the Complex library
Incompatible changes to the Math module
Complex modifies the Math library in a way that breaks compatibility in many ways.
1 Math.log("10") # => 2.30258509299405
2 require "complex"
3 Math.log("10") # => raises NoMethodError: undefined method `polar' for "10":String
Running the Math specs after the Complex specs, exposes a total of 50 errors/failures.
bin/mspec -t r spec/ruby/1.8/library/complex/ spec/ruby/1.8/core/math/ ... 77 files, 433 examples, 977 expectations, 33 failures, 17 errors
See the attached complex_math.patch file for fixes.
Some of Complex' methods fail when the Complex contains Floats
1 require "complex"
2 Complex(3, 4).numerator # => Complex(3, 4)
3 Complex(3.6, 3).numerator # => raises NoMethodError: undefined method `denominator' for 3.6:Float
I think it would be more appropriate to raise a "real" exception.
Complex#hash might cause problems
1 require "complex"
2 Complex(3, 4).hash # => 14
3 Complex(4, 3).hash # => 14
Bugs in the Rational library
Rational#hash might cause problems
1 require "rational"
2 Rational(3, 4).hash # => 14
3 Rational(4, 3).hash # => 14
Bugs in the Net::FTP library
A response code of type 5xx (unless it is 500) when calling Net::FTP#chdir results in a NoMethodError.
The offending line is in net/ftp.rb at line 671:
1 if $![0, 3] != "500"
Exceptions do not respond to the method #[], thus this line results in a NoMethodError.
A fix for this problem is to change the line to:
1 if $!.message[0, 3] != "500"
