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=aWk5kxqrMHPo1SGPk5a4J2eSXDkpEPeg1IE2oDoRgcyXeQ8CYImG+ 2GXYgsM6N+JoVLbTKgRO8sr0e/9kicWQTLd7j2EnBfrw73B/+wQwNs7l8jjQvHjh NhFpGJvyV0ZGuL/xgPkKgnlEc1G9lhSsVpQuzCl9N2dtA6xYFX3eoM= 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=ItmYeQI3cMmg1OCG9ij8dndJ7tw=; b=BAfkb0YJPXGTtUST1ElHLNSS1Tnr vc7UxOmj9/yhvovquNzQ6q9bLLCiEOyZ7pmg8mDp6YVDFWTrHU63PYE0CtU5nXhc 83vh3UmAhS3rmWIzQAXyepC0440+7r7LdOZ4WG7ab/Lzz/6/YYya0I+1XCbUnIL9 j8PCenbCXni6yIY= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE autolearn=ham version=3.3.1 X-Mail-Handler: Dyn Standard SMTP by Dyn X-Report-Abuse-To: abuse AT dyndns DOT com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX18pz8pvF5qj3v8PpS61w2/b Date: Tue, 11 Jun 2013 10:20:02 -0400 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: [PATCH] Check for existence of the path before processing '..' Message-ID: <20130611142002.GA1927@ednor.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <001401ce66a4$bb9029a0$32b07ce0$%fedin AT samsung DOT com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <001401ce66a4$bb9029a0$32b07ce0$%fedin@samsung.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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 >is done for things like "../..". Because, obviously, if "/foo/bar/baz" >exists, then "/foo/bar" exists too. Also, the check is done only after some >components have been added to the path. So, for example, current directory >(obtained when processing relative paths), will not be checked. > I tried to add a similar test also to normalize_win32_path() function, >however this broke things like "cd /usr/src/..". For some reason, a POSIX >version of the path (but with reversed slashes) is passed to this routine >when expanding mount points, so, consequently, test for "\usr\src" using >GetFileType() fails. > I think it's ok, at least POSIX paths now behave in POSIX way. I have >tested against performance, there is some loss (~0.2 seconds), but only for >referencing '..'. > With this patch i am able to compile the latest version of glibc with no >problems. You introduce a check_parent flag which is set every time a non-slash character is found. That doesn't seem right. It seems like it should be set whenever you see a slash. Also you are calling path_conv recursively. I assume that is where you are seeing a performance hit. cgf -- 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