Having an "interesting" segfault with a rake task. When run as quoted here from the command line, it works properly. If I run all rake tasks from a single system call, I get a segfault.
task :cruise do
  system 'rake db:reset db:test:clone teabag'
  system 'rake spec'
end
For those of you unfamiliar with it, Teabag is "a JavaScript test runner built on top of Rails". So what we have here is basically:
- Reinitialise the (development) database
- Clone the test database from the known-state development one; and
- Run specs for {Java,Coffee}Script and Ruby/Rails.
Version information:
- OS X 10.8.2
- ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.2.0]
- Not using rvm
- Rails 3.2.12
My Gemfile and Gemfile.lock are at this Gist. Task output, including crash dump, is on Pastebin.
EDITED 5 March 2013 12:20 SGT (GMT+8) *
I rewrote the task as
task :cruise do
  ['db:reset', 'db:test:clone', 'teabag', 'spec'].each do |task|
    Rake::Task[task].reenable
    Rake::Task[task].invoke
  end
end
and it runs as expected. (Note that I had to add Rake::Task[task].reenable to eliminate the RSpec segfault).
This still doesn't answer why RSpec will reliably segfault when either run as part of a multi-task rake command line (as with the original system-calling task) or when run in the reworked cruise task without calling reenable before invoke.  But I've got the workaround, so I consider the question answered.
