delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/06/11/11:26:43

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=JPwwa8MsiH7ONXmE/wHr0b7Dk7nZQSCcMvTotAOVm7ufBrXc/lH6h
1E1OAxsGkcz+wGcGLY1zosIedcbkvc1azEXpOk1ycTo3LzwSoPQPcOuO4aXI1Wto
5oeTJvcogI+3dq1fldCxI50HLWolk1h/bLHi1nBYdSJlzMwxc5JlJM=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=+BS3raVhqi/3aEs4wDTHGb5eO4g=; b=Y6UZBjTtuStsAAqKfxiTinL8xyQE
t/+LMe6YSWJ2soRXGZcdvYcG8rbkEveKF41G2KQbfssZ2JPdNeBrI83NlKP/7AlY
lqNsrqB4a0FseaR0i8GDDeiHlNT9t4cU9f8FpYsvTaELz0aUjLNsq0stysTiBUcJ
qu/zUQAihiCGFXw=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.1
Date: Tue, 11 Jun 2013 17:26:24 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: [PATCH] Check for existence of the path before processing '..'
Message-ID: <20130611152624.GE9484@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <001401ce66a4$bb9029a0$32b07ce0$%fedin AT samsung DOT com> <20130611142002 DOT GA1927 AT ednor DOT casa DOT cgf DOT cx> <20130611150446 DOT GB9484 AT calimero DOT vinschen DOT de> <20130611151708 DOT GB2235 AT ednor DOT casa DOT cgf DOT cx>
MIME-Version: 1.0
In-Reply-To: <20130611151708.GB2235@ednor.casa.cgf.cx>
User-Agent: Mutt/1.5.21 (2010-09-15)

On Jun 11 11:17, Christopher Faylor wrote:
> On Tue, Jun 11, 2013 at 05:04:46PM +0200, Corinna Vinschen wrote:
> >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.
> 
> Yes, but it is a HUGE stack hit to call path_conv recursively here.

Shouldn't that be much reduced by the fact that the temporary buffers
used by path_conv are tmp_pathbuf buffers?  Originally, when we started
with 1.7, we had all those 64K buffers on the stack and thus a lot of
spurious crashes due to stack overflow.  But since using tmp_pathbuf
buffers we got rid of those.

Maybe we should contemplate the idea to raise the maximum number of
tmp_pathbuf buffers to accommodate situations we're not aware of at
this point in time.

> >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.
> 
> If we are considering doing this, then couldn't we somehow just avoid
> eliminating "/.." until after the path is fully parsed and then collapse
> all of them in one final loop?  Also, don't we have the same problem for
> foo/./bar?  We change that to foo/bar but foo may not exist.

The problem with .. is that a path component disappears while normalizing
the path, without checking it's existence.  Therefore foo/./bar is no
problem here, because the final patch still contains foo and thus it's
existence will be checked anyway.

I may be missing something, but if we don't remove .. and . from the
path right at the start of path_conv, then we have exactly the problem
which so far kept us from doing the check:  A . or .. component spoils
the mount_table->conv_to_win32_path path, and it might (I'm *not* sure)
break the sym.check call as well.


Corinna

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019