Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.93k stars 553 forks source link

Perl debugger dies #8764

Closed p5pRT closed 11 years ago

p5pRT commented 17 years ago

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

Searchable as RT41461$

p5pRT commented 17 years ago

From 1illig@informatik.uni-hamburg.de

Created by 1illig@rzdspc2.informatik.uni-hamburg.de

$ echo 'print "hello\n";' > bug.pl $ env PERLDB_OPTS="noTTY frame=2" perl -d bug.pl Can't use an undefined value as a symbol reference at /usr/pkg/2006Q2/lib/perl5/5.8.0/perl5db.pl line 5376. at /usr/pkg/2006Q2/lib/perl5/5.8.0/perl5db.pl line 5376   DB​::print_lineinfo(''\, 'Package bug.pl.\x{a}') called at /usr/pkg/2006Q2/lib/perl5/5.8.0/perl5db.pl line 5480   DB​::postponed('*main​::_\<bug.pl') called at bug.pl line 1

Perl Info ``` Flags: category=utilities severity=low Site configuration information for perl v5.8.8: Configured by 1illig at Thu Aug 3 02:04:39 CEST 2006. Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=solaris, osvers=2.8, archname=sparc-solaris-thread-multi uname='sunos rzdspc2 5.8 generic_117350-26 sun4u sparc sunw,ultra-4 ' config_args='-sde -Darchname=sparc-solaris -Dcc=gcc -Doptimize=-O -D_REENTRANT -I/usr/include -Duseshrplib -Ui_malloc -Uusemymalloc -Uinstallusrbinperl -Dinstallstyle=lib/perl5 -Dprefix=/usr/pkg/2006Q2 -Dsiteprefix=/usr/pkg/2006Q2 -Dvendorprefix=/usr/pkg/2006Q2 -Dscriptdir=/usr/pkg/2006Q2/lib/perl5/bin -Dsitescript=/usr/pkg/2006Q2/lib/perl5/site_perl/bin -Dvendorscript=/usr/pkg/2006Q2/lib/perl5/vendor_perl/bin -Dsitebin=/usr/pkg/2006Q2/lib/perl5/site_perl/bin -Dvendorbin=/usr/pkg/2006Q2/lib/perl5/vendor_perl/bin -Dprivlib=/usr/pkg/2006Q2/lib/perl5/5.8.0 -Dsitelib=/usr/pkg/2006Q2/lib/perl5/site_perl/5.8.0 -Dvendorlib=/usr/pkg/2006Q2/lib/perl5/vendor_perl/5.8.0 -Dsitelib_stem=/usr/pkg/2006Q2/lib/perl5/site_perl -Dvendorlib_stem=/usr/pkg/2006Q2/lib/perl5/vendor_perl -Dman1ext=1 -Dman1dir=/usr/pkg/2006Q2/lib/perl5/man/man1 -Dsiteman1dir=/usr/pkg/2006Q2/lib/perl5/site_perl/man/man1 -Dvendorman1dir=/usr/pkg/2006Q2/lib/perl5/vendor_perl/man/man1 -Dman3ext=3 -Dman3dir=/usr/pkg/20 06Q2/lib/perl5/man/man3 -Dsiteman3dir=/usr/pkg/2006Q2/lib/perl5/site_perl/man/man3 -Dvendorman3dir=/usr/pkg/2006Q2/lib/perl5/vendor_perl/man/man3 -Daphostname=/bin/hostname -Dln=/usr/bin/ln -Dsed=/usr/pkg/2006Q2/bin/nbsed -Dsh=/bin/ksh -Dissymlink=test -h -Duseithreads -Dlibswanted=m crypt dl socket nsl pthread rt' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef 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='gcc', ccflags ='-D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O -D_REENTRANT -I/usr/include', cppflags='-D_REENTRANT' ccversion='Sun C 5.8 Patch 121015-02 2006/03/29', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='gcc', ldflags ='-Wl,-R/usr/pkg/2006Q2/lib -L/usr/lib -L/usr/ccs/lib -L/local/SUNWspro/prod/lib/v8plus -L/local/SUNWspro/prod/lib -L/lib -L/usr/pkg/2006Q2/lib ' libpth=/usr/lib /usr/ccs/lib /local/SUNWspro/prod/lib/v8plus /local/SUNWspro/prod/lib /lib /usr/pkg/2006Q2/lib libs=-lm -ldl -lsocket -lnsl -lpthread -lrt perllibs=-lm -ldl -lsocket -lnsl -lpthread -lrt libc=/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -R /usr/pkg/2006Q2/lib/perl5/5.8.0/sparc-solaris-thread-multi/CORE' cccdlflags='-KPIC', lddlflags='-Wl,-R/usr/pkg/2006Q2/lib -G -L/usr/lib -L/usr/ccs/lib -L/local/SUNWspro/prod/lib/v8plus -L/local/SUNWspro/prod/lib -L/lib -L/usr/pkg/2006Q2/lib' Locally applied patches: @INC for perl v5.8.8: /usr/pkg/2006Q2/lib/perl5/site_perl/5.8.0/sparc-solaris-thread-multi /usr/pkg/2006Q2/lib/perl5/site_perl/5.8.0 /usr/pkg/2006Q2/lib/perl5/site_perl /usr/pkg/2006Q2/lib/perl5/vendor_perl/5.8.0/sparc-solaris-thread-multi /usr/pkg/2006Q2/lib/perl5/vendor_perl/5.8.0 /usr/pkg/2006Q2/lib/perl5/vendor_perl /usr/pkg/2006Q2/lib/perl5/5.8.0/sparc-solaris-thread-multi /usr/pkg/2006Q2/lib/perl5/5.8.0 . Environment for perl v5.8.8: HOME=/home/j2001/1illig LANG=de_DE.ISO8859-1 LANGUAGE (unset) LC_COLLATE=de_DE.ISO8859-1 LC_CTYPE=de_DE.ISO8859-1 LC_MESSAGES=C LC_MONETARY=de_DE.ISO8859-1 LC_NUMERIC=C LC_TIME=C LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/usr/pkg/unstable/bin:/usr/pkg/unstable/sbin:/usr/pkg/unstable/bin:/usr/pkg/unstable/sbin:/usr/pkg/current/bin:/usr/pkg/current/sbin:/home/j2001/1illig/bin:/opt/bin:/local/gnu/bin:/usr/sfw/bin:/opt/sfw/bin:/usr/openwin/bin:/usr/dt/bin:/local/SUNWspro/bin:/local/TeX/bin:/usr/java/bin:/usr/bin:/usr/ccs/bin:/usr/ucb:/usr/xpg4/bin:/usr/sbin:/sbin:/usr/xpg4/bin:/usr/sbin:/sbin PERL_BADLANG (unset) SHELL=/bin/bash ```
p5pRT commented 12 years ago

From @jkeenan

On Wed Feb 07 06​:06​:40 2007\, 1illig@​informatik.uni-hamburg.de wrote​:

$ echo 'print "hello\n";' > bug.pl $ env PERLDB_OPTS="noTTY frame=2" perl -d bug.pl Can't use an undefined value as a symbol reference at /usr/pkg/2006Q2/lib/perl5/5.8.0/perl5db.pl line 5376. at /usr/pkg/2006Q2/lib/perl5/5.8.0/perl5db.pl line 5376 DB​::print_lineinfo(''\, 'Package bug.pl.\x{a}') called at /usr/pkg/2006Q2/lib/perl5/5.8.0/perl5db.pl line 5480 DB​::postponed('*main​::_\<bug.pl') called at bug.pl line 1

This is still present in perl 5.14.2​:

[perl] 547 $ echo 'print "hello\n";' > bug.pl

[perl] 549 $ env PERLDB_OPTS="noTTY frame=2" perl -d bug.pl Can't use an undefined value as a symbol reference at /usr/local/lib/perl5/5.14.2/perl5db.pl line 5403. at /usr/local/lib/perl5/5.14.2/perl5db.pl line 5403   DB​::print_lineinfo(''\, 'Package bug.pl.\x{a}') called at /usr/local/lib/perl5/5.14.2/perl5db.pl line 5507   DB​::postponed('*main​::_\<bug.pl') called at bug.pl line 1

Here's the relevant part of perl5db.pl​:

  5397 sub print_lineinfo {   5398   5399 # Make the terminal sensible if we're not the primary debugger.   5400 resetterm(1) if $LINEINFO eq $OUT and $term_pid != $$;   5401 local $\ = '';   5402 local $\, = '';   5403 print $LINEINFO @​_;   5404 } ## end sub print_lineinfo

p5pRT commented 12 years ago

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

p5pRT commented 11 years ago

From @jkeenan

On Sat Nov 12 07​:12​:13 2011\, jkeenan wrote​:

On Wed Feb 07 06​:06​:40 2007\, 1illig@​informatik.uni-hamburg.de wrote​:

$ echo 'print "hello\n";' > bug.pl $ env PERLDB_OPTS="noTTY frame=2" perl -d bug.pl Can't use an undefined value as a symbol reference at /usr/pkg/2006Q2/lib/perl5/5.8.0/perl5db.pl line 5376. at /usr/pkg/2006Q2/lib/perl5/5.8.0/perl5db.pl line 5376 DB​::print_lineinfo(''\, 'Package bug.pl.\x{a}') called at /usr/pkg/2006Q2/lib/perl5/5.8.0/perl5db.pl line 5480 DB​::postponed('*main​::_\<bug.pl') called at bug.pl line 1

This is still present in perl 5.14.2​:

[perl] 547 $ echo 'print "hello\n";' > bug.pl

[perl] 549 $ env PERLDB_OPTS="noTTY frame=2" perl -d bug.pl Can't use an undefined value as a symbol reference at /usr/local/lib/perl5/5.14.2/perl5db.pl line 5403. at /usr/local/lib/perl5/5.14.2/perl5db.pl line 5403 DB​::print_lineinfo(''\, 'Package bug.pl.\x{a}') called at /usr/local/lib/perl5/5.14.2/perl5db.pl line 5507 DB​::postponed('*main​::_\<bug.pl') called at bug.pl line 1

Here's the relevant part of perl5db.pl​:

5397 sub print_lineinfo { 5398 5399 # Make the terminal sensible if we're not the primary debugger. 5400 resetterm(1) if $LINEINFO eq $OUT and $term_pid != $$; 5401 local $\ = ''; 5402 local $\, = ''; 5403 print $LINEINFO @​_; 5404 } ## end sub print_lineinfo

And still present in 5.18.0​:

$ env PERLDB_OPTS="noTTY frame=2" perl -d bug.pl Can't use an undefined value as a symbol reference at /usr/local/lib/perl5/5.18.0/perl5db.pl line 6141. at /usr/local/lib/perl5/5.18.0/perl5db.pl line 6141.   DB​::print_lineinfo(''\, 'Package bug.pl.\x{a}') called at /usr/local/lib/perl5/5.18.0/perl5db.pl line 6247   DB​::postponed('*main​::_\<bug.pl') called at bug.pl line 1

p5pRT commented 11 years ago

From @shlomif

On Fri Aug 09 18​:43​:12 2013\, jkeenan wrote​:

On Sat Nov 12 07​:12​:13 2011\, jkeenan wrote​:

On Wed Feb 07 06​:06​:40 2007\, 1illig@​informatik.uni-hamburg.de wrote​:

$ echo 'print "hello\n";' > bug.pl $ env PERLDB_OPTS="noTTY frame=2" perl -d bug.pl Can't use an undefined value as a symbol reference at /usr/pkg/2006Q2/lib/perl5/5.8.0/perl5db.pl line 5376. at /usr/pkg/2006Q2/lib/perl5/5.8.0/perl5db.pl line 5376 DB​::print_lineinfo(''\, 'Package bug.pl.\x{a}') called at /usr/pkg/2006Q2/lib/perl5/5.8.0/perl5db.pl line 5480 DB​::postponed('*main​::_\<bug.pl') called at bug.pl line 1

This is still present in perl 5.14.2​:

[perl] 547 $ echo 'print "hello\n";' > bug.pl

[perl] 549 $ env PERLDB_OPTS="noTTY frame=2" perl -d bug.pl Can't use an undefined value as a symbol reference at /usr/local/lib/perl5/5.14.2/perl5db.pl line 5403. at /usr/local/lib/perl5/5.14.2/perl5db.pl line 5403 DB​::print_lineinfo(''\, 'Package bug.pl.\x{a}') called at /usr/local/lib/perl5/5.14.2/perl5db.pl line 5507 DB​::postponed('*main​::_\<bug.pl') called at bug.pl line 1

Here's the relevant part of perl5db.pl​:

5397 sub print_lineinfo { 5398 5399 # Make the terminal sensible if we're not the primary debugger. 5400 resetterm(1) if $LINEINFO eq $OUT and $term_pid != $$; 5401 local $\ = ''; 5402 local $\, = ''; 5403 print $LINEINFO @​_; 5404 } ## end sub print_lineinfo

And still present in 5.18.0​:

$ env PERLDB_OPTS="noTTY frame=2" perl -d bug.pl Can't use an undefined value as a symbol reference at /usr/local/lib/perl5/5.18.0/perl5db.pl line 6141. at /usr/local/lib/perl5/5.18.0/perl5db.pl line 6141. DB​::print_lineinfo(''\, 'Package bug.pl.\x{a}') called at /usr/local/lib/perl5/5.18.0/perl5db.pl line 6247 DB​::postponed('*main​::_\<bug.pl') called at bug.pl line 1

Attached are​:

1. A patch to fix the problem with a test.

2. Something that remove some code in lib/perl5db.t whose effect is pointless.

You can also pull them from​:

https://github.com/shlomif/perl/tree/rt41461_perl_debugger_dies

Note that the branch diverged from bleadperl\, so the appropriate patches will need to be cherrypicked for perl-5.18.x.

Regards\,

-- Shlomi Fish

p5pRT commented 11 years ago

From @shlomif

0001-Fix-RT-41461-with-a-test.patch ```diff From df2c5269b0f8ba0c20fcb7f0523eaabdba4ab495 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Sat, 10 Aug 2013 10:21:16 +0300 Subject: [PATCH 1/2] Fix RT #41461 (with a test). A problem with the perl debugger of writing to an undef $LINEINFO. --- lib/perl5db.pl | 6 +++++- lib/perl5db.t | 10 +++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/perl5db.pl b/lib/perl5db.pl index 48ec301..9556e2d 100644 --- a/lib/perl5db.pl +++ b/lib/perl5db.pl @@ -6143,7 +6143,11 @@ sub print_lineinfo { resetterm(1) if $LINEINFO eq $OUT and $term_pid != $$; local $\ = ''; local $, = ''; - print $LINEINFO @_; + # $LINEINFO may be undef if $noTTY is set or some other issue. + if ($LINEINFO) + { + print {$LINEINFO} @_; + } } ## end sub print_lineinfo =head2 C diff --git a/lib/perl5db.t b/lib/perl5db.t index 26b0581..09a8655 100644 --- a/lib/perl5db.t +++ b/lib/perl5db.t @@ -29,7 +29,7 @@ BEGIN { $ENV{PERL_RL} = 'Perl'; # Suppress system Term::ReadLine::Gnu } -plan(117); +plan(119); my $rc_filename = '.perldb'; @@ -108,6 +108,14 @@ EOF is( $?, 0, '[perl #116771] autotrace does not crash debugger, exit == 0' ); like( $output, 'success' , '[perl #116771] code is run' ); } +# [ perl #41461] Frame=2 noTTY +{ + local $ENV{PERLDB_OPTS} = "frame=2 noTTY nonstop"; + rc(''); + my $output = runperl( switches => [ '-d' ], prog => 'print q{success}' ); + is( $?, 0, '[perl #41461] frame=2 noTTY does not crash debugger, exit == 0' ); + like( $output, 'success' , '[perl #41461] code is run' ); +} { rc(<<'EOF'); -- 1.8.3.4 ```
p5pRT commented 11 years ago

From @shlomif

0002-Remove-some-effect-less-code.patch ```diff From c82f0459245574d4836678b41637c457f68d3c0b Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Sat, 10 Aug 2013 10:24:00 +0300 Subject: [PATCH 2/2] Remove some effect-less code. --- lib/perl5db.t | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/lib/perl5db.t b/lib/perl5db.t index 09a8655..d805936 100644 --- a/lib/perl5db.t +++ b/lib/perl5db.t @@ -117,21 +117,6 @@ EOF like( $output, 'success' , '[perl #41461] code is run' ); } -{ - rc(<<'EOF'); -&parse_options("NonStop=0 TTY=db.out LineInfo=db.out"); - -sub afterinit { - push (@DB::typeahead, - 't 2', - 'c', - 'q', - ); - -} -EOF -} - package DebugWrap; sub new { -- 1.8.3.4 ```
p5pRT commented 11 years ago

From @jkeenan

On Sat Aug 10 00​:53​:29 2013\, shlomif wrote​:

On Fri Aug 09 18​:43​:12 2013\, jkeenan wrote​:

And still present in 5.18.0​:

$ env PERLDB_OPTS="noTTY frame=2" perl -d bug.pl Can't use an undefined value as a symbol reference at /usr/local/lib/perl5/5.18.0/perl5db.pl line 6141. at /usr/local/lib/perl5/5.18.0/perl5db.pl line 6141. DB​::print_lineinfo(''\, 'Package bug.pl.\x{a}') called at /usr/local/lib/perl5/5.18.0/perl5db.pl line 6247 DB​::postponed('*main​::_\<bug.pl') called at bug.pl line 1

Attached are​:

1. A patch to fix the problem with a test.

2. Something that remove some code in lib/perl5db.t whose effect is pointless.

Thanks for the patches. I applied the first patch in commit aa8c2dc (with a version bump) and then verified it with the OP's complaint​:

$ echo 'print "hello\n";' > bug.pl [perl] 1043 $ env PERLDB_OPTS="noTTY frame=2" ./perl -I./lib -d bug.pl hello

Could you say a bit more about why the code being deleted in the second patch is pointless? (I don't understand it well enough to say so myself.)

Thank you very much. Jim Keenan

p5pRT commented 11 years ago

From @shlomif

Hi James\,

On Sat Aug 10 06​:34​:19 2013\, jkeenan wrote​:

On Sat Aug 10 00​:53​:29 2013\, shlomif wrote​:

On Fri Aug 09 18​:43​:12 2013\, jkeenan wrote​:

And still present in 5.18.0​:

$ env PERLDB_OPTS="noTTY frame=2" perl -d bug.pl Can't use an undefined value as a symbol reference at /usr/local/lib/perl5/5.18.0/perl5db.pl line 6141. at /usr/local/lib/perl5/5.18.0/perl5db.pl line 6141. DB​::print_lineinfo(''\, 'Package bug.pl.\x{a}') called at /usr/local/lib/perl5/5.18.0/perl5db.pl line 6247 DB​::postponed('*main​::_\<bug.pl') called at bug.pl line 1

Attached are​:

1. A patch to fix the problem with a test.

2. Something that remove some code in lib/perl5db.t whose effect is pointless.

Thanks for the patches. I applied the first patch in commit aa8c2dc (with a version bump) and then verified it with the OP's complaint​:

$ echo 'print "hello\n";' > bug.pl [perl] 1043 $ env PERLDB_OPTS="noTTY frame=2" ./perl -I./lib -d bug.pl hello

Thanks!

Could you say a bit more about why the code being deleted in the second patch is pointless? (I don't understand it well enough to say so myself.)

Sure​: one should call rc() in lib/perl5db.t to initialise a configuration ("RC") file with commands and options. Now\, I've extracted most of the tests into a class that calls RC for you (after the right method or constructor are getting invoked). The call to rc() that I deleted came right before a test that is based on that class\, so the config file created by that RC (always in the same location for all tests) was overrided by the one in the class' instance instantiation\, so it is completely pointless.

Hope it is clearer now.

Regards\,

-- Shlomi Fish

p5pRT commented 11 years ago

From @jkeenan

On Sat Aug 10 07​:05​:03 2013\, shlomif wrote​:

Could you say a bit more about why the code being deleted in the second patch is pointless? (I don't understand it well enough to say so myself.)

Sure​: one should call rc() in lib/perl5db.t to initialise a configuration ("RC") file with commands and options. Now\, I've extracted most of the tests into a class that calls RC for you (after the right method or constructor are getting invoked). The call to rc() that I deleted came right before a test that is based on that class\, so the config file created by that RC (always in the same location for all tests) was overrided by the one in the class' instance instantiation\, so it is completely pointless.

Hope it is clearer now.

Regards\,

-- Shlomi Fish

Thank you very much. Applied in commit 1a066ce.

Resolving ticket. Jim Keenan

p5pRT commented 11 years ago

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