Archive for August, 2009

Rcov, NaN, and Fatal Crashes

Seems its possible to crash the current version of rcov hard under certain circumstances (version as of this writing: rcov (0.8.1.2.0)). If you find it crashing with:

ruby(17057,0xa0124720) malloc: *** error for object 0×5b1a602: Non-aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug
/opt/local/lib/ruby/1.8/rss/rss.rb:274: [BUG] Segmentation fault
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9]

rake aborted!
NaN

Check to see if you have any empty helper files that don’t have any coverage. I had a couple that resembled the following. Removing them removed the “divide by zero” issue that causes the crash:

module ProductHelper
end

Update
Scratch that, it doesn’t entirely fix the issue. I’ve also implemented Stew Welbourne’s hack for round_to_tenths(decimal) in MetricFu but that too does not seem to be a complete solution. The seg fault still happens, though intermittently (sometimes it runs through the complete test suite, sometimes it doesn’t).

The search continues.

No Comments »

chris on August 27th 2009 in /dev/rails, /dev/ruby

Rails, date_select and “index out of string”

If you’re working in Rails and using date_select() or datetime_select() (and presumably select_date() and select_datetime()) and you find yourself up against an error like the following:

index 3873 out of string

Check that your :default parameter is either nil or an actual Date/Time/DateTime instance and not a String. Passing in a string as :default really messes things up.

No Comments »

chris on August 11th 2009 in /dev/rails