What is Lamp? Lamp ain't Mac POSIX. It's like Cygwin for
traditional Mac OS. In most respects it behaves like Unix, though it
has no fork() and must use vfork() instead.
$ perl -we '$SIG{__WARN__} = sub { die }; `/dev/null/`;'
Illegal instruction
What happens is that perl vforks and tries to exec, but gets an error
(since /dev/null isn't executable). It issues a warning, which
invokes a sub which dies, and thereby longjmps back to perl_run(),
which is wrong because it's the child of a vfork() further down the
stack. Soon after perl's main() calls exit(), the _exit() system
call tries to resume the vfork() as the parent, by which point the
stack is undefined.
A related issue exists for fork-enabled systems:
$ perl -we '$SIG{__WARN__} = sub { die }; `/dev/null/`;'
Died at -e line 1.
$ echo $?
0
$ perl -v | head -2 | tail -1
This is perl, v5.10.0 built for i486-linux-gnu-thread-multi
Arguably, perl shouldn't be indicating success in the presence of an
uncaught exception. In this case, perhaps the child should merely
communicate the failure back to the parent, and let it issue the
warning, which would solve both problems.
Josh
Thread Next