delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/03/17/13:06:39

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-9.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4BA119E0.60504@redhat.com>
Date: Wed, 17 Mar 2010 12:05:20 -0600
From: Eric Blake <eblake AT redhat DOT com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Lightning/1.0b1 Thunderbird/3.0.3
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: allow executing a path in backslash notation
References: <435451 DOT 56628 DOT qm AT web88306 DOT mail DOT re4 DOT yahoo DOT com> <20100316150700 DOT GZ6505 AT calimero DOT vinschen DOT de>
In-Reply-To: <20100316150700.GZ6505@calimero.vinschen.de>
X-IsSubscribed: yes
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

--------------enigE69145A21E73CC6C84679106
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 03/16/2010 09:07 AM, Corinna Vinschen wrote:
> I checked this situation in cmd.exe, and it is not capable of using
> paths relativ to %Path%.  In other words, if %Path% contains a path
> c:\foo and you have two files C:\foo\baz.exe and C:\foo\bar\baz.exe,
> then calling "baz" works, but calling "bar\baz" fails.  OTOH, the
> SearchPath function does it right.

POSIX says PATH searches are only performed on single components; they
are skipped if the argument contains /.  That is:

PATH=3D/b c/d

will NOT execute /b/c/d (unless you happen to be in /b at the time);
rather it MUST execute ./c/d or fail altogether.  Another term for this
(at least, in the bash sources) is the notion of an anchored search -
even though the requested name is relative, the fact that it contains a
/ means it does not trigger a PATH search, but is anchored in the
current directory.

Therefore, I see no reason why we shouldn't behave the same for \, since
we are treating it as a directory separator.  That is, if you have both
c:\foo\baz.exe and c:\foo\bar\baz.exe, then calling bar\baz should NOT
care whether c:\foo is in %Path%, but should only work if .\bar\baz exists.

--=20
Eric Blake   eblake AT redhat DOT com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


--------------enigE69145A21E73CC6C84679106
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.10 (GNU/Linux)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkuhGeAACgkQ84KuGfSFAYBI+gCeK9GUxhZB8xx3oPhc+wwmzERw
c84An2fxl+uknpBO1RCHvYb931rhmLwI
=D8ZI
-----END PGP SIGNATURE-----

--------------enigE69145A21E73CC6C84679106--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019