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: 101078
Status: resolved
Priority: 0/
Queue: Term-ReadLine-Gnu

People
Owner: HAYASHI [...] cpan.org
Requestors: rjbs [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.26



Subject: causes debugger to exit immediately on 5.21.7
This bug seems like it could be in a few different places, but I'm reporting it here first. I've installed perl 5.21.7 and Term::ReadLine::Gnu. When I run "perl -de0" the debugger exits immediately. I have attached perl -V output. I have attached verbose testing results. My $TERM is xterm-256ocolor. -- rjbs
Subject: make-verbose.txt

Message body is not shown because it is too large.

Subject: perl.V
Download perl.V
application/octet-stream 2.9k

Message body not shown because it is not plain text.

Thank you for your report. Show quoted text
> I've installed perl 5.21.7 and Term::ReadLine::Gnu. When I run "perl > -de0" the debugger exits immediately.
I cannot reproduce this with my perl 5.14.2 and 5.16.3. Can you try with other version perls?
It's fine with every other version I had tried, up to and including 5.21.6. There is some interaction between 5.21.7 and Term::ReadLine::Gnu. -- rjbs
Show quoted text
> It's fine with every other version I had tried, up to and including > 5.21.6. There is some interaction between 5.21.7 and > Term::ReadLine::Gnu.
Thank you. I've installed 5.21.7 and reproduce the issue. It seems that handling of filehandle is changed in 5.21.7. I don't know it is a permanent change or not.
On 2014-12-23 02:41:42, HAYASHI wrote: Show quoted text
> I've installed 5.21.7 and reproduce the issue. > It seems that handling of filehandle is changed in 5.21.7. > I don't know it is a permanent change or not.
Right now, I can tell you that there are no major issues known with changes to filehandles, so any current change should be considered permanent unless you can demonstrate that perl is probably wrong. Or, put another way: if you tell us a bit more specifically what has changed that is affecting Term-ReadLine-Gnu this way, we can give you a more definitive answer. Right now there is not a big rush, but as we approach April, this will become a blocker for the release of perl 5.22.0. Thanks! -- rjbs
On Mon Jan 19 10:08:30 2015, RJBS wrote: Show quoted text
> On 2014-12-23 02:41:42, HAYASHI wrote:
> > I've installed 5.21.7 and reproduce the issue. > > It seems that handling of filehandle is changed in 5.21.7. > > I don't know it is a permanent change or not.
> > Right now, I can tell you that there are no major issues known with > changes to filehandles, so any current change should be considered > permanent unless you can demonstrate that perl is probably wrong. > > Or, put another way: if you tell us a bit more specifically what has > changed that is affecting Term-ReadLine-Gnu this way, we can give you > a more definitive answer. > > Right now there is not a big rush, but as we approach April, this will > become a blocker for the release of perl 5.22.0.
I had a look through the git log between 5.21.6 and 5.21.7, but I did not see anything related to I/O handles. Admittedly it all started to sound like ‘blah blah blah’ after a while. If someone is in a position to do a bisect, that would be immensely helpful.
Hi, I debugged this issue today. It seems the behavior of PerlIO changed on 5.21. doio.c are changed from 5.20. I hope the maintainer of doio.c could solve this issue. Here is a simplified perl script. -------------- use Term::ReadLine; # needs Term::ReadLine::Gnu open(IN,"<&STDIN") || warn "Cannot open STDIN for read"; open(OUT,">&STDOUT") || warn "Cannot open STDOUT for write"; Term::ReadLine::Gnu::Var::_rl_store_iostream(\*IN, 0); Term::ReadLine::Gnu::Var::_rl_store_iostream(\*OUT, 1); # The followings work. #Term::ReadLine::Gnu::Var::_rl_store_iostream(STDIN, 0); #Term::ReadLine::Gnu::Var::_rl_store_iostream(STDOUT, 1); my $instream = Term::ReadLine::Gnu::Var::_rl_fetch_iostream(0); while (<$instream>) { print; } my $outstream = Term::ReadLine::Gnu::Var::_rl_fetch_iostream(1); print $outstream "test\n"; -------------- 5.21.8 does not work on this. -------------- $ PERLIO_DEBUG=/tmp/log_fail ./perl -Mblib test Warning: unable to close filehandle _GEN_3 properly: Bad file descriptor. Warning: unable to close filehandle _GEN_2 properly: Bad file descriptor. $ -------------- I've attached /tmp/log_fail. The followings are XS code of _rl_fetch_iostream() and _rl_store_iostream() ---------------------- PerlIO * _rl_store_iostream(stream, id) PerlIO *stream int id PROTOTYPE: $$ CODE: { switch (id) { case 0: rl_instream = PerlIO_findFILE(stream); RETVAL = instreamPIO = stream; break; case 1: rl_outstream = PerlIO_findFILE(stream); RETVAL = outstreamPIO = stream; break; default: warn("Gnu.xs:_rl_store_iostream: Illegal `id' value: `%d'", id); XSRETURN_UNDEF; break; } PerlIO_debug("TRG:store_iostream id %d fd %d\n", id, PerlIO_fileno(RETVAL)); } OUTPUT: RETVAL PerlIO * _rl_fetch_iostream(id) int id PROTOTYPE: $ CODE: { switch (id) { case 0: if (instreamPIO == NULL) RETVAL = instreamPIO = PerlIO_importFILE(rl_instream, NULL); else RETVAL = instreamPIO; break; case 1: if (outstreamPIO == NULL) RETVAL = outstreamPIO = PerlIO_importFILE(rl_outstream, NULL); else RETVAL = outstreamPIO; break; default: warn("Gnu.xs:_rl_fetch_iostream: Illegal `id' value: `%d'", id); XSRETURN_UNDEF; break; } PerlIO_debug("TRG:fetch_iostream id %d fd %d\n", id, PerlIO_fileno(RETVAL)); } OUTPUT: RETVAL ---------------------- The following test code works. ---------------------- use Term::ReadLine; Term::ReadLine::Gnu::Var::_rl_store_iostream(STDIN, 0); Term::ReadLine::Gnu::Var::_rl_store_iostream(STDOUT, 1); my $instream = Term::ReadLine::Gnu::Var::_rl_fetch_iostream(0); while (<$instream>) { print; } my $outstream = Term::ReadLine::Gnu::Var::_rl_fetch_iostream(1); print $outstream "test\n"; ---------------------- ------- $ PERLIO_DEBUG=/tmp/log_fine ./perl -Mblib test sdf sdf test [hiroo@localhost trunk]$ ------- /tmp/log_fine is also attached. If there are anything I can help, let me know. Regards,
Subject: log_fail
Download log_fail
application/octet-stream 16.9k

Message body not shown because it is not plain text.

Subject: log_fine
Download log_fine
application/octet-stream 15.8k

Message body not shown because it is not plain text.

On Sun Jan 25 10:02:30 2015, HAYASHI wrote: Show quoted text
> Hi, > > I debugged this issue today. It seems the behavior of PerlIO changed > on 5.21. > doio.c are changed from 5.20. I hope the maintainer of doio.c could > solve this issue.
This may be the result of a bug fix. I used the attached .sh and .pl (which is just your demo code) scripts to bisect this problem. It came back with: 50e5165b9638b94be310f15477b42935c79e82d5 is the first bad commit commit 50e5165b9638b94be310f15477b42935c79e82d5 Author: David Mitchell <davem@iabyn.com> Date: Fri Dec 12 19:52:22 2014 +0000 stop T_IN/OUT/INOUT/STDIO typemaps leaking These typemaps (which are ancient; mostly going back to 1994 or so) each leaked a GV and an RV. :040000 040000 21d214f612c38dab40f92f2acb3a330aef1d8240 01d1c3d3ba1e839092e970ea5b736176275e7d8b M lib bisect run success _rl_store_iostream() can return a new GV pointing to the same PerlIO object as its input. Since your test code calls _rl_store_iostream() in void context, the returned ref to a GV is immediately destroyed. Before Dave's change since there was a leak the GV itselt wasn't destroyed, keeping the file open, after, there is no extra reference, so the GV is destroyed, closing the file. _rl_fetch_iostream() may have a similar problem, explaining why there's several warnings during global destruction. Tony
Subject: bisect-trl-gnu.pl
use Term::ReadLine; # needs Term::ReadLine::Gnu open(IN,"<&STDIN") || warn "Cannot open STDIN for read"; open(OUT,">&STDOUT") || warn "Cannot open STDOUT for write"; Term::ReadLine::Gnu::Var::_rl_store_iostream(\*IN, 0); Term::ReadLine::Gnu::Var::_rl_store_iostream(\*OUT, 1); # The followings work. #Term::ReadLine::Gnu::Var::_rl_store_iostream(STDIN, 0); #Term::ReadLine::Gnu::Var::_rl_store_iostream(STDOUT, 1); my $instream = Term::ReadLine::Gnu::Var::_rl_fetch_iostream(0); while (<$instream>) { print; } my $outstream = Term::ReadLine::Gnu::Var::_rl_fetch_iostream(1); print $outstream "test\n";
On Sun Jan 25 19:17:50 2015, TONYC wrote: Show quoted text
> I used the attached .sh and .pl (which is just your demo code) scripts > to bisect this problem.
Either I forget to attach the .sh or it got lost. Attached again now. Tony
Subject: bisect-trl-gnu.sh
Download bisect-trl-gnu.sh
application/octet-stream 554b

Message body not shown because it is not plain text.

Hi, Thank you for your feedback. Show quoted text
> _rl_store_iostream() can return a new GV pointing to the same PerlIO object as its input. Since your test code calls _rl_store_iostream() in void context, the returned ref to a GV is immediately destroyed. Before Dave's change since there was a leak the GV itselt wasn't destroyed, keeping the file open, after, there is no extra reference, so the GV is destroyed, closing the file.
I see. I've comfirmed the following script works. ------- use Term::ReadLine; open(IN,"<&STDIN") || warn "Cannot open STDIN for read"; open(OUT,">&STDOUT") || warn "Cannot open STDOUT for write"; my $instream = Term::ReadLine::Gnu::Var::_rl_store_iostream(\*IN, 0); my $outstream = Term::ReadLine::Gnu::Var::_rl_store_iostream(\*OUT, 1); #$instream = Term::ReadLine::Gnu::Var::_rl_fetch_iostream(0); while (<$instream>) { print; } #$outstream = Term::ReadLine::Gnu::Var::_rl_fetch_iostream(1); print $outstream "test\n"; ------- I have an idea of a fix. I will try it on the next weekend. Thanks.
Hi, I think the following change in Perl 5.21 must be wrong. Show quoted text
> Since your test code calls _rl_store_iostream() in void context, the returned ref to a GV is immediately destroyed. Before Dave's change since there was a leak the GV itselt wasn't destroyed, keeping the file open, after, there is no extra reference, so the GV is destroyed, closing the file.
---------------------- use Term::ReadLine; # needs Term::ReadLine::Gnu open(IN,"<&STDIN") || warn "Cannot open STDIN for read"; open(OUT,">&STDOUT") || warn "Cannot open STDOUT for write"; my $instream = \*IN; my $outstream = \*OUT; Term::ReadLine::Gnu::Var::_rl_store_iostream($instream, 0); Term::ReadLine::Gnu::Var::_rl_store_iostream($outstream, 1); while (<$instream>) { print; } print $outstream "test\n"; ---------------------- As you wrote, the following _rl_store_iostream() destroy the filehandles ($instream and $outstream), but they ARE STILL REFERENCED in the Perl script. --------- PerlIO * _rl_store_iostream(stream, id) PerlIO *stream int id PROTOTYPE: $$ CODE: { switch (id) { case 0: rl_instream = PerlIO_findFILE(stream); RETVAL = stream; break; case 1: rl_outstream = PerlIO_findFILE(stream); RETVAL = stream; break; default: warn("Gnu.xs:_rl_store_iostream: Illegal `id' value: `%d'", id); XSRETURN_UNDEF; break; } PerlIO_debug("TRG:store_iostream id %d fd %d\n", id, PerlIO_fileno(stream)); } OUTPUT: RETVAL --------- The following _rl_store_iosteam() DOES NOT destroy filehandles. --------- void _rl_store_iostream(stream, id) PerlIO *stream int id PROTOTYPE: $$ CODE: { switch (id) { case 0: rl_instream = PerlIO_findFILE(stream); break; case 1: rl_outstream = PerlIO_findFILE(stream); break; default: warn("Gnu.xs:_rl_store_iostream: Illegal `id' value: `%d'", id); break; } PerlIO_debug("TRG:store_iostream id %d fd %d\n", id, PerlIO_fileno(stream)); } --------- The first _rl_store_iostream() works if the return values are used as follows. --------- use Term::ReadLine; # needs Term::ReadLine::Gnu open(IN,"<&STDIN") || warn "Cannot open STDIN for read"; open(OUT,">&STDOUT") || warn "Cannot open STDOUT for write"; my $instream = \*IN; my $outstream = \*OUT; $instream = Term::ReadLine::Gnu::Var::_rl_store_iostream($instream, 0); $outstream = Term::ReadLine::Gnu::Var::_rl_store_iostream($outstream, 1); while (<$instream>) { print; } print $outstream "test\n"; --------------------------
Although I think the PerlIO change in Perl 5.21 must be wrong, I released Term-ReadLine-Gnu 1.26 which used the second implementation of _rl_store_iosteam() in my previous message. It works even with Perl 5.21. I stay the status of this ticket as open for a while.
Thanks for the new release. While I can't (yet) comment on the correctness of the perl5 change, being able to use Term-ReadLine-Gnu in the meantime is a *very* big help for me in day to day testing of bleadperl. I really appreciate it. -- rjbs
From: ppisar [...] redhat.com
Dne So 31.led.2015 21:47:31, HAYASHI napsal(a): Show quoted text
> Although I think the PerlIO change in Perl 5.21 must be wrong, I > released Term-ReadLine-Gnu 1.26 which used the second implementation > of _rl_store_iosteam() in my previous message. It works even with > Perl 5.21. > > I stay the status of this ticket as open for a while.
I found this change causing a dead-lock in Debug-Client-0.29 tests (see <https://github.com/PadreIDE/Debug-Client/issues/1>). I don't know which party is more guilty, but I observe that perl debugger does not emit "DB<1>" prompt if it is run from the Debug-Client's test, so it does not process client "c" command and everything halts.
From: ppisar [...] redhat.com
Dne Čt 12.úno.2015 09:51:59, ppisar napsal(a): Show quoted text
> I found this change causing a dead-lock in Debug-Client-0.29 tests > (see <https://github.com/PadreIDE/Debug-Client/issues/1>). I don't > know which party is more guilty, but I observe that perl debugger does > not emit "DB<1>" prompt if it is run from the Debug-Client's test, so > it does not process client "c" command and everything halts.
I should note that I use perl 5.20.1.
RT-Send-CC: ppisar [...] redhat.com, TONYC [...] cpan.org
Hi, Thank you for your report. On Thu, 12 Feb 2015 14:52:48 GMT, ppisar wrote: Show quoted text
> Dne Čt 12.úno.2015 09:51:59, ppisar napsal(a):
> > I found this change causing a dead-lock in Debug-Client-0.29 tests > > (see <https://github.com/PadreIDE/Debug-Client/issues/1>). I don't > > know which party is more guilty, but I observe that perl debugger does > > not emit "DB<1>" prompt if it is run from the Debug-Client's test, so > > it does not process client "c" command and everything halts.
> > I should note that I use perl 5.20.1.
Here is a fix. I don't know why 1.26 fails or why this works. =================================================================== --- Gnu.pm (revision 481) +++ Gnu.pm (working copy) @@ -725,9 +725,8 @@ } elsif ($type eq 'F') { return _rl_store_function($value, $id); } elsif ($type eq 'IO') { - my $FH = $value; # Pass filehandles to the GNU Readline Library - _rl_store_iostream($FH, $id); + my $FH = _rl_store_iostream($value, $id); # pop stdio layer pushed by PerlIO_findFILE(). # https://rt.cpan.org/Ticket/Display.html?id=59832 my @layers = PerlIO::get_layers($FH); =================================================================== --- Gnu.xs (revision 481) +++ Gnu.xs (working copy) @@ -3138,7 +3138,7 @@ } } -void +PerlIO * _rl_store_iostream(stream, id) PerlIO *stream int id @@ -3148,9 +3148,11 @@ switch (id) { case 0: rl_instream = PerlIO_findFILE(stream); + RETVAL = stream; break; case 1: rl_outstream = PerlIO_findFILE(stream); + RETVAL = stream; #ifdef __CYGWIN__ { /* Cygwin b20.1 library converts NL to CR-NL @@ -3167,11 +3169,14 @@ break; default: warn("Gnu.xs:_rl_store_iostream: Illegal `id' value: `%d'", id); + XSRETURN_UNDEF; break; } PerlIO_debug("TRG:store_iostream id %d fd %d\n", - id, PerlIO_fileno(stream)); + id, PerlIO_fileno(RETVAL)); } + OUTPUT: + RETVAL #if 0 /* not used since 1.26 */
Subject: Re: [rt.cpan.org #101078] causes debugger to exit immediately on 5.21.7
Date: Tue, 17 Feb 2015 15:10:18 +0100
To: Hiroo_HAYASHI via RT <bug-Term-ReadLine-Gnu [...] rt.cpan.org>
From: Petr Pisar <ppisar [...] redhat.com>
On Sat, Feb 14, 2015 at 09:55:25AM -0500, Hiroo_HAYASHI via RT wrote: Show quoted text
> On Thu, 12 Feb 2015 14:52:48 GMT, ppisar wrote:
> > Dne Čt 12.úno.2015 09:51:59, ppisar napsal(a):
> > > I found this change causing a dead-lock in Debug-Client-0.29 tests > > > (see <https://github.com/PadreIDE/Debug-Client/issues/1>). I don't > > > know which party is more guilty, but I observe that perl debugger does > > > not emit "DB<1>" prompt if it is run from the Debug-Client's test, so > > > it does not process client "c" command and everything halts.
> > > > I should note that I use perl 5.20.1.
> > Here is a fix. I don't know why 1.26 fails or why this works. >
Thanks a lot. It works for me. -- Petr
Download (untitled)
application/pgp-signature 213b

Message body not shown because it is not plain text.

RT-Send-CC: ppisar [...] redhat.com, bowtie [...] cpan.org, gabor [...] szabgab.com
Dear Petr Pisar, Kevin Dawson, and Gabor Szabo, I'm working for releasing Term-ReadLine-Gnu 1.27. I found that the fix for Debug-Client.pm caused warning messages on the latest Perl 5.22.0; Show quoted text
> Warning: unable to close filehandle properly: Bad file descriptor during global destruction.
I am trying find a way to work with both Perl 5.22.0 and Debug-Client.pm, but cannot find it yet. I have some questions about Debug-Client. Could you answer them for me? Q1. Does Debug-Client call Term-ReadLine[-Gnu]? Are my following understandings correct? - Debug-Client does not call Term-ReadLine directly. - Debug-Client invoke perl debugger (perl -d) and it calls Term-ReadLine. I commented out the lines "use Term::ReadLine;" in Client.pm and t/00-initialize.t. It works well with Term-ReadLine-Gnu 1.26. Q2. Is Term::ReadLine enough for Padre IDE? Are my following understandings correct? - The primary use of Debug-Client is Padre IDE. - For the purpose it does not call perl debugger from a terminal. - For Padre IDE Term::ReadLine is enough, and Term::ReadLine::Gnu is over-kill. Q3. How does t/00-initialize.t call Term-ReadLine-Gnu? As Petr Pisar reported, t/07-initialize.t hangs with Term-ReadLine-Gnu 1.26. It hangs at the line in _get() function; my $ret = $self->{socket}->sysread( $buffer, 1024, length $buffer ); I found this as follows; ========================================================== [hiroo@localhost Debug-Client-0.29]$ perl -d -Mblib t/07-initialize.t 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. 1..4 main::(t/07-initialize.t:5): local $OUTPUT_AUTOFLUSH = 1; DB<1> c ok 1 - initialize with prams ^CDebug::Client::_get(/tmp/Debug-Client-0.29/blib/lib/Debug/Client.pm:506): 506: if ( not defined $ret ) { DB<1> c Interrupted system call at t/07-initialize.t line 41. at /tmp/Debug-Client-0.29/blib/lib/Debug/Client.pm line 507. Debug::Client::_get('Debug::Client=HASH(0x12c00e8)') called at /tmp/Debug-Client-0.29/blib/lib/Debug/Client.pm line 454 Debug::Client::get('Debug::Client=HASH(0x12c00e8)') called at /tmp/Debug-Client-0.29/blib/lib/Debug/Client.pm line 651 Debug::Client::_send_get('Debug::Client=HASH(0x12c00e8)', 'c') called at /tmp/Debug-Client-0.29/blib/lib/Debug/Client.pm line 218 Debug::Client::run('Debug::Client=HASH(0x12c00e8)') called at t/07-initialize.t line 41 ok 2 - quit with prams ok 3 - initialize without prams ^CDebug::Client::_get(/tmp/Debug-Client-0.29/blib/lib/Debug/Client.pm:506): 506: if ( not defined $ret ) { ... ========================================================== By adding print message in my moudle, I found Term::ReadLine::Gnu::new method is called but Term::ReadLine::Gnu::readline method is never called during t/07-initizalize.t execution. I cann't understand how Term-ReadLine-Gnu 1.26 causes the hang-up. Above _get function, you wrote the following comment. Show quoted text
> # TODO shall we add a time-out and/or a number to count down the number sysread calls that return 0 before deciding it is really done
If you can fix this issue on your module, I can release Term-ReadLine-Gnu 1.27 without the patch below. Any clues are welcome. Thanks in advance. On Sat, 14 Feb 2015 14:55:25 GMT, HAYASHI wrote: Show quoted text
> Hi, > > Thank you for your report. > > On Thu, 12 Feb 2015 14:52:48 GMT, ppisar wrote:
> > Dne Čt 12.úno.2015 09:51:59, ppisar napsal(a):
> > > I found this change causing a dead-lock in Debug-Client-0.29 tests > > > (see <https://github.com/PadreIDE/Debug-Client/issues/1>). I don't > > > know which party is more guilty, but I observe that perl debugger does > > > not emit "DB<1>" prompt if it is run from the Debug-Client's test, so > > > it does not process client "c" command and everything halts.
> > > > I should note that I use perl 5.20.1.
> > Here is a fix. I don't know why 1.26 fails or why this works. > > =================================================================== > --- Gnu.pm (revision 481) > +++ Gnu.pm (working copy) > @@ -725,9 +725,8 @@ > } elsif ($type eq 'F') { > return _rl_store_function($value, $id); > } elsif ($type eq 'IO') { > - my $FH = $value; > # Pass filehandles to the GNU Readline Library > - _rl_store_iostream($FH, $id); > + my $FH = _rl_store_iostream($value, $id); > # pop stdio layer pushed by PerlIO_findFILE(). > # https://rt.cpan.org/Ticket/Display.html?id=59832 > my @layers = PerlIO::get_layers($FH); > =================================================================== > --- Gnu.xs (revision 481) > +++ Gnu.xs (working copy) > @@ -3138,7 +3138,7 @@ > } > } > > -void > +PerlIO * > _rl_store_iostream(stream, id) > PerlIO *stream > int id > @@ -3148,9 +3148,11 @@ > switch (id) { > case 0: > rl_instream = PerlIO_findFILE(stream); > + RETVAL = stream; > break; > case 1: > rl_outstream = PerlIO_findFILE(stream); > + RETVAL = stream; > #ifdef __CYGWIN__ > { > /* Cygwin b20.1 library converts NL to CR-NL > @@ -3167,11 +3169,14 @@ > break; > default: > warn("Gnu.xs:_rl_store_iostream: Illegal `id' value: `%d'", id); > + XSRETURN_UNDEF; > break; > } > PerlIO_debug("TRG:store_iostream id %d fd %d\n", > - id, PerlIO_fileno(stream)); > + id, PerlIO_fileno(RETVAL)); > } > + OUTPUT: > + RETVAL > > #if 0 /* not used since 1.26 */
RT-Send-CC: ppisar [...] redhat.com, gabor [...] szabgab.com, bowtie [...] cpan.org
I have released Term::ReadLine::Gnu 1.27. It does not include the fix for Debug-Client.pm on <https://rt.cpan.org/Ticket/Display.html?id=101078#txn-1463705>. If some of you think it is the bug in Term::ReadLine:Gnu, please open another ticket and answer my questions above. Regards, On Sun, 23 Aug 2015 07:56:14 GMT, HAYASHI wrote: Show quoted text
> Dear Petr Pisar, Kevin Dawson, and Gabor Szabo, > > I'm working for releasing Term-ReadLine-Gnu 1.27. > > I found that the fix for Debug-Client.pm caused warning messages on > the latest Perl 5.22.0; >
> > Warning: unable to close filehandle properly: Bad file descriptor > > during global destruction.
> > I am trying find a way to work with both Perl 5.22.0 and Debug- > Client.pm, but cannot find it yet. > > I have some questions about Debug-Client. Could you answer them for > me? > > Q1. Does Debug-Client call Term-ReadLine[-Gnu]? > > Are my following understandings correct? > - Debug-Client does not call Term-ReadLine directly. > - Debug-Client invoke perl debugger (perl -d) and it calls Term- > ReadLine. > > I commented out the lines "use Term::ReadLine;" in Client.pm and t/00- > initialize.t. It works well with Term-ReadLine-Gnu 1.26. > > Q2. Is Term::ReadLine enough for Padre IDE? > > Are my following understandings correct? > - The primary use of Debug-Client is Padre IDE. > - For the purpose it does not call perl debugger from a terminal. > - For Padre IDE Term::ReadLine is enough, and Term::ReadLine::Gnu is > over-kill. > > Q3. How does t/00-initialize.t call Term-ReadLine-Gnu? > > As Petr Pisar reported, t/07-initialize.t hangs with Term-ReadLine-Gnu > 1.26. > It hangs at the line in _get() function; > my $ret = $self->{socket}->sysread( $buffer, 1024, > length $buffer ); > > I found this as follows; > ========================================================== > [hiroo@localhost Debug-Client-0.29]$ perl -d -Mblib t/07-initialize.t > > 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. > > 1..4 > main::(t/07-initialize.t:5): local $OUTPUT_AUTOFLUSH = 1; > DB<1> c > ok 1 - initialize with prams > ^CDebug::Client::_get(/tmp/Debug-Client- > 0.29/blib/lib/Debug/Client.pm:506): > 506: if ( not defined $ret ) { > DB<1> c > Interrupted system call at t/07-initialize.t line 41. > at /tmp/Debug-Client-0.29/blib/lib/Debug/Client.pm line 507. > Debug::Client::_get('Debug::Client=HASH(0x12c00e8)') called at > /tmp/Debug-Client-0.29/blib/lib/Debug/Client.pm line 454 > Debug::Client::get('Debug::Client=HASH(0x12c00e8)') called at > /tmp/Debug-Client-0.29/blib/lib/Debug/Client.pm line 651 > Debug::Client::_send_get('Debug::Client=HASH(0x12c00e8)', 'c') > called at /tmp/Debug-Client-0.29/blib/lib/Debug/Client.pm line 218 > Debug::Client::run('Debug::Client=HASH(0x12c00e8)') called at > t/07-initialize.t line 41 > ok 2 - quit with prams > ok 3 - initialize without prams > ^CDebug::Client::_get(/tmp/Debug-Client- > 0.29/blib/lib/Debug/Client.pm:506): > 506: if ( not defined $ret ) { > ... > ========================================================== > > By adding print message in my moudle, I found Term::ReadLine::Gnu::new > method is called but Term::ReadLine::Gnu::readline method is never > called during t/07-initizalize.t execution. > > I cann't understand how Term-ReadLine-Gnu 1.26 causes the hang-up. > > Above _get function, you wrote the following comment. >
> > # TODO shall we add a time-out and/or a number to count down the > > number sysread calls that return 0 before deciding it is really done
> > If you can fix this issue on your module, I can release Term-ReadLine- > Gnu 1.27 without the patch below. > > > Any clues are welcome. > > Thanks in advance. > > On Sat, 14 Feb 2015 14:55:25 GMT, HAYASHI wrote:
> > Hi, > > > > Thank you for your report. > > > > On Thu, 12 Feb 2015 14:52:48 GMT, ppisar wrote:
> > > Dne Čt 12.úno.2015 09:51:59, ppisar napsal(a):
> > > > I found this change causing a dead-lock in Debug-Client-0.29 > > > > tests > > > > (see <https://github.com/PadreIDE/Debug-Client/issues/1>). I > > > > don't > > > > know which party is more guilty, but I observe that perl debugger > > > > does > > > > not emit "DB<1>" prompt if it is run from the Debug-Client's > > > > test, so > > > > it does not process client "c" command and everything halts.
> > > > > > I should note that I use perl 5.20.1.
> > > > Here is a fix. I don't know why 1.26 fails or why this works. > > > > =================================================================== > > --- Gnu.pm (revision 481) > > +++ Gnu.pm (working copy) > > @@ -725,9 +725,8 @@ > > } elsif ($type eq 'F') { > > return _rl_store_function($value, $id); > > } elsif ($type eq 'IO') { > > - my $FH = $value; > > # Pass filehandles to the GNU Readline Library > > - _rl_store_iostream($FH, $id); > > + my $FH = _rl_store_iostream($value, $id); > > # pop stdio layer pushed by PerlIO_findFILE(). > > # https://rt.cpan.org/Ticket/Display.html?id=59832 > > my @layers = PerlIO::get_layers($FH); > > =================================================================== > > --- Gnu.xs (revision 481) > > +++ Gnu.xs (working copy) > > @@ -3138,7 +3138,7 @@ > > } > > } > > > > -void > > +PerlIO * > > _rl_store_iostream(stream, id) > > PerlIO *stream > > int id > > @@ -3148,9 +3148,11 @@ > > switch (id) { > > case 0: > > rl_instream = PerlIO_findFILE(stream); > > + RETVAL = stream; > > break; > > case 1: > > rl_outstream = PerlIO_findFILE(stream); > > + RETVAL = stream; > > #ifdef __CYGWIN__ > > { > > /* Cygwin b20.1 library converts NL to CR-NL > > @@ -3167,11 +3169,14 @@ > > break; > > default: > > warn("Gnu.xs:_rl_store_iostream: Illegal `id' value: `%d'", > > id); > > + XSRETURN_UNDEF; > > break; > > } > > PerlIO_debug("TRG:store_iostream id %d fd %d\n", > > - id, PerlIO_fileno(stream)); > > + id, PerlIO_fileno(RETVAL)); > > } > > + OUTPUT: > > + RETVAL > > > > #if 0 /* not used since 1.26 */
Subject: [rt.cpan.org #101078] causes debugger to exit immediately on 5.21.7
Date: Thu, 10 Sep 2015 00:05:20 +0200
To: bug-Term-ReadLine-Gnu [...] rt.cpan.org
From: Emmanuel Seyman <emmanuel [...] seyman.fr>
I've rebased Petr's patch for v1.27. Here is the result. Emmanuel

Message body is not shown because sender requested not to inline it.

Show quoted text
> I've rebased Petr's patch for v1.27. Here is the result.
It was not Petr's patch. It was my WRONG patch for Petr. Please read my comments.
From: ppisar [...] redhat.com
Dne St 09.zář.2015 18:05:42, emmanuel@seyman.fr napsal(a): Show quoted text
> > I've rebased Petr's patch for v1.27. Here is the result. >
The port is missing final "OUTPUT: RETVAL" statement in Gnu.xs. Attached patch is a proper port.
Subject: Term-ReadLine-Gnu-1.27-Propagete-PerlIO_return_value_from_STORE.patch
From a70e0540b53a137a8b30cd4c2426c33e2c8e9720 Mon Sep 17 00:00:00 2001 From: HAYASHI <HAYASHI@cpan.org> Date: Wed, 23 Sep 2015 12:22:23 +0200 Subject: [PATCH] Propagete PerlIO return value from STORE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Thu, 12 Feb 2015 14:52:48 GMT, ppisar wrote: > Dne Čt 12.úno.2015 09:51:59, ppisar napsal(a): > > I found this change causing a dead-lock in Debug-Client-0.29 tests > > (see <https://github.com/PadreIDE/Debug-Client/issues/1>). I don't > > know which party is more guilty, but I observe that perl debugger does > > not emit "DB<1>" prompt if it is run from the Debug-Client's test, so > > it does not process client "c" command and everything halts. > > I should note that I use perl 5.20.1. Here is a fix. I don't know why 1.26 fails or why this works. Petr Pisar: Patch for 1.26 ported to 1.27. CPAN RT#101078 Signed-off-by: Petr Písař <ppisar@redhat.com> --- Gnu.pm | 3 +-- Gnu.xs | 9 +++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Gnu.pm b/Gnu.pm index 4701589..298d567 100644 --- a/Gnu.pm +++ b/Gnu.pm @@ -734,9 +734,8 @@ sub STORE { } elsif ($type eq 'F') { return _rl_store_function($value, $id); } elsif ($type eq 'IO') { - my $FH = $value; # Pass filehandles to the GNU Readline Library - _rl_store_iostream($value, $id); + my $FH = _rl_store_iostream($value, $id); # pop stdio layer pushed by PerlIO_findFILE(). # https://rt.cpan.org/Ticket/Display.html?id=59832 my @layers = PerlIO::get_layers($FH); diff --git a/Gnu.xs b/Gnu.xs index cb91a2c..5bf0845 100644 --- a/Gnu.xs +++ b/Gnu.xs @@ -3147,7 +3147,7 @@ _rl_fetch_int(id) } } -void +PerlIO * _rl_store_iostream(stream, id) PerlIO *stream int id @@ -3157,9 +3157,11 @@ _rl_store_iostream(stream, id) switch (id) { case 0: rl_instream = PerlIO_findFILE(stream); + RETVAL = stream; break; case 1: rl_outstream = PerlIO_findFILE(stream); + RETVAL = stream; #ifdef __CYGWIN__ { /* Cygwin b20.1 library converts NL to CR-NL @@ -3176,11 +3178,14 @@ _rl_store_iostream(stream, id) break; default: warn("Gnu.xs:_rl_store_iostream: Illegal `id' value: `%d'", id); + XSRETURN_UNDEF; break; } PerlIO_debug("TRG:store_iostream id %d fd %d\n", - id, PerlIO_fileno(stream)); + id, PerlIO_fileno(RETVAL)); } + OUTPUT: + RETVAL #if 0 /* not used since 1.26 */ -- 2.4.3