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

xow: 0.4 -> 0.5 #91403

Merged
merged 1 commit into from Jun 26, 2020
Merged

xow: 0.4 -> 0.5 #91403

merged 1 commit into from Jun 26, 2020

Conversation

jansol
Copy link
Contributor

@jansol jansol commented Jun 24, 2020

Motivation for this change

Upstream update.

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.

@jtojnar
Copy link
Contributor

jtojnar commented Jun 25, 2020

Comment on lines 25 to 26
"MODPDIR=${placeholder ''out''}/lib/modprobe.d"
"SYSDDIR=${placeholder ''out''}/lib/systemd/system"
Copy link
Contributor

@jtojnar jtojnar Jun 25, 2020

Choose a reason for hiding this comment

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

Looks like all these paths changed:

medusalix/xow@29999d5

Not sure if it is correct, though. See for example https://unix.stackexchange.com/questions/333697/etc-udev-rules-d-vs-lib-udev-rules-d-which-to-use-and-why

Edit: Yeah, my suspicion was right – the previous values were correct. Reading systemd.unit (5), the path /etc/systemd/system is described as “System units created by the administrator”, whereas the previous value /lib/systemd/system had “System units installed by the distribution package manager”.

Edit 2: And also https://unix.stackexchange.com/questions/206315/whats-the-difference-between-usr-lib-systemd-system-and-etc-systemd-system. /etc is reserved for sysadmins, packages should install to /lib.

Copy link

@medusalix medusalix Jun 25, 2020

Choose a reason for hiding this comment

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

When you install xow from source, there is usually no package manager involved, so the installation to /etc is in fact correct. Overwriting files placed into /lib by a package manager would cause confusion.
You are free to set those values to the appropriate locations when packaging xow, but I want to have sane defaults for users building from source.

Copy link
Contributor

@jtojnar jtojnar Jun 25, 2020

Choose a reason for hiding this comment

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

Then it should IMHO go to /usr/local/lib/systemd/system – “System units installed by the administrator” resp. $(PREFIX)/lib/systemd/system since administrator does not create them. Packagers would then only change PREFIX (Debian distro packagers would also need to override SYSDDIR=/lib/systemd/system as per their manual).

Edit: udev has the same structure (Debian, non-Debian). Maybe we should have rootprefix like systemd does: https://github.com/systemd/systemd/blob/b7d81d19cc13987319d61782d3b4c7bff8b0b4da/meson.build#L79-L86

PREFIX := /usr/local
# Debian distros use /lib instead of /usr/lib
ROOTPREFIX := $(PREFIX)
BINDIR := $(PREFIX)/bin
UDEVDIR := $(ROOTPREFIX)/lib/udev/rules.d
MODLDIR := $(ROOTPREFIX)/lib/modules-load.d
MODPDIR := /lib/modprobe.d
SYSDDIR := $(ROOTPREFIX)/lib/systemd/system

Then normal distros would set PREFIX=/usr, NixOS would set PREFIX=${placeholder "out"} and Debian would set PREFIX=/usr ROOTPREFIX=/. And it would still be installed to /usr/local for people calling make install manually.

Edit 2: According to https://www.freedesktop.org/software/systemd/man/modules-load.d.html, modules-load.d supports that too:

Packages should install their configuration files in /usr/lib/ (distribution packages) or /usr/local/lib/ (local installs). Files in /etc/ are reserved for the local administrator, who may use this logic to override the configuration files installed by vendor packages. It is recommended to prefix all filenames with a two-digit number and a dash, to simplify the ordering of the files.

So the only odd one out is modprobe.d. But there it might still be preferable to override the /lib/xow-blacklist.conf file installed by package manager (since package manager can repair that). If user administrator sets up their own blacklist in /etc, overriding it would not be so painless.

Choose a reason for hiding this comment

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

Then it should IMHO go to /usr/local/lib/systemd/system – “System units installed by the administrator” resp. $(PREFIX)/lib/systemd/system since administrator does not create them.

Yeah, I fully agree with that, but there's one problem: If I make changes to these files and they get installed to /usr/local/*, the old configs in /etc/* will still override all of the newer files. It's basically a breaking change, as users have to make sure they delete the old files manually.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can that not be fixed by mentioning it in release news? Hopefully, most people would use distro package rather than modifying their system manually.

Copy link

@medusalix medusalix Jun 28, 2020

Choose a reason for hiding this comment

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

Yeah, moving it to libexecdir is a good idea.

I wonder why I didn't notice that the first time I read the docs. It makes things so much easier.
I recommend people to run make uninstall for every update they do (before installing the new version), so if they stick to that it will cause absolutely no problems for them. Users that didn't read the README might wonder why they're no longer running the newest version even after running make install, so I hope they'll see the pinned issue.

@jtojnar I'm still wondering about the rootprefix you suggested above. On my Debian system (sid/unstable) there's a symlink from /lib to /usr/lib, wouldn't that make a rootprefix option redundant? Debian packaging for systemd also doesn't seem to specify the rootprefix value.

Choose a reason for hiding this comment

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

PREFIX := /usr/local
LIBEXECDIR := $(PREFIX)/libexec
LIBDIR := $(PREFIX)/lib
UDEVDIR := $(LIBDIR)/udev/rules.d
MODLDIR := $(LIBDIR)/modules-load.d
MODPDIR := $(LIBDIR)/modprobe.d
SYSDDIR := $(LIBDIR)/systemd/system

@jtojnar This is what I've come up with regarding my last comment. I don't want to make changes to the installation directory a third time, so I need your full approval before I commit this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like the rules files aren't getting loaded correctly at the moment, mt76x2u grabs the dongle before xow can. Do the paths to them need to be specified in some option in the nixos module file? It was working before though, and I don't see any relevant-looking option in the browser.

Copy link
Contributor

@jtojnar jtojnar Jul 2, 2020

Choose a reason for hiding this comment

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

@medusalix That looks good, except I am not sure about the modprobe. For example, kmod does not seem to support /usr/local: https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/tree/libkmod/libkmod.c?id=f5434cf5fc5b567359e1b9207bbab24c6782cfbd#n65 It would be best to test if it works there first.

Edit: Asked on the ML about it: https://lore.kernel.org/linux-modules/b0894a8dd06ccee4326bcd7ff14e1f871bd45080.camel@gmail.com/T/#u

Choose a reason for hiding this comment

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

@jtojnar I found this commit on Debian's kmod packaging repository. It mentions systemd-modules-load, which seems to include /usr/local/lib/modules-load.d in its search path (see this commit).

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