Bug #345

1.9 racc appears to seg fault

Added by Roger Pack almost 7 years ago. Updated about 4 years ago.

[ruby-core:17922]
Status:Closed
Priority:Normal
Assignee:Koichi Sasada
ruby -v: Backport:

Description

=begin
ruby_parser, which uses racc, generates a seg fault in 1.9
require 'ruby_parser'

irb(main):003:0> RubyParser.new.parse "1+1"

/Users/rogerpack/dev/ruby_19_installed/lib/ruby/gems/1.9.0/gems/ruby_parser-1.0.0/lib/ruby_lexer.rb:2617: [BUG] Bus Error
ruby 1.9.0 (2008-07-23 revision 17865) [i686-darwin9.3.0]

-- control frame ----------
c:0029 p:---- s:0098 b:0098 l:000097 d:000097 CFUNC :method_missing
c:0028 p:---- s:0096 b:0096 l:000095 d:000095 CFUNC :old_initialize
c:0027 p:0029 s:0092 b:0092 l:000091 d:000091 METHOD /Users/rogerpack/dev/ruby_19_installed/lib/ruby/gems/1.9.0/gems/ruby_parser-1.0.0/lib/ruby_lexer.rb:2617
c:0026 p:---- s:0088 b:0088 l:000087 d:000087 FINISH :(null)

Also as a note, with the latest 1.9 SVN HEAD, it doesn't compile:

gcc -I. -I../../.ext/include/i686-darwin9.3.0 -I../.././include -I../.././ext/openssl -DRUBY_EXTCONF_H=\"extconf.h\" -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O2 -g -Wall -Wno-parentheses -fno-common -pipe -fno-common -o ossl_pkcs7.o -c ossl_pkcs7.c
ossl_pkcs7.c: In function ‘ossl_pkcs7si_new’:
ossl_pkcs7.c:89: error: ‘d2i_of_void’ undeclared (first use in this function)

though that's not the real issue here.
-R
=end

History

#1 Updated by Koichi Sasada almost 7 years ago

  • Assignee set to Koichi Sasada

=begin

=end

#2 Updated by Nobuyoshi Nakada almost 7 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r18357.
=end

#3 Updated by Roger Pack almost 7 years ago

=begin
It now no longer segfaults.
irb(main):002:0> RubyParser.new.parse "1+1"
NoMethodError: undefined method old_initialize' for #<StringIO:0x618cd0>
from /Users/rogerpack/dev/ruby_19_installed/lib/ruby/gems/1.9.0/gems/ruby_parser-1.0.0/lib/ruby_lexer.rb:2617:in
old_initialize'
from /Users/rogerpack/dev/ruby_19_installed/lib/ruby/gems/1.9.0/gems/ruby_parser-1.0.0/lib/ruby_lexer.rb:2617:in initialize'
from /Users/rogerpack/dev/ruby_19_installed/lib/ruby/gems/1.9.0/gems/ruby_parser-1.0.0/lib/ruby_lexer.rb:48:in
new'
from /Users/rogerpack/dev/ruby_19_installed/lib/ruby/gems/1.9.0/gems/ruby_parser-1.0.0/lib/ruby_lexer.rb:48:in parse'
from (irb):2
from /Users/rogerpack/dev/ruby_19_installed/bin/irb19:12:in
'

But may have revealed another bug. Should I file another bug report?
Thanks!
-R
=end

#4 Updated by Nobuyoshi Nakada almost 7 years ago

=begin
Hi,

At Fri, 8 Aug 2008 02:01:42 +0900,
Roger Pack wrote in :

It now no longer segfaults.
irb(main):002:0> RubyParser.new.parse "1+1"
NoMethodError: undefined method old_initialize' for #<StringIO:0x618cd0>
from /Users/rogerpack/dev/ruby_19_installed/lib/ruby/gems/1.9.0/gems/ruby_parser-1.0.0/lib/ruby_lexer.rb:2617:in
old_initialize'
from /Users/rogerpack/dev/ruby_19_installed/lib/ruby/gems/1.9.0/gems/ruby_parser-1.0.0/lib/ruby_lexer.rb:2617:in initialize'
from /Users/rogerpack/dev/ruby_19_installed/lib/ruby/gems/1.9.0/gems/ruby_parser-1.0.0/lib/ruby_lexer.rb:48:in
new'
from /Users/rogerpack/dev/ruby_19_installed/lib/ruby/gems/1.9.0/gems/ruby_parser-1.0.0/lib/ruby_lexer.rb:48:in parse'
from (irb):2
from /Users/rogerpack/dev/ruby_19_installed/bin/irb19:12:in
'

But may have revealed another bug. Should I file another bug report?

It's different story.
`super' calls ancestor's method of the called name, whereas the
defined name is used in 1.8

--
Nobu Nakada

=end

#5 Updated by Roger Pack over 6 years ago

=begin
Perhaps you can help me understand this -- so with StringIO you can't call an aliased constructor

require 'stringio'
class C < StringIO
alias :old_init :initialize
def initialize
old_init
end
end
C.new # fails

whereas with normal Ruby classes you can?

class A
def initialize
print 'A init'
end
end
class B < A
alias :old_init :initialize
def initialize
old_init
end
end
B.new # succeeds

Thanks!
-=R
=end

#6 Updated by Ryan Davis over 6 years ago

=begin

On Oct 7, 2008, at 22:31 , Roger Pack wrote:

Perhaps you can help me understand this -- so with StringIO you

can't call an aliased constructor

require 'stringio'
class C < StringIO
alias :old_init :initialize
def initialize
old_init
end
end
C.new # fails

please change the title of the bug. this doesn't have to do with racc,

but with StringIO. You should also point out that this code works fine

in 1.8.

=end

#7 Updated by Nobuyoshi Nakada over 6 years ago

=begin
Hi,

At Wed, 8 Oct 2008 14:31:00 +0900,
Roger Pack wrote in :

Perhaps you can help me understand this -- so with StringIO
you can't call an aliased constructor

OK, let's start a new ticket.

require 'stringio'
class C < StringIO
alias :old_init :initialize
def initialize
old_init
end
end
C.new # fails

whereas with normal Ruby classes you can?

class A
def initialize
print 'A init'
end
end
class B < A
alias :old_init :initialize
def initialize
old_init
end
end
B.new # succeeds

I don't think it desirable.

--
Nobu Nakada

=end

Also available in: Atom PDF