develooper Front page | perl.perl5.porters | Postings from February 2008

Re: MM_Win32.t failures (caused by PathTools upgrade)

Thread Previous | Thread Next
Ken Williams
February 1, 2008 05:08
Re: MM_Win32.t failures (caused by PathTools upgrade)
Message ID:
On Jan 31, 2008 11:09 AM, Michael G Schwern <> wrote:
> MakeMaker runs catfile() through canonpath() to work around some old bugs.
> It's possible that canonpath() is the one translating C:trick\dir\now_OK into
> C:\trick\dir\now_OK.  If so, that's a bug.
> Can you check what File::Spec->canonpath("C:trick\dir\now_OK") does?

That has to be left alone, since it's a valid [relative] path.

> > I can imagine that most people would expect catdir(qw(C: trick)) to
> > produce "C:\trick". It currently doesn't, and it isn't clear what you
> > have to do to get "C:\trick":
> Probably use a blank directory to represent root.  That's what Unix does.  Try:
> catdir( 'c:', '', 'trick', 'dir' );

That won't work because it means a directory called 'c:' containing a
directory called '' (which for some reason gets collapsed away)
containing etc. etc.

Arguably it should just die() on those arguments, because AFAIK 'c:'
is an invalid directory name.

> Actually the correct answer is "none of the above" because catdir() uses
> directories, not volumes.  In reality the correct thing to use is catpath().

Yes, that's right.

File::Spec is just hard to use correctly.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About