Bug #1129: IO.binread(Pathname(...)) dumps core
http://redmine.ruby-lang.org/issues/show/1129

起票者: Sakuro OZAWA
ステータス: Open, 優先度: Normal
ruby -v: ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-darwin9.6.0]

Pathnameのインスタンスを引数にしたとき、
IO.binreadがコアを吐きます。
IO.readは吐きません。

MacOS X Leopard 10.5.6のMacPortsのruby19
Ubuntu Linux 8.04(Low Price Intel Architecture)で自分でコンパイルしたもの
で確認。

% ruby -rpathname -e 'puts IO.read(Pathname("/etc/shells"))'
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
<snip>
/bin/tcsh
/bin/zsh

% ruby -rpathname -e 'puts IO.binread(Pathname("/etc/shells"))'
-e:1: [BUG] Bus Error
ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-darwin9.6.0]

-- control frame ----------
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC  :binread
c:0003 p:0025 s:0007 b:0006 l:001b64 d:001dd4 EVAL   -e:1
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001b64 d:001b64 TOP    <main>:47140
---------------------------
-- Ruby level backtrace information-----------------------------------------
-e:1:in `binread'
-e:1:in `<main>'

-- C level backtrace information -------------------------------------------
0x2f8e02 0   libruby.dylib                       0x002f8e02 rb_vm_bugreport + 82
0x20e38c 1   libruby.dylib                       0x0020e38c rb_warning + 444
0x20e3eb 2   libruby.dylib                       0x0020e3eb rb_bug + 43
0x29f5ab 3   libruby.dylib                       0x0029f5ab rb_enable_interrupt + 75
0x95abe2bb 4   libSystem.B.dylib                   0x95abe2bb _sigtramp + 43
0xffffffff 5   ???                                 0xffffffff 0x0 + 4294967295
0x22cdc4 6   libruby.dylib                       0x0022cdc4 rb_close_before_exec + 484
0x23696f 7   libruby.dylib                       0x0023696f rb_file_open_str + 4959
0x236a4d 8   libruby.dylib                       0x00236a4d rb_file_open_str + 5181
0x2e4845 9   libruby.dylib                       0x002e4845 rb_iseq_compile + 1125
0x2e92bd 10  libruby.dylib                       0x002e92bd rb_funcall2 + 1773
0x2eba2b 11  libruby.dylib                       0x002eba2b rb_funcall2 + 11867
0x2f0e1b 12  libruby.dylib                       0x002f0e1b rb_funcall2 + 33355
0x2f102f 13  libruby.dylib                       0x002f102f rb_iseq_eval_main + 159
0x2114e9 14  libruby.dylib                       0x002114e9 ruby_exec_node + 169
0x213b6e 15  libruby.dylib                       0x00213b6e ruby_run_node + 94
0x1fef 16  ruby                                0x00001fef main + 95
0x1f56 17  ruby                                0x00001f56 start + 54
0x4 18  ???                                 0x00000004 0x0 + 4

[NOTE]
You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

zsh: abort (core dumped)  ruby -rpathname -e 'puts IO.binread(Pathname("/etc/shells"))'


----------------------------------------
http://redmine.ruby-lang.org