Rcov with segfault bug patched
Rcov are hurting many people because of a segfault when used with rspec. Fortunately Tom Copeland wrote a patch last week. I patched it against rcov and put on GitHub. You can install it as a gem doing like this:
$ gem sources -a http://gems.github.com (you only have to do this once)
$ sudo gem install mergulhao-rcov
Someone knows how to make GitHub recognizes my README.markdown file?
29.08.2008 01:28 AM





August 29th, 2008 at 08:54 AM
Sylvestre, use README.mkdn.
August 29th, 2008 at 09:35 AM
Sylvestre, funcionou beleza! Muito obrigado, estávamos precisando deste patch!! :)
August 31st, 2008 at 10:01 PM
I’ve pulled your changes into my rcov repo on github, and with the forthcoming rcov jruby changes we will have it working on ruby 1.8.6, 1.8.7 and jRuby! Thanks for the great work integrating the patch.
September 5th, 2008 at 04:57 PM
You’re my hero. Totally solved my problem.
September 9th, 2008 at 09:16 AM
thank you so much!!
September 29th, 2008 at 05:41 PM
The 0.8.1.3 version of rcov still crashes with a nil.+ No MethodError when—aggregate is turned on. At least it’s crash in Ruby now, so it can be patched with the following diff.
-rcov.rb.old 2008-09-29 12:09:59.000000000 -0600 + rcov.rb 2008-09-29 12:10:15.000000000 -0600@ -651,7 +651,8@ def aggregate_data(aggregated_data, delta) delta.each_pair do |file, cov_arr| dest = (aggregated_data[file] ||= Array.new(cov_arr.size, 0)) - cov_arr.each_with_index{|x,i| dest[i] += x} + # Added rescue clause to deal with dest array being smaller than cov_arr. + cov_arr.each_with_index{|x,i| dest[i] += x rescue dest[i] = x } end endSeptember 29th, 2008 at 05:44 PM
Wow, posting that patch surely didn’t work. The offending line is 654 of rcov.rb. The addition of a rescue clause fixes a nil.+ NoMethodError:
# Added rescue clause to deal with dest array being smaller than cov_arr. cov_arr.each_with_index{|x,i| dest[i] += x rescue dest[i] = x }September 29th, 2008 at 05:47 PM
One last time. Line 654 of rcov.rb should look like this:
# Added rescue clause to deal with dest array being smaller than cov_arr.cov_arr.each_with_index{|x,i| dest[i] += x rescue dest[i] = x }October 9th, 2008 at 10:07 AM
Thank you so much for posting this. Works perfectly.
October 22nd, 2008 at 01:13 PM
Do you have a version already built for win32? I do not have nmake installed.
Thanks for the fix
October 24th, 2008 at 08:31 PM
@Remi
Sorry I don’t know anything about win32.
@Sheldon Maloff
Thanks for your report, I’ll apply it. Try to contact someone from the main project, because mine is only a fork.
November 11th, 2008 at 03:15 AM
Beautiful! This totally fixed my problem. Thanks!!