Skip to content
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

perl5db.pl: Undefined subroutine &DB::db_warn called #14400

Closed
p5pRT opened this issue Jan 6, 2015 · 8 comments

Comments

@p5pRT
Copy link
Collaborator

@p5pRT p5pRT commented Jan 6, 2015

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

Searchable as RT123553$

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Jan 6, 2015

From @choroba

Created by @choroba

Perl debugger sometimes tries to call a non-existent subroutine
db_warn. It's real name is _db_warn, though.

How to replicate​:

perl -d -e1
!/

Output​:

/bin/bash​: /​: Is a directory
Undefined subroutine &DB​::db_warn called at /usr/lib/perl5/5.18.1/perl5db.pl line 6740.
  at /usr/lib/perl5/5.18.1/perl5db.pl line 6740.
  DB​::_db_system('/bin/bash', '-c', '/') called at /usr/lib/perl5/5.18.1/perl5db.pl line 3923
  DB​::Obj​::_handle_sh_command('DB​::Obj=HASH(0x105df48)') called at /usr/lib/perl5/5.18.1/perl5db.pl line 2992
  DB​::DB called at -e line 1

Patch to fix the issue attached.

  Choroba

Perl Info

Flags:
     category=library
     severity=low
     module=DB

This perlbug was built using Perl 5.18.1 - Fri Sep 27 18:27:33 UTC 2013
It is being executed now by  Perl 5.18.1 - Fri Sep 27 18:20:30 UTC 2013.

Site configuration information for perl 5.18.1:

Configured by abuild at Fri Sep 27 18:20:30 UTC 2013.

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

   Platform:
     osname=linux, osvers=3.4.6-2.10-xen, archname=x86_64-linux-thread-multi
     uname='linux build16 3.4.6-2.10-xen #1 smp thu jul 26 09:36:26 utc 2012 
(641c197) x86_64 x86_64 x86_64 gnulinux '
     config_args='-ds -e -Dprefix=/usr -Dvendorprefix=/usr -Dinstallusrbinperl 
-Dusethreads -Di_db -Di_dbm -Di_ndbm -Di_gdbm -Dd_dbm_open -Duseshrplib=true 
-Doptimize=-fmessage-length=0 -grecord-gcc-switches -O2 -Wall 
-D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables 
-fasynchronous-unwind-tables -g -Wall -pipe -Accflags=-DPERL_USE_SAFE_PUTENV 
-Dotherlibdirs=/usr/lib/perl5/site_perl 
-Dinc_version_list=5.18.0/x86_64-linux-thread-multi 5.18.0'
     hint=recommended, useposix=true, d_sigaction=define
     useithreads=define, usemultiplicity=define
     useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
     use64bitint=define, use64bitall=define, uselongdouble=undef
     usemymalloc=n, bincompat5005=undef
   Compiler:
     cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV 
-fno-strict-aliasing -pipe -fstack-protector -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64',
     optimize='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall 
-D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables 
-fasynchronous-unwind-tables -g -Wall -pipe',
     cppflags='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV 
-fno-strict-aliasing -pipe -fstack-protector'
     ccversion='', gccversion='4.8.1 20130909 [gcc-4_8-branch revision 
202388]', gccosandvers=''
     intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
     ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', 
lseeksize=8
     alignbytes=8, prototype=define
   Linker and Libraries:
     ld='cc', ldflags =' -L/usr/local/lib64 -fstack-protector'
     libpth=/lib64 /usr/lib64 /usr/local/lib64
     libs=-lm -ldl -lcrypt -lpthread
     perllibs=-lm -ldl -lcrypt -lpthread
     libc=/lib64/libc-2.18.so, so=so, useshrplib=true, libperl=libperl.so
     gnulibc_version='2.18'
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E 
-Wl,-rpath,/usr/lib/perl5/5.18.1/x86_64-linux-thread-multi/CORE'
     cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib64 
-fstack-protector'

Locally applied patches:



@INC for perl 5.18.1:
     /home/choroba/perl5/lib/perl5/x86_64-linux-thread-multi
     /home/choroba/perl5/lib/perl5/x86_64-linux-thread-multi
     /home/choroba/perl5/lib/perl5
     /home/choroba/perl5/lib/perl5/x86_64-linux-thread-multi
     /home/choroba/perl5/lib/perl5/x86_64-linux-thread-multi
     /home/choroba/perl5/lib/perl5
     /usr/lib/perl5/site_perl/5.18.1/x86_64-linux-thread-multi
     /usr/lib/perl5/site_perl/5.18.1
     /usr/lib/perl5/vendor_perl/5.18.1/x86_64-linux-thread-multi
     /usr/lib/perl5/vendor_perl/5.18.1
     /usr/lib/perl5/5.18.1/x86_64-linux-thread-multi
     /usr/lib/perl5/5.18.1
     /usr/lib/perl5/site_perl
     .


Environment for perl 5.18.1:
     HOME=/home/choroba
     LANG=en_US.UTF-8
     LANGUAGE=en_US.utf8
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)

PATH=/home/choroba/perl5/bin:/home/choroba/bin:/bin:/sbin:/usr/bin:/usr/local/bin:/usr/games:/usr/X11R6/bin:/opt/gnome/bin:/home/choroba/perl/bin:.

PERL5LIB=/home/choroba/perl5/lib/perl5/x86_64-linux-thread-multi:/home/choroba/perl5/lib/perl5:/home/choroba/perl5/lib/perl5/x86_64-linux-thread-multi:/home/choroba/perl5/lib/perl5:
     PERL_BADLANG (unset)
     PERL_LOCAL_LIB_ROOT=/home/choroba/perl5
     PERL_MB_OPT=--install_base /home/choroba/perl5
     PERL_MM_OPT=INSTALL_BASE=/home/choroba/perl5
     SHELL=/bin/bash
@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Jan 6, 2015

From @choroba

perl5db.patch
--- perl5db.pl.backup	2015-01-06 00:35:29.089785377 +0100
+++ perl5db.pl	2015-01-06 00:35:56.181979984 +0100
@@ -6723,24 +6723,24 @@
 
     # We save, change, then restore STDIN and STDOUT to avoid fork() since
     # some non-Unix systems can do system() but have problems with fork().
-    open( SAVEIN,  "<&STDIN" )  || db_warn("Can't save STDIN");
-    open( SAVEOUT, ">&STDOUT" ) || db_warn("Can't save STDOUT");
-    open( STDIN,   "<&IN" )     || db_warn("Can't redirect STDIN");
-    open( STDOUT,  ">&OUT" )    || db_warn("Can't redirect STDOUT");
+    open( SAVEIN,  "<&STDIN" )  || _db_warn("Can't save STDIN");
+    open( SAVEOUT, ">&STDOUT" ) || _db_warn("Can't save STDOUT");
+    open( STDIN,   "<&IN" )     || _db_warn("Can't redirect STDIN");
+    open( STDOUT,  ">&OUT" )    || _db_warn("Can't redirect STDOUT");
 
     # XXX: using csh or tcsh destroys sigint retvals!
     system(@_);
-    open( STDIN,  "<&SAVEIN" )  || db_warn("Can't restore STDIN");
-    open( STDOUT, ">&SAVEOUT" ) || db_warn("Can't restore STDOUT");
+    open( STDIN,  "<&SAVEIN" )  || _db_warn("Can't restore STDIN");
+    open( STDOUT, ">&SAVEOUT" ) || _db_warn("Can't restore STDOUT");
     close(SAVEIN);
     close(SAVEOUT);
 
     # most of the $? crud was coping with broken cshisms
     if ( $? >> 8 ) {
-        db_warn( "(Command exited ", ( $? >> 8 ), ")\n" );
+        _db_warn( "(Command exited ", ( $? >> 8 ), ")\n" );
     }
     elsif ($?) {
-        db_warn(
+        _db_warn(
             "(Command died of SIG#",
             ( $? & 127 ),
             ( ( $? & 128 ) ? " -- core dumped" : "" ),
@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Jan 6, 2015

From @jkeenan

On Mon Jan 05 16​:26​:08 2015, choroba@​cpan.org wrote​:

This is a bug report for perl from choroba@​cpan.org,
generated with the help of perlbug 1.39 running under perl 5.18.1.

-----------------------------------------------------------------
[Please describe your issue here]

Perl debugger sometimes tries to call a non-existent subroutine
db_warn. It's real name is _db_warn, though.

How to replicate​:

perl -d -e1
!/

Output​:

/bin/bash​: /​: Is a directory
Undefined subroutine &DB​::db_warn called at
/usr/lib/perl5/5.18.1/perl5db.pl line 6740.
at /usr/lib/perl5/5.18.1/perl5db.pl line 6740.
DB​::_db_system('/bin/bash', '-c', '/') called at
/usr/lib/perl5/5.18.1/perl5db.pl line 3923
DB​::Obj​::_handle_sh_command('DB​::Obj=HASH(0x105df48)') called
at /usr/lib/perl5/5.18.1/perl5db.pl line 2992
DB​::DB called at -e line 1

Patch to fix the issue attached.

Choroba

Thank you very much for this report. This is a bug which crept in somewhere between perl 5.16.3 and perl 5.18.2.

#####
[] 11 $ perlbrew switch perl-5.16.3
[
] 12 $ perl -d -e1

Loading DB routines from perl5db.pl version 1.37
Editor support available.

Enter h or 'h h' for help, or 'man perldebug' for more help.

main​::(-e​:1)​: 1
  DB<1> !/
No such command!

  DB<1> q
[] 13 $ perlbrew switch perl-5.18.2
[
] 14 $ perl -d -e1

Loading DB routines from perl5db.pl version 1.39_10
Editor support available.

Enter h or 'h h' for help, or 'man perldebug' for more help.

main​::(-e​:1)​: 1
  DB<1> !/
/bin/bash​: /​: Is a directory
Undefined subroutine &DB​::db_warn called at /home/jkeenan/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/perl5db.pl line 6735.
at /home/jkeenan/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/perl5db.pl line 6735.
  DB​::_db_system('/bin/bash', '-c', '/') called at /home/jkeenan/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/perl5db.pl line 3918
  DB​::Obj​::_handle_sh_command('DB​::Obj=HASH(0x1dee6b0)') called at /home/jkeenan/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/perl5db.pl line 2987
  DB​::DB called at -e line 1
Debugged program terminated. Use q to quit or R to restart,
use o inhibit_exit to avoid stopping after program termination,
h q, h R or h o to get additional info.
  DB<2> q
#####

We should figure out what commit broke this functionality, then consider whether we should apply your patch or try to restore the previous behavior.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags​:
category=library
severity=low
module=DB
---
This perlbug was built using Perl 5.18.1 - Fri Sep 27 18​:27​:33 UTC
2013
It is being executed now by Perl 5.18.1 - Fri Sep 27 18​:20​:30 UTC
2013.

Site configuration information for perl 5.18.1​:

Configured by abuild at Fri Sep 27 18​:20​:30 UTC 2013.

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

Platform​:
osname=linux, osvers=3.4.6-2.10-xen, archname=x86_64-linux-thread-
multi
uname='linux build16 3.4.6-2.10-xen #1 smp thu jul 26 09​:36​:26 utc
2012
(641c197) x86_64 x86_64 x86_64 gnulinux '
config_args='-ds -e -Dprefix=/usr -Dvendorprefix=/usr
-Dinstallusrbinperl
-Dusethreads -Di_db -Di_dbm -Di_ndbm -Di_gdbm -Dd_dbm_open
-Duseshrplib=true
-Doptimize=-fmessage-length=0 -grecord-gcc-switches -O2 -Wall
-D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables
-fasynchronous-unwind-tables -g -Wall -pipe -Accflags=-
DPERL_USE_SAFE_PUTENV
-Dotherlibdirs=/usr/lib/perl5/site_perl
-Dinc_version_list=5.18.0/x86_64-linux-thread-multi 5.18.0'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler​:
cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE
-DPERL_USE_SAFE_PUTENV
-fno-strict-aliasing -pipe -fstack-protector -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
optimize='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall
-D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables
-fasynchronous-unwind-tables -g -Wall -pipe',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV
-fno-strict-aliasing -pipe -fstack-protector'
ccversion='', gccversion='4.8.1 20130909 [gcc-4_8-branch revision
202388]', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries​:
ld='cc', ldflags =' -L/usr/local/lib64 -fstack-protector'
libpth=/lib64 /usr/lib64 /usr/local/lib64
libs=-lm -ldl -lcrypt -lpthread
perllibs=-lm -ldl -lcrypt -lpthread
libc=/lib64/libc-2.18.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.18'
Dynamic Linking​:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E
-Wl,-rpath,/usr/lib/perl5/5.18.1/x86_64-linux-thread-multi/CORE'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib64
-fstack-protector'

Locally applied patches​:

---
@​INC for perl 5.18.1​:
/home/choroba/perl5/lib/perl5/x86_64-linux-thread-multi
/home/choroba/perl5/lib/perl5/x86_64-linux-thread-multi
/home/choroba/perl5/lib/perl5
/home/choroba/perl5/lib/perl5/x86_64-linux-thread-multi
/home/choroba/perl5/lib/perl5/x86_64-linux-thread-multi
/home/choroba/perl5/lib/perl5
/usr/lib/perl5/site_perl/5.18.1/x86_64-linux-thread-multi
/usr/lib/perl5/site_perl/5.18.1
/usr/lib/perl5/vendor_perl/5.18.1/x86_64-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.18.1
/usr/lib/perl5/5.18.1/x86_64-linux-thread-multi
/usr/lib/perl5/5.18.1
/usr/lib/perl5/site_perl
.

---
Environment for perl 5.18.1​:
HOME=/home/choroba
LANG=en_US.UTF-8
LANGUAGE=en_US.utf8
LD_LIBRARY_PATH (unset)
LOGDIR (unset)

PATH=/home/choroba/perl5/bin​:/home/choroba/bin​:/bin​:/sbin​:/usr/bin​:/usr/local/bin​:/usr/games​:/usr/X11R6/bin​:/opt/gnome/bin​:/home/choroba/perl/bin​:.

PERL5LIB=/home/choroba/perl5/lib/perl5/x86_64-linux-thread-
multi​:/home/choroba/perl5/lib/perl5​:/home/choroba/perl5/lib/perl5/x86_64-
linux-thread-multi​:/home/choroba/perl5/lib/perl5​:
PERL_BADLANG (unset)
PERL_LOCAL_LIB_ROOT=/home/choroba/perl5
PERL_MB_OPT=--install_base /home/choroba/perl5
PERL_MM_OPT=INSTALL_BASE=/home/choroba/perl5
SHELL=/bin/bash

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Jan 6, 2015

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

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Jan 6, 2015

From @cpansprout

On Mon Jan 05 18​:51​:14 2015, jkeenan wrote​:

We should figure out what commit broke this functionality, then
consider whether we should apply your patch or try to restore the
previous behavior.

b5679dc clearly had a few typos in it. That 5.16 had no ! command is unrelated.

On Mon Jan 05 16​:26​:08 2015, choroba@​cpan.org wrote​:

Patch to fix the issue attached.

Thank you. Applied as 2384afe.

--

Father Chrysostomos

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Jan 6, 2015

@cpansprout - Status changed from 'open' to 'pending release'

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Jun 2, 2015

From @khwilliamson

Thanks for submitting this ticket

The issue should be resolved with the release today of Perl v5.22, available at http​://www.perl.org/get.html
If you find that the problem persists, feel free to reopen this ticket

--
Karl Williamson for the Perl 5 porters team

@p5pRT p5pRT closed this Jun 2, 2015
@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Jun 2, 2015

@khwilliamson - Status changed from 'pending release' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.