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

MM_Win32.t failures (caused by PathTools upgrade)

Thread Next
Steve Hay
January 31, 2008 03:19
MM_Win32.t failures (caused by PathTools upgrade)
Message ID:
ExtUtils/t/MM_Win32.t has been failing two tests lately:

not ok 9 - catdir()
#   Failed test 'catdir()'
#   at ..\lib\ExtUtils\t\MM_Win32.t line 96.
#          got: 'C:trick\dir\now_OK'
#     expected: 'C:\trick\dir\now_OK'

not ok 11 - catfile()
#   Failed test 'catfile()'
#   at ..\lib\ExtUtils\t\MM_Win32.t line 105.
#          got: 'C:trick\dir\now_OK\file.ext'
#     expected: 'C:\trick\dir\now_OK\file.ext'

These are caused by the upgrade to PathTools-3.27 in #33042, which
brought in a major rewrite of Win32's catdir, catfile and canonpath from

In short, this program:

use File::Spec::Functions qw(catdir);
my @path_eg = qw( c: trick dir/now_OK );
print catdir(@path_eg);

used to output:


but now outputs:


Is this new behaviour intended and correct (in which case
ExtUtils/t/MM_Win32.t needs a simple tweak to fix), or is PathTools
broken and needs fixing itself instead?

Either output is arguably correct (the notation "C:path" means the file
or directory called "path" relative to the current directory on the "C:"
drive, there being the notion of a current directory per drive), and the
File::Spec docs don't make it clear which output is to be expected.

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": it turns out that this works:

my @path_eg = qw( c:/ trick dir/now_OK );
print catdir(@path_eg);

but this doesn't:

my @path_eg = qw( c: /trick dir/now_OK );
print catdir(@path_eg);

and neither does this:

my @path_eg = qw( c: / trick dir/now_OK );
print catdir(@path_eg);

which is all very confusing.

Given all that, I think I'd personally prefer not to have a change in
behaviour and fix PathTools so that the example above (and MM_Win32.t)
works as before. (That could be easier said than done, of course.)

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