Bug #2563: Segmentation fault using module_eval
http://redmine.ruby-lang.org/issues/show/2563

Author: James Conroy-Finn
Status: Open, Priority: Normal
Category: core
ruby -v: 1.9.1p376

I'm running Ruby 1.9.1p376, built from source using RVM on Mac OS X (10.6.2). When executing github clone user/repo I get a reproducible seg fault.

Here's the stack trace???

===
/Users/jcf/.rvm/gems/ruby-1.9.1-p376/gems/github-0.4.1/lib/github/extensions.rb:11: warning: undefining `object_id' may cause serious problem
/Users/jcf/.rvm/gems/ruby-1.9.1-p376/gems/github-0.4.1/lib/github.rb:151: [BUG] Segmentation fault
ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-darwin10.2.0]

-- control frame ----------
c:0012 p:---- s:0039 b:0039 l:000038 d:000038 CFUNC  :module_eval
c:0011 p:0088 s:0034 b:0034 l:000033 d:000033 METHOD /Users/jcf/.rvm/gems/ruby-1.9.1-p376/gems/github-0.4.1/lib/github.rb:151
c:0010 p:0012 s:0028 b:0028 l:000019 d:000027 BLOCK  /Users/jcf/.rvm/gems/ruby-1.9.1-p376/gems/github-0.4.1/lib/github.rb:68
c:0009 p:---- s:0025 b:0025 l:000024 d:000024 FINISH
c:0008 p:---- s:0023 b:0023 l:000022 d:000022 CFUNC  :each
c:0007 p:0081 s:0020 b:0020 l:000019 d:000019 METHOD /Users/jcf/.rvm/gems/ruby-1.9.1-p376/gems/github-0.4.1/lib/github.rb:67
c:0006 p:0100 s:0016 b:0016 l:000015 d:000015 TOP    /Users/jcf/.rvm/gems/ruby-1.9.1-p376/gems/github-0.4.1/bin/gh:8
c:0005 p:---- s:0013 b:0013 l:000012 d:000012 FINISH
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC  :load
c:0003 p:0127 s:0007 b:0007 l:001ae8 d:001890 EVAL   /Users/jcf/.rvm/gems/ruby-1.9.1-p376/bin/gh:19
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001ae8 d:001ae8 TOP   
---------------------------
-- Ruby level backtrace information-----------------------------------------
/Users/jcf/.rvm/gems/ruby-1.9.1-p376/gems/github-0.4.1/lib/github.rb:151:in `module_eval'
/Users/jcf/.rvm/gems/ruby-1.9.1-p376/gems/github-0.4.1/lib/github.rb:151:in `load'
/Users/jcf/.rvm/gems/ruby-1.9.1-p376/gems/github-0.4.1/lib/github.rb:68:in `block in activate'
/Users/jcf/.rvm/gems/ruby-1.9.1-p376/gems/github-0.4.1/lib/github.rb:67:in `each'
/Users/jcf/.rvm/gems/ruby-1.9.1-p376/gems/github-0.4.1/lib/github.rb:67:in `activate'
/Users/jcf/.rvm/gems/ruby-1.9.1-p376/gems/github-0.4.1/bin/gh:8:in `<top (required)>'
/Users/jcf/.rvm/gems/ruby-1.9.1-p376/bin/gh:19:in `load'
/Users/jcf/.rvm/gems/ruby-1.9.1-p376/bin/gh:19:in `<main>'

-- C level backtrace information -------------------------------------------

[NOTE]
You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
===

It occurs within the Github gem when attempting to execute???

def load(file)
  file[0] =~ /^\// ? path = file : path = BasePath + "/commands/#{File.basename(file)}"
  data = File.read(path)
  GitHub.module_eval data, path
end

???within lib/github.rb, line 148.

You can checkout the gem on Github at http://github.com/defunkt/github-gem and clone the source via git://github.com/defunkt/github-gem.git.


----------------------------------------
http://redmine.ruby-lang.org