-
-
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 $HOME=/proc/homeless-shelter instead of /homeless-shelter #11300
Conversation
This makes it so even root can't create $HOME, for example by running `mkdir -p $HOME/.cache/foo`.
@@ -102,7 +102,7 @@ void handleDiffHook( | |||
} | |||
} | |||
|
|||
const Path LocalDerivationGoal::homeDir = "/homeless-shelter"; | |||
const Path LocalDerivationGoal::homeDir = "/proc/homeless-shelter"; |
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.
/proc
doesn't exist on macOS, maybe doesn't exist on any of the *BSDs we have (fledgling?) support for, and probably won't exist on Windows (which has seen some development recently).
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 don't think that changing the path will cause new trouble - it would just mean that a build script which does mkdir -p $HOME/.local/cache
(for example) will create /proc/homeless-shelter
instead of /homeless-shelter
. But would it help if I add a condition that will set it to /proc/homeless-shelter
only on Linux?
I deleted it again because we can actually just keep /homeless-shelter on Mac because it's not writable at any point. However my other thought was, what if /homeless-shelter exits but is bind mount on itself read-only? |
From Nix Team: Approve the idea. Still need to clarify the OSX case (or keep it where it is for now). |
Thanks @tomberek ! I added a commit that sets $HOME to |
Probably good to test and look around in Nixpkgs for anything that might depend on this. Please keep an eye out for issues, upgrade any systems you have to use it, and so forth. |
If we’re changing the path, maybe it’d be a good time to not call it a homeless shelter? And instead give it a name that helps the user identify the problem.
…On Mon, Aug 19, 2024, at 11:27 PM, tomberek wrote:
Merged #11300 <#11300> into master.
—
Reply to this email directly, view it on GitHub <#11300 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAASXLBAENDGGQIJZ2QGWEDZSKZQRAVCNFSM6AAAAABMQWTV22VHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJTHEZTQNRVGU3DAMQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
@noamraph if you got time, could you also make a changelog entry for this change? |
Do you have a suggestions in mind? |
Yes, I hope to do it today.
Maybe I usually don't like long names like that, but I guess that it would usually only appear when there's a problem related to this. |
How about |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2024-08-19-nix-team-meeting-minutes-170/50942/1 |
Make $HOME=/proc/homeless-shelter instead of /homeless-shelter (cherry picked from commit 43e82c9)
This is already causing regressions in Nixpkgs (see above). I suggest reverting before this gets to a release, please. |
Note that there are already loads of examples of overwriting HOME in packages that need a writable home, search for ‘export HOME=‘ and you’ll find plenty of examples.
Since nix can be used with and without sandboxing, I feel it is typically expected to make efforts to function correctly in both. You can see examples of this very problem here: #11295
I’m not comfortable calling package building problems originating from this change a regression, personally, since it was already causing more sinister and harder to identify / correct issues.
…On Fri, Aug 23, 2024, at 11:02 PM, Winter wrote:
This is already causing regressions in Nixpkgs (see above). I suggest reverting before this gets to a release, please.
—
Reply to this email directly, view it on GitHub <#11300 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAASXLH2S75VAFKXSVCCT3LZS7ZVBAVCNFSM6AAAAABMQWTV22VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBYGAYTCNBVHE>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Correct, and, more interestingly,
I think that Anyhow, I debugged the issue that When |
FWIW, given @puckipedia 's analysis that |
Revert in #11366 |
Motivation
When building, $HOME is currently set to
/homeless-shelter
. In some scenarios (specifically when using the linux sandbox with a single-user installation), it is possible to create this directory, and some tools will make it, resulting in a build error.Instead, if $HOME is set to
/proc/homeless-shelter
, it is never possible to create it, since /proc is a virtual filesystem which doesn't allow creating files or directories. This resolves the issue mentioned.Context
#11295 - nix build fails because /homeless-shelter exists.
#8313 - a suggestion to do what this PR does.
I prefer to put /homeless-shelter in /proc rather than /sys, since /proc is standard in linux, and /sys seems less standard. See https://tldp.org/LDP/Linux-Filesystem-Hierarchy/html/c23.html, of the Linux Documentation Project, which describes
/proc
and doesn't describe/sys
.Priorities and Process
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.