[PATCH] Check for existence of the path before processing '..'

Corinna Vinschen corinna-cygwin@cygwin.com
Tue Jun 11 15:09:00 GMT 2013

On Jun 11 17:04, Corinna Vinschen wrote:
> On Jun 11 10:20, Christopher Faylor wrote:
> > On Tue, Jun 11, 2013 at 05:08:13PM +0400, Fedin Pavel wrote:
> > > Hello!
> > >
> > > Some time ago i reported ability to access things like
> > >"/usr/nonexistent/..bin". I still had this problem and i tried my hands on
> > >fixing it.
> > > The patch works by checking the actual existence of the path before
> > >removing the last component from it. For performance reasons, only one check
> > [...]
> > Also you are calling path_conv recursively.  I assume that is where you
> > are seeing a performance hit.
> I don't see how do this without calling path_conv, though.  You have to
> perform the full conversion on the parent path, with symlinks and
> everything to get the right result.
> However, I'm rather impressed by the low impact of this change.  I moved
> the check_parent setting so it's only set when a slash occurs, and then
> I made a couple of runs building coreutils.  As you know, GCC uses ..
> paths a lot.  The performance hit is almost unnoticable:  72.3 seconds
> without, 73.4 seconds with the patch.

Ouch, I computed 2 minutes as 60 seconds here :-P

Correctly computed it's even more impressive: 132.3 secs without, 133.4
secs with the patch.  These are average numbers over 5 runs each.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 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

More information about the Cygwin mailing list