From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8829 invoked by alias); 31 Jul 2013 10:27:46 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 8796 invoked by uid 89); 31 Jul 2013 10:27:46 -0000 X-Spam-SWARE-Status: No, score=0.3 required=5.0 tests=AWL,BAYES_50,RDNS_NONE autolearn=no version=3.3.1 Received: from Unknown (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 31 Jul 2013 10:27:46 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id C1DF65201C5; Wed, 31 Jul 2013 12:27:37 +0200 (CEST) Date: Wed, 31 Jul 2013 10:47:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: [BUG ?] Failed to rebuild Cygwin Message-ID: <20130731102737.GW4166@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <003401ce8dcb$a630b310$f2921930$%fedin@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <003401ce8dcb$a630b310$f2921930$%fedin@samsung.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2013-07/txt/msg00694.txt.bz2 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