Package managing code might in certain cases not notice the availability of a more recent version of a package X that was made available by modifying auto_path at runtime if package manager have already seen any version of package X at the scanning stage.
How to trigger:
1) We have a package named, say, "foo" somewhere accessible via $auto_path;
2) Then by some means (usually by calling [package require something]) we cause the package manager to make its run through the $auto_path scanning the packages. After that the package manager will know that the package "foo" is available.
3) Then we add another direcroty to auto_path which makes some more recent version of the same package "foo" available to the package manager. (Use case: we want to locally override a certain package in the standard package hierarchy).
4) Then [package require foo] will fetch the original version (not the latest) since the package manager won't rescan the directories listed on auto_path.
From the Tclers' chatroom:
[00:14]<jenglish> kostix - the default [package unknown] handler does keep track of auto_path adjustments -- if any pkgIndex.tcl diddles with auto_path (which, really, they shouldn't, but some do anyway...) it will scan the new directories too.
[00:18]<jenglish> ... but IIRC the default [package unknown] handler has some short-circuiting logic; it might stop scanning for pkgIndex.tcl files once it finds a package that satisfies the requirements.
The ways to overcome the problem are:
1) Add [package forget foo] before calling [package require foo];
2) Specify the exact version in [package require] to make [package unknown] be not happy with the version of "foo" it already known about.
My poposition is to make the package manager rescan the hierarchy on any change of auto_path (may be it's worth remembering the sorted list of normalized paths from auto_path and compare it with the similar list aquired from the changed auto_path to track changes which don't really change things). Changes to auto_path are rare and probably such change in behaviour won't lead to slowdowns.
This issue is also confirmed to exist in 8.4.14 and .15