[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

gsub! segmentation fault

innes

3/15/2005 3:55:00 PM

Hi all,
I've managed to make irb blow up: when I call gsub! on a string and
then evaluate the string I get a segmentation fault, depending on the
variable name of the receiving string:

Examples: (ruby 1.8.2 (2004-12-25) [i386-mswin32]):

String named 's' - works okay:
-------------------------------------------
D:\Documents and Settings\innes>irb
irb(main):001:0> s = "select * from tablenamehere"
=> "select * from tablenamehere"
irb(main):002:0> s.gsub!(/tablenamehere/, 'test')
=> "select * from test"
irb(main):003:0> s
=> "select * from test"
irb(main):004:0> exit
D:\Documents and Settings\innes>

String named 'create_table_script' - throws an error:
--------------------------------------------------------------------------
D:\Documents and Settings\innes>irb
irb(main):001:0> create_table_script = "select * from tablenamehere"
=> "select * from tablenamehere"
irb(main):002:0> create_table_script.gsub!(/tablenamehere/, 'test')
=> "select * from test"
irb(main):003:0> create_table_script
c:/ruby/lib/ruby/1.8/irb/input-method.rb:97: [BUG] Segmentation fault
ruby 1.8.2 (2004-12-25) [i386-mswin32]


This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
D:\Documents and Settings\innes>

I've tried it with a couple of other names for 's/create_table_script'
and have found only the latter causes the segmentation fault. Has
anyone else seen this problem, or have I cocked something up?