Skip to content

Perl print error to STDERR, but finish with error status 0 #10441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
p5pRT opened this issue Jun 15, 2010 · 5 comments
Closed

Perl print error to STDERR, but finish with error status 0 #10441

p5pRT opened this issue Jun 15, 2010 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented Jun 15, 2010

Migrated from rt.perl.org#75758 (status was 'resolved')

Searchable as RT75758$

@p5pRT
Copy link
Author

p5pRT commented Jun 15, 2010

From [email protected]

Created by [email protected]

This is a bug report for perl from q@​cono.org.ua,
generated with the help of perlbug 1.39 running under perl 5.10.1.

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

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

Perl Info

Flags:
    category=core
    severity=high

Site configuration information for perl 5.10.1:

Configured by Debian Project at Fri Apr 23 07:59:14 UTC 2010.

Summary of my perl5 (revision 5 version 10 subversion 1) configuration:

  Platform:
    osname=linux, osvers=2.6.24-27-server, archname=i486-linux-gnu-thread-multi
    uname='linux vernadsky 2.6.24-27-server #1 smp fri mar 12 01:45:06
utc 2010 i686 gnulinux '
    config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN
-Dcccdlflags=-fPIC -Darchname=i486-linux-gnu -Dprefix=/usr
-Dprivlib=/usr/share/perl/5.10 -Darchlib=/usr/lib/perl/5.10
-Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5
-Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local
-Dsitelib=/usr/local/share/perl/5.10.1
-Dsitearch=/usr/local/lib/perl/5.10.1 -Dman1dir=/usr/share/man/man1
-Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1
-Dsiteman3dir=/usr/local/man/man3 -Dman1ext=1 -Dman3ext=3perl
-Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Ud_ualarm -Uusesfio
-Uusenm -DDEBUGGING=-g -Doptimize=-O2 -Duseshrplib
-Dlibperl=libperl.so.5.10.1 -Dd_dosuid -des'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN
-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2 -g',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing
-pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.4.3', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/lib64
    libs=-lgdbm -lgdbm_compat -ldb -ldl -lm -lpthread -lc -lcrypt
    perllibs=-ldl -lm -lpthread -lc -lcrypt
    libc=/lib/libc-2.11.1.so, so=so, useshrplib=true, libperl=libperl.so.5.10.1
    gnulibc_version='2.11.1'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib
-fstack-protector'

Locally applied patches:



@INC for perl 5.10.1:
    /etc/perl
    /usr/local/lib/perl/5.10.1
    /usr/local/share/perl/5.10.1
    /usr/lib/perl5
    /usr/share/perl5
    /usr/lib/perl/5.10
    /usr/share/perl/5.10
    /usr/local/lib/site_perl
    .


Environment for perl 5.10.1:
    HOME=/home/cono
    LANG=en_US.utf8
    LANGUAGE (unset)
    LC_ALL=en_US.UTF-8
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/cono/work/rakudo/parrot_install/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/home/cono/bin:.
    PERL_BADLANG (unset)
    SHELL=/usr/bin/zsh

-- 
Varyanick I. Alex
icq: 102 575 440
skype: cono..
[email protected]

@p5pRT
Copy link
Author

p5pRT commented Jun 16, 2010

From @nwc10

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

27e9045 is first bad commit
commit 27e9045
Author​: David Mitchell <davem@​iabyn.com>
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

@p5pRT
Copy link
Author

p5pRT commented Jun 16, 2010

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jun 16, 2010

From @Abigail

On Wed, Jun 16, 2010 at 01​:16​:08PM +0100, Nicholas Clark wrote​:

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

27e9045 is first bad commit
commit 27e9045
Author​: David Mitchell <davem@​iabyn.com>
Date​: Thu Apr 8 13​:16​:56 2010 +0100

fix RT 23810&#8203;: eval and tied methods

Something like the following ended up corrupted&#8203;:
    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

Indeed, it still is an issue in 5.12.1.

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.

Some additional diagnostic​:

  $ perl -e'/(?{"})/'
  panic​: top_env
  perl​: perl.c​:542​: perl_destruct​: Assertion `PL_scopestack_ix == 1' failed.
  Aborted
  $

which is exactly the same error "perl -e'\sort{eval$;}%!'" gives me in 5.12.1.

Abigail

@p5pRT
Copy link
Author

p5pRT commented Jan 21, 2011

@iabyn - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant