-
-
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
darwin installer: remove the file before installing new one #3532
darwin installer: remove the file before installing new one #3532
Conversation
Not sure this fixes it: |
Although I'd argue that should be a separate check at installation |
If we want to support this it's probably best to also ensure that whatever has been loaded by launchd is also removed first.
|
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.
seems 0644
is needed
scripts/install-darwin-multi-user.sh
Outdated
@@ -39,7 +39,7 @@ EOF | |||
|
|||
poly_configure_nix_daemon_service() { | |||
_sudo "to set up the nix-daemon as a LaunchDaemon" \ | |||
cp -f "/nix/var/nix/profiles/default$PLIST_DEST" "$PLIST_DEST" | |||
install -m 0664 "/nix/var/nix/profiles/default$PLIST_DEST" "$PLIST_DEST" |
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.
Compare:
brick:~ blast$ launchctl stop org.nixos.nix-daemon && launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist
brick:~ blast$ sudo install -m 0664 /nix/var/nix/profiles/default/Library/LaunchDaemons/org.nixos.nix-daemon.plist /Library/LaunchDaemons/org.nixos.nix-daemon.plist
brick:~ blast$ launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist && launchctl start org.nixos.nix-daemon
/Library/LaunchDaemons/org.nixos.nix-daemon.plist: Path had bad ownership/permissions
with
brick:~ blast$ launchctl stop org.nixos.nix-daemon && launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist
brick:~ blast$ sudo install -m 0644 /nix/var/nix/profiles/default/Library/LaunchDaemons/org.nixos.nix-daemon.plist /Library/LaunchDaemons/org.nixos.nix-daemon.plist
brick:~ blast$ launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist && launchctl start org.nixos.nix-daemon
I marked this as stale due to inactivity. → More info |
Still relevant. |
b038a04
to
db2dc7c
Compare
I rebased this and changed the mode as @blast-hardcheese accepted. I also made it symbolic because that is much more readable/maintainable. |
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 really think there is a good way to test this between CI and just....deploying to the wild --- at least I don't know of a good manual test plan.
I did some manual copying to my home directory with cp
and install
. I could not reproduce the original issue --- I thought cp -f
was supposed to be idempotent?! --- but I could confirm that the new thing is at least idempotent too.
The bottom line is that install
is...meant to be used in installers. Being explicit about the mode and not trusting unpacking is also good. Trying to be idempotent is always laudable. The theory is sound. I say we finally merge this tiny one line change, and see what happens. Users will let us know if something unpredictable goes wrong :).
Otherwise results into: cp: /Library/LaunchDaemons/org.nixos.nix-daemon.plist and /nix/var/nix/profiles/default/Library/LaunchDaemons/org.nixos.nix-daemon.plist are identical (not copied).
db2dc7c
to
c73daea
Compare
I'm unsure why it would take so long to manifest as user reports, but it doesn't look like the mode part of this change works, and I'm starting to suspect it's causing some people to turn up with $ touch inst1
$ /usr/bin/install -m -rw-r--r-- inst1 inst2
$ ls -la inst*
-rw-r--r-- 1 abathur _lpoperator 0 Feb 12 12:19 inst1
---------- 1 abathur _lpoperator 0 Feb 12 12:21 inst2 FWIW I see the same behavior with the nix-installed coreutils implementation of User reports I've spotted so far:
Won't be able to start on anything myself until this evening, but I imagine this will cause enough ongoing grief until all of the wild installs with these perms age out that it's worth getting a point release together, and maybe an issue with a lucid explanation and a clear workaround to pin. If someone happens to pull together a PR with installer tests configured, I have a spare x86_64-darwin system that I can use to confirm it. |
Otherwise results into:
cp: /Library/LaunchDaemons/org.nixos.nix-daemon.plist and /nix/var/nix/profiles/default/Library/LaunchDaemons/org.nixos.nix-daemon.plist are identical (not copied).