Skip to content
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

nixos/deluge: fix directory creation errors #67888

Merged
merged 1 commit into from Sep 1, 2019
Merged

Conversation

aanderse
Copy link
Member

@aanderse aanderse commented Sep 1, 2019

Motivation for this change

Directory creation errors exist in the deluge module currently because of the systemd tmpfiles.d rules.

Summary of the problem:

  • the module creates cfg.dataDir to be owned by cfg.user
  • the module then attempts to create ${cfg.dataDir}/.config/deluge to be owned by cfg.user
  • tmpfiles.d notices that ${cfg.dataDir}/.config doesn't exist exist but is required... with no rule specified tmpfiles.d is forced to create the directory with root ownership (the default)
  • tmpfiles.d then attempts to create ${cfg.dataDir}/.config/deluge to be owned by cfg.user which is considered unsafe because... tmpfiles.d won't create ownership hierarchies like this

People who wish to utilize tmpfiles.d need to keep this in mind.

NOTE: This PR is meant as a replacement for #67852.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @gleber @bricewge

@aanderse aanderse requested a review from flokli September 1, 2019 14:35
@aanderse
Copy link
Member Author

aanderse commented Sep 1, 2019

@GrahamcOfBorg test deluge

@gleber
Copy link
Contributor

gleber commented Sep 1, 2019

Awesome! Can we still depend on using /var/lib/deluge as a storage for scripts, keys/secrets and other non-Nixified files if it is not created as a home directory?

@aanderse
Copy link
Member Author

aanderse commented Sep 1, 2019

Awesome! Can we still depend on using /var/lib/deluge as a storage for scripts, keys/secrets and other non-Nixified files if it is not created as a home directory?

Yes, everything should function as it is intended. The tmpfiles.d structures are created quite early in the nixos-rebuild switch process, if I recall correctly.

@infinisil
Copy link
Member

Neat, thanks for figuring this out, will have to watch out for this. I kind of wish systemd-tmpfiles would error out instead of defaulting to root though.

@flokli flokli merged commit 8e7c47b into NixOS:master Sep 1, 2019
@aanderse aanderse deleted the deluge branch September 1, 2019 17:24
@aanderse aanderse mentioned this pull request Sep 2, 2019
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants