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 */