-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
nix store delete: Show why deletion fails #13421
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
base: master
Are you sure you want to change the base?
Conversation
@@ -208,7 +208,7 @@ void LocalStore::findTempRoots(Roots & tempRoots, bool censor) | |||
while ((end = contents.find((char) 0, pos)) != std::string::npos) { | |||
Path root(contents, pos, end - pos); | |||
debug("got temporary root '%s'", root); | |||
tempRoots[parseStorePath(root)].emplace(censor ? censored : fmt("{temp:%d}", pid)); | |||
tempRoots[parseStorePath(root)].emplace(censor ? censored : fmt("{nix-process:%d}", pid)); |
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.
The censoring is probably a good thing, but my imagination is lacking this morning. Did you have a threat in mind for this?
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.
It can reveal information about other user's processes (i.e. pid X has store path Y open).
However, since the Nix store is world-readable, I wouldn't mind getting rid of censoring altogether. It might make sense if we have store ACLs but right now it seems pointless.
@@ -730,6 +730,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store, | |||
options.action = (GCOptions::GCAction) readInt(conn.from); | |||
options.pathsToDelete = WorkerProto::Serialise<StorePathSet>::read(*store, rconn); | |||
conn.from >> options.ignoreLiveness >> options.maxFreed; | |||
options.censor = !trusted; |
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.
Unlike binary allow/deny authorization, this kind of use of the trusted flag is not consistent with the removal of trust by an intermediate nix daemon (untrusted cli -> daemon connection in untrusted mode -> trusted daemon connection -> root).
The intermediate daemon can deny unauthorized operations, but it can not feasibly censor messages that are returned to the untrusted cli.
For this to work correctly, the intermediate daemon needs to be able to request a demotion, so that the trusted daemon can censor as needed.
Examples: error: Cannot delete path '/nix/store/6fcrjgfjip2ww3sx51rrmmghfsf60jvi-patchelf-0.14.3' because it's referenced by the GC root '/home/eelco/Dev/nix-master/build/result'. error: Cannot delete path '/nix/store/rn0qyn3kmky26xgpr2n10vr787g57lff-cowsay-3.8.4' because it's referenced by the GC root '/proc/3600568/environ'.
Example: error: Cannot delete path '/nix/store/klyng5rpdkwi5kbxkncy4gjwb490dlhb-foo.drv' because it's in use by Nix process '{nix-process:3605324}'.
e541f5a
to
2059f72
Compare
Motivation
This replaces the unhelpful error
Cannot delete path '...' since it is still alive. To find out why, use: nix-store --query --roots and nix-store --query --referrers
.Examples:
Context
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.