Ruby Issue Tracking System: Issues
https://redmine.ruby-lang.org/
https://redmine.ruby-lang.org/favicon.ico?1711330511
2011-11-02T10:07:25Z
Ruby Issue Tracking System
Redmine
Backport193 - Backport #5546 (Closed): Bus error in Complex.rationalize
https://redmine.ruby-lang.org/issues/5546
2011-11-02T10:07:25Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>This only happens if you pass in a parameter to rationalize.</p>
<p>=begin<br>
dave[ruby3/Book 20:05:52] ruby -ve 'p Complex(2.5, 0).rationalize(1)'<br>
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]<br>
-e:1: [BUG] Segmentation fault<br>
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]</p>
<p>-- Control frame information -----------------------------------------------<br>
c:0005 p:---- s:0013 b:0013 l:000012 d:000012 CFUNC :rationalize<br>
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :rationalize<br>
c:0003 p:0022 s:0007 b:0006 l:000c98 d:0011c8 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:000c98 d:000c98 TOP</p>
<p>-- Ruby level backtrace information ----------------------------------------<br>
-e:1:in <code><main>' -e:1:in </code>rationalize'<br>
-e:1:in `rationalize'</p>
<p>-- C level backtrace information -------------------------------------------</p>
<p>See Crash Report log file under ~/Library/Logs/CrashReporter or<br>
/Library/Logs/CrashReporter, for the more detail of.</p>
<p>-- Other runtime information -----------------------------------------------</p>
<ul>
<li>
<p>Loaded script: -e</p>
</li>
<li>
<p>Loaded features:</p>
</li>
</ul>
<p>0 enumerator.so<br>
1 /Users/dave/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/x86_64-darwin11.2.0/enc/encdb.bundle<br>
2 /Users/dave/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/x86_64-darwin11.2.0/enc/trans/transdb.bundle<br>
3 /Users/dave/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/defaults.rb<br>
4 /Users/dave/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/x86_64-darwin11.2.0/rbconfig.rb<br>
5 /Users/dave/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/deprecate.rb<br>
6 /Users/dave/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/exceptions.rb<br>
7 /Users/dave/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb<br>
8 /Users/dave/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems.rb</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><br>
=end</p>
Ruby master - Bug #5529 (Rejected): Bus error with Fibers on OSX Lion
https://redmine.ruby-lang.org/issues/5529
2011-11-01T01:24:12Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
The attached program crashes with the following trace:</p>
<p>dave[ruby3/Book 11:18:39] ruby /tmp/prog.rb<br>
cat<br>
dog<br>
/tmp/prog.rb:2: [BUG] Bus Error<br>
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]</p>
<p>-- Control frame information -----------------------------------------------<br>
c:0003 p:0015 s:0005 b:0005 l:002508 d:000004 BLOCK /tmp/prog.rb:2<br>
c:0002 p:---- s:0003 b:0003 l:000002 d:000002 FINISH<br>
c:0001 p:---- s:0001 b:-001 l:000000 d:000000 ------</p>
<p>-- Ruby level backtrace information ----------------------------------------<br>
/tmp/prog.rb:2:in `block in '</p>
<p>-- C level backtrace information -------------------------------------------</p>
<p>See Crash Report log file under ~/Library/Logs/CrashReporter or<br>
/Library/Logs/CrashReporter, for the more detail of.</p>
<p>-- Other runtime information -----------------------------------------------</p>
<ul>
<li>
<p>Loaded script: /tmp/prog.rb</p>
</li>
<li>
<p>Loaded features:</p>
</li>
</ul>
<p>0 enumerator.so<br>
1 /Users/dave/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/x86_64-darwin11.2.0/enc/encdb.bundle<br>
2 /Users/dave/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/x86_64-darwin11.2.0/enc/trans/transdb.bundle<br>
3 /Users/dave/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/defaults.rb<br>
4 /Users/dave/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/x86_64-darwin11.2.0/rbconfig.rb<br>
5 /Users/dave/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/deprecate.rb<br>
6 /Users/dave/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/exceptions.rb<br>
7 /Users/dave/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb<br>
8 /Users/dave/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems.rb</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><br>
=end</p>
Ruby master - Bug #3849 (Closed): Add back documentation for [IO|Kernel].select
https://redmine.ruby-lang.org/issues/3849
2010-09-18T07:51:40Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
The documentation for select() seems to have been removed. The attached patch adds it back.</p>
<p>Dave<br>
=end</p>
Ruby master - Bug #3843 (Closed): ruby -r tracer prog.rb no longer tracers prog.rb
https://redmine.ruby-lang.org/issues/3843
2010-09-17T07:39:45Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
The problem appears to be at the end of tracer.rb:</p>
<p>if $0 == <strong>FILE</strong></p>
<a name="direct-call"></a>
<h1 >direct call<a href="#direct-call" class="wiki-anchor">¶</a></h1>
<p>$0 = ARGV[0]<br>
ARGV.shift<br>
Tracer.on<br>
require $0<br>
elsif caller.size <= 1<br>
Tracer.on<br>
end</p>
<p>IN 1.9.2, caller() at this point is 2 deep:</p>
<p>["<a href="internal:lib/rubygems/custom_require" class="external">internal:lib/rubygems/custom_require</a>:29:in <code>require'", "<internal:lib/rubygems/custom_require>:29:in </code>require'"]</p>
<p>The following change seems to fix it, but it feels a little hacky..</p>
<p>if $0 == <strong>FILE</strong></p>
<a name="direct-call-2"></a>
<h1 >direct call<a href="#direct-call-2" class="wiki-anchor">¶</a></h1>
<p>$0 = ARGV[0]<br>
ARGV.shift<br>
Tracer.on<br>
require $0<br>
elsif caller.size <= 2 && caller.all? {|place| place =~ /custom_require/}<br>
Tracer.on<br>
end</p>
<p>Dave<br>
=end</p>
Ruby master - Bug #3760 (Closed): help "String.new" (for example) no longer works in irb
https://redmine.ruby-lang.org/issues/3760
2010-08-29T22:37:44Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
ruby-1.9.2-p0 > help "String.new"<br>
NoMethodError: undefined method <code>get_info_for' for #<RDoc::RI::Driver:0x000001009d9c38> from /Users/dave/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb/cmd/help.rb:29:in </code>block in execute'<br>
from /Users/dave/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb/cmd/help.rb:27:in `each'<br>
. . .</p>
<p>Cheers</p>
<p>Dave<br>
=end</p>
Ruby master - Bug #1020 (Closed): Matrix#rank loops in some circumstances
https://redmine.ruby-lang.org/issues/1020
2009-01-17T06:06:41Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
$ ruby -v -r matrix -e 'p Matrix[ [1,2,3], [4,5,6], [7,8,9] ].rank'<br>
ruby 1.9.1p5000 (2009-01-16 trunk 21610) [i386-darwin9.6.0]<br>
<< loops... >></p>
<p>The answer should be 2.<br>
=end</p>
Ruby master - Bug #1019 (Closed): irb/xmp fails because StringInputMethod doesn't support #encoding
https://redmine.ruby-lang.org/issues/1019
2009-01-17T03:47:58Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
% ruby -v -r irb/xmp -e 'xmp("1+2")'</p>
<p>ruby 1.9.1p5000 (2009-01-16 trunk 21610) [i386-darwin9.6.0]</p>
<p>/usr/local/rubybook/lib/ruby/1.9.1/irb/context.rb:166: warning: method redefined; discarding old irb_name<br>
1+2<br>
/usr/local/rubybook/lib/ruby/1.9.1/irb/ruby-lex.rb:243:in <code>block (2 levels) in each_top_level_statement': undefined method </code>encoding' for #<a href="XMP::StringInputMethod:0x3e1e44" class="external">XMP::StringInputMethod:0x3e1e44</a> (NoMethodError)<br>
from /usr/local/rubybook/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in <code>loop' from /usr/local/rubybook/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in </code>block in each_top_level_statement'<br>
from /usr/local/rubybook/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in <code>catch' from /usr/local/rubybook/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in </code>each_top_level_statement'<br>
from /usr/local/rubybook/lib/ruby/1.9.1/irb.rb:145:in <code>eval_input' from /usr/local/rubybook/lib/ruby/1.9.1/irb/xmp.rb:49:in </code>block in puts'<br>
from /usr/local/rubybook/lib/ruby/1.9.1/irb/xmp.rb:48:in <code>catch' from /usr/local/rubybook/lib/ruby/1.9.1/irb/xmp.rb:48:in </code>puts'<br>
from /usr/local/rubybook/lib/ruby/1.9.1/irb/xmp.rb:83:in <code>xmp' from -e:1:in </code>'<br>
=end</p>
Ruby master - Bug #848 (Closed): debug.rb doesn't have access to the source file under test until...
https://redmine.ruby-lang.org/issues/848
2008-12-11T05:53:25Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
dave[RUBY3/Book 14:51:21*] ruby -v -r debug t.rb<br>
ruby 1.9.1 (2008-12-10 revision 20602) [i386-darwin9.5.0]<br>
Debug.rb<br>
Emacs support available.</p>
<p>/usr/local/rubybook/lib/ruby/1.9.1/debug.rb:904:<br>
(rdb:1) l<br>
[899, 908] in /usr/local/rubybook/lib/ruby/1.9.1/debug.rb<br>
No sourcefile available for /usr/local/rubybook/lib/ruby/1.9.1/debug.rb <<<< !!!</p>
<p>(rdb:1) step<br>
t.rb:1:var = 'cat'<br>
(rdb:1) l<br>
[-4, 5] in t.rb<br>
=> 1 var = 'cat'<br>
2 def escape(l, s); l; end<br>
3<br>
4 while l.length > 70</p>
<p>Also, not line number range of [-4,5]<br>
=end</p>
Ruby master - Bug #847 (Closed): debug.rb reports extraneous information
https://redmine.ruby-lang.org/issues/847
2008-12-11T05:51:08Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
dave[RUBY3/Book 14:50:01*] ruby -v -r debug t.rb<br>
ruby 1.9.1 (2008-12-10 revision 20602) [i386-darwin9.5.0]<br>
Debug.rb<br>
Emacs support available.</p>
<p>/usr/local/rubybook/lib/ruby/1.9.1/debug.rb:904: <<< this seems wrong<br>
(rdb:1)<br>
=end</p>
Ruby master - Bug #727 (Closed): Signal(CLD) seems not to work on OS X
https://redmine.ruby-lang.org/issues/727
2008-11-08T23:51:37Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
I've noticed differences in the handling of SIGCLD in 1.9. For example, the following code:</p>
<pre><code> Signal.trap("CLD") { puts "Child died" }
fork && Process.wait
</code></pre>
<p>now reports</p>
<pre><code> t.rb:2:in `wait': Interrupted system call (Errno::EINTR)
from t.rb:2:in `<main>'
</code></pre>
<p>With 1.8, it just says "Child died" (which is what I'd expect)<br>
=end</p>
Ruby master - Bug #726 (Closed): erb references $KCOD
https://redmine.ruby-lang.org/issues/726
2008-11-08T23:47:12Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
$ erb -K SJIS<br>
/usr/local/rubybook/bin//erb:81: warning: variable $KCODE is no longer effective; ignored<br>
=end</p>
Ruby master - Bug #694 (Closed): eof? call on a pty IO object causes application to exit
https://redmine.ruby-lang.org/issues/694
2008-10-29T08:10:48Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
dave[RUBY3/Book 18:08:15*] cat t.rb</p>
<p>require 'pty'</p>
<p>PTY.spawn("/usr/bin/ruby /usr/bin/irb") do |reader, writer, pid|<br>
reader.eof?<br>
end</p>
<p>dave[RUBY3/Book 18:08:52*] ruby -v t.rb</p>
<p>ruby 1.9.0 (2008-10-29 revision 15427) [i386-darwin9.5.0]<br>
t.rb:4:in <code>eof?': pty - exited: 82527 (PTY::ChildExited) from t.rb:4:in </code>block in '<br>
from t.rb:3:in <code>spawn' from t.rb:3:in </code>'</p>
<p>This problem prevents expect() from working.<br>
=end</p>
Ruby master - Bug #693 (Closed): Thread#set_trace_func seems not to work
https://redmine.ruby-lang.org/issues/693
2008-10-29T04:43:28Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
trace_func = lambda {|a,b,c,d,e,f| p a}<br>
Thread.current.set_trace_func trace_func<br>
puts "here"</p>
<p>thr = Thread.new do<br>
Thread.current.add_trace_func(trace_func)<br>
puts "hello"<br>
def one<br>
puts "in one"<br>
end<br>
one<br>
end</p>
<p>thr.join</p>
<p>If you replace Thread.set_trace_func with set_trace_func, it reports as expected.<br>
=end</p>
Ruby master - Bug #678 (Closed): Socket.getservbyport should convert the port param to network by...
https://redmine.ruby-lang.org/issues/678
2008-10-23T07:56:29Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
getservbyname returns the port number in native byte order (so "telnet" returns 23).</p>
<p>But if you pass 23 back to getserverbyport, it fails, because it doesn't covert the param to network byte order before calling getservbyport(2).</p>
<p>Here's a patch that fixes it:</p>
<a name="Index-extsocketsocketc"></a>
<h1 >Index: ext/socket/socket.c<a href="#Index-extsocketsocketc" class="wiki-anchor">¶</a></h1>
<p>--- ext/socket/socket.c (revision 19883)<br>
+++ ext/socket/socket.c (working copy)<br>
@@ -3254,7 +3254,7 @@<br>
if (NIL_P(proto)) proto = rb_str_new2("tcp");<br>
StringValue(proto);</p>
<ul>
<li>sp = getservbyport(NUM2INT(port), StringValueCStr(proto));</li>
</ul>
<ul>
<li>sp = getservbyport(htons(NUM2INT(port)), StringValueCStr(proto));<br>
if (!sp) {<br>
rb_raise(rb_eSocket, "no such service for port %d/%s", NUM2INT(port), RSTRING_PTR(proto));<br>
}<br>
=end</li>
</ul>
Ruby master - Bug #647 (Rejected): Source encoding not applied to 7-bit regular expressions
https://redmine.ruby-lang.org/issues/647
2008-10-15T06:31:22Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin</p>
<a name="encoding-utf-8"></a>
<h1 >encoding: utf-8<a href="#encoding-utf-8" class="wiki-anchor">¶</a></h1>
<p>"cat".encoding # => #<a href="Encoding:UTF-8" class="external">Encoding:UTF-8</a><br>
"δδδ".encoding # => #<a href="Encoding:UTF-8" class="external">Encoding:UTF-8</a><br>
/cat/.encoding # => #<a href="Encoding:US-ASCII" class="external">Encoding:US-ASCII</a> # <<<<<br>
:δδδ.encoding # => #<a href="Encoding:UTF-8" class="external">Encoding:UTF-8</a></p>
<p>I was expecting the regular expression to be encoded the same way a<br>
string is.</p>
<p>Matz: Yes, it's a bug. Thank you.<br>
=end</p>
Ruby master - Bug #599 (Closed): mini/test reports incorrect source file for refutations
https://redmine.ruby-lang.org/issues/599
2008-09-25T07:45:45Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
require 'test/unit'</p>
<p>class ShowTestDifference < Test::Unit::TestCase<br>
def test_positive_logic<br>
assert false<br>
end</p>
<p>def test_negative_logic<br>
refute true<br>
end<br>
end</p>
<p>results in</p>
<p>dave[RUBY3/Book 17:42:17*] ruby t.rb<br>
Loaded suite t<br>
Started<br>
FF<br>
Finished in 0.000552 seconds.</p>
<ol>
<li>
<p>Failure:<br>
test_negative_logic(ShowTestDifference) [/usr/local/rubybook/lib/ruby/1.9.0/mini/test.rb:229]:<br>
Failed refutation, no message given</p>
</li>
<li>
<p>Failure:<br>
test_positive_logic(ShowTestDifference) [t.rb:5]:<br>
Failed assertion, no message given.</p>
</li>
</ol>
<p>2 tests, 2 assertions, 2 failures, 0 errors</p>
<p>Note that the source file listed for the refutation is mini/test.rb, and not the file containing the actual test.<br>
=end</p>
Ruby master - Bug #588 (Closed): Offset parameter breaks IO.binread
https://redmine.ruby-lang.org/issues/588
2008-09-24T02:19:32Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
dave[RUBY3/Book 12:17:17*] ruby -v -e 'IO.binread("/etc/passwd", 10, 10)'<br>
ruby 1.9.0 (2008-09-23 revision 15427) [i386-darwin9.5.0]<br>
-e:1:in <code>binread': can't convert Fixnum into String (TypeError) from -e:1:in </code>'<br>
=end</p>
Ruby master - Bug #457 (Closed): Is irb/xmp supported in 1.9?
https://redmine.ruby-lang.org/issues/457
2008-08-20T05:48:51Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
Running the following:</p>
<p>require 'irb/xmp'</p>
<p>xmp <<END<br>
artist = "Doc Severinsen"<br>
artist.upcase<br>
END</p>
<p>results in</p>
<p>(eval):3:in <code>Raise': frame underflow (IRB::Frame::FrameUnderflow) from /usr/local/rubybook/lib/ruby/1.9.0/irb/frame.rb:38:in </code>top'<br>
from /usr/local/rubybook/lib/ruby/1.9.0/irb/frame.rb:54:in <code>top' from /usr/local/rubybook/lib/ruby/1.9.0/irb/xmp.rb:81:in </code>xmp'<br>
from t1.rb:3:in `'<br>
=end</p>
Ruby master - Bug #455 (Closed): Array#sample(n) loops if a > arr.size
https://redmine.ruby-lang.org/issues/455
2008-08-19T23:12:58Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
Try:</p>
<p>[1].sample(2)<br>
=end</p>
Ruby master - Bug #232 (Closed): profile: get error "can't creating binding object on top of Fiber"
https://redmine.ruby-lang.org/issues/232
2008-07-08T07:23:41Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
$ ruby -v -rprofile -e 'puts 1'<br>
ruby 1.9.0 (2008-06-30 revision 15427) [i686-darwin9.3.0]<br>
% cumulative self self total<br>
time seconds seconds calls ms/call ms/call name<br>
0.00 0.01 0.00 1 0.00 10.00 #toplevel<br>
-e:1:in <code>puts': Can't create Binding Object on top of Fiber. (RuntimeError) from -e:1:in </code>puts'<br>
from -e:1:in `'<br>
=end</p>
Ruby master - Bug #231 (Closed): Profile.rb uses old VM constant
https://redmine.ruby-lang.org/issues/231
2008-07-08T07:19:41Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
Should use RubyVM.</p>
<p>A patch is attached</p>
<p>Dave<br>
=end</p>
Ruby master - Bug #172 (Closed): Regular expressions should inherit encoding of context even if t...
https://redmine.ruby-lang.org/issues/172
2008-06-16T23:04:40Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
The following program fails:</p>
<a name="encoding-utf-8"></a>
<h1 >encoding: utf-8<a href="#encoding-utf-8" class="wiki-anchor">¶</a></h1>
<p>"∂y/∂x = 2x" =~ /\p{Greek}/</p>
<p>with "t.rb:2: invalid character property name {Greek}: /\p{Greek}/"</p>
<p>The reason is that the regexp has US-ASCII encoding, and in that encoding the property 'Greek' is not defined.</p>
<p>However, in this case, that's very unexpected behavior. I'd suggest that if a regular expression is US-ASCII, but is being compared to a string that is not US-ASCII, the regular expression should temporarily take on the same encoding as the string.</p>
<p>Dave<br>
=end</p>
Ruby master - Bug #167 (Closed): net/telnet login() method no longer works under 1.9
https://redmine.ruby-lang.org/issues/167
2008-06-16T13:26:15Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
dave[RUBY3/Book 23:25:26*] ruby -r net/telnet -e 'Net::Telnet.new({}).login "a", "b"'<br>
/usr/local/rubybook/lib/ruby/1.9.0/net/telnet.rb:567:in <code>Integer': can't convert nil into Integer (TypeError) from /usr/local/rubybook/lib/ruby/1.9.0/net/telnet.rb:567:in </code>waitfor'<br>
from /usr/local/rubybook/lib/ruby/1.9.0/net/telnet.rb:745:in <code>login' from -e:1:in </code>'<br>
=end</p>
Ruby master - Bug #166 (Closed): Signal handling and sleep() don't work together
https://redmine.ruby-lang.org/issues/166
2008-06-16T13:18:52Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
Setting up a sleep seems to interfere with signal handlers. The following code</p>
<p>trap("CLD") do<br>
pid = Process.wait<br>
puts "Child pid #{pid}: terminated"<br>
end</p>
<p>exec("/bin/sh -c 'echo hello'") if fork.nil?<br>
puts "start"<br>
sleep 2<br>
puts "done"</p>
<p>Outputs start/hello/done with no delay, and the trap never fires. Replace the sleep with a gets, and the signal handler gets invoked—it never writes “Child xxx terminated.”<br>
=end</p>
Ruby master - Bug #164 (Closed): set_trace_func no longer reports 'line', 'call' and 'return' events
https://redmine.ruby-lang.org/issues/164
2008-06-16T12:12:38Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
Given the following code:</p>
<p>class Test<br>
def test<br>
a = 1<br>
b = 2<br>
end<br>
end</p>
<p>set_trace_func proc {|event, file, line, id, binding, classname|<br>
printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname<br>
}<br>
t = Test.new<br>
t.test</p>
<p>Run under 1.9:</p>
<pre><code>dave[RUBY3/Book 22:09:47*] ruby -v t.rb
ruby 1.9.0 (2008-06-16 revision 15427) [i686-darwin9.3.0]
c-return t.rb:10 set_trace_func Kernel
c-call t.rb:11 new Class
c-call t.rb:11 initialize BasicObject
c-return t.rb:11 initialize BasicObject
c-return t.rb:11 new Class
</code></pre>
<p>But, under 1.8:</p>
<pre><code>dave[RUBY3/Book 22:11:17*] /usr/bin/ruby -v t.rb
ruby 1.8.6 (2007-09-24 patchlevel 111) [universal-darwin9.0]
line t.rb:11 false
c-call t.rb:11 new Class
c-call t.rb:11 initialize Object
c-return t.rb:11 initialize Object
c-return t.rb:11 new Class
line t.rb:12 false
call t.rb:2 test Test
line t.rb:3 test Test
line t.rb:4 test Test
return t.rb:3 test Test
</code></pre>
<p>If this is deliberate, I'll update the documentation in the book.</p>
<p>Dave<br>
=end</p>
Ruby master - Bug #163 (Closed): Thread.priority= is effectively a no-op
https://redmine.ruby-lang.org/issues/163
2008-06-16T12:06:30Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
I raised the following back in January:</p>
<p>Is it reasonable to expect the following to produce differing counts in the result array?</p>
<p>counts = [ 0 ] * 10<br>
Thread.abort_on_exception = true<br>
10.times do |i|<br>
thread = Thread.new(i) do |index|<br>
Thread.current.priority = index<br>
loop do<br>
counts[index] += 1<br>
Thread.pass<br>
end<br>
end<br>
end<br>
sleep 1<br>
p counts</p>
<p>I get [6176, 6173, 6167, 6173, 6174, 6175, 6177, 6178, 6174, 6177]</p>
<p>Matz replied:</p>
<p>I don't know the rationale behind, but at least on Linux:</p>
<ul>
<li>the default scheduling policy is SCHED_OTHER. Ruby does not explicitly specify scheduling policy.</li>
<li>for SCHED_OTHER, min and max of priority is both zero</li>
<li>the specified priority is rounded to zero</li>
<li>as a result, no priority change happens</li>
</ul>
<p>We have to ask Koichi if it's a bug or not.</p>
<p>Given this: (a) is it a Ruby bug, and (b) if not, should we remove the method, as it might confuse folks?<br>
=end</p>
Ruby master - Bug #162 (Closed): The thwait standard library fails to comp;ile under 1.9
https://redmine.ruby-lang.org/issues/162
2008-06-16T11:58:06Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
dave[RUBY3/Book 21:56:55*] ruby -v -r 'thwait' -e 1<br>
ruby 1.9.0 (2008-06-16 revision 15427) [i686-darwin9.3.0]<br>
/usr/local/rubybook/lib/ruby/1.9.0/thwait.rb:56:in <code><class:ThreadsWait>': undefined method </code>extend_to' for Exception2MessageMapper:Module (NoMethodError)<br>
from /usr/local/rubybook/lib/ruby/1.9.0/thwait.rb:53:in <code><top (required)>' from :0:in </code>require'<br>
=end</p>
Ruby master - Bug #161 (Closed): Profile library seems broken in 1.9 15427cat t.rv
https://redmine.ruby-lang.org/issues/161
2008-06-16T08:13:21Z
pragdave (Dave Thomas)
dave@pragprog.com
<p>=begin<br>
dave[RUBY3/Book 18:11:11*] cat t.rb<br>
require 'profile'<br>
def ackerman(m, n)<br>
if m == 0 then n+1<br>
elsif n == 0 and m > 0 then ackerman(m-1, 1)<br>
else ackerman(m-1, ackerman(m, n-1))<br>
end<br>
end<br>
ackerman(3, 3)</p>
<p>With 1.8:</p>
<p>dave[RUBY3/Book 18:11:36*] /usr/bin/ruby -v t.rb<br>
ruby 1.8.6 (2007-09-24 patchlevel 111) [universal-darwin9.0]<br>
% cumulative self self total<br>
time seconds seconds calls ms/call ms/call name<br>
72.97 0.27 0.27 2432 0.11 4.65 Object#ackerman<br>
13.51 0.32 0.05 3676 0.01 0.01 Fixnum#==<br>
10.81 0.36 0.04 2431 0.02 0.02 Fixnum#-<br>
2.70 0.37 0.01 1188 0.01 0.01 Fixnum#+<br>
0.00 0.37 0.00 1 0.00 0.00 Module#method_added<br>
0.00 0.37 0.00 57 0.00 0.00 Fixnum#><br>
0.00 0.37 0.00 1 0.00 370.00 #toplevel</p>
<p>With 1.9:</p>
<p>dave[RUBY3/Book 18:11:40*] ruby -v t.rb<br>
ruby 1.9.0 (2008-06-16 revision 15427) [i686-darwin9.3.0]<br>
% cumulative self self total<br>
time seconds seconds calls ms/call ms/call name<br>
0.00 0.00 0.00 1 0.00 0.00 Module#method_added<br>
0.00 0.01 0.00 1 0.00 10.00 #toplevel<br>
=end</p>