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=qlmB6ySZitP5OX8caUzAV5ldoYDGC7uy5xA/DoLg5hTMRYx0Wa0mG b52pYhmfNNveVmuuGrp3IIPyo0m28MRyBAxaq3lkMO9tubZcrDIetqxb0vdTrmt1 3Ux2Aqr9hmbr1gVGqrzVy/AM56ZoaPwEUUb5/D2ec/nm0hW4uV7Ou4= 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=eBdwt9X7/KCqi8l7942Kc8IgeFw=; b=IWEHPNuuilK9L/ki3ZOZ+CEpQVgc 9VAJuCxnU9Ml8pwV35cUWrIU9CEu5JscjbwiSAgV4Ry1fsmg/Gt6fmSdQmRK5+g5 EM2FMfd/wdHKtimLjfCek0XFb10TWTrz9mFWJRmHycHP4rp9FuJENREU12lIRTnJ bEUv3EHNQsIJ7q4= 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 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=-100.2 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_BRBL_LASTEXT,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Jo=c3=a3o, jo=c3=a3o?= X-HELO: drew.franken.de Date: Tue, 12 Dec 2017 10:16:42 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Issue with resolving symlinks (realpath, readlink, etc) Message-ID: <20171212091642.GS18791@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="7LkOrbQMr4cezO2T" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) --7LkOrbQMr4cezO2T Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Dec 11 18:18, Jo=C3=A3o Eiras wrote: > Hi. >=20 > Programs and functions that rely in realpath() are broken. >=20 > Example: > $ cd > $ ln -s /var symlink > $ cd symlink > $ readlink -m . > /var > $ mkdir subfolder > $ cd subfolder > $ readlink -m . > /home/user/symlink/subfolder > # should be /var/subfolder >=20 > This is the block I think is causing problems, as it breaks the loop > as soon as a real file is found, instead of iterating further upwards > resolving ancestors. > https://cygwin.com/git/gitweb.cgi?p=3Dnewlib-cygwin.git;a=3Dblob;f=3Dwins= up/cygwin/path.cc#l994 >=20 > There also a comment at line 736 that says: > "Scan path_copy from right to left looking either for a symlink or an > actual existing file. If an existing file is found, just return. If a > symlink is found, exit the for loop." This is an old problem in the path_conv class, given that POSIX mandates scanning the patch from left to right. However, changing this isn't simple. For one thing the path conversion POSIX<->Windows is already slower than desired, and scanning from left to right would make it probably worse. But the real problem is that this would basically mean a re-write of the path_conv class. Given how much this is a core component it's quite the task. Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --7LkOrbQMr4cezO2T Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJaL556AAoJEPU2Bp2uRE+goREP/2itWJ2iWQVJxn3wxl9Fl7eh Ab9uO1MN+7CyMypV0A5kbxWGB5L/RarHnhrKkJzAcQBa2wadXjRRmpX3LADj9Iyp JgaBUIjYktoF3qfLApTk1HbgCDx9LBqX4lPockAToeaV729NCFuwEZzZ0mU/LOnO x9wFoks+nuZeXnTXvBzXVvxhKu53cyJXyOCrKRtjrRKlWQdoxJrq3ch0xvk8Guem kKREeemEgLTIUDk+a9ssHwjrrGXXKDkyPBawxBJ1ezLlpFkAVC1XyzVnL2vlBOhR D2EFTWNauabc3RT0Z8PuWFYz90I3KZOdjdyyVeoIzJYO13A6qGZHAjd4fCKd+AZB DiPCn7ys2db6h3WkkmthiYfT6UV/3FZq5Frj5Fps58RbKz8pvWJxHNshe5qSWO/E cm7jzsRkN37f5FjbW3VVIv3SIUO6FdV1VoCMpAWJ7q4bvIkGd4mz8EedtiKZbc1r NUSgYMZpbvcVtPwZn8XB9Zq9trssPdQ6HSDfn3b6i8TU56Ssko/qIgS1fvwRimxQ /TQdYhjKoTjMcXIAO3T2oUhGFtphz2dwqn4gWyNAEVR9qoezoXr1yVCy9svyXFZO 2QkxWZA99TRhjrV1ZKce1M8rHbPZOp4I4SULuN3uA3MyOlkVMobLczOs8i4T1/63 l8V+LIcr0frRwXczThdQ =2RBL -----END PGP SIGNATURE----- --7LkOrbQMr4cezO2T--