[PATCH] Problem with filenames ending in "." with check_case:strict

Igor Pechtchanski pechtcha@cs.nyu.edu
Wed Mar 30 18:51:00 GMT 2005


Hi,

I noticed that my Makefiles that tack on a "." to the filename to
differentiate no-ext targets from .exe targets stopped working with the
update from 1.5.12 to latest CVS (yes, I know, a little late).  I've
tracked it down to
<http://cygwin.com/ml/cygwin-cvs/2004-q4/msg00145.html>.

Basically, the trailing spaces and dots used to be stripped always, and
now they're only stripped if raw WinNT names are used.  This breaks
symlink_info::case_check, since the name returned by FindFirstFile and the
name extracted from the path parameter are different (the path has
trailing dots and spaces).  Thus, "touch a." doesn't work anymore with
check_case:strict.

The attached (trivial, IMO) patch fixes this issue.
	Igor
P.S. Corinna, Rose should have the corresponding FAX already.
==============================================================================
ChangeLog:
2005-03-21  Igor Pechtchanski  <pechtcha@cs.nyu.edu>

	* path.cc (symlink_info::case_check): Ignore trailing characters
	in paths when comparing case.

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT
-------------- next part --------------
Index: winsup/cygwin/path.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/path.cc,v
retrieving revision 1.355
diff -u -p -r1.355 path.cc
--- winsup/cygwin/path.cc	12 Mar 2005 02:32:59 -0000	1.355
+++ winsup/cygwin/path.cc	22 Mar 2005 00:46:23 -0000
@@ -3217,6 +3217,7 @@ symlink_info::case_check (char *path)
   WIN32_FIND_DATA data;
   HANDLE h;
   char *c;
+  int len;
 
   /* Set a pointer to the beginning of the last component. */
   if (!(c = strrchr (path, '\\')))
@@ -3230,7 +3231,8 @@ symlink_info::case_check (char *path)
       FindClose (h);
 
       /* If that part of the component exists, check the case. */
-      if (strcmp (c, data.cFileName))
+      len = strlen(data.cFileName);
+      if (strncmp (c, data.cFileName, len))
 	{
 	  case_clash = true;
 


More information about the Cygwin-patches mailing list