delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/07/31/06:28:02

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=w8dBxoOINw6gP4+2LWWFU5asXdMEK2ItfR/aITRBMmjNfeJb8+3xD
6Gy4vyZm9HUFtR5y8eRQIPYXSm1cNr1DjpzGoIJ1w080lb8xotK4UrVZADUh7vbG
m41DbMFXD1olPjoSHvbS73l1fPQ3DxC79wcCqPrXN/pIJQDpqROmuE=
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=apYI9TfOiFgM9u4FWN7sJELnqEM=; b=N9KZmt3wNbmUiKCjXkEplNVv+zTl
Yqiu74EJRzzR29gfsmgfoPpADBpowHmpt+BHA0r7nYyMkQXQHPHGg09fhRJSlHVe
p0EMt7QSDZIs5w4MEKQBd48KdpMvmYzD08KGWg9YyXgBAOjW0ynVkUlwZebKjdx8
FBY8grv9I3B8PcU=
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=0.3 required=5.0 tests=AWL,BAYES_50,RDNS_NONE autolearn=no version=3.3.1
Date: Wed, 31 Jul 2013 12:27:37 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: [BUG ?] Failed to rebuild Cygwin
Message-ID: <20130731102737.GW4166@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <003401ce8dcb$a630b310$f2921930$%fedin AT samsung DOT com>
MIME-Version: 1.0
In-Reply-To: <003401ce8dcb$a630b310$f2921930$%fedin@samsung.com>
User-Agent: Mutt/1.5.21 (2010-09-15)

On Jul 31 12:55, Pavel Fedin wrote:
>  Hello!
> 
>  I have occasionally found a little problem in path check code. Attempt to
> reference thing like '/..' fails, however at least under Linux this resolves
> to root, and you can actually attempt to go past-root as many times as you
> want, e. g. '/../../../..'. The bug was occasionally revealed by 'make' test
> suite.
>  [...]
>  P.S. I suggest that the way to fix the described path check bug is to undo
> your small optimization and move back setting check_parent flag to:
> --- cut ---
>       /* Strip runs of /'s.  */
>       if (!isslash (*src))
>         {
> 	  *tail++ = *src++;
> 	  check_parent = true;
> 	}
> --- cut ---

This works, but what bugs me a bit is setting a variable to true for
each non-slash character.  That happens a lot of time.

>  The idea behind this is that the check will take place only if we have
> actually got something to check (at least one non-slash character). In case
> of '/..' the first 'isslash(*src)' returns TRUE, consequently the loop will
> not run at all.
>  An alternative is to add a check against 'dst' being empty around the
> actual check:
> --- cut ---
> 		      path_conv head (dst);
> 		      if (!head.isdir())
> 		        return ENOENT;
> --- cut ---

I applied a patch which skips testing / or // when a /.. or //.. has
been encountered.  Can you please give it a try?


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