In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/fff5c6e2d16a6c4070b5580acb55b3663ed90c08?hp=94e9284742fce739393f3ccf1f443b4486b689cc>

- Log -----------------------------------------------------------------
commit fff5c6e2d16a6c4070b5580acb55b3663ed90c08
Author: David Mitchell <da...@iabyn.com>
Date:   Sat Mar 27 18:07:30 2010 +0000

    RT #73714: Regression in 5.12: File::Copy and initial spaces
    
    Commit 81ec4fbc8320b72171c9fbea0fa0456b3a687f92
    removed some obsolete code that processed with leading spaces in filenames
    (not needed with 3-arg open), but didn't quite clean out everything.
    This meant that trying to copy to a file whose name had a leading space
    would unceremoniously die with
        Undefined subroutine &File::Copy::_protect called
-----------------------------------------------------------------------

Summary of changes:
 lib/File/Copy.pm |    5 ++---
 lib/File/Copy.t  |   13 ++++++++++++-
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/lib/File/Copy.pm b/lib/File/Copy.pm
index 4dc8c6d..c3823ac 100644
--- a/lib/File/Copy.pm
+++ b/lib/File/Copy.pm
@@ -22,7 +22,7 @@ sub syscopy;
 sub cp;
 sub mv;
 
-$VERSION = '2.17';
+$VERSION = '2.18';
 
 require Exporter;
 @ISA = qw(Exporter);
@@ -242,8 +242,7 @@ sub copy {
     if ($to_a_handle) {
        $to_h = $to;
     } else {
-       $to = _protect($to) if $to =~ /^\s/s;
-       $to_h = \do { local *FH };
+       $to_h = \do { local *FH }; # XXX is this line obsolete?
        open $to_h, ">", $to or goto fail_open2;
        binmode $to_h or die "($!,$^E)";
        $closeto = 1;
diff --git a/lib/File/Copy.t b/lib/File/Copy.t
index 2644bce..cc1c3ff 100644
--- a/lib/File/Copy.t
+++ b/lib/File/Copy.t
@@ -14,7 +14,7 @@ use Test::More;
 
 my $TB = Test::More->builder;
 
-plan tests => 461;
+plan tests => 463;
 
 # We're going to override rename() later on but Perl has to see an override
 # at compile time to honor it.
@@ -223,6 +223,17 @@ for my $cross_partition_test (0..1) {
 
   unlink "file-$$" or die $!;
   unlink "copy-$$" or die $!;
+
+  # RT #73714 copy to file with leading whitespace failed
+
+  open(F, ">file-$$") or die $!;
+  close F;
+  copy "file-$$", " copy-$$";
+  warn "XXX\n";
+  ok -e " copy-$$", "copy with leading whitespace";
+  unlink "file-$$" or die "unlink: $!";
+  unlink " copy-$$" or die "unlink: $!";
+
 }
 
 

--
Perl5 Master Repository

Reply via email to