-
-
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
nix develop: use proper permissions for $TMPDIR #6974
base: master
Are you sure you want to change the base?
Conversation
src/nix/develop.cc
Outdated
@@ -298,7 +298,7 @@ struct Common : InstallableCommand, MixProfile | |||
for (auto & var : savedVars) | |||
out << fmt("%s=\"$%s:$nix_saved_%s\"\n", var, var, var); | |||
|
|||
out << "export NIX_BUILD_TOP=\"$(mktemp -d -t nix-shell.XXXXXX)\"\n"; | |||
out << "export NIX_BUILD_TOP=\"$(mktemp -d -t nix-shell.XXXXXX)\"\nchmod 777 \"$NIX_BUILD_TOP\"\n"; |
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.
You are really sure about 777? I would expect something more like 755.
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.
/tmp
on Linux is usually 777, that's what I went off of.
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.
Isn't the common perms for /tmp 1777
(note the sticky bit)? (At least it is on my systems.)
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.
You're right, I thought the sticky bit signified that it was a directory for whatever reason. Fixed.
Before this change, unsandboxed builds that tried to use `passAsFile` would fail when run within a devshell.
eb13059
to
faed136
Compare
I don't understand how this is supposed to fix
Creating a world-writable directory definitely seems like something to be avoided. Probably |
This fixes $ nix develop ...
$ nix build ...
So should the permissions be set to I used |
Triaged in the Nix team meeting: We couldn't figure out what problem this is solving exactly. @winterqt, we will pick this up again if you add a test that reproduces the bug. Postponed for now. Complete discussion
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-03-03-nix-team-meeting-minutes-37/25998/1 |
Before this change, unsandboxed builds that tried to use
passAsFile
would fail when run within a devshell.