Re: [perl #75758] Perl print error to STDERR, but finish with error status 0

[email protected] (Nicholas Clark)
Newsgroups perl.perl5.porters
Message-ID <[email protected]>
On Tue, Jun 15, 2010 at 03:00:08AM -0700, Alex Varyanick wrote:

Thanks for the report.
> This code:
> perl -e'\sort{eval$;}%!' && echo "exit 0"
> prints: "panic: restartop" into STDERR and finish with exit status 0

That turns out to already be fixed in blead. I bisected with

#!/bin/sh
git clean -dxf
# If you can use ccache, add -Dcc=ccache\ gcc -Dld=gcc to the Configure line
# if Encode is not needed for the test, you can speed up the bisect by
# excluding it from the runs with -Dnoextensions=Encode
sh Configure -des -Dusedevel -Uusethreads -Doptimize="-Os" -Dcc=ccache\ gcc -Dld=gcc -Dnoextensions=Encode
test -f config.sh || exit 125
# Correct makefile for newer GNU gcc
perl -ni -we 'print unless /<(?:built-in|command)/' makefile x2p/makefile
# if you just need miniperl, replace test_prep with miniperl
make -j4 test_prep
[ -x ./perl ] || exit 125
./perl -Ilib -e'\sort{eval$;}%!' 2>&1 | grep panic
ret=$?
[ $ret -gt 127 ] && ret=127
git clean -dxf

and it reveals that the fix was

27e904532594b7fb224bdf9a05bf3b5336b8a39e is first bad commit
commit 27e904532594b7fb224bdf9a05bf3b5336b8a39e
Author: David Mitchell <[email protected]>
Date:   Thu Apr 8 13:16:56 2010 +0100

    fix RT 23810: eval and tied methods
    
    Something like the following ended up corrupted:
        sub FETCH { eval 'BEGIN{syntax err}' }
    The croak on error popped back the context stack etc to the EVAL pushed by
    entereval, but the corresponding JUMPENV_PUSH(3) unwound all the way to the
    outer perl_run, losing all the mg_get() related parts of the C stack.
    
    It turns out that the run-time parts of pp_entereval were protected with
    a new JUMPENV level, but the compile-time parts weren't. Add this.

:100644 100644 80c7b221d7e967a6f3380d70917bd73700b16852 bbb2d1587cb197977c996ecfe8abddf4f9aa3631 M      pp_ctl.c
:040000 040000 7fa8480b6084b533c3eaddbbbd6834e2551f8a4e f2ec8022695df42cff76ab78c117bd44d1fb626c M      t
bisect run success

I don't have a 5.12 handy, but I think from the timing that that fix isn't
in 5.12

> This code:
> perl -e'/(?{"})/' && echo "exit 0"
> prints: "panic: top_env" into STDERR and finish with exit status 0

This is still a bug in blead.

Nicholas Clark
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.