develooper Front page | perl.perl5.porters | Postings from December 2013

[perl #120827] [PATCH] Fix a tab-completion bug in perl -d with Term::ReadLine::Gnu

From:
shlomif @ shlomifish . org
Date:
December 19, 2013 11:31
Subject:
[perl #120827] [PATCH] Fix a tab-completion bug in perl -d with Term::ReadLine::Gnu
Message ID:
rt-4.0.18-13437-1387452653-1867.120827-75-0@perl.org
# New Ticket Created by  shlomif@shlomifish.org 
# Please include the string:  [perl #120827]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=120827 >


Hi all,

I noticed that when I type "$F" and then tab complete inside perl -d with
Term::ReadLine::Gnu (and possibly Term::ReadLine::Perl as well), then it causes
the debugger to crash, like that:

<<<<
shlomif@telaviv1:~/progs/riddles/project-euler/hg/project-euler/160$ perl -d eul
er-160.pl

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::(euler-160.pl:8): my $N = abs(int($ENV{N} || 1_000_000_000_000));
  DB<147> b 89
  DB<148> c
There are 249999999997 powers of 5.
There are 999999999987 components of 2.
There are 749999999990 components of 2 excluding those for the digits.
They contribute 20224 to the modulo
main::(euler-160.pl:89):            $FINAL_100k_MODULO = $mod;
  DB<148> x $F
0  undef
  DB<149> x $FCan't use string ("::") as a HASH ref while "strict refs" in use
at /usr/lib/perl5/5.18.1/perl5db.pl line 9513.
at /usr/lib/perl5/5.18.1/perl5db.pl line 9513. DB::db_complete('$F', 'x $F', 2)
called
at /usr/lib/perl5/vendor_perl/5.18.1/x86_64-linux-thread-multi/Term/ReadLine/Gnu/XS.pm
line 574 Term::ReadLine::Gnu::XS::_trp_completion_function('$F', 0) called
at /usr/lib/perl5/vendor_perl/5.18.1/x86_64-linux-thread-multi/Term/ReadLine/Gnu.pm
line 719
Term::ReadLine::Gnu::AU::__ANON__[/usr/lib/perl5/vendor_perl/5.18.1/x86_64-linux-thread-multi/Term/ReadLine/Gnu.pm:719]('Term::ReadLine=HASH(0x1a58508)',
'\x{1}\x{1b}[4m\x{2}  DB<149> \x{1}\x{1b}[24m\x{2}') called
at /usr/lib/perl5/vendor_perl/5.18.1/x86_64-linux-thread-multi/Term/ReadLine/Gnu.pm
line 331 Term::ReadLine::Gnu::readline('Term::ReadLine=HASH(0x1a58508)', '
DB<149> ') called at /usr/lib/perl5/5.18.1/perl5db.pl line 7281 DB::readline('
DB<149> ') called at /usr/lib/perl5/5.18.1/perl5db.pl line 1831
DB::_DB__read_next_cmd(undef) called at /usr/lib/perl5/5.18.1/perl5db.pl line
2741 DB::DB called at euler-160.pl line 89 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<149> [1]
0:perl*                                              telaviv1.shlomifish.org
>>>>

The attached patch fixes it by adding "do { no strict 'refs'; ...}". I didn't
add a test, but all existing debugger and non-debugger tests pass. It's
possible this bug was already reported in perlbug, but I'm too lazy to find it
now.

Regards,

	Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Chuck Norris/etc. Facts - http://www.shlomifish.org/humour/bits/facts/

Judaism: God knows you will do shit, does nothing to prevent it, but makes you
take the blame for it anyways.

Please reply to list if it's a mailing list post - http://shlom.in/reply .



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About