Sun Apr 26 12:23:12 2015: Request 103983 was acted upon.
Transaction: Ticket created by https://me.yahoo.com/howdidwegetherereally#f714d
       Queue: Win32
     Subject: Test Fails for GetShortPathName
   Broken in: 0.51
    Severity: (no value)
       Owner: Nobody
  Requestors: strom...@nexgo.de
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=103983 >


GetShort PathName tests do not check if the file system the test runs on 
actually has short path names enabled.  Consequently it fails if run from a 
drive where that feature is not turned on.  Itz appears that only the System 
Drive has that feature enabled by default on most installations although it 
could be switched off there as well.  The following patch demonstrates the 
issue, if run on Cygwin/Win8.1 from an extra disk the test fails.  Moving the 
test file to the system drive, the test succeeds using the same build.

A rea fix should check the file system and/or try to use the system drive 
(which might not be "C:", so it needs to be determined).  If that's not 
possible the tests need to be skipped if short path names a re not available.

--- origsrc/Win32-0.51/t/GetShortPathName.t     2013-11-08 21:42:25.000000000 
+0100
+++ src/Win32-0.51/t/GetShortPathName.t 2015-03-08 19:46:49.706174300 +0100
@@ -2,18 +2,21 @@ use strict;
 use Test;
 use Win32;
 
-my $path = "Long Path $$";
+my $path = "C:\\Long Path $$";
 unlink($path);
 END { unlink $path }
 
-plan tests => 5;
+plan tests => 7;
 
 Win32::CreateFile($path);
 ok(-f $path);
 
 my $short = Win32::GetShortPathName($path);
-ok($short, qr/^\S{1,8}(\.\S{1,3})?$/);
+ok($short, qr/^C:\\\S{1,8}(\.\S{1,3})?$/);
 ok(-f $short);
+my $long = Win32::GetLongPathName($short);
+ok($long, $path);
+ok(-f $long);
 
 unlink($path);
 ok(!-f $path);

Reply via email to