[PATCH] normalize_posix_path and c:/foo/bar

Brian Dessent brian@dessent.net
Sun Mar 16 07:24:00 GMT 2008


There's a small buglet in normalize_posix_path in that it doesn't see
c:/foo/bar type paths as being win32 and so it treats them as a relative
path and prepends cwd.  Things go downhill from there.  The testcase
that exposed this was insight failing to load because some of the tcl
parts use win32 paths, but really a reduced testcase is simply
open("c:/cygwin/bin/ls.exe", O_RDONLY) = ENOENT.

Brian
-------------- next part --------------
2008-03-16  Brian Dessent  <brian@dessent.net>

	* path.cc (normalize_posix_path): Correctly identify a win32
	path beginning with a drive letter and forward slashes.

 path.cc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: path.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/path.cc,v
retrieving revision 1.479
diff -u -p -r1.479 path.cc
--- path.cc	12 Mar 2008 16:07:04 -0000	1.479
+++ path.cc	16 Mar 2008 07:18:41 -0000
@@ -253,7 +253,7 @@ normalize_posix_path (const char *src, c
   char *dst_start = dst;
   syscall_printf ("src %s", src);
 
-  if ((isdrive (src) && src[2] == '\\') || *src == '\\')
+  if ((isdrive (src) && (src[2] == '\\' || isslash (src[2]))) || *src == '\\')
     goto win32_path;
 
   tail = dst;


More information about the Cygwin-patches mailing list