--Q7MaAb+MMjzLKrXy
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Patrick May (patrick / hexane.org) wrote:

> Hello,
> 
> T suggested that ruby-core would be an appropriate place for this.  I 
> think I've found a Mac OS X bug.  Here is the example:
> 
>    continuation = []
>    at_exit{
>      puts 'at_exit'
>      continuation[0].call unless continuation[0].nil?
>    }
>    callcc{ |c|
>      continuation[0] = c
>    }
>    puts 'running'
> 
> This code runs in the expected continuous loop on linux.  On my mac
> (10.2) I get the error:
> 
>    [~/programming/narf] patsplat% ruby bug.rb
>    running
>    at_exit
>    running
>    bug.rb:9: compile error (SyntaxError)
>    bug.rb:9: [BUG] Bus Error
>    ruby 1.8.1 (2003-12-25) [powerpc-darwin]
> 
>    Abort
>    [~/programming/narf] patsplat%
> 
> Does this happen on any other platform?  Is this an OS X limitation?

On FreeBSD 5.2-CURRENT I get:

$ ruby -v x.rb
ruby 1.8.1 (2004-05-02) [i386-freebsd5]
running
at_exit
running
x.rb:12: [BUG] Segmentation fault
ruby 1.8.1 (2004-05-02) [i386-freebsd5]

Abort trap (core dumped)
$

Here's a backtrace:

#0  0x281b5a93 in kill () from /lib/libc.so.5
#1  0x281ab25a in raise () from /lib/libc.so.5
#2  0x2821cea7 in abort () from /lib/libc.so.5
#3  0x280998c8 in rb_bug () from /usr/local/lib/libruby18.so.18
#4  0x280fb24b in sigsegv () from /usr/local/lib/libruby18.so.18
#5  0xbfbfffb4 in ?? ()
#6  0x0000000b in ?? ()
#7  0x0000000c in ?? ()
#8  0xbfbfe810 in ?? ()
#9  0x00001440 in ?? ()
#10 0x280fb22c in sigbus () from /usr/local/lib/libruby18.so.18
#11 0x080485f9 in main ()

After upgrading Ruby:

$ ruby -v x.rb
ruby 1.8.2 (2004-07-29) [i386-freebsd5]
running
at_exit
running
x.rb:12: [BUG] Segmentation fault
ruby 1.8.2 (2004-07-29) [i386-freebsd5]

Abort trap (core dumped)
$

The backtrace was nearly identical, the locations of some addresses
moved, but that was all.  If you'd like, I can recompile with debugging
symbols.

A Ruby19 works:

$ ruby19 -v x.rb
ruby 1.9.0 (2004-07-29) [i386-freebsd5.2]
running
at_exit
running
$

On FreeBSD 4.9-STABLE it works:

$ ruby -v x.rb
ruby 1.8.1 (2003-12-25) [i386-freebsd4]
running
at_exit
running
$

(Same for a 2004-07-29 build)

(at_exit only fires once for both of these)

-- 
Eric Hodel - drbrain / segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04


--Q7MaAb+MMjzLKrXy
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iD8DBQFBQAxFMypVHHlsnwQRApBPAKCyl0xiVP+FRnyRxqJzeM642SqmIwCdGrio
GlbAWeKnGGR1YRBvVRQeVvgP7M
-----END PGP SIGNATURE-----

--Q7MaAb+MMjzLKrXy--