Subject: | PATCH for VMS, directories named "0" disappear when using catdir/catfile. |
File::Spec 3.17, Perl 5.87 on VMS
This is best demonstrated by:
perl "-MFile::Spec" -e "print File::Spec->catfile
('0','i_am_not_a_number','i_am_a_free_man');"
VMS returns:
[.i_am_not_a_number]i_am_a_free_man
UNIX, Linux, Cygwin, A.S. Windows all do not make "0" vanish.
The fix is to add "defined" and "&& (ne '')" to the lines:
@dirs = grep((defined $_) && ($_ ne ''),@dirs); # 3rd line of sub
catdir
@files = grep((defined $_) && ($_ ne ''),@files); # 3rd line of sub
catfile
$rslt = vmsify($rslt.((defined $rslt) && ($rslt
ne '') ? '/' : '').unixify($file); # line 14 of sub catfile
return '' unless (defined $path) && ($path ne ''); # 2nd line of sub
eliminate_macros
All in File/Spec/VMS.pm
I'm sorry I don't have time to provide a patch for this with some
additional test cases, but if you wanted to add:
File::Spec->catfile('0','b','c');" [0.b]c
File::Spec->catfile('a','0','c');" [a.0]c
File::Spec->catfile('a','b','0');" [a.b]0
File::Spec->catfile('0','0','c');" [0.0]c
File::Spec->catfile('a','0','0');" [a.0]0
File::Spec->catfile('0','b','0');" [0.b]0
File::Spec->catfile('0','0','0');" [0.0]0
I can confirm that the changes I'm suggesting fix these cases.
If you would accept a vms.t file then I'll find time to create one
next week.
Thanks,
Peter (Stig) Edwards