Ruby Issue Tracking System: Issueshttps://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112013-11-07T07:34:12ZRuby Issue Tracking System
Redmine Ruby master - Bug #9089 (Rejected): rb_fix2uint no longer raises a RangeError when given negative...https://bugs.ruby-lang.org/issues/90892013-11-07T07:34:12ZNoKarma (Arthur Schreiber)schreiber.arthur@gmail.com
<p>Up until the change that was made in ((<a href="URL:https://github.com/ruby/ruby/commit/92f59c6d7937b14bb5eefb052099ef0a3ef3bcd0" class="external">URL:https://github.com/ruby/ruby/commit/92f59c6d7937b14bb5eefb052099ef0a3ef3bcd0</a>)), (({rb_fix2uint})) would raise a (({RangeError})) if it was given a negative value like (({-1})) (e.g. when using the (({FIX2UINT})) macro).</p>
<p>Due to the changes made in that commit, this error is no longer raised and (({rb_fix2uint})) will return an incorrect value instead.</p>
<p>There is a C-API spec in rubyspec that shows that this behavior has changed between 2.0.0-p247 and 2.1.0-preview1, and I checked and made sure this is still not working correctly in the latest 2.1.0-dev version. The failing spec can be found at ((<a href="URL:https://github.com/rubyspec/rubyspec/blob/master/optional/capi/fixnum_spec.rb#L16-L18" class="external">URL:https://github.com/rubyspec/rubyspec/blob/master/optional/capi/fixnum_spec.rb#L16-L18</a>)), it is part of the "optional" c-api specs.</p>
<p>Is there any reason why there is the (({if (num < (unsigned long)INT_MIN)})) is made inside the (({check_uint})) function? Doesn't the (({sign})) parameter automatically indicate that we can't convert to an unsigned integer?</p> Ruby master - Bug #447 (Closed): [PATCH] Net::HTTPHeaders iterator methods should return Enumeratorshttps://bugs.ruby-lang.org/issues/4472008-08-15T21:57:26ZNoKarma (Arthur Schreiber)schreiber.arthur@gmail.com
<p>=begin<br>
Net::HTTPHeader#canonical_each, Net::HTTPHeader#each_capitalized_name,<br>
Net::HTTPHeader#each_capitalized, Net::HTTPHeader#each_header,<br>
Net::HTTPHeader#each and Net::HTTPHeader#each_value should return Enumerable::Enumerator<br>
instances instead of raising a LocalJumpError when being called without a block.</p>
<p>The attached patch adds this functionality.<br>
=end</p> Ruby master - Bug #446 (Closed): [PATCH] [DOC] Net::HTTPHeaders#fetch does not return nil but rai...https://bugs.ruby-lang.org/issues/4462008-08-15T21:47:57ZNoKarma (Arthur Schreiber)schreiber.arthur@gmail.com
<p>=begin<br>
As Hash#fetch, Net::HTTPHeaders#fetch does raise an IndexError when neither a default<br>
value nor a block was passed and the requested key can not be found.</p>
<p>The attached patch updates the documentation for Net::HTTPHeaders#fetch to reflect this.<br>
=end</p> Ruby master - Bug #445 (Closed): [PATCH] Net::HTTPHeaders#fetch raises NoMethodError instead of r...https://bugs.ruby-lang.org/issues/4452008-08-15T21:42:46ZNoKarma (Arthur Schreiber)schreiber.arthur@gmail.com
<p>=begin<br>
require "net/http"</p>
<p>class Example<br>
include Net::HTTPHeader</p>
<p>attr_accessor :body</p>
<p>def initialize<br>
initialize_http_header({})<br>
end<br>
end</p>
<p>@headers = Example.new</p>
<p>@headers.fetch("My-Header", "bla")<br>
=> NoMethodError: undefined method `join' for "bla":String</p>
<p>@headers.fetch("My-Header") { |key| "#{key}: bla" }<br>
=> NoMethodError: undefined method `join' for "bla":String</p>
<p>NoMethodError: undefined method `join' for "my-header: bla":String</p>
<p>The attached Patch fixes this issue.<br>
=end</p> Ruby 1.8 - Bug #444 (Rejected): [PATCH] CGI#radio_group raises a TypeError when passing false as ...https://bugs.ruby-lang.org/issues/4442008-08-15T20:41:48ZNoKarma (Arthur Schreiber)schreiber.arthur@gmail.com
<p>=begin<br>
c = CGI.new("html4")<br>
c.radio_group("test", ["bar", "label for bar", false])<br>
=> TypeError: can't convert false into String</p>
<p>After applying the patch:</p>
<p>c.radio_group("test", ["bar", "label for bar", false])<br>
=> "<INPUT NAME="test" TYPE="radio" VALUE="bar">label for bar"<br>
=end</p> Ruby 1.8 - Bug #443 (Rejected): [PATCH] CGI#checkbox_group raises a TypeError when passing false ...https://bugs.ruby-lang.org/issues/4432008-08-15T20:35:01ZNoKarma (Arthur Schreiber)schreiber.arthur@gmail.com
<p>=begin<br>
c = CGI.new("html4")<br>
c.checkbox_group("test", ["bar", "label for bar", false])<br>
=> TypeError: can't convert false into String</p>
<p>After applying the patch:</p>
<p>c.checkbox_group("test", ["bar", "label for bar", false])<br>
=> "<INPUT NAME="test" TYPE="checkbox" VALUE="bar">label for bar"<br>
=end</p> Backport186 - Backport #229 (Closed): CGI::Cookies can "get out of sync"https://bugs.ruby-lang.org/issues/2292008-07-07T07:37:39ZNoKarma (Arthur Schreiber)schreiber.arthur@gmail.com
<p>=begin<br>
CGI::Cookies are an instance of a DelegateClass of their @value instance variable,<br>
which is always an Array. But changing a Cookie's value using the #value= instance<br>
method of CGI::Cookie causes the Cookie to "get out of sync":</p>
<p>require "cgi"</p>
<p>cookie = CGI::Cookie.new("my-cookie", "first value", "second value")<br>
cookie.value # => ["first value", "second value"]</p>
<p>cookie[0] # => "first value"<br>
cookie[1] # => "second value"<br>
cookie[2] = "new value"</p>
<p>cookie.each do |val|<br>
val # => "first value", "second value", "new value"<br>
end</p>
<p>cookie.inspect # => "["first value", "second value", "new value"]"<br>
cookie.to_s # => "my-cookie=first+value&second+value&new+value; path="</p>
<p>cookie = CGI::Cookie.new("my-cookie", "first value", "second value")<br>
cookie.value # => ["first value", "second value"]</p>
<a name="This-makes-the-cookie-get-out-of-sync"></a>
<h1 >This makes the cookie get out of sync<a href="#This-makes-the-cookie-get-out-of-sync" class="wiki-anchor">¶</a></h1>
<p>cookie.value = [ "test" ]</p>
<p>cookie[0] # => "first value"<br>
cookie[1] # => "second value"<br>
cookie[2] = "new value"</p>
<p>cookie.each do |val|<br>
val # => "first value", "second value", "new value"<br>
end</p>
<p>cookie.inspect # => "["first value", "second value", "new value"]"<br>
cookie.to_s # => "my-cookie=test; path="</p>
<p>The attached patch fixes this issue.<br>
=end</p> Ruby 1.8 - Bug #223 (Closed): Net::FTP#sendport incompatible with Mathn libraryhttps://bugs.ruby-lang.org/issues/2232008-07-04T02:21:00ZNoKarma (Arthur Schreiber)schreiber.arthur@gmail.com
<p>=begin<br>
The Mathn library modifies the #/ Operator to return a Rational instead of an Integer. But Net::FTP#sendport relies on getting an Integer and not a Rational value. Using #div instead of #/ for division fixes this error.</p>
<p>@ftp.send(:sendport, "192.168.0.1", 1234)</p>
<p>writes "PORT 192,168,0,1,4,210\r\n" to the socket</p>
<p>require "mathn"<br>
@ftp.send(:sendport, "192.168.0.1", 1234)</p>
<p>writes "PORT 192,168,0,1,617/128,210\r\n" to the socket.<br>
=end</p> Ruby 1.8 - Bug #175 (Closed): Rational#power2 raises a NameError or causes infinite loops when pa...https://bugs.ruby-lang.org/issues/1752008-06-17T18:18:37ZNoKarma (Arthur Schreiber)schreiber.arthur@gmail.com
<p>=begin<br>
There is propably a typo in the Rational#power2 method, as there is no variable<br>
called "neaed", but there is one called "neard".</p>
<p>Desktop:~ arthur$ irb<br>
irb(main):001:0> require "mathn"<br>
=> true<br>
irb(main):002:0> Rational(1, 4).power2(Rational(1, 2))<br>
NameError: undefined local variable or method <code>neaed' for 1/4:Rational from /usr/local/lib/ruby/1.8/mathn.rb:204:in </code>power2'<br>
from /usr/local/lib/ruby/1.8/mathn.rb:202:in <code>loop' from /usr/local/lib/ruby/1.8/mathn.rb:202:in </code>power2'<br>
from (irb):2</p>
<p>If you pass a value that is equal to self, it will cause an infinite loop:</p>
<p>Rational(1, 2).power2(Rational(1, 2)) # => Infinite Loop<br>
Rational(1, 4).power2(Rational(1, 4)) # => Infinite Loop<br>
=end</p> Ruby 1.8 - Bug #174 (Closed): [1.8.6] File.extname(".profile") is not returning an empty Stringhttps://bugs.ruby-lang.org/issues/1742008-06-17T16:50:47ZNoKarma (Arthur Schreiber)schreiber.arthur@gmail.com
<p>=begin<br>
In the latest patchlevel versions of the ruby_1_8_6 branch, the File.extname method stopped returning empty Strings for files starting with a dot:</p>
<p>Latest version of the ruby_1_8 branch:<br>
File.extname(".profile") # => ""</p>
<p>Latest version of the ruby_1_8_7 branch:<br>
File.extname(".profile") # => ""</p>
<p>Latest version of the ruby_1_8_6 branch:<br>
File.extname(".profile") # => ".profile"<br>
=end</p> Ruby 1.8 - Bug #171 (Closed): StringIO#each and StringIO#readlines does change $_, IO#each and IO...https://bugs.ruby-lang.org/issues/1712008-06-16T21:12:55ZNoKarma (Arthur Schreiber)schreiber.arthur@gmail.com
<p>=begin<br>
Changeset r17352 has fixed the issue reported in <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: [PATCH] StringIO#readline does not set $_ (Closed)" href="https://bugs.ruby-lang.org/issues/159">#159</a>, but has introduced two new ones:</p>
<p>First: StringIO#readlines was changed to set $_ to nil:</p>
<p>$_ = "test"<br>
File.open("test.file") { |f| f.readlines } # => ["line 1\n", "line 2\n", "line 3"]<br>
$_ # => "test"</p>
<p>require "stringio"<br>
$_ = "test"<br>
StringIO.new("line 1\nline 2\nline 3").readlines # => ["line 1\n", "line 2\n", "line 3"]<br>
$_ # => nil</p>
<p>Second: StringIO#each was changed to change $_ on each yield:</p>
<p>$_ = "test"<br>
File.open("test.file") do |f|<br>
f.each do |l|<br>
# >> Line: "line 1\n" - "test"<br>
# >> Line: "line 2\n" - "test"<br>
# >> Line: "line 3" - "test"<br>
puts "Line: #{l.inspect} - #{$<em>.inspect}"<br>
end<br>
end<br>
$</em> # => "test"</p>
<p>require "stringio"<br>
$_ = "test"<br>
strio = StringIO.new("line 1\nline 2\nline 3")<br>
strio.each do |l|<br>
# >> Line: "line 1\n" - "line 1\n"<br>
# >> Line: "line 2\n" - "line 2\n"<br>
# >> Line: "line 3" - "line 3"<br>
puts "Line: #{l.inspect} - #{$<em>.inspect}"<br>
end<br>
$</em> # => "line 3"<br>
=end</p> Ruby 1.8 - Bug #159 (Closed): [PATCH] StringIO#readline does not set $_https://bugs.ruby-lang.org/issues/1592008-06-16T03:22:17ZNoKarma (Arthur Schreiber)schreiber.arthur@gmail.com
<p>=begin<br>
Desktop:ruby_1_8 arthur$ irb<br>
irb(main):001:0> $stdin.readline<br>
some text<br>
=> "some text\n"<br>
irb(main):002:0> $_<br>
=> "some text\n"<br>
irb(main):003:0> require "stringio"<br>
=> true<br>
irb(main):004:0> strio = StringIO.new("line1\nline2")<br>
=> #<a href="StringIO:0x282ddc" class="external">StringIO:0x282ddc</a><br>
irb(main):005:0> strio.readline<br>
=> "line1\n"<br>
irb(main):006:0> $_<br>
=> "some text\n"<br>
=end</p> Ruby 1.8 - Bug #156 (Closed): [PATCH] StringIO#sysread(0) raises a EOFErrorhttps://bugs.ruby-lang.org/issues/1562008-06-14T21:15:05ZNoKarma (Arthur Schreiber)schreiber.arthur@gmail.com
<p>=begin<br>
$stdin.sysread(0) # => ""<br>
StringIO.new("test").sysread # =>raises EOFError: end of file reached<br>
=end</p> Ruby master - Bug #140 (Closed): [PATCH] Set#== performance improvementhttps://bugs.ruby-lang.org/issues/1402008-06-11T09:01:54ZNoKarma (Arthur Schreiber)schreiber.arthur@gmail.com
<p>=begin<br>
Without this patch:</p>
<p>Set#== with Set: 2.350000 1.100000 3.450000 ( 3.670881)<br>
Set#== with SortedSet: 2.430000 1.100000 3.530000 ( 3.721129)<br>
SortedSet#== with SortedSet: 2.430000 1.090000 3.520000 ( 3.778875)</p>
<p>With this patch:</p>
<p>Set#== with Set: 0.050000 0.000000 0.050000 ( 0.048722)<br>
Set#== with SortedSet: 2.230000 1.100000 3.330000 ( 3.630617)<br>
SortedSet#== with SortedSet: 0.040000 0.000000 0.040000 ( 0.049494)<br>
=end</p> Ruby 1.8 - Bug #124 (Closed): Module#remove_method broken in 1.8.6-p166https://bugs.ruby-lang.org/issues/1242008-06-09T20:07:07ZNoKarma (Arthur Schreiber)schreiber.arthur@gmail.com
<p>=begin<br>
Module#remove Method should raise a NameError when trying to remove non-existant methods.</p>
<p>On Ruby 1.8.6-p111, Ruby 1.8.6-p114, Ruby 1.8.7, Ruby 1.8.7-p7 and Ruby 1.8.7-p17:</p>
<p>irb(main):001:0> class A; remove_method :blabla; end<br>
NameError: method <code>blabla' not defined in A from (irb):1:in </code>remove_method'<br>
from (irb):1</p>
<p>But on Ruby 1.8.6-p166:</p>
<p>irb(main):001:0> class A; remove_method :blabla; end<br>
=> A<br>
=end</p> Ruby 1.8 - Bug #119 (Closed): Set#divide and SortedSet#divide raise NoMethodErrors when passed no...https://bugs.ruby-lang.org/issues/1192008-06-09T03:11:36ZNoKarma (Arthur Schreiber)schreiber.arthur@gmail.com
<p>=begin<br>
Set[1].divide # => raises a NoMethodError: undefined method <code>arity' for nil:NilClass SortedSet[1].divide # => raises a NoMethodError: undefined method </code>arity' for nil:NilClass</p>
<p>Raising a LocalJumpError or returning an enumerator would be much more consistent with general behaviour in Ruby.<br>
=end</p> Ruby 1.8 - Bug #118 (Closed): SortedSet#inspect does not work with nested SortedSetshttps://bugs.ruby-lang.org/issues/1182008-06-09T02:56:12ZNoKarma (Arthur Schreiber)schreiber.arthur@gmail.com
<p>=begin<br>
SortedSet["a", "b", SortedSet["c"]].inspect # => raises an ArgumentError: comparison of String with SortedSet failed<br>
=end</p> Ruby 1.8 - Bug #117 (Closed): SortedSet#flatten_merge and SortedSet#flatten can't actually flatte...https://bugs.ruby-lang.org/issues/1172008-06-09T02:50:25ZNoKarma (Arthur Schreiber)schreiber.arthur@gmail.com
<p>=begin<br>
set1 = SortedSet[1, 2]<br>
set2 = SortedSet[3, 4, SortedSet[5, 6]]<br>
set1.send(:flatten_merge, set2) # => raises a NoMethodError: undefined method `<=>' for #<SortedSet: {5, 6}></p>
<p>SortedSet[1, 2, SortedSet[3, 4, SortedSet[5, 6, SortedSet[7, 8]]], 9, 10].flatten # => raises a NoMethodError: undefined method `<=>' for #<a href="SortedSet:0x5f2be8" class="external">SortedSet:0x5f2be8</a></p>
<p>SortedSet[1, 2, SortedSet[3, 4]].flatten # => raises an ArgumentError: comparison of Fixnum with SortedSet failed<br>
=end</p> Ruby 1.8 - Bug #116 (Closed): SortedSet#each does not return selfhttps://bugs.ruby-lang.org/issues/1162008-06-09T02:38:10ZNoKarma (Arthur Schreiber)schreiber.arthur@gmail.com
<p>=begin<br>
irb(main):001:0> require "set"<br>
=> true<br>
irb(main):002:0> Set[1, 2, 3].each {}<br>
=> #<Set: {1, 2, 3}><br>
irb(main):003:0> SortedSet[1, 2, 3].each {}<br>
=> [1, 2, 3]</p>
<p>This behaviour deviates from what Array#each and Set#each do.<br>
=end</p> Ruby 1.8 - Bug #115 (Closed): SortedSet#delete_if does not yield in sorted orderhttps://bugs.ruby-lang.org/issues/1152008-06-09T02:26:38ZNoKarma (Arthur Schreiber)schreiber.arthur@gmail.com
<p>=begin<br>
ret = []<br>
SortedSet["one", "two", "three"].delete_if { |x| ret << x }<br>
ret == ["one", "two", "three"].sort # => false<br>
=end</p>