I found very, very strange bug in ruby 1.9. I've discovered that
executing my ~/.irbrc file causes segmentation fault. I've tried to
cut down source but I failed. Every time I do very small change (for
example delete some method definition) bug doesn't appear. Even if I
remove some gem (which is not used at all!) bug doesn't appear. So I
describe all steps to reproduce this bug, because I have to small
knowledge to spy this bug.

I've filed this bug also on rubyforge Ruby bugs tracker
(http://rubyforge.org/tracker/index.php?func=detail&aid=16679&group_id=426&atid=1698).

STEP TO REPRODUCE

* Check out new version of ruby (I've tried with 15010 revision),
compile and install to some directory (--prefix and --program-suffix
option are useful, I've used --prefix=/home/radarek/opt,
--program-suffix=1.9). It's very important to use clean ruby
installation (I'll explain later).

* Install some gems, gem1.9 install GEM (small digression: I've
fetched and installed it manually, 'gem install ...' has some problems
with installation)
- wirble
- utility_belt

* Patch wirble.rb (you find it in wirble gem directory)  with
http://code.tie-rack.org/cms/wirble/wirble.rb_no_more_1.9_errors.patch
file.

* Download my .irbrc file from:
http://rubyforge.org/tracker/download.php/426/1698/16679/3103/.irbrc.
Try run this file.
* Execute .irbrc file


When I execute it I have following errors:

Loaded suite .irbrc
Started
..
Finished in 0.000714944 seconds.

2 tests, 3 assertions, 0 failures, 0 errors
<dummy toplevel>:126: [BUG] Segmentation fault
ruby 1.9.0 (2008-01-13 revision 0) [x86_64-linux]

-- control frame ----------
c:0001 p:0000 s:0002 b:0002 l:000001 d:000001 TOP    <dummy toplevel>:126
---------------------------
-- backtrace of native function call (Use addr2line) --
0x4acccf
0x4cb14e
0x4cb2a1
0x47d7b3
0x2b657ff05100
0x7f6420
-------------------------------------------------------
Aborted (core dumped)


But there are some weird things:
- when I comment out some method definition (which are not used), for
example 'ri', 'qri' and run again - bugs doesn't appear
- when I manually delete utility_belt gem directory and run again -
bugs doesn't appear (look at the .irbrc source file, 'require
"utility_belt" is commented out!)
- sometimes (but very rarely, maybe 5% chance) everything is ok

Can anyone reproduce it?

-- 
Radosw Bu„Šat

http://radarek.jogger.pl - m blog