-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make nix-store --delete explain why a path is alive #4850
base: master
Are you sure you want to change the base?
Conversation
I like this functionality, but I don't think printing these info messages (unconditionally) is the responsibility of libstore. Perhaps the method could return a chain of references as a From a practical perspective, this is to prevent that unrelated callers start spamming these messages for no good reason. |
I marked this as stale due to inactivity. → More info |
@@ -558,7 +558,7 @@ bool LocalStore::canReachRoot(GCState & state, StorePathSet & visited, const Sto | |||
if (state.dead.count(path)) return false; | |||
|
|||
if (state.roots.count(path)) { | |||
debug("cannot delete '%1%' because it's a root", printStorePath(path)); | |||
printInfo("need '%1%' because it's a root", printStorePath(path)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with what @roberth said.
Let's return something like:
struct DeadAlready {};
struct IsRoot {};
struct RootedBy { StorePath root; };
typedef std::variant<DeadAlready, IsRoot, RootedBy> OptLiveness;
to indicate why.
state.alive
can likewise be a map of:
typedef std::variant<IsRoot, RootedBy> Liveness;
Making OptLiveness
be std::optional<Liveness>
is fine me too.
Shut up bot. |
Is this dead? |
If it's a store path, who knows ;) I don't think anyone should feel inhibited to work on solving this problem. To make this more actionable, I think an improved solution could perform a graph search on the retrieved dependency edges, and report the path in the thrown exception. That's perhaps a bit easier to manage than reporting all the data internally and then still having to implement such logic in the CLI. (fwiw I wasn't a maintainer yet when I reviewed this; this was from before the Nix team) |
I would love to work on and learn more about how Nix works internally, but honestly I don't have the time. |
Fixes #1810
The output looks like this: