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: bash - command - PATH question


On 05/19/2010 01:42 PM, Rockefeller, Harry wrote:
> $ type mysvn
> mysvn is hashed (./mysvn)

There's your problem.  Bash remembers the hashed location of where it
last found the command, but that location is relative.  You either need
to disable bash's hashing, or force it to re-evaluate its hash as soon
as you are in a different directory.  'shopt -s checkhash'.

> $ echo $PATH
> [gives a very long path.  Yes, ./ and ./bin are present but are the only
> relative paths in the listing.]

Obligatory comments about having '.' in your PATH being a security hole,
opening the door for trojan horse applications.  (Well, I do it, but
only as the LAST item in my PATH, so that any application I am likely to
run occurs earlier in the PATH).  But ./bin?  Seriously, change your
path to call out an absolute path of ~/bin instead of using ./bin and
relying on the first invocation being from ~.  That way, bash will hash
the absolute name in the first place.

At which point, this is no longer a cygwin-specific question - you would
get the same behavior on Linux.

-- 
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]