develooper Front page | perl.perl5.porters | Postings from August 2009

RE: RE: 5.10.1-RC1 Test::Harness ruins @INC

Jan Dubois
August 10, 2009 17:56
RE: RE: 5.10.1-RC1 Test::Harness ruins @INC
Message ID:
On Mon, 10 Aug 2009, wrote:
> > Jan Dubois <> wrote:
> > Could you try the fix I mention in the bug report and check if the
> > missing entries will reappear if the full path for $^X isn't
> > mangled?
> Damn - I've been looking at that mangling of $^X a few times, as it's
> the only place that GetShortPathName() is called within the Test and
> TAP trees ... but I was too stupid to think of commenting out that
> line just to see what difference it makes :-(
> It does, indeed, fix my problem - and I'll certainly be removing that
> line from TAP/Parser/Source/ (if it hasn't been removed for me
> when 5.10.1 is released).

While I think that the TAP::Parser change is ill-advised, the behavior you see
with the dropped directories in @INC is nevertheless a bug in core Perl
(because calling Perl with the short pathname should not change the

Could you try the attached patch to see if it normalizes the Perl behavior
regarding $^X and @INC again?  If you can confirm that it works for you
then I'll commit it to blead, which means eventually we don't care anymore
if the problematic code in TAP::Parser gets reverted or not.

Don't expect this to go into 5.10.1 though; it is too late for that.


--- perl/5.10/win32/win32.c.~1~	Mon Aug 10 17:47:09 2009
+++ perl/5.10/win32/win32.c	Mon Aug 10 17:47:09 2009
@@ -231,6 +231,13 @@
          * explicitly by LoadLibrary() with a relative path. */
         GetFullPathNameW(modulename, sizeof(fullname)/sizeof(WCHAR), fullname, NULL);
+        /* Make sure we start with the long path name of the module because we
+         * later scan for pathname components to match "5.xx" to locate
+         * compatible sitelib directories, and the short pathname might mangle
+         * this path segment (e.g. by removing the dot on NTFS to something
+         * like "5xx~1.yy") */
+        GetLongPathNameW(modulename, modulename, sizeof(modulename)/sizeof(WCHAR));
         /* remove \\?\ prefix */
         if (memcmp(fullname, L"\\\\?\\", 4*sizeof(WCHAR)) == 0)
             memmove(fullname, fullname+4, (wcslen(fullname+4)+1)*sizeof(WCHAR));
End of Patch. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About