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

dbus: don't make datadir /etc, set runstatedir to /run #67363

Merged
merged 7 commits into from Aug 29, 2019

Conversation

worldofpeace
Copy link
Contributor

Motivation for this change

Not sure why we've changed this, but I don't think it should cause any issues restoring it to default.

Citing the documentation on the directories

The standard system bus normally also reads XML files from /etc/dbus-1/system.d, which should be used by system administrators if they wish to override default policies.

Third-party packages would historically install XML files into /etc/dbus-1/system.d, but this practice is now considered to be deprecated: that directory should be treated as reserved for the system administrator.

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 @

@jtojnar
Copy link
Contributor

jtojnar commented Aug 23, 2019

Hmm, why is there ./systemd.patch?

@worldofpeace
Copy link
Contributor Author

Hmm, why is there ./systemd.patch?

Noticed that too, I don't see any references to it outside dbus. I think we can remove it.

@jtojnar
Copy link
Contributor

jtojnar commented Aug 23, 2019

  1. Should not this be /etc.

    --- /nix/store/l4rvh7fp92ljip1924sb8ggyng13d55l-dbus-1.12.16/etc/dbus-1/session.conf
    +++ /nix/store/5aajva4nk6scppj33d8ksrm6azxpccxs-dbus-1.12.16/etc/dbus-1/session.conf
    @@ -3,7 +3,7 @@
     
     In older versions of dbus, this file defined the behaviour of the well-known
     session bus. That behaviour is now determined by
    -/etc/dbus-1/session.conf, which should not be edited.
    +/nix/store/5aajva4nk6scppj33d8ksrm6azxpccxs-dbus-1.12.16/share/dbus-1/session.conf, which should not be edited.
     
     For local configuration changes, create a file
     session-local.conf or files matching session.d/*.conf in the same directory
    @@ -12,7 +12,7 @@
     
     For upstream or distribution-wide defaults that can be overridden
     by a local sysadmin, create files matching
    -/etc/dbus-1/session.d/*.conf instead.
    +/nix/store/5aajva4nk6scppj33d8ksrm6azxpccxs-dbus-1.12.16/share/dbus-1/session.d/*.conf instead.
     -->
     <!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
      "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">

    (source)

    Edit: We are dropping the include in the stylesheet. Perhaps we should remove it in postInstall. ✔️

  2. Hmm, I do not know how it could work before (perhaps it was replaced somewhere) but for setuid, the store path will not work:

    --- /nix/store/l4rvh7fp92ljip1924sb8ggyng13d55l-dbus-1.12.16/share/dbus-1/system.conf
    +++ /nix/store/5aajva4nk6scppj33d8ksrm6azxpccxs-dbus-1.12.16/share/dbus-1/system.conf
    @@ -24,7 +24,7 @@
       <standard_system_servicedirs/>
     
       <!-- This is a setuid helper that is used to launch system services -->
    +  <servicehelper>/libexec/dbus-daemon-launch-helper</servicehelper>
    *  <servicehelper>/nix/store/5aajva4nk6scppj33d8ksrm6azxpccxs-dbus-1.12.16/libexec/dbus-daemon-launch-helper</servicehelper>
     
       <!-- Write a pid file -->
       <pidfile>/run/dbus/pid</pidfile>
    

    (source)

    Edit: we are replacing the value in the stylesheet. ✔️

  3. This looks good

    --- /nix/store/95wb8nr32bhi2fnfpj3qpspv8j0y2l54-dbus-1.12.16-dev/lib/pkgconfig/dbus-1.pc
    +++ /nix/store/kvrkj9icq3pgj969lmw2dkd7kjyvvly5-dbus-1.12.16-dev/lib/pkgconfig/dbus-1.pc
    @@ -7,7 +7,7 @@
     system_bus_default_address=unix:path=/run/dbus/system_bus_socket
     datarootdir=${prefix}/share
    -datadir=/etc
    +datadir=${datarootdir}
     sysconfdir=/etc
     session_bus_services_dir=${datadir}/dbus-1/services
     system_bus_services_dir=${datadir}/dbus-1/system-services

    ✔️

@jtojnar
Copy link
Contributor

jtojnar commented Aug 24, 2019

  1. The share/dbus-1/*.d paths ought to be added to docs:

    <filename><replaceable>pkg</replaceable>/etc/dbus-1/system.d</filename>
    <filename><replaceable>pkg</replaceable>/share/dbus-1/system-services</filename>
    <filename><replaceable>pkg</replaceable>/etc/dbus-1/session.d</filename>
    <filename><replaceable>pkg</replaceable>/share/dbus-1/services</filename>

  2. share/dbus-1/session.d path should be added here:

    <includedir><xsl:value-of select="." />/etc/dbus-1/session.d</includedir>

@worldofpeace
Copy link
Contributor Author

I think I responded to your comments correctly @jtojnar.

@jtojnar
Copy link
Contributor

jtojnar commented Aug 24, 2019

Changes look good from here.

Not sure how to test it, as it rebuilds everything.

@worldofpeace
Copy link
Contributor Author

Aside from a rebuild, you could test with https://github.com/worldofpeace/nixpkgs/commits/test-dbus.

Copy link
Contributor

@jtojnar jtojnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Started GNOME with the test-dbus branch, ran some programs (GNOME Photos) and the journal did not look abnormal.

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

3 participants