This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: allow executing a path in backslash notation


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=/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.

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

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]