summaryrefslogtreecommitdiff
path: root/lib/perl5db.t
diff options
context:
space:
mode:
authorShlomi Fish <shlomif@shlomifish.org>2014-03-27 19:07:50 +0200
committerTony Cook <tony@develop-help.com>2014-05-28 13:35:25 +1000
commitc59f1e04636e3bafbbd2c362defb3fe67b18d108 (patch)
treee93ecd8b84504e1dc52cea5b9ed690d3d6044ec9 /lib/perl5db.t
parentbd47baf274ecea5636da37b74e4368e6f271fed5 (diff)
downloadperl-c59f1e04636e3bafbbd2c362defb3fe67b18d108.tar.gz
Fix RT #121509 : perl -d handling chdir().
See: https://rt.perl.org/Ticket/Display.html?id=121509 [perl #121509] perl debugger doesn't save starting dir to restart from Thanks to Linda Walsh for reporting the problem and RJBS for commenting for initial approval. Fix and a regression test by Shlomi Fish.
Diffstat (limited to 'lib/perl5db.t')
-rw-r--r--lib/perl5db.t51
1 files changed, 50 insertions, 1 deletions
diff --git a/lib/perl5db.t b/lib/perl5db.t
index 3af7f64e6e..bd5615a673 100644
--- a/lib/perl5db.t
+++ b/lib/perl5db.t
@@ -29,7 +29,7 @@ BEGIN {
$ENV{PERL_RL} = 'Perl'; # Suppress system Term::ReadLine::Gnu
}
-plan(119);
+plan(120);
my $rc_filename = '.perldb';
@@ -2697,6 +2697,55 @@ DebugWrap->new({
);
}
+# perl 5 RT #121509 regression bug.
+# “perl debugger doesn't save starting dir to restart from”
+# Thanks to Linda Walsh for reporting it.
+{
+ use File::Temp qw/tempdir/;
+
+ my $temp_dir = tempdir( CLEANUP => 1 );
+
+ local $ENV{__PERLDB_TEMP_DIR} = $temp_dir;
+ my $wrapper = DebugWrap->new(
+ {
+ cmds =>
+ [
+ # This is to avoid getting the "Debugger program terminated"
+ # junk that interferes with the normal output.
+ 'b _after_chdir',
+ 'c',
+ 'R',
+ 'b _finale',
+ 'c',
+ 'n',
+ 'n',
+ 'n',
+ 'n',
+ 'n',
+ 'n',
+ 'n',
+ 'n',
+ 'n',
+ 'n',
+ 'n',
+ 'n',
+ 'q',
+ ],
+ prog => '../lib/perl5db/t/rt-121509-restart-after-chdir',
+ }
+ );
+
+ $wrapper->output_like(
+ qr/
+In\ _finale\ No\ 1
+ .*?
+In\ _finale\ No\ 2
+ .*?
+In\ _finale\ No\ 3
+ /msx,
+ "Test that the debugger chdirs to the initial directory after a restart.",
+ );
+}
# Test the perldoc command
# We don't actually run the program, but we need to provide one to the wrapper.
SKIP: