In bug #57522 I've entered a bug report for "pkg unload". In short, "pkg
unload" does not take package dependencies into account (unlike "pkg load"
which does do the right thing). This bug manifests itself in two scenarios:
1. When unloading a depender package, its dependencies that were loaded
implicity when loading the depender remain loaded. I think this isn't very
harmful, but it isn't elegant either.
2. But when unloading package(s) that happen to be dependencies of other
loaded packages (dependers), those depender packages aren't unloaded as
well. pkg.m obediently just unloads the dependency and doesn't emit any
information, warning or error about the reverse dependencies. As a
consequence, those depender package's functionalities may silently get
Now the question is: What do we want "pkg unload" to do in the second
scenario, where we want to unload just package "A" but some other loaded
package "B" depends on "A", whether we know that or not.
Mike came up with a few options, repeated below.
I'll shamelessly put my own preference here on top, but I'll keep most of my
motives for a next post:
Given the fact that "pkg load" has an (undocumented) "-nodeps" option:
(A0. Document the '-nodeps' option for "pkg load")
A1. Emit an error and do not unload "A" and "B"
A2. Only unload package "A" if "pkg unload" was called with a "-nodeps"
flag; document and implement it.
B. silently unload both A and B
C. unload both A and B, warning message about B
D. unload A, keep B loaded (current behavior)
E. unload A, keep B loaded, warning message that B may not fully work now
F. unload A, interactive prompt the user what to do with B
G. interactive prompt the user what to do with both A and B
To make the story complete, here's why I think this issue should be
(1) (Repeating myself) By accidentally or purposely unloading only a
dependency, functions in other loaded packages may silently fail. Dependency
packages have no info about their dependers so it is not easy for users to
be aware of reverse dependencies.
(2) Bugs #41298 and #41215 (about implementing a "pkg test" feature) have
been revived and patches for them can be tested. In order to "pkg test"
packages they must be loaded incl. all dependencies, and it would be elegant
if packages loaded in the course of a "pkg test" run could be gracefully