On Apr 24, 2010, at 8:18 AM, Craig A. Berry wrote:


On Apr 23, 2010, at 11:37 AM, martin.zin...@deutsche-boerse.com wrote:

here is another reproducer for a 5.12 problem (this might be something for
Robert). The following little script fails:

use File::Copy;

my $from = 'sys$login:from.lis';
my $to   = 'sys$login:to.lis';

system("create/fdl=nl: $from") ;
copy($from, $to) || warn ("Copy failed:", $!);

The failiure condition is that the file spec does not contain an explicit
directory spec (i.e. dsa0:[zinser]to.lis works).

Hmm.  What does this give you with 5.8.6:

$ perl -"MFile::Spec" -e "print File::Spec->catpath('foo:', q(), 'bar');"
foo:[]bar



Carl Friedberg reminds me that this is still out there tripping people up. Here's what I just wrote him about it. I hope we get the fix into File::Spec at some point, but I don't know when that will be:

I think what it boils down to (as I posted on-list at some point) is this:

$ perl -"MFile::Spec" -e "print File::Spec->catpath('foo:', q(), 'bar');"
foo:[]bar

File::Copy is using catpath, so when there is a zero-length directory spec, it defaults in the double brackets. It can probably be fixed by patching catpath like so:

--- lib/File/Spec/VMS.pm;-0     2010-07-15 23:37:15 -0500
+++ lib/File/Spec/VMS.pm        2010-07-16 17:29:15 -0500
@@ -759,6 +759,7 @@ sub catpath {
          $dir = vmspath($dir);
      }
    }
+    $dir = '' if $dir eq '[]' || $dir eq '<>';
    "$dev$dir$file";
}

[end]

This is relatively untested, so do be careful. I haven't thought of anything else that will break, but the number of things I"m capable of thinking of is relatively small compared to the number of things that might break.

The reproducer for your problem is as simple as:

$ perl -"MFile::Copy" -e "copy('sys$help:DECRAM$HELP.HLB', 'sys $login:temp.hlb') or die $!;"
error in directory name at -e line 1.
%RMS-F-DIR, error in directory name

but this does work after the patch above.


________________________________________
Craig A. Berry
mailto:craigbe...@mac.com

"... getting out of a sonnet is much more
 difficult than getting in."
                 Brad Leithauser

Reply via email to