develooper Front page | perl.perl5.porters | Postings from January 2014

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

Thread Previous | Thread Next
From:
Tony Cook via RT
Date:
January 6, 2014 00:27
Subject:
[perl #120827] [PATCH] Fix a tab-completion bug in perl -d with Term::ReadLine::Gnu
Message ID:
rt-4.0.18-1799-1388968055-25.120827-15-0@perl.org
On Thu Dec 19 03:30:53 2013, shlomif@shlomifish.org wrote:
> 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.

Thanks, applied to blead as c3970b8037ca5769191bce298ba0202ce318fc78.

I looked at writing a test for this, but encountered a different crash I think
because there was no real Term::ReadLine - just the stub.

Tony

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=120827

Thread Previous | Thread Next


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