Skip Menu |

This queue is for tickets about the PathTools CPAN distribution.

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

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

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



Subject: catpath won't handle rootdir + path under cygwin
Under cygwin, catdir( '/', 'my/path' ) returns '//my/path' rather than '/my/path'. The join in catdir assumes canonpath will deal with the multiple slashes, but canonpath doesn't strip them becuase it interprets the path as a network path (as it should in most cases). Adding this to Cygwin.pm to override the Unix.pm verions of catdir fixes it: sub catdir { my ($self, @path) = @_; $path[0] = '' if $path[0] eq '/'; # avoid adding // by mistake $self->canonpath(join('/', @path, '')); # '' because need a trailing '/' } Actually, I would assume that this change would be appropriate under Unix.pm, but I haven't thought through all the implications yet. Regards, Mark
Hi Mark, I just tried (and committed) the following patch, and the tests succeeded, so I'm unable to reproduce the bug on Unix (Mac OS X). What version did you test? --- t/Spec.t 4 Mar 2006 04:16:36 -0000 1.8 +++ t/Spec.t 13 Apr 2006 02:48:58 -0000 1.9 @@ -90,6 +90,7 @@ [ "Unix->catdir('d1','d2','d3','')", 'd1/d2/d3' ], [ "Unix->catdir('','d1','d2','d3')", '/d1/d2/d3' ], [ "Unix->catdir('d1','d2','d3')", 'd1/d2/d3' ], +[ "Unix->catdir('/','d2/d3')", '/d2/d3' ], [ "Unix->canonpath('///../../..//./././a//b/.././c/././')", '/a/b/../c' ], [ "Unix->canonpath('')", '' ], @@ -600,6 +601,7 @@ #[ "Epoc->canonpath('/.')", '/' ], [ "Cygwin->case_tolerant()", '0' ], +[ "Cygwin->catdir('/','d2/d3')", '/d2/d3' ], ) ;