Skip Menu |

This queue is for tickets about the PathTools CPAN distribution.

Report information
The Basics
Id: 7925
Status: rejected
Priority: 0/
Queue: PathTools

People
Owner: Nobody in particular
Requestors: SMPETERS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: File::Spec::Win32 - catpath() bug with UNC paths
This issue is reported at perlbug #22148 at http://rt.perl.org/rt3/Ticket/Display.html?id=22148. With UNC file paths, a warning is generated and no path separator is placed between the $volume and the $directory. In the perlbug a suggested solution is included. I am also including a script that demonstrates the problem. #!/usr/bin/perl -w use strict; use File::Spec::Win32; use Test::More tests => 1; my $volume = "\\\\myserver\\temp"; my $dir = "foo"; my $file = "bar.txt"; my $cat_path = File::Spec::Win32->catpath($volume, $dir, $file); print "$cat_path\n"; is($cat_path, "\\\\myserver\\temp\\foo\\bar.txt");
RT-Send-CC: perl5-porters [...] perl.org
Hi, Thanks for the report. File::Spec certainly is doing the wrong thing by returning "\\\\myserver\\tempfoo\\bar.txt", but I'm not sure "\\\\myserver\\temp\\foo\\bar.txt" is the right value either. The reason is that "foo" is a relative path, as opposed to "\\foo", which is absolute (with respect to the volume). Compare with catpath('C:', '..\\foo', 'bar.txt'), which properly returns 'C:..\\foo\\bar.txt', as shown in this test case from t/Spec.t: [ "Win32->catpath('C:','../d2\\d3/','file')", 'C:../d2\\d3/file' ], The complication comes because while lettered drives each have their own working directory, I don't think the same is true of UNC paths (someone from p5p correct me if I'm wrong?). So perhaps the best behavior would be to throw an exception (die) if a UNC volume and relative directory are given to catpath()? -Ken
On Sat Oct 09 22:45:33 2004, KWILLIAMS wrote: Show quoted text
> Hi, > > Thanks for the report. File::Spec certainly is doing the wrong thing > by returning > "\\\\myserver\\tempfoo\\bar.txt", but I'm not sure > "\\\\myserver\\temp\\foo\\bar.txt" is > the right value either. The reason is that "foo" is a relative path, > as opposed to "\\foo", which > is absolute (with respect to the volume). Compare with catpath('C:', > '..\\foo', 'bar.txt'), which > properly returns 'C:..\\foo\\bar.txt', as shown in this test case
from Show quoted text
> t/Spec.t: > > [ "Win32->catpath('C:','../d2\\d3/','file')", 'C:../d2\\d3/file' > ], > > The complication comes because while lettered drives each have their > own working directory, > I don't think the same is true of UNC paths (someone from p5p correct > me if I'm wrong?). So > perhaps the best behavior would be to throw an exception (die) if a > UNC volume and relative > directory are given to catpath()? > > -Ken