On Wed, Jan 26, 2005 at 12:15:08AM +0000, Dave Mitchell wrote:
> On Tue, Jan 25, 2005 at 11:02:16PM +0000, Nicholas Clark wrote:
> > > $ perl -e '$SIG{"ALRM"} = sub { die }; eval { alarm(1); my $x = `sleep
> > > 2`; }; chomp ($_="foo\n"); die "Wrong" if /\n/;'
> > > Wrong at -e line 1.
> >
> > Most curious. It seems to be a bug introduced between 5.8.0 and 5.8.1.
> > I can't think of any immediate cause, or place to start looking for this.
>
>
> pp_backtick temporarily alters PL_rs, but saves the old value in a C local
> var rather than on the savestack. A subsequent die and eval thus fails to
> restore the old value during the stack unwind.
Ah yes.
I wonder how many other places in the perl code have a similar class of bug.
Specifically here, I wonder how to safely write a portable regression test.
Maybe it's safe already as the output of the backticks is ignored, so if there
is no sleep command to run it would still pass.
Nicholas Clark