gsub! segmentation fault

Discussion in 'Ruby' started by Innes MacKenzie, Mar 15, 2005.

  1. 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?
    Innes MacKenzie, Mar 15, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Hunsley
    Replies:
    17
    Views:
    849
  2. Pud
    Replies:
    0
    Views:
    562
  3. Replies:
    0
    Views:
    515
  4. Ivan Vecerina
    Replies:
    0
    Views:
    475
    Ivan Vecerina
    Jun 29, 2003
  5. aurelianito

    gsub and gsub! are inconsistent

    aurelianito, Nov 8, 2005, in forum: Ruby
    Replies:
    9
    Views:
    152
    Robert Klemme
    Nov 9, 2005
Loading...

Share This Page