victor@watson.ibm.com (Victor Miller) (04/18/91)
I built and tested perl-4.003 (from prep) on three platforms: IBM BSD/RT, IBM RS/6000, and SparcStation running SunOs 4. The script below causes perl to get a core dump on all 3. #!/usr/local/bin/perl # /usr/local/bin/foobar should be non-existent $foobar = '/usr/local/bin/foobar'; sub PLUMBER { print join(',',caller()); die "caught SIG$_[0] -- plumber bailing out"; } $SIG{'PIPE'} = $SIG{'INT'} = $SIG{'QUIT'} = 'PLUMBER'; sub NOPIPE { print join(',',caller(0)); shift(@_); die "Couldn't pipe:" . join(' ',@_) . "\n"; } $SIG{'PIPE'} = 'NOPIPE'; open(MESS,"| $foobar") || die "Couldn't pipe to $foobar\n"; print MESS "Hello\n"; print Mess "Goodbye\n"; close(MESS); print "Return status is $?\n"; -- Victor S. Miller Vnet and Bitnet: VICTOR at WATSON Internet: victor@watson.ibm.com IBM, TJ Watson Research Center
lwall@jpl-devvax.jpl.nasa.gov (Larry Wall) (04/20/91)
In article <VICTOR.91Apr18112016@irt.watson.ibm.com> victor@watson.ibm.com writes:
: I built and tested perl-4.003 (from prep) on three platforms: IBM
: BSD/RT, IBM RS/6000, and SparcStation running SunOs 4. The script
: below causes perl to get a core dump on all 3.
:
: sub NOPIPE {
: print join(',',caller(0));
: shift(@_); die "Couldn't pipe:" . join(' ',@_) . "\n";
: }
: $SIG{'PIPE'} = 'NOPIPE';
: open(MESS,"| $foobar") || die "Couldn't pipe to $foobar\n";
: print MESS "Hello\n";
caller with an argument currently only works if you're running under
the debugger. I'll fix that in the next patch.
But I should mention that using stdio in a signal handler dealing with
a fault that happened in the stdio routines is risky business. I'd
use syswrite().
Larry