This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: path conversion regression?


On Jan  9 10:09, Corinna Vinschen wrote:
> On Jan  9 00:43, Christopher Faylor wrote:
> > Shouldn't this:
> > 
> > cygpath -u 'c:\cygwin\bin\cygwin1.dll'
> >             ^
> > 
> > be equivalent to:
> > 
> > cygpath -u 'C:\cygwin\bin\cygwin1.dll'
> >             ^
> > [...]
> I thought the code I added lately (*) had taken care of DOS paths so that
> they are always treated caseinsensitive so your patch shouldn't have been
> necessary.  Looks like that doesn't work as advertised.  I take a look.

Thinko, sorry.  That's not the problem here.

> Hmm, the mount table entries are another point.  I think what we really
> should do is to convert all incoming DOS paths, no matter where they
> come from, to an uppercased drive letter.  Later code then doesn't have
> to care for the case anymore.

I've created a patch which always creates uppercased drive letters
so it doesn't matter if the path is casesensitive or not.  It also
allows to revert your patch to path_prefix_p.  See below.  Is that
ok with you or would you rather stick to the test in path_prefix_p?


Corinna


	* mount.cc (mount_info::from_fstab_line): Always convert drive
	letter in native path to uppercase.
	* path.cc (normalize_win32_path): Ditto.
	(path_prefix_p): Revert previous patch.


Index: mount.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/mount.cc,v
retrieving revision 1.30
diff -u -p -r1.30 mount.cc
--- mount.cc	3 Jan 2009 05:12:21 -0000	1.30
+++ mount.cc	9 Jan 2009 13:36:13 -0000
@@ -876,6 +876,9 @@ mount_info::from_fstab_line (char *line,
   char *cend = find_ws (c);
   *cend = '\0';
   native_path = conv_fstab_spaces (c);
+  /* Always convert drive letter to uppercase for case sensitivity. */
+  if (isdrive (native_path))
+    native_path[0] = cyg_toupper (native_path[0]);
   /* Second field: POSIX path. */
   c = skip_ws (cend + 1);
   if (!*c)
Index: path.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/path.cc,v
retrieving revision 1.538
diff -u -p -r1.538 path.cc
--- path.cc	9 Jan 2009 05:18:01 -0000	1.538
+++ path.cc	9 Jan 2009 13:36:14 -0000
@@ -169,20 +169,8 @@ path_prefix_p (const char *path1, const 
     return isdirsep (path2[0]) && !isdirsep (path2[1]);
 
   if (isdirsep (path2[len1]) || path2[len1] == 0 || path1[len1 - 1] == ':')
-    {
-      if (len1 < 2 || (path1[1] != ':') || (path2[1] != ':'))
-	/* nothing */;
-      else if (tolower (*path1) != tolower(*path2))
-	return 0;
-      else
-	{
-	  path1 += 2;
-	  path2 += 2;
-	  len1 -= 2;
-	}
-      return caseinsensitive ? strncasematch (path1, path2, len1)
-			     : !strncmp (path1, path2, len1);
-    }
+    return caseinsensitive ? strncasematch (path1, path2, len1)
+			   : !strncmp (path1, path2, len1);
 
   return 0;
 }
@@ -1177,17 +1165,23 @@ normalize_win32_path (const char *src, c
 	    }
 	}
     }
-  if (tail == dst && !isdrive (src) && *src != '/')
+  if (tail == dst)
     {
-      if (beg_src_slash)
-	tail += cygheap->cwd.get_drive (dst);
-      else if (!cygheap->cwd.get (dst, 0))
-	return get_errno ();
-      else
-	{
-	  tail = strchr (tail, '\0');
-	  if (tail[-1] != '\\')
-	    *tail++ = '\\';
+      if (isdrive (src))
+	/* Always convert drive letter to uppercase for case sensitivity. */
+	*tail++ = cyg_toupper (*src++);
+      else if (*src != '/')
+	{
+	  if (beg_src_slash)
+	    tail += cygheap->cwd.get_drive (dst);
+	  else if (!cygheap->cwd.get (dst, 0))
+	    return get_errno ();
+	  else
+	    {
+	      tail = strchr (tail, '\0');
+	      if (tail[-1] != '\\')
+		*tail++ = '\\';
+	    }
 	}
     }
 


-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]