Skip Menu |

This queue is for tickets about the Term-ReadLine-Gnu CPAN distribution.

Maintainer(s)' notes

When you report a bug, please provide the following information;

- output of
	perl -V
	perl Makefile.PL verbose
	make test TEST_VERBOSE=1
	perl -Mblib t/00checkver.t
	echo $TERM
- terminal emulator which you are using
- compiler which is used to compile the GNU Readline Library (libreadline.a) if you can know.
Read INSTALL in the distribution for more details.

Report information
The Basics
Id: 83040
Status: resolved
Priority: 0/
Queue: Term-ReadLine-Gnu

People
Owner: HAYASHI [...] cpan.org
Requestors: elbeardmorez [...] msn.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.20
Fixed in: (no value)



Subject: segfault following pager in perl debugger
all combinations of i686/x86_64 linux boxes, readline 5.2/6,2, and xterm/xfce term give me segfaults following use of the pager in perl debugger as demonstrated below. i've switched to Term::ReadLine::Perl which works sufficiently for my purposes, but hopefully the info below is of use to someone? ####### [root@box ~]# PERL_RL=Gnu perl -d -e 0 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): 0 DB<1> o pager? pager = '|/usr/bin/less -isr' DB<2> |h <--[then pressing 'q' to quit 'less'] Signal SEGV at /usr/local/lib/perl5/Term/ReadLine/Gnu.pm line 331. Term::ReadLine::Gnu::readline('Term::ReadLine=HASH(0x988e628)', ' DB<3> ') called at /usr/share/perl5/perl5db.pl line 6422 DB::readline(' DB<2> ') called at /usr/share/perl5/perl5db.pl line 1997 DB::DB called at -e line 1 Aborted ####### [root@box ~]# gdb perl --pid=$(pidof perl) GNU gdb (GDB) 7.5 Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/ gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i486-slackware-linux". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /usr/bin/perl...(no debugging symbols found)...done. Attaching to program: /usr/bin/perl, process 2336 warning: Could not load shared library symbols for linux-gate.so.1. Do you need "set solib-search-path" or "set sysroot"? Reading symbols from /usr/lib/perl5/CORE/libperl.so...(no debugging symbols found)...done. Loaded symbols for /usr/lib/perl5/CORE/libperl.so Reading symbols from /lib/libnsl.so.1...(no debugging symbols found)...done. Loaded symbols for /lib/libnsl.so.1 Reading symbols from /lib/libdl.so.2...(no debugging symbols found)...done. Loaded symbols for /lib/libdl.so.2 Reading symbols from /lib/libm.so.6...(no debugging symbols found)...done. Loaded symbols for /lib/libm.so.6 Reading symbols from /lib/libcrypt.so.1...(no debugging symbols found)...done. Loaded symbols for /lib/libcrypt.so.1 Reading symbols from /lib/libutil.so.1...(no debugging symbols found)...done. Loaded symbols for /lib/libutil.so.1 Reading symbols from /lib/libpthread.so.0...(no debugging symbols found)...done. [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/libthread_db.so.1". Loaded symbols for /lib/libpthread.so.0 Reading symbols from /lib/libc.so.6...(no debugging symbols found)...done. Loaded symbols for /lib/libc.so.6 Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done. Loaded symbols for /lib/ld-linux.so.2 Reading symbols from /usr/lib/perl5/auto/IO/IO.so...(no debugging symbols found)...done. Loaded symbols for /usr/lib/perl5/auto/IO/IO.so Reading symbols from /usr/local/lib/perl5/auto/Term/ReadLine/Gnu/ Gnu.so...done. Loaded symbols for /usr/local/lib/perl5/auto/Term/ReadLine/Gnu/Gnu.so Reading symbols from /usr/lib/libreadline.so.6...done. Loaded symbols for /usr/lib/libreadline.so.6 Reading symbols from /lib/libtermcap.so.2...(no debugging symbols found)...done. Loaded symbols for /lib/libtermcap.so.2 0xb755a30e in __read_nocancel () from /lib/libpthread.so.0 (gdb) c Continuing. Program received signal SIGSEGV, Segmentation fault. 0xb742e86f in fflush () from /lib/libc.so.6 (gdb) bt full #0 0xb742e86f in fflush () from /lib/libc.so.6 No symbol table info available. #1 0xb7335a8b in rl_prep_terminal (meta_flag=1) at ../rltty.c:662 tty = 4 tio = { c_iflag = 1030, c_oflag = 5, c_cflag = 191, c_lflag = 35377, c_line = 0 '\000', c_cc = "\003\034\177\025\004\000\001\000\021\023\032\000\022\017\027", '\000' <repeats 16 times>, c_ispeed = 15, c_ospeed = 15 } #2 0xb732e9a5 in readline (prompt=0x96b6020 "\001\033[4m\002 DB<2> \001\033[m\002") at ../readline.c:336 value = 0xb779fd50 "\320)\030" #3 0xb7368405 in XS_Term__ReadLine__Gnu__XS_rl_readline (my_perl=0x95ba008, cv=0x98a5ff0) at Gnu.xs:1357 prompt = 0x96b6020 "\001\033[4m\002 DB<2> \001\033[m\002" RETVAL = 0x95ba170 "ps\214\t" sp = 0x98d0fac ax = 3 mark = 0x98d0fa8 items = 1 #4 0xb76d3ad4 in Perl_pp_entersub () from /usr/lib/perl5/CORE/ libperl.so No symbol table info available. #5 0xb76cba08 in Perl_runops_standard () from /usr/lib/perl5/CORE/ libperl.so No symbol table info available. #6 0xb765ee1f in perl_run () from /usr/lib/perl5/CORE/libperl.so No symbol table info available. #7 0x08048bc3 in main () No symbol table info available. (gdb) c Continuing. Program received signal SIGABRT, Aborted. 0xb73f7e01 in kill () from /lib/libc.so.6 (gdb) c Continuing. Program terminated with signal SIGABRT, Aborted. The program no longer exists. (gdb) ########### [root@box ~]# perl -V Summary of my perl5 (revision 5 version 16 subversion 1) configuration: Platform: osname=linux, osvers=3.2.27-smp, archname=i486-linux-thread-multi uname='linux hive 3.2.27-smp #1 smp mon aug 13 16:23:23 cdt 2012 i686 amd phenom(tm) ii x6 1100t processor authenticamd gnulinux ' config_args='-de -Dprefix=/usr -Dsiteprefix=/usr/local -Dsitelib=/ usr/local/share/perl5 -Dsitearch=/usr/local/lib/perl5 -Darchlib=/usr/ lib/perl5 -Dvendorprefix=/usr -Dprivlib=/usr/share/perl5 -Dvendorlib=/ usr/share/perl5/vendor_perl -Dvendorarch=/usr/lib/perl5/vendor_perl - Dscriptdir=/usr/bin -Dcccdlflags=-fPIC -Dinstallprefix=/usr -Dlibpth=/ usr/local/lib /usr/lib /lib -Doptimize=-O2 -march=i486 -mtune=i686 - Dusethreads -Duseithreads -Duseshrplib -Ubincompat5005 -Uversiononly - Dpager=/usr/bin/less -isr -Darchname=i486-linux' 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 -fno-strict-aliasing - pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE - D_FILE_OFFSET_BITS=64', optimize='-O2 -march=i486 -mtune=i686', cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe - fstack-protector -I/usr/local/include' ccversion='', gccversion='4.7.1', 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 /usr/lib /lib libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=/lib/libc-2.15.so, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='2.15' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E - Wl,-rpath,/usr/lib/perl5/CORE' cccdlflags='-fPIC', lddlflags='-shared -O2 -march=i486 -mtune=i686 - L/usr/local/lib -fstack-protector' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP PERL_PRESERVE_IVUV USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API Built under linux Compiled at Aug 20 2012 13:28:33 @INC: /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 . #######
Hi, Finally I've debugged this issue. This is a bug in perl5db.pl. When the pager command (| or ||) is used, perl5db.pl replaces the output stream, and restore it after the command is done. It must call ReadLine::newTTY(), but not. Here is a patch for perl5db.pl version 1.37 in perl v5.16.3; --- perl5db.pl-save 2013-11-11 21:52:01.000000000 +0900 +++ perl5db.pl 2014-03-16 01:39:14.174576955 +0900 @@ -3316,6 +3316,9 @@ open( OUT, ">&SAVEOUT" ) || &warn("Can't restore DB::OUT"); } + # Let Readline know the new filehandles. + reset_IN_OUT( \*IN, \*OUT ); + # Close filehandle pager was using, restore the normal one # if necessary, close(SAVEOUT);
I've reported the fix, it will be included in the perl distribution. https://rt.perl.org/Public/Bug/Display.html?id=121456