News for hackers. Stuff that matters.
Re:Path Isn't Real on Linux by vlovich123 on Tuesday April 29, 2025 @10:12PM (#43840481)
Is this an old behavior? I would think ENOENT would invalidate the cache entry at least.
Re:Path Isn't Real on Linux by Aloisius on Tuesday April 29, 2025 @10:42PM (#43840682)
It's still a thing in bash 5.2.37.

It's just how bash works. If there's an entry in the session cache, it uses it. Since executable paths only get cached when you run a command successfully, this only happens when it gets moved from one directory in your PATH to another after you run it once, which isn't that common.

Setting PATH or calling hash -r will clear the session cache or one could run set +h which will disable it altogether.

Re:Path Isn't Real on Linux by Hackbraten on Wednesday April 30, 2025 @01:48AM (#43841657)
> this only happens when it gets moved from one directory in your PATH to another after you run it once

It also happens when you have two executables in different directories and then you delete the one with the higher priority. Happens regularly for me after I uninstall a Linux Homebrew package.

Re:Path Isn't Real on Linux by edoceo on Tuesday April 29, 2025 @11:57PM (#43841119)
Isn't cache invalidation one of the hard problems?
Re:Path Isn't Real on Linux by vlovich123 on Wednesday April 30, 2025 @10:52AM (#43846100)
Sure but not doing it on ENOENT suggests they’re just being completely lazy. Not to mention that they do have the tools (eg inotify watches) to proactively remove stale entries based on HD changes. Of course I’d be careful about the proactive one as it’s really easy to screw things up more (eg 100 bash instances all watching the same PATH directories might get expensive or forgetting to only do this for interactive mode connected to a TTY)
Re:Path Isn't Real on Linux by rendaw on Tuesday April 29, 2025 @11:52PM (#43841093)
Not working, as intended
Re:Path Isn't Real on Linux by mzajc on Tuesday April 29, 2025 @10:34PM (#43840632)
Retested with bash 5.2.37(1)-release from Debian testing, it still does this :(

Changing $PATH does wipe it at least.