Ruby Issue Tracking System: Issueshttps://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112017-05-31T03:14:14ZRuby Issue Tracking System
Redmine Ruby master - Bug #13615 (Third Party's Issue): YAML parser stops processing at the first newline...https://bugs.ruby-lang.org/issues/136152017-05-31T03:14:14Zhasari (Hiro Asari)asari.ruby@gmail.com
<p>When the input has byte order mark, the YAML parser stops processing the input upon seeing the first newline.</p>
<p>I believe this is a violation of YAML specification. [[http://www.yaml.org/spec/1.2/spec.html#id2771184]]</p>
<pre><code>[1] pry(main)> RUBY_DESCRIPTION
=> "ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin15]"
[2] pry(main)> require 'yaml'
=> true
[3] pry(main)> YAML.load("a: b\nc: d")
=> {"a"=>"b", "c"=>"d"}
[4] pry(main)> YAML.load("\xEF\xBB\xBF" + "a: b\nc: d")
=> {"a"=>"b"}
</code></pre> Ruby master - Bug #12588 (Rejected): When an exception is re-raised in the "rescue" clause, the b...https://bugs.ruby-lang.org/issues/125882016-07-15T20:02:46Zhasari (Hiro Asari)asari.ruby@gmail.com
<p>Given:</p>
<pre><code>$ cat -n foo.rb
1 def foo
2 raise StandardError
3 rescue StandardError => e
4 raise e
5 end
6
7 foo
</code></pre>
<p>one would reasonably expect to see line 4 to be in the back trace when this file is executed, but one does not.</p>
<pre><code>$ ruby -v foo.rb
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin14]
foo.rb:2:in `foo': StandardError (StandardError)
from foo.rb:7:in `<main>'
</code></pre> Ruby master - Bug #10700 (Closed): On case-sensitive filesystem on OS X, Dir.glob("*.TXT") matche...https://bugs.ruby-lang.org/issues/107002015-01-06T13:05:31Zhasari (Hiro Asari)asari.ruby@gmail.com
<p>My Mac has the disk reformatted so that it is case-sensitive (HFS+):</p>
<pre><code>$ touch foo.txt foo.TXT FOO.txt FOO.TXT
$ ls -li foo.* FOO.*
286444732 -rw-r--r-- 1 asari staff 0 Jan 6 08:00 FOO.TXT
286444731 -rw-r--r-- 1 asari staff 0 Jan 6 08:00 FOO.txt
286444729 -rw-r--r-- 1 asari staff 0 Jan 6 08:00 foo.TXT
286444728 -rw-r--r-- 1 asari staff 0 Jan 6 08:00 foo.txt
</code></pre>
<p>You notice that they are all different files.</p>
<p>In Ruby 2.1.5, Dir.glob("*.TxT") returns an empty array, but in 2.2.0, all of these files are returned:</p>
<pre><code>$ rvm 2.1.5 do ruby -v -e 'p Dir.glob("*.TxT")'
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin14.0]
[]
$ rvm 2.2.0 do ruby -v -e 'p Dir.glob("*.TxT")'
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin13]
["FOO.TXT", "FOO.txt", "foo.TXT", "foo.txt"]
</code></pre>
<p>This is unexpected and incorrect. This does not happen on Linux.</p> Ruby master - Bug #8877 (Closed): OptionParser::Version should not rely on SVNhttps://bugs.ruby-lang.org/issues/88772013-09-08T12:26:29Zhasari (Hiro Asari)asari.ruby@gmail.com
<p>=begin<br>
Currently, (({OptionParser::Version})) is ((<defined|URL:<a href="https://github.com/ruby/ruby/blob/2b44bbf/lib/optparse.rb#L215-L216%3E" class="external">https://github.com/ruby/ruby/blob/2b44bbf/lib/optparse.rb#L215-L216></a>)) by:</p>
<p>RCSID = %w$Id$[1..-1].each {|s| s.freeze}.freeze<br>
Version = (RCSID[1].split('.').collect {|s| s.to_i}.extend(Comparable).freeze if RCSID[1])</p>
<p>This assumes that before this file is invoked, something preprocesses this file and rewrites (({$Id$})). This is not the case with (({git})).</p>
<p>As a result, if you build from the git clone, you'd get</p>
<p>irb(main):001:0> RUBY_DESCRIPTION<br>
=> "ruby 2.1.0dev (2013-08-02 trunk 42320) [x86_64-darwin12.4.0]"<br>
irb(main):002:0> require 'optparse'<br>
=> true<br>
irb(main):003:0> OptionParser::Version<br>
=> nil</p>
<p>While I understand the history of the development process and Ruby core's professed affinity for SVN, but this strikes me as a very bad idea.</p>
<p>=end</p> Ruby master - Bug #8195 (Rejected): Time-dependent testshttps://bugs.ruby-lang.org/issues/81952013-04-01T10:21:43Zhasari (Hiro Asari)asari.ruby@gmail.com
<p>There are some tests that depend on timing of the execution, and fail sporadically.</p>
<p>I have not surveyed the entire suite, but one is pointed out in <a href="https://github.com/jruby/jruby/issues/618" class="external">https://github.com/jruby/jruby/issues/618</a>.</p>
<p><a href="https://github.com/ruby/ruby/blob/v1_8_7_371/test/zlib/test_zlib.rb#L318" class="external">https://github.com/ruby/ruby/blob/v1_8_7_371/test/zlib/test_zlib.rb#L318</a><br>
<a href="https://github.com/ruby/ruby/blob/v1_9_3_392/test/zlib/test_zlib.rb#L293" class="external">https://github.com/ruby/ruby/blob/v1_9_3_392/test/zlib/test_zlib.rb#L293</a><br>
<a href="https://github.com/ruby/ruby/blob/v2_0_0_0/test/zlib/test_zlib.rb#L469" class="external">https://github.com/ruby/ruby/blob/v2_0_0_0/test/zlib/test_zlib.rb#L469</a></p>
<p><a href="https://github.com/ruby/ruby/blob/6a23960/test/zlib/test_zlib.rb#L471" class="external">https://github.com/ruby/ruby/blob/6a23960/test/zlib/test_zlib.rb#L471</a></p>
<p>Perhaps defining a margin of error might be permissible.</p> Ruby master - Bug #8180 (Closed): Backport r39967 to 1.9.3 and 2.0.xhttps://bugs.ruby-lang.org/issues/81802013-03-28T21:32:02Zhasari (Hiro Asari)asari.ruby@gmail.com
<p>Please backport this bug fix to these branches.</p>
<p>Thank you.</p> Ruby master - Bug #8173 (Closed): 2-arg form of Time.at can take a Time as either argumenthttps://bugs.ruby-lang.org/issues/81732013-03-27T12:30:44Zhasari (Hiro Asari)asari.ruby@gmail.com
<p><a href="http://www.ruby-doc.org/core-2.0/Time.html#method-c-at" class="external">http://www.ruby-doc.org/core-2.0/Time.html#method-c-at</a> shows 3 forms of invocation:</p>
<p>at(time) → time click to toggle source<br>
at(seconds_with_frac) → time<br>
at(seconds, microseconds_with_frac) → time</p>
<p>But the last form can take a Time as either argument (and converts to a numeric value represented by the number of seconds since the Epoch). If a Time is used as the second argument, the numeric value is then converted to microseconds to return a Time. (I hope that I'm making sense.)</p>
<p>irb(main):001:0> RUBY_DESCRIPTION<br>
=> "ruby 2.1.0dev (2013-03-11 trunk 39724) [x86_64-darwin12.2.1]"<br>
irb(main):002:0> t1=Time.at(10)<br>
=> 1969-12-31 19:00:10 -0500<br>
irb(main):003:0> t2=Time.at(t1,t1)<br>
=> 1969-12-31 19:00:10 -0500<br>
irb(main):004:0> t2.usec<br>
=> 10</p>
<p>Is this intended behavior? If so, the documentation should be updated.</p>
<p>1.9.3 behaves the same way.</p> Ruby master - Bug #7534 (Closed): /(?i:[\W])/ and /(?i:[\w])/ both match "s"https://bugs.ruby-lang.org/issues/75342012-12-08T15:10:38Zhasari (Hiro Asari)asari.ruby@gmail.com
<p>If you drop any of the 3 conditions - case-insensitivity, character class, or "s" - this bug does not happen.</p>
<p>See <a href="https://gist.github.com/4238886" class="external">https://gist.github.com/4238886</a></p> Ruby master - Bug #7437 (Closed): Array#delete(obj) should return obj when there is an object tha...https://bugs.ruby-lang.org/issues/74372012-11-26T13:00:08Zhasari (Hiro Asari)asari.ruby@gmail.com
<p>According to <a href="http://www.ruby-doc.org/core-1.9.3/Array.html#method-i-delete" class="external">http://www.ruby-doc.org/core-1.9.3/Array.html#method-i-delete</a>, Array#delete(obj) should return "obj" when there are objects in the array that are "equal to obj" (internally, "==" is used, it seems).</p>
<p>Notice that the documentation does not state that the return value is an element of the array itself. However, 1.9.3 and trunk both return a member of the Array, rather than the argument.</p>
<p>This issue was raised in <a href="https://github.com/jruby/jruby/issues/411" class="external">https://github.com/jruby/jruby/issues/411</a></p>
<p>#!/usr/bin/env ruby</p>
<p>class Foo<br>
attr_reader :name, :age</p>
<p>def initialize name, age<br>
@name = name<br>
@age = age<br>
end</p>
<p>def == other<br>
other.name == name<br>
end<br>
end</p>
<p>foo1 = Foo.new "John Shahid", 27<br>
foo2 = Foo.new "John Shahid", 28<br>
array = [foo1]<br>
temp = array.delete foo2 # => foo1, not foo2</p> Ruby master - Bug #7170 (Closed): tOP_ASGN and rescue_modifier precedence, with a few confusing e...https://bugs.ruby-lang.org/issues/71702012-10-16T11:38:09Zhasari (Hiro Asari)asari.ruby@gmail.com
<p>parse.y shows that tOP_ASGN has precedence over modifier_rescue.</p>
<p>So I expect that</p>
<pre><code>a = 1
a += [] rescue 5
</code></pre>
<p>should be parsed as "(a += []) rescue 5". Furthermore, it should evaluate to 5, and leave a untouched.</p>
<p>But in reality, this raises a TypeError. (If you rescue this TypeError, you can see that a is untouched.)</p>
<p>Likewise,</p>
<pre><code>a = 'a'
a += b rescue 'c'
</code></pre>
<p>should not raise a NameError (for b), evaluate to 'c', and leave 'a' untouched.</p>
<p>However, in reality, this does not raise any exception, but it evaluates to 'ac' and assigns the value 'ac' to a.</p>
<p>Did I reason this incorrectly? Or is there a bug somewhere?</p> Ruby master - Bug #7152 (Closed): Is the order of Module#instance_methods intended to be preserved?https://bugs.ruby-lang.org/issues/71522012-10-13T11:58:34Zhasari (Hiro Asari)asari.ruby@gmail.com
<p><a href="https://github.com/jruby/jruby/issues/277" class="external">https://github.com/jruby/jruby/issues/277</a> asks this question:</p>
<p>results = 10000.times.map do<br>
chars = ('A'..'Z').map(&:to_sym).shuffle</p>
<p>cls = Class.new do</p>
<pre><code>chars.each do |chr|
define_method(chr) {}
end
</code></pre>
<p>end</p>
<p>chars == cls.instance_methods.take(26)<br>
end</p>
<p>p results.all?{|o|o.equal? true} # => true on MRI</p> Ruby master - Bug #6600 (Closed): Should Module#constants retain insertion order?https://bugs.ruby-lang.org/issues/66002012-06-17T13:09:51Zhasari (Hiro Asari)asari.ruby@gmail.com
<p>=begin<br>
This is pointed out in ((<a href="URL:http://bugs.jruby.org/6733" class="external">URL:http://bugs.jruby.org/6733</a>)).</p>
<p>Should (({Module#constants})) maintain the order in which the constants are defined?</p>
<p>irb(main):001:0> RUBY_DESCRIPTION<br>
=> "ruby 2.0.0dev (2012-06-16 trunk 36115) [x86_64-darwin11.4.0]"<br>
irb(main):002:0> module MyNamespace<br>
irb(main):003:1> class First<br>
irb(main):004:2> end<br>
irb(main):005:1><br>
irb(main):006:1* class Second<br>
irb(main):007:2> end<br>
irb(main):008:1><br>
irb(main):009:1* class Third<br>
irb(main):010:2> end<br>
irb(main):011:1> end<br>
=> nil<br>
irb(main):012:0><br>
irb(main):013:0* p MyNamespace.constants<br>
[:First, :Second, :Third]<br>
=> [:First, :Second, :Third]<br>
=end</p> Ruby master - Bug #5884 (Rejected): Float::NAN and 0.0/0.0 is represented differently when packed...https://bugs.ruby-lang.org/issues/58842012-01-12T06:50:37Zhasari (Hiro Asari)asari.ruby@gmail.com
<p>$ ruby2.0 -e 'p [Float::NAN].pack("g")'<br>
"\x7F\xC0\x00\x00"</p>
<p>$ ruby2.0 -e 'p [0.0/0.0].pack("g")'<br>
"\xFF\xC0\x00\x00"</p>
<p>It would be nice to have Float::NAN and 0.0/0.0 behave identically in this regard.</p> Ruby master - Bug #5865 (Closed): Exception#== should return false if the classes differhttps://bugs.ruby-lang.org/issues/58652012-01-08T15:08:35Zhasari (Hiro Asari)asari.ruby@gmail.com
<p>Documentation says "If obj is not an Exception, returns false. Otherwise, returns true if exc and obj share same class, messages, and backtrace."</p>
<p>However,</p>
<p>$ ruby2.0 -v -e 'x=RuntimeError.new("msg"); y=ScriptError.new("msg"); p x==y'<br>
ruby 2.0.0dev (2011-12-31 trunk 34165) [x86_64-darwin11.2.0]<br>
true</p> Ruby master - Bug #5860 (Rejected): Hash literal '{:a==>1}'https://bugs.ruby-lang.org/issues/58602012-01-08T03:45:43Zhasari (Hiro Asari)asari.ruby@gmail.com
<p>=begin<br>
There is an esoteric hash literal construct possible in the Ruby grammar:</p>
<p>{:a==>1}</p>
<p>Looking at ((<parse.y|URL:<a href="https://github.com/ruby/ruby/blob/731e45216ae4adf4122f0515d3056e1579efb0f9/parse.y#L8408-8418%3E" class="external">https://github.com/ruby/ruby/blob/731e45216ae4adf4122f0515d3056e1579efb0f9/parse.y#L8408-8418></a>)), I am pretty sure this is intended behavior, but I wanted to make sure that this is so.</p>
<p>=end</p> Ruby master - Bug #4136 (Closed): Enumerable#reject should not inherit the receiver's instance va...https://bugs.ruby-lang.org/issues/41362010-12-09T03:36:39Zhasari (Hiro Asari)asari.ruby@gmail.com
<p>=begin<br>
re<br>
Below, you see that a.reject returns a copy of the receiver, which inherits the instance variable @foo. This is not the case with Array#select.</p>
<p>irb(main):001:0> a=[]<br>
=> []<br>
irb(main):002:0> a.instance_variable_set "@foo", "bar"<br>
=> "bar"<br>
irb(main):003:0> a.reject {}.instance_variable_get "@foo"<br>
=> "bar"<br>
irb(main):004:0> a.select {}.instance_variable_get "@foo"<br>
=> nil</p>
<p>1.8.x behaves the same way.<br>
=end</p> Ruby 1.8 - Bug #3576 (Closed): WIN32OLE segmentation faulthttps://bugs.ruby-lang.org/issues/35762010-07-16T11:10:22Zhasari (Hiro Asari)asari.ruby@gmail.com
<p>=begin<br>
This simple code results in seg fault.</p>
<p>C:>ruby -v -r win32ole -e "ev = WIN32OLE_EVENT.new(WIN32OLE.new('Scripting.Dictionary'))"<br>
ruby 1.8.7 (2010-06-23 patchlevel 299) [i386-mingw32]<br>
-e:1: [BUG] Segmentation fault<br>
ruby 1.8.7 (2010-06-23 patchlevel 299) [i386-mingw32]</p>
<p>This application has requested the Runtime to terminate it in an unusual way.<br>
Please contact the application's support team for more information.</p>
<p>The same code raises RuntimeError in 1.9.1:</p>
<p>C:>ruby -v -r win32ole -e "ev = WIN32OLE_EVENT.new(WIN32OLE.new('Scripting.Dictionary'))"<br>
ruby 1.9.1p429 (2010-07-02 revision 28523) [i386-mingw32]<br>
-e:1:in <code>initialize': interface not found (RuntimeError) HRESULT error code:0x80004002 No such interface supported from -e:1:in </code>new'<br>
from -e:1:in `'<br>
=end</p> Backport187 - Backport #3551 (Closed): REXML::Document#add uses undefined method 'kind_of'https://bugs.ruby-lang.org/issues/35512010-07-09T02:23:45Zhasari (Hiro Asari)asari.ruby@gmail.com
<p>=begin<br>
明らかに kind_of? の間違いです。1.9では直っています。</p>
<h1>$ svn diff<br>
Index: lib/rexml/document.rb</h1>
<p>--- lib/rexml/document.rb (revision 28587)<br>
+++ lib/rexml/document.rb (working copy)<br>
@@ -78,7 +78,7 @@<br>
x.kind_of?(Element) || x.kind_of?(DocType)<br>
}<br>
if @children[ insert_before_index ] # Not null = not end of list</p>
<ul>
<li>
<pre><code> if @children[ insert_before_index ].kind_of DocType
</code></pre>
</li>
</ul>
<ul>
<li>
<pre><code> if @children[ insert_before_index ].kind_of? DocType
@children[ insert_before_index ] = child
else
@children[ index_before_index-1, 0 ] = child
</code></pre>
</li>
</ul>
<p>=end</p> Backport191 - Backport #3279 (Closed): BigMath::log is very slowhttps://bugs.ruby-lang.org/issues/32792010-05-12T14:16:17Zhasari (Hiro Asari)asari.ruby@gmail.com
<p>=begin<br>
<a href="http://bugs.jruby.org/4787" class="external">http://bugs.jruby.org/4787</a> で、この関数は非常に遅いと言う報告がありました。JRubyでもRubiniusでも遅いので是非ともMRIの方で対処して欲しいです。</p>
<p>上のチケットで示されているパッチを試したところ、要求された精度までは正確な物を返すようです。例えば log(BigDecimal("1000"),100)だと小数点以下110桁くらい、log(BigDecimal("0.0001"),200)だと210桁くらい。</p>
<p>検討して下さい。これが改善されるのであれば1.8へのバックポートも重ねて検討して下さい。<br>
=end</p> Ruby master - Feature #2323 (Closed): "Z".."Z".succが空https://bugs.ruby-lang.org/issues/23232009-11-02T16:19:37Zhasari (Hiro Asari)asari.ruby@gmail.com
<p>=begin<br>
surfboard:~$ ruby1.9 -v; ruby1.9 -e 'p ("Z".."Z".succ); p ("Z".."Z".succ).to_a'<br>
ruby 1.9.2dev (2009-11-02 trunk 25625) [x86_64-darwin10.0.0]<br>
"Z".."AA"<br>
[]</p>
<p>"Z".succではなくてもうちょっと”離れた”ヤツをRangeの終わりとして指定すると"AA"はしっかりと入っています。</p>
<p>surfboard:~$ ruby1.9 -e 'p ("Z".."ZA").include? "Z".succ'<br>
true</p>
<p>でも半端な”離れ”方ではいけません。</p>
<p>surfboard:~$ ruby1.9 -e 'p ("Z".."CA").include? "Z".succ'<br>
false</p>
<p>to_aを介しても同様です。</p>
<p>surfboard:~$ ruby1.9 -e 'p ("Z".."ZA").to_a.include? "Z".succ'<br>
true<br>
surfboard:~$ ruby1.9 -e 'p ("Z".."CA").to_a.include? "Z".succ'<br>
false<br>
=end</p> Ruby master - Feature #2296 (Rejected): Dir.home(0)でTypeErrorが出るhttps://bugs.ruby-lang.org/issues/22962009-10-28T09:45:01Zhasari (Hiro Asari)asari.ruby@gmail.com
<p>=begin<br>
現在の実装ですと</p>
<p>$ ruby19 -v -e 'p Dir.home(0)'<br>
ruby 1.9.2dev (2009-10-27 trunk 25509) [x86_64-darwin10.0.0]<br>
-e:1:in <code>home': can't convert Fixnum into String (TypeError) from -e:1:in </code>'</p>
<p>となっています。<br>
中で引数についてto_sみたいなことをするか、或いはFixnumを渡されたら(それが適当なら)UIDであるとしてユーザーを見つけてくるのが自然ではないでしょうか。<br>
=end</p> Ruby master - Bug #2030 (Closed): Math.gamma(x) seg faults for integer x larger than 2<<63-1https://bugs.ruby-lang.org/issues/20302009-09-02T12:52:19Zhasari (Hiro Asari)asari.ruby@gmail.com
<p>=begin<br>
$ ruby19 -e 'puts Math.gamma(2<<63-1); puts Math.gamma(2<<63)'<br>
Infinity<br>
-e:1: [BUG] Segmentation fault<br>
ruby 1.9.2dev (2009-09-02 trunk 24735) [i386-darwin10.0.0]</p>
<h2>-- control frame ----------<br>
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :gamma<br>
c:0003 p:0052 s:0007 b:0006 l:001488 d:000b18 EVAL -e:1<br>
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH<br>
c:0001 p:0000 s:0002 b:0002 l:001488 d:001488 TOP</h2>
<p>-- Ruby level backtrace information-----------------------------------------<br>
-e:1:in <code><main>' -e:1:in </code>gamma'</p>
<p>-- C level backtrace information -------------------------------------------</p>
<p>[NOTE]<br>
You may have encountered a bug in the Ruby interpreter or extension libraries.<br>
Bug reports are welcome.<br>
For details: <a href="http://www.ruby-lang.org/bugreport.html" class="external">http://www.ruby-lang.org/bugreport.html</a></p>
<p>Abort trap</p>
<p>Incidentally, the URL at the end of this output should be updated. (Is that a separate ticket?)<br>
=end</p>