bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Hashed excutable found is incorrect where 2 executables of samename in 2


From: Marc A Dickenson
Subject: Hashed excutable found is incorrect where 2 executables of samename in 2 dirs specified by PATH
Date: Tue, 11 Feb 2003 15:09:30 -0600






Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
-DCONF_OSTYPE='lin\
ux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu' -DCONF_VENDOR='redhat'
-DSHELL \
-DHAVE_CONFIG_H  -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64  -I.  -I. -I./include
-I.\
/lib -I/usr/include -O2 -march=i386 -mcpu=i686
uname output: Linux fspbld04 2.4.7-10enterprise #1 SMP Thu Sep 6 16:48:20
EDT 2\
001 i686 unknown
Machine Type: i386-redhat-linux-gnu

Bash Version: 2.05
Patch Level: 8
Release Status: release

Description:

Hashing seems to pick the wrong executable when same executable name is in
more than one directory in PATH.

Repeat-By:


1) cat /tmp/texe
#!/bin/csh
echo texe in TMP

2) cat /tmp/tmp1/texe
#!/bin/csh
echo texe in TMP1

3) export PATH=$PATH:/tmp:/tmp/tmp1  <=== add test dirs to path

4) chmod 666 /tmp/texe; chmod 777 /tmp/tmp1/texe

5) which texe ==> shows /tmp/tmp1/texe, which is the correct one

6) texe ==> print “texe in TMP1” ==> this is correct

7) chmod 777 /tmp/texe ==> turn on exe bit for /tmp/exe

8) which texe ==> shows /tmp/texe ==> this is correct

>>>>>>>>>>>>>>>>> Note: If you run hash -r here, it works, if you dont 9
fails.

9) texe ==> print “texe in TMP1” ==> THIS IS NOT CORRECT. Why?????

10) hash ==> texe is hashed to /tmp/tmp1/texe ==> which is wrong.


Fix:

Workarounds:

If i run hash -r in the testcase below before the final problem where it
fails... then it works,  but I guess a user shouldnt be required to do
that....

you could also type set +h  // turn off hashing...

reply via email to

[Prev in Thread] Current Thread [Next in Thread]