Project

General

Profile

Actions

Bug #4238

closed

GC.stress 下で OptionParser で設定のない引数をパースさせると core

Added by metanest (Makoto Kishimoto) over 13 years ago. Updated about 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.3dev (2011-01-06 trunk 30471) [x86_64-freebsd8.2]
Backport:
[ruby-dev:42963]

Description

=begin
r29832 以降で起きます

以下のようなスクリプトを実行すると、

$ cat optparse-core.rb
require "optparse"

parser = OptionParser.new
GC.stress
parser.parse! ['-a']

以下のように core を吐きます。

$ ruby19 optparse-core.rb
/usr/local/lib/ruby/1.9.1/optparse.rb:233: [BUG] Segmentation fault
ruby 1.9.3dev (2011-01-06 trunk 30471) [x86_64-freebsd8.2]

-- Control frame information -----------------------------------------------
c:0026 p:---- s:0116 b:0116 l:000115 d:000115 CFUNC :each
c:0025 p:---- s:0114 b:0114 l:0021f0 d:000113 IFUNC
c:0024 p:---- s:0112 b:0112 l:000111 d:000111 CFUNC :call
c:0023 p:0058 s:0109 b:0109 l:001ad0 d:001ad0 METHOD /usr/local/lib/ruby/1.9.1/optparse.rb:233
c:0022 p:0039 s:0101 b:0101 l:000100 d:000100 METHOD /usr/local/lib/ruby/1.9.1/optparse.rb:248
c:0021 p:0033 s:0095 b:0095 l:000094 d:000094 METHOD /usr/local/lib/ruby/1.9.1/optparse.rb:253
c:0020 p:0031 s:0085 b:0085 l:000084 d:000084 METHOD /usr/local/lib/ruby/1.9.1/optparse.rb:658
c:0019 p:0020 s:0077 b:0077 l:000068 d:000076 BLOCK /usr/local/lib/ruby/1.9.1/optparse.rb:1509
c:0018 p:---- s:0074 b:0074 l:000073 d:000073 FINISH
c:0017 p:---- s:0072 b:0072 l:000071 d:000071 CFUNC :reverse_each
c:0016 p:0013 s:0069 b:0069 l:000068 d:000068 METHOD /usr/local/lib/ruby/1.9.1/optparse.rb:1508
c:0015 p:0023 s:0063 b:0063 l:001bd8 d:000e38 BLOCK /usr/local/lib/ruby/1.9.1/optparse.rb:1540
c:0014 p:---- s:0061 b:0061 l:000060 d:000060 FINISH
c:0013 p:---- s:0059 b:0059 l:000058 d:000058 CFUNC :catch
c:0012 p:0051 s:0055 b:0053 l:001bd8 d:001bd8 METHOD /usr/local/lib/ruby/1.9.1/optparse.rb:1539
c:0011 p:0032 s:0046 b:0046 l:000030 d:000045 BLOCK /usr/local/lib/ruby/1.9.1/optparse.rb:1379
c:0010 p:0296 s:0043 b:0043 l:000030 d:000042 BLOCK /usr/local/lib/ruby/1.9.1/optparse.rb:1371
c:0009 p:---- s:0037 b:0037 l:000036 d:000036 FINISH
c:0008 p:---- s:0035 b:0035 l:000034 d:000034 CFUNC :catch
c:0007 p:0062 s:0031 b:0031 l:000030 d:000030 METHOD /usr/local/lib/ruby/1.9.1/optparse.rb:1346
c:0006 p:0024 s:0021 b:0021 l:000020 d:000020 METHOD /usr/local/lib/ruby/1.9.1/optparse.rb:1340
c:0005 p:0038 s:0016 b:0016 l:000015 d:000015 METHOD /usr/local/lib/ruby/1.9.1/optparse.rb:1431
c:0004 p:0054 s:0011 b:0011 l:000010 d:000010 METHOD /usr/local/lib/ruby/1.9.1/optparse.rb:1452
c:0003 p:0063 s:0007 b:0007 l:0016b8 d:000ec0 EVAL optparse-core.rb:5
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:0016b8 d:0016b8 TOP

-- Ruby level backtrace information ----------------------------------------
optparse-core.rb:5:in <main>' /usr/local/lib/ruby/1.9.1/optparse.rb:1452:in parse!'
/usr/local/lib/ruby/1.9.1/optparse.rb:1431:in permute!' /usr/local/lib/ruby/1.9.1/optparse.rb:1340:in order!'
/usr/local/lib/ruby/1.9.1/optparse.rb:1346:in parse_in_order' /usr/local/lib/ruby/1.9.1/optparse.rb:1346:in catch'
/usr/local/lib/ruby/1.9.1/optparse.rb:1371:in block in parse_in_order' /usr/local/lib/ruby/1.9.1/optparse.rb:1379:in rescue in block in parse_in_order'
/usr/local/lib/ruby/1.9.1/optparse.rb:1539:in complete' /usr/local/lib/ruby/1.9.1/optparse.rb:1539:in catch'
/usr/local/lib/ruby/1.9.1/optparse.rb:1540:in block in complete' /usr/local/lib/ruby/1.9.1/optparse.rb:1508:in visit'
/usr/local/lib/ruby/1.9.1/optparse.rb:1508:in reverse_each' /usr/local/lib/ruby/1.9.1/optparse.rb:1509:in block in visit'
/usr/local/lib/ruby/1.9.1/optparse.rb:658:in complete' /usr/local/lib/ruby/1.9.1/optparse.rb:253:in complete'
/usr/local/lib/ruby/1.9.1/optparse.rb:248:in candidate' /usr/local/lib/ruby/1.9.1/optparse.rb:233:in candidate'
/usr/local/lib/ruby/1.9.1/optparse.rb:233:in call' /usr/local/lib/ruby/1.9.1/optparse.rb:233:in each'

-- Other runtime information -----------------------------------------------

  • Loaded script: optparse-core.rb

  • Loaded features:

    0 enumerator.so
    1 /usr/local/lib/ruby/1.9.1/x86_64-freebsd8.2/enc/encdb.so
    2 /usr/local/lib/ruby/1.9.1/x86_64-freebsd8.2/enc/trans/transdb.so
    3 /usr/local/lib/ruby/1.9.1/optparse.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Abort trap: 6 (core dumped)
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0