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:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type; q=dns; s=default; b=CB86+X t66NDD/FyXE3purzGolujHD/S+xCNwwA0fsNRj3ccgTkcRbq5JPn4lL7WKnIkYL4 +ZHgdfvrn+TXpZfPtQSXPG48y6dHn/KuY9sj65XhEUpJF86t5Euo8Qg6XImc7J24 AKwVqNwpchoo4Z6ykaFB9H+OxD8L04xKvyrPQ= 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:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type; s=default; bh=eMbh990u8Ios tZUXrtdo+bZCcFA=; b=WsW1FzsKaOh7BWzPpTFw6OvHeyXS7KeBuoyu97kLefH0 dIY6+RpsWK3Q2H4O1h6lwWzGR7Z1ma4O59qNzKIsJwcBZpKibuvxtqvWMYjku/dN jSYzZDI712P4qake/QbinRlN8oHQ5NB7+WgrrTuvqCV8+08+nH9xpzfpEo68NqU= 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: No, score=-5.6 required=5.0 tests=AWL,BAYES_20,KHOP_PGP_SIGNED,KHOP_THREADED,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Message-ID: <5239C62F.6030602@redhat.com> Date: Wed, 18 Sep 2013 09:26:39 -0600 From: Eric Blake User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: cygpath -m behaviour change References: In-Reply-To: OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="IC8gXT352fhAP60nHanlrSprlNaLvc0pt" X-IsSubscribed: yes --IC8gXT352fhAP60nHanlrSprlNaLvc0pt Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 09/18/2013 08:34 AM, David Griffiths wrote: > Hi, the script is attempting to determine the directory in which it > exists, so CURRENT_DIR is a bit misleading. This is so that it can > access other files in the same package relative to it (quite a common > technique I think). >=20 > Might be helpful to have some examples: >=20 > /home/dgriff> mkdir test > /home/dgriff> cd test > /home/dgriff/test> cygpath -m "file\.." > ./ Using \ means you are asking Windows to do the resolution, and Windows has a known issue that it is intentionally NOT posix-compliant unless you tweak a registry option. But the fact that you can tweak a registry option means that you CAN encounter machines where file\.. will fail to resolve instead of (incorrectly optimizing) to . without first checking whether "file/" is a directory. > /home/dgriff/test> cygpath -m "file/.." > cygpath: error converting "file/.." - No such file or directory This is POSIX-mandated behavior, and since you used /, you asked for POSIX semantics. This is not a bug. >=20 > Note that the backslash variant always works and all of these used to > work under previous levels of cygwin. The backslash variants "work" only so far as the windows registry setting has not been tweaked to allow windows to use its non-posix "optimization". But why are you even using cygpath to try and determine the containing directory? 'dirname' does that task, in a much more portable manner, and without having to worry about whether 'file/..' can be abused in spite of POSIX semantics. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --IC8gXT352fhAP60nHanlrSprlNaLvc0pt Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSOcYvAAoJEKeha0olJ0NqM74H/12sUn8gVAP3TqqpdpQVI/Ws f7ereSBz2cy6Dl+pNNhNzRWxYVSMS2T4gVFLuqoFxYhtsHrqlSx+lsZ1LFYepb/b Q5mlZUXedO8FnTBRwx4Npe/Wd+LXmtPHhOo8d8yE9DbhaXaSQWSrESZ4lb7M3J+y Oy4LW2vrNaXRqNghWZIyR9v9R8ShUQTLbL6d2FutEzecwlWUi/+D8G3uG61ReJK5 IEbuds9l0f16MqPHf9dIIqWa5NlI/blWMfeGW9lNzGVeJW5zB/D4StUzbUe+vK63 4nxDbhaK/EgD4rlisea1HJejQ8C40dS6gbthcvQCCT63XOKaplxUyI28ZzXyAU4= =w5rS -----END PGP SIGNATURE----- --IC8gXT352fhAP60nHanlrSprlNaLvc0pt--