delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/05/19/15:51:28

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_SV,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <4BF44116.1010200@redhat.com>
Date: Wed, 19 May 2010 13:50:46 -0600
From: Eric Blake <eblake AT redhat DOT com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-3.fc13 Lightning/1.0b1 Mnenhy/0.8.2 Thunderbird/3.0.4
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: bash - command - PATH question
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>
In-Reply-To: <3185EFAF9C8F7B4E9DBDF56829BF7C78378E8F81@srv060ex01.ssd.fsi.com>
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

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

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.

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


--------------enig4AF731CB8228D7B95D250CE4
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJL9EEWAAoJEKeha0olJ0NqqI4H/AvhMc4zmW49/sg1Te720ORQ
eISluRhjctlhkM4DEydWJWUaz10UhfNlOGtmOHAGV9paXFekHff1G6dMxHZ34IFk
zKqktbIgPTGueraPcbvUapwPAHhhWRFI/DTYBY5d0EP3xj4b9cXUlabfjenzXFY0
/yyTeJLN4OiOm1WOyYbO+5kUuYRPZABfipdIdPiIxacVybrWCHHTy5m/8PweN7Gz
zJZiTTGM4W6spkgohRRAvdN4aXBWmA5blQ04FsGnA1CJmCpgpLJaTAv2wYGElVAE
6UW4i6y6S6CBKiI2fPZPTM4/Dhqo86HoMk+nIr1CUgRltK5K1GCzHOQ5HssxiVk=
=/jmh
-----END PGP SIGNATURE-----

--------------enig4AF731CB8228D7B95D250CE4--

- Raw text -


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