develooper Front page | perl.perl5.porters | Postings from November 2015

Re: [perl #126735] Can not quit from perl debugger by 'q'

Thread Previous | Thread Next
From:
KES
Date:
November 27, 2015 11:44
Subject:
Re: [perl #126735] Can not quit from perl debugger by 'q'
Message ID:
1164411448624632@web10o.yandex.ru
No, this patch does not fix the problem. The output:

perl -d t.pl 
Unable to connect to remote host: keswork:9001
Compilation failed in require.
 at t.pl line 0.
	main::BEGIN() called at t.pl line 0
	eval {...} called at t.pl line 0
BEGIN failed--compilation aborted.
 at t.pl line 0.
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<1> q
syntax error at (eval 10)[/home/kes/perl/lib/5.22.0/perl5db.pl:737] line 4, at EOF
  (Might be a runaway multi-line ;; string starting on line 2)

  DB<1> 


Maybe you need "q\n" in your testcase? (NOTICE: \n)

26.11.2015, 22:25, "Shlomi Fish via RT" <perlbug-followup@perl.org>:
> On Thu Nov 26 00:57:44 2015, kes-kes@yandex.ua wrote:
>>  To: perlbug@perl.org
>>  Subject: Can not quit from perl debugger by 'q'
>>  Cc: kes-kes@yandex.ru
>>  Reply-To: kes-kes@yandex.ru
>>  Message-Id: <5.22.0_28030_1448525199@keswork>
>>  From: kes-kes@yandex.ru
>>
>>  This is a bug report for perl from kes-kes@yandex.ru,
>>  generated with the help of perlbug 1.40 running under perl 5.22.0.
>>
>>  -----------------------------------------------------------------
>>  [Please describe your issue here]
>>
>>  When I try debug script remotely I set:
>>
>>  PERLDB_OPTS=RemotePort=keswork:9001
>>
>>  and if the nobody occasionally listen that port
>>  I can not exit from debugger, even can not run any command
>>  Only CTRL+C works.
>
> Thanks for the report, kes! The problem happens when one specifies a RemotePort that cannot be connected to. Attached is a patch to fix the problem on mostly recent bleadperl. It passes all tests and adds some new test assertions. The patch was caused by a lexical variable in lib/perl5db.pl that was used in the BEGIN stage before being initialised. I believe it was I who introduced this variable as part of the massive debugger refactoring I have done as part of one of my TPF grants, and it wasn't caught due to inadequate test coverage.
>
> I ran into some problems getting the tests not to hang but they should be OK now.
>
> Please look into applying it.
>
> Regards,
>
> -- Shlomi Fish
>
> ,
>
> diff --git a/lib/perl5db.pl b/lib/perl5db.pl
> index 0d240ae..884f67a 100644
> --- a/lib/perl5db.pl
> +++ b/lib/perl5db.pl
> @@ -2490,7 +2490,11 @@ EOP
>  # 'm' is method.
>  # 'v' is the value (i.e: method name or subroutine ref).
>  # 's' is subroutine.
> -my %cmd_lookup =
> +my %cmd_lookup;
> +
> +BEGIN
> +{
> + %cmd_lookup =
>  (
>      '-' => { t => 'm', v => '_handle_dash_command', },
>      '.' => { t => 's', v => \&_DB__handle_dot_command, },
> @@ -2523,6 +2527,7 @@ my %cmd_lookup =
>      (map { $_ => {t => 'm', v => '_handle_cmd_wrapper_commands' }, }
>          qw(a A b B e E h i l L M o O v w W)),
>  );
> +};
>
>  sub DB {
>
> diff --git a/lib/perl5db.t b/lib/perl5db.t
> index 98a3686..6ac3932 100644
> --- a/lib/perl5db.t
> +++ b/lib/perl5db.t
> @@ -29,7 +29,7 @@ BEGIN {
>      $ENV{PERL_RL} = 'Perl'; # Suppress system Term::ReadLine::Gnu
>  }
>
> -plan(121);
> +plan(123);
>
>  my $rc_filename = '.perldb';
>
> @@ -2799,6 +2799,22 @@ SKIP:
>      );
>  }
>
> +{
> + # perl 5 RT #126735 regression bug.
> + local $ENV{PERLDB_OPTS} = "NonStop=0 RemotePort=non-existent-host.tld:9001";
> + my $output = runperl( stdin => 'q', stderr => 1, switches => [ '-d' ], prog => '../lib/perl5db/t/fact' );
> + like(
> + $output,
> + qr/^Unable to connect to remote host:/ms,
> + 'Tried to connect.',
> + );
> + unlike(
> + $output,
> + qr/syntax error/,
> + 'Can quit from the debugger after a wrong RemotePort',
> + );
> +}
> +
>  END {
>      1 while unlink ($rc_filename, $out_fn);
>  }

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