Bojan Land wrote:
Under what circumstances does the gnu-bash path hash differ from that of
the $PATH variable?  Why is it even possible for this difference to
occur?

Because bash uses a hash to speed look-up of frequently used commands. The only way to (almost) always get the right command every time is to do a $PATH lookup every time, which would of course defeat the purpose of having a hash. At least, that's my guess.

Anyway you would still have a race condition e.g. if PATH is '/usr/local/bin:/usr/bin:/bin' and a program appears in e.g. /usr/local/bin right after bash checks there (and, say, ultimately finds the program in /bin). By the time bash fork()s and exec()s, it is using the "wrong" version. So there isn't really any way to "fix" the problem; the hash just puts the onus on the user to force a refresh when things change (and meanwhile reduces I/O).

--
Matthew
Caution: keep out of reach of adults.



_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to