Patch to allow trailing dots on managed mounts
Corinna Vinschen
vinschen@redhat.com
Mon Dec 20 15:45:00 GMT 2004
On Dec 20 10:17, Christopher Faylor wrote:
> On Mon, Dec 20, 2004 at 11:23:29AM +0100, Corinna Vinschen wrote:
> >On Dec 19 21:57, Pierre A. Humblet wrote:
> >> At 09:44 PM 12/18/2004 -0500, Christopher Faylor wrote:
> >> >
> >> >For now, I'm disallowing all use of '.\' and ' \' in a path. It seems
> >> >more consistent to disallow everything than to allow some stuff. I
> >> >didn't change the symlink code to disallow "ln -s foo bar..." If someone
> >> >actually complains about this, maybe I will.
> >> >
> >> >So, "ls /bin........." works, "ls /bin./pwd.exe" doesn't work and "ls
> >> >/cygwin/c/cygwin/bin./pwd.exe" doesn't work either. Nor does
> >> >"ls c:\cygwin\bin.\pwd.exe". I don't know if we'll hear complaints about
> >> >this one or not.
> >
> >I guess we will. The trailing dots are not removed from the POSIX path
> >in case of chdir, but the chdir itself succeeds. That leads to an
> >unexpected result:
> >
> >$ cd /bin...
> >$ pwd
> >/bin... <- This was printed as /bin before
> >$ ls sh.exe
> >ls: sh.exe: No such file or directory
> >
> >In terms of consistancy it should be impossible to chdir already,
> >shouldn't it?
>
> If we're allowing trailing dots then I guess we should strip them from the
> posix path as well as the windows path.
What I'm trying to say is, if it's possible to chdir into a directory
with a non-existant name, then it comes as a surprise that stat()
fails for files inside that directory. The inconsistancy I see is
that `ls /bin.../foo' does not work, but cd'ing into /bin... works.
After that, ls foo doesn't work either, but the successing chdir is
somewhat misleading.
> >AFAICS, this code could go.
>
> We're talking about this code, right?
>
> else if (src[2] && !isslash (src[2]))
> {
Actually just about this part:
> if (src[2] == '.')
> {
> /* Is this a run of dots? That would be an invalid
> filename. A bunch of leading dots would be ok,
> though. */
> int n = strspn (src, ".");
> if (!src[n] || isslash (src[n])) /* just dots... */
> return ENOENT;
> }
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader mailto:cygwin@cygwin.com
Red Hat, Inc.
More information about the Cygwin-patches
mailing list