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

Reintroduce lib output for systemd #99382

Closed
wants to merge 2 commits into from
Closed

Conversation

arianvp
Copy link
Member

@arianvp arianvp commented Oct 2, 2020

Motivation for this change

#94354 removed $lib output but this causes significant closure bloat
See #98094

This reintroduces $lib, by getting rid of the problematic cyclic dependency

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nixpkgs-review --run "nixpkgs-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.

sd_path_lookup_*  returns $rootprefix, which was making a cyclic
dependency to $out and $lib

We also patch systemd in  ./0014-add-rootprefix-to-lookup-dir-paths.patch
to look for all config files (except unit files; they have their
own lookup path logic) in rootprefix. This will keep working
Now that $lib doesn't refer to rootprefixdir anymore,  the
cyclic dependnecy should be gone
@arianvp
Copy link
Member Author

arianvp commented Oct 2, 2020

@edolstra PTAL. I don't have time to make a backport PR to 20.09. Would love if somebody else could do this.

We should also probably make the base-branch staging instead of master

I didn't test yet if this works.

@arianvp
Copy link
Member Author

arianvp commented Oct 2, 2020

cc @NixOS/systemd

@arianvp
Copy link
Member Author

arianvp commented Oct 2, 2020

Nevermind this doesn't work. As systemd tries to install files in rootprefixdir in meson.build. we'd have to patch sd_path_ instead so that it doesn't refer to ROOTPREFIXDIR

@arianvp
Copy link
Member Author

arianvp commented Oct 2, 2020

The "problematic" patch that causes these issues is systemd/systemd@9c5bb20

The systemd folks are refactoring the path-related code and AFAIK sd-path should be the source of truth of all path-prefix related things after that refactoring is complete. But it's not there yet.

As it adds a reference to src/basic/path-lookup.h (which has references to both PREFIX and ROOTPREFIX, which we both set to $out) to libsystemd/sd-path/sd-path.c
it causes systemd.lib to depend on systemd.out

It also directly pulls in ROOTPREFIX , USER_DATA_UNIT_PATH , SYSTEM_DATA_UNIT_PATH , SYSTEM_GENERATOR_PATH USER_GENERATOR_PATH, which also all refer to $out

Three ideas:

  1. Revert systemd/systemd@9c5bb20 as non of these code paths are actively used in systemd as of 246. It's not sustainable but it will quickly fix our issues

  2. Patch both path-lookup.h/path-lookup.c and sd-path.c to not refer to PREFIX and ROOTPREFIX but to /run/current-system/systemd consistently

  3. don't do anything. Simply return the lib output without fixing the cycle, and fix Support cyclic references in multi-output derivations nix#494 instead

I honestly don't see upstream accommodating us here. As they don't think it's problematic to have references between libsystemd and systemd proper. So option 3 sounds very attractive as we do not have to keep playing cat and mouse with changes inside systemd.

@worldofpeace worldofpeace added this to To Do in 20.09 Blockers via automation Oct 2, 2020
@worldofpeace worldofpeace moved this from To Do to In progress in 20.09 Blockers Oct 2, 2020
@worldofpeace worldofpeace added this to To Do in systemd via automation Oct 2, 2020
@worldofpeace worldofpeace moved this from To Do to In Progress in systemd Oct 2, 2020
@worldofpeace worldofpeace removed this from In progress in 20.09 Blockers Oct 2, 2020
@flokli
Copy link
Contributor

flokli commented Nov 24, 2020

Based on

So option 3 sounds very attractive as we do not have to keep playing cat and mouse with changes inside systemd.

let's close this :-)

@flokli flokli closed this Nov 24, 2020
@flokli flokli moved this from In Progress to Done in systemd Dec 8, 2020
@wegank wegank deleted the systemd-lib-reintroduce branch May 27, 2023 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
systemd
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants