Subject: | TAP::Harness 3.23 'prove --archive' failure with absolute paths |
Date: | Thu, 27 Sep 2012 12:48:51 -0700 |
To: | bug-Test-Harness [...] rt.cpan.org |
From: | Jason Gibson <jgibson [...] perforce.com> |
Running on Win7:
prove -V
TAP::Harness v3.23 and Perl v5.14.2
and
TAP::Harness::Archive 0.14.
When the test file is an absolute path, prove will error-out because the volume
is part of the path and the colon is an invalid filename character:
prove --archive C:\t\spool\out.tgz C:\t\Test-Harness-3.25\t\000-load.t
mkdir C:\Users\perforce\AppData\Local\Temp\asdfadf\C:\: Invalid Argument;
The filename, directory name ....
Changing the _open_spool function to remove the volume appears to fix it:
if ( my $spool_dir = $ENV{PERL_TEST_HARNESS_DUMP_TAP} ) {
- my $spool = File::Spec->catfile( $spool_dir, $test );
+ # Remove the volume since $test could be absolute, and that
+ # would cause $path to be invalid. E.g. 'c:\tmp\C:\test\file'
+ my ( undef, $tdir, $tfile ) = File::Spec->splitpath( $test );
+ my $tpath = File::Spec->catfile( $tdir, $tfile );
+
+ my $spool = File::Spec->catfile( $spool_dir, $tpath );
# Make the directory
my ( $vol, $dir, undef ) = File::Spec->splitpath($spool);