Subject: Re: bug #3542 (23.0.94; File access via UNC path slow again under Windows)

From: Eli Zaretskii <[email-masked]>
Date: Thu, 09 Jul 2009 21:50:19 +0300

> From: Mathias Dahl <[email-masked]>
> Date: Sun, 5 Jul 2009 23:01:53 +0200
> 
> I understand that the release of 23.1 is not far away and I am a bit
> worried that this bug won't be solved before that. Is there anything I
> can do to help? I use a lot of UNC file names / paths in my work and
> the current slowness is very annoying (both opening files and listing
> them in Dired). As this was a problem in the past too it isn't
> unreasonable to believe that the bug has reappeared by mistake when
> fixing some other thing (could it be related to TRAMP?).
> 
> I am willing to go bug hunting as long as it's in elisp-land and would
> like to get some hints on where to start digging.
> 
> For details see:
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3542
> 
> Thanks!

Fixed with this patch:

2009-07-09  Eli Zaretskii  <[email-masked]>

	* w32.c (stat): Treat UNC file names as residing on remote
	drives.  (Bug#3542)

--- src/w32.c.orig	2009-06-21 10:38:18.000000000 +0300
+++ src/w32.c	2009-07-09 16:31:51.250000000 +0300
@@ -3154,11 +3154,13 @@
 	}
     }
 
-  /* GetDriveType needs the root directory of NAME's drive.  */
-  if (!(strlen (name) >= 2 && IS_DEVICE_SEP (name[1])))
-    devtype = GetDriveType (NULL); /* use root of current diectory */
+  if (IS_DIRECTORY_SEP (name[0]) && IS_DIRECTORY_SEP (name[1]))
+    devtype = DRIVE_REMOTE;	   /* assume UNC name is remote */
+  else if (!(strlen (name) >= 2 && IS_DEVICE_SEP (name[1])))
+    devtype = GetDriveType (NULL); /* use root of current drive */
   else
     {
+      /* GetDriveType needs the root directory of NAME's drive.  */
       strncpy (drive_root, name, 3);
       drive_root[3] = '\0';
       devtype = GetDriveType (drive_root);