This is the mail archive of the cygwin 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: stat() and tilde prefix (was bad bash tab completion)


On Jan 14 16:37, Ryan Johnson wrote:
> On 14/01/2013 3:24 PM, Stephan Mueller wrote:
> >Perhaps (as you may well have already considered):
> >
> >- replace the path prefix by the mount point first?  (this may be naÃve
> >   on my part, but it's not clear to me that .. early in a path should be able
> >   to influence which mount point is substituted)
> If I mount something at /foo/bar/baz, then /foo/bar/baz/../../blah
> definitely shouldn't end up inside baz.
> 
> >- test directory existence of the component preceding .. before collapsing
> >   (in the example above) b/.. to nothing.
> >- trust that for a/b3/b2/b/../../../c, the existence test of a/b3/b2/b
> >   before collapsing b/.. to nothing implies existence of b2 and b3 so no
> >   further tests are needed for 'runs' of .. components with enough
> >   components before them
> >
> >Understood that this is still going to cause a slowdown because paths with
> >.. are not uncommon, but it would reduce the number of additional
> >existence checks from one-per-path-component to one-per-run-of-..,
> >which means none in the case of paths without .. in them.
> The rest seems totally reasonable to me, FWIW.

That's a chicken/egg-like situation.  To be able to convert the
POSIX path prefix (aka mount point) to the matching DOS path prefix,
the path has to be normalized.  But without being converted to a
DOS path, you can't check path components.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

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


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