New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can not quit from perl debugger by 'q' #15064
Comments
From @KES777Created by @KES777When I try debug script remotely I set: PERLDB_OPTS=RemotePort=keswork:9001 and if the nobody occasionally listen that port http://paste.scsys.co.uk/501839 Perl Info
|
From @shlomifOn Thu Nov 26 00:57:44 2015, kes-kes@yandex.ua wrote:
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 |
From @shlomifperl-debugger-rt126735-fix-v1.patchdiff --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);
}
|
The RT System itself - Status changed from 'new' to 'open' |
From @KES777No, this patch does not fix the problem. The output: perl -d t.pl 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>:
|
From @shlomifHi KES, On Fri Nov 27 03:44:52 2015, kes-kes@yandex.ua wrote:
Really? How did you apply it? Did you run "make install"? This patch was done against bleadperl - is that what you used? This patch worked perfectly well here with bleadperl.
What are the contents of t.pl? The error you are getting from it initially is really strange.
It's not a bad idea to add it, but I believe it's not necessary, because the STDIN will get an EOF. Regards, -- Shlomi Fish
|
From @shlomifHere is a better patch with the \n and the $VERSION of perl -d. |
From @shlomifperl-d-rt126735-fix-v5.diffdiff --git a/lib/perl5db.pl b/lib/perl5db.pl
index 0d240ae..68f7e50 100644
--- a/lib/perl5db.pl
+++ b/lib/perl5db.pl
@@ -528,7 +528,7 @@ BEGIN {
# Debugger for Perl 5.00x; perl5db.pl patch level:
use vars qw($VERSION $header);
-$VERSION = '1.49_01';
+$VERSION = '1.49_02';
$header = "perl5db.pl version $VERSION";
@@ -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..0c4fc42 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\n", 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);
}
|
From @KES777I redone your instructions from start. It seems I did something wrong. Thank you. |
From @shlomifHi KES, On Mon Nov 30 05:02:59 2015, kes-kes@yandex.ua wrote:
Thanks for the heads up, and I'm happy to hear the patch is now working fine for you. You're also very welcome. I suggest one of the bleadperl committers look into applying this patch. (As I don't have a commit bit.) Regards, -- Shlomi Fish |
From @jkeenanOn Mon Nov 30 09:19:32 2015, shlomif wrote:
Thanks for the patch. I have it smoking in this branch: smoke-me/jkeenan/shlomif/126735-debugger Let's get some more eyeballs on it. Thank you very much. |
From @shlomifOn Mon Nov 30 15:32:31 2015, jkeenan wrote:
Thanks!
Sure.
You're welcome. |
From @rjbs* James E Keenan via RT <perlbug-followup@perl.org> [2015-11-30T18:32:32]
+1 -- |
From @jkeenanOn Tue Dec 01 19:22:37 2015, perl.p5p@rjbs.manxome.org wrote:
Thanks for the review. Applied to blead in commit 2305393. -- |
@jkeenan - Status changed from 'open' to 'resolved' |
From @shlomifOn Wed, 2 Dec 2015 15:32:02 -0800
Thanks for applying the patch! Regards, Shlomi Fish -- Shlomi Fish Please reply to list if it's a mailing list post |
Migrated from rt.perl.org#126735 (status was 'resolved')
Searchable as RT126735$
The text was updated successfully, but these errors were encountered: