1.5.1: can't open files beginning with "..."

Igor Pechtchanski pechtcha@cs.nyu.edu
Sun Oct 26 10:51:00 GMT 2003


On Sun, 26 Oct 2003, Corinna Vinschen wrote:

> On Sat, Oct 25, 2003 at 10:58:10PM +0200, Pavel Tsekov wrote:
>
> > On Sat, 25 Oct 2003, Corinna Vinschen wrote:
> >
> > > On Sat, Oct 25, 2003 at 12:04:14AM +0200, Pavel Tsekov wrote:
> > > > > Chris Moore wrote:
> > > > > > I have a file on my PC called "...foo.txt".
> > > >
> > > > This does work, but Cygwin's path handling code understands
> > > > only ".." and "." . If it get three dots in a raw and they
> > > > appear before the last '/' char, Cygwin returns ENOENT.
> > >
> > > Fixed in CVS now.
> >
> > Does it fix the following:
> >
> > Administrator@mordor ~
> > $ cd /usr/bin../
>
> No, it fixes the more than two leading dots problem.  The above is
> a genuin windows problem as you noted in your previous mail.  I don't
> know how to fix this without noticeably slowing down the path conv
> routine.
>
> Corinna

That's what managed mode would be perfect for.  It would need something
like the patch below:

Index: winsup/cygwin/path.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/path.cc,v
retrieving revision 1.277
diff -u -p -r1.277 path.cc
--- winsup/cygwin/path.cc       25 Oct 2003 16:12:45 -0000      1.277
+++ winsup/cygwin/path.cc       26 Oct 2003 01:35:16 -0000
@@ -1178,6 +1178,11 @@ special_name (const char *s, int inc = 1
   if (strpbrk (s, special_chars))
     return !strncasematch (s, "%2f", 3);

+  if (strcasematch (s, ".") || strcasematch (s, ".."))
+    return false;
+  if (s[strlen (s)-1] == '.')
+    return -1;
+
   const char *p;
   if (strcasematch (s, "conin$") || strcasematch (s, "conout$"))
     return -1;

-- 
				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!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list