Ivan Richwalski wrote: > David Korn wrote: > > cc: John.Zolnowsky at Sun.COM > > Subject: Re: Re: [ksh93-integration-discuss] Non-existent directories in > > $PATH and stat caching > > -------- > > > >> Once a utility has been searched for and found (either as a > >> result of this specific search or as part of an unspecified > >> shell startup activity), an implementation may remember its > >> location and need not search for the utility again unless the > >> PATH variable has been the subject of an assignment. If the > >> remembered location fails for a subsequent invocation, the > >> shell shall repeat the search to find the new location of the > >> utility, if any. > > > > Had the lookup for this script been successful with the shell > > previously? If so then you are correct that the shell > > must do the rescan and this is a bug. Otherwise, this sentence > > does not apply. > > No, ~/bin had been added to $PATH before ~/bin existed, and the scripts > are unique names not found elsewhere in $PATH. After setting $PATH > the first time, the stat on "/home/ivan/bin" fails, so ksh93 never > attempts looking for "/home/ivan/bin/foo".
I'm not sure but IMO it may be legal behaviour. Imagine that a shell uses a set of file descriptors to cache the location of each element in PATH and then uses the new POSIX.2008 function |statat()| to find commands relative to these file descriptors - in that case the "fd" for your non-existant directory does not exist and the following |statat()| fails, too. > I also found that PATH=$PATH wasn't enough to get ksh93 to notice that > /home/ivan/bin now exists. I had to change PATH, either by adding a new > directory or by resetting it like this: > I=$PATH > PATH=/bin > PATH=$I That sounds like a bug. Can you test whether $ hash -r # works, please ? ---- Bye, Roland -- __ . . __ (o.\ \/ /.o) roland.mainz at nrubsig.org \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer /O /==\ O\ TEL +49 641 3992797 (;O/ \/ \O;)