This is the mail archive of the cygwin-developers@cygwin.com 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: moving towards 1.5.10?


On May  4 12:43, Pierre A. Humblet wrote:
> Corinna, your recent trailing space and dot removal code only handles Posix paths,
> not Windows paths. Is that by design, or should it be moved from

It's more a case of "I don't care for Windows paths", sorry.

> normalize_posix_path into path_conv::check? 

normalize_posix_path and normalize_win32_path are both called twice, so
removing trailing dots and spaces should probably done in the normalize
functions.  The code could be either duplicated or an (inlined) function
call.  Chris?

> Also it should be placed after the removal of the final /, so as to get rid of the 
> trailing . in "/somewhere/mydir./"

Uh, yes, right you are.  That's not covered by my change.  I have a fix
in my sandbox but I'm wondering if somebody has a smarter idea:

Index: path.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/path.cc,v
retrieving revision 1.308
diff -u -p -r1.308 path.cc
--- path.cc     4 May 2004 15:14:48 -0000       1.308
+++ path.cc     4 May 2004 18:20:46 -0000
@@ -196,6 +196,7 @@ normalize_posix_path (const char *src, c
 {
   const char *src_start = src;
   char *dst_start = dst;
+  bool has_trailing_slash = false;
 
   syscall_printf ("src %s", src);
 
@@ -288,8 +289,15 @@ normalize_posix_path (const char *src, c
 done:
   /* Remove trailing dots and spaces which are ignored by Win32 functions but
      not by native NT functions. */
+  if (dst[-1] == '/' && dst > dst_start + 1)
+    {
+      has_trailing_slash = true;
+      --dst;
+    }
   while (dst[-1] == '.' || dst[-1] == ' ')
     --dst;
+  if (has_trailing_slash)
+    *dst++ = '/';
   *dst = '\0';
   *tail = dst;
 

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Co-Project Leader          mailto:cygwin@cygwin.com
Red Hat, Inc.


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