Bugs item #4491, was opened at 2006-05-16 12:46
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=4491&group_id=426

Category: Core
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Jeff Abbott (fdiv_bug)
Assigned to: Nobody (None)
Summary: Segfault on x86_64 when built with -O0 in CFLAGS

Initial Comment:
Due to a bug in the spec file for the package I was building (which I will be filing separately with the package author), Ruby 1.8.4 was getting built with -O0 in its CFLAGS.  This worked fine on i386, but on x86_64 it caused a segfault which I was easily able to reproduce with the following in either ruby or irb:

  Dir['/bin/bash/foo']

The problem appears to stem from '/bin/bash' being a file, not a directory -- Rails was doing a similar Dir.glob, referencing a subdirectory of a plain file object, which was where I was seeing the segfault in production.  On i386 it returns an empty array.  Building with -O2 in the CFLAGS resolves the problem.  I understand if this mightbe a case of "so don't build with -O0" but I believe behavior should be identical on both platforms, or at the very least not exhibit a segfault on x86_64.

Thanks,
Jeff

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=4491&group_id=426