Skip Menu |

This queue is for tickets about the Test-Harness CPAN distribution.

Report information
The Basics
Id: 47890
Status: resolved
Priority: 0/
Queue: Test-Harness

People
Owner: andy [...] hexten.net
Requestors: JDB [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.99_01
Fixed in: (no value)



Subject: Test::Harness changes @INC on Windows
I noticed a change in @INC with Test-Harness 3 in maint-5.10: The directories in @INC on Windows are derived from the location of the Perl binary (stored in $^X). The function TAP::Parser::Source::Perl::_get_perl() runs Win32::GetShortPathName() on $^X before returning it (most likely to try to remove any spaces in the filename to the perl.exe executable). It then uses this modified $^X value to run perl.exe for the actual tests. This however also changes the @INC entries in the perl.exe subprocess to use the short pathnames: C:\>"C:\My Perl\bin\perl.exe" -E "say for $^X, @INC" C:\My Perl\bin\perl.exe C:/My Perl/site/lib C:/My Perl/lib . C:\>C:\MYPERL~1\bin\perl.exe -E "say for $^X, @INC" C:\MYPERL~1\bin\perl.exe C:/MYPERL~1/site/lib C:/MYPERL~1/lib . I don't really like this change (from Test-Harness 2) as it makes it harder to use Test-Harness to check if a module works correctly when perl.exe is installed in a directory name with a space in it, giving you a false sense of security. And it would not be correct to rely on the result of Win32::GetShortPathName() not to include any spaces as the generation of short names can be disabled for NTFS, and there may be filesystems that don't even support short names. Is there a good reason not to get rid of this line in _get_perl(): return Win32::GetShortPathName($^X) if IS_WIN32;
On Tue Jul 14 20:16:53 2009, JDB wrote: Show quoted text
> Is there a good reason not to get rid of this line in _get_perl(): > > return Win32::GetShortPathName($^X) if IS_WIN32;
With a "versioned" build of perl, this line also leads to the *removal* of some of the @INC directories. Getting rid of that line fixes that problem, too. Cheers, Rob
On Mon Aug 10 05:19:24 2009, SISYPHUS wrote: Show quoted text
> On Tue Jul 14 20:16:53 2009, JDB wrote: >
> > Is there a good reason not to get rid of this line in _get_perl(): > > > > return Win32::GetShortPathName($^X) if IS_WIN32;
> > With a "versioned" build of perl, this line also leads to the *removal* > of some of the @INC directories. Getting rid of that line fixes that > problem, too.
So, yes, getting rid of it definitely sounds like a good thing. I'm not sure where that line came from - I can't find a change that introduced it in the vc history - so that implies that it's been there a long time. I assume it was introduced to fix some other problem - but unfortunately I can't verify what. Presumable GetShortPathName() yields a path that contains no spaces? That may be the reason for that line. I'll do some experiments next time I'm in front of a Windows box and if I can satisfy myself that that line serves no useful purpose I'll get rid of it. Thanks!
Subject: Re: [rt.cpan.org #47890] Test::Harness changes @INC on Windows
Date: Sun, 17 Jan 2010 13:54:17 -0800
To: bug-Test-Harness [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
Andy Armstrong via RT wrote: Show quoted text
> So, yes, getting rid of it definitely sounds like a good thing. I'm not > sure where that line came from - I can't find a change that introduced > it in the vc history - so that implies that it's been there a long time. > I assume it was introduced to fix some other problem - but unfortunately > I can't verify what. > > Presumable GetShortPathName() yields a path that contains no spaces? > That may be the reason for that line.
Yes, exactly. This was removed from Test::Harness 2 in 2.57_02 and replaced with... return qq["$^X"] if $self->{_is_win32} && ($^X =~ /[^\w\.\/\\]/); So $^X is simply quoted if it has dodgy characters. The change must not have made it to TH3. Incidentally, now that TH is in git I can easily stitch together the history from my old SVN repository. -- The past has a vote, but not a veto. -- Mordecai M. Kaplan
Fixed by commit c963d55f01e35e9d8c66f9a290ca6968ec43dc6b Author: Andy Armstrong <andy@hexten.net> Date: Mon Apr 18 10:15:07 2011 +0100 [#47890] Don't use Win32::GetShortPathName. Thanks.