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 [not cygwin issue last post]


-----Original Message-----
> From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com] On Behalf Of Eric Blake
> Sent: Wednesday, May 19, 2010 2:51 PM
> To: cygwin@cygwin.com
> Subject: 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.

Thanks for your help in tracking this down.
I found out that ./ and ./bin were being prepended to PATH by Mortens Cygwin X-Launcher.
FWIW, ./ is in the default PATH in Mortens Cygwin X-Launcher.  
I removed them from there and added "export PATH=$PATH:~/bin/:./bin/:./" to ~/.bash_login.
Everything began working correctly afterward.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


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