delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/05/19/17:08:42

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,TW_SV,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
From: "Rockefeller, Harry" <Harry DOT Rockefeller AT flightsafety DOT com>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Date: Wed, 19 May 2010 16:08:24 -0500
Subject: RE: bash - command - PATH question [not cygwin issue last post]
Message-ID: <3185EFAF9C8F7B4E9DBDF56829BF7C78378E8F8F@srv060ex01.ssd.fsi.com>
References: <3185EFAF9C8F7B4E9DBDF56829BF7C78378E8F0B AT srv060ex01 DOT ssd DOT fsi DOT com> <4BF3FC7A DOT 8030705 AT bopp DOT net> <3185EFAF9C8F7B4E9DBDF56829BF7C78378E8F33 AT srv060ex01 DOT ssd DOT fsi DOT com> <ht102a$5fg$1 AT dough DOT gmane DOT org> <3185EFAF9C8F7B4E9DBDF56829BF7C78378E8F41 AT srv060ex01 DOT ssd DOT fsi DOT com> <3185EFAF9C8F7B4E9DBDF56829BF7C78378E8F57 AT srv060ex01 DOT ssd DOT fsi DOT com> <3185EFAF9C8F7B4E9DBDF56829BF7C78378E8F6F AT srv060ex01 DOT ssd DOT fsi DOT com> <4BF43867 DOT 3070908 AT redhat DOT com> <3185EFAF9C8F7B4E9DBDF56829BF7C78378E8F81 AT srv060ex01 DOT ssd DOT fsi DOT com> <4BF44116 DOT 1010200 AT redhat DOT com>
In-Reply-To: <4BF44116.1010200@redhat.com>
MIME-Version: 1.0
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

-----Original Message-----
> From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com] On Behalf =
Of Eric Blake
> Sent: Wednesday, May 19, 2010 2:51 PM
> To: cygwin AT cygwin DOT 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 las=
t found the command, but that location is relative.  You either need to dis=
able 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=20
> > 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 a=
s the LAST item in my PATH, so that any application I am likely to run occu=
rs earlier in the PATH).  But ./bin?  Seriously, change your path to call o=
ut an absolute path of ~/bin instead of using ./bin and relying on the firs=
t invocation being from ~.  That way, bash will hash the absolute name in t=
he 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 Cygwi=
n X-Launcher.
FWIW, ./ is in the default PATH in Mortens Cygwin X-Launcher.=20=20
I removed them from there and added "export PATH=3D$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

- Raw text -


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