Repository navigation
Conversation
[Medium impact] The changes affect Linux device permissions across package installs and the app’s permission grant. The code addresses both numbered findings, but the required guide update must land before merging. Findings
|
459aeb3 to
4e2ff8e
Compare
|
Rebased onto current master (install.sh was rewritten into a verified-release installer since I opened this — the udev path was still the old /etc one there too) and addressed both findings:
|
|
Thanks @4ni1ak for picking this up. I ran into #1545 on Arch with
Commit: felipe-NR@c1b713e. Shellcheck, shfmt, the install smoke test and the It can be cherry-picked onto this branch, or go up as a separate PR on top of this one, whichever fits better. Fine to disregard if a different approach is preferred. |
The Debian package (nfpm.yaml) and install.sh's --from-source path both installed 70-openlogi.rules to /etc/udev/rules.d — reserved for admin-authored local overrides, not files a package or installer ships. Debian's dpkg triggers reload rules there too, but pacman's udev-reload hook (35-systemd-udev-reload.hook) only watches /usr/lib/udev/rules.d, so the AUR openlogi-bin package (built from the same .deb) installed a rule nothing reloaded — the device-permission grants silently didn't apply until a manual `udevadm control --reload-rules` or a reboot. Move both to /usr/lib/udev/rules.d, matching what packaging/linux/package.nix already does for the Nix build. Also, since both install paths now converge on one file that either a package or this installer can own: - install.sh migrates a stale /etc copy left by a pre-fix run of itself — udev prefers /etc over /usr/lib, so an un-migrated one would silently shadow the corrected rule forever. Skipped when a package (dpkg/rpm/ pacman) owns that path instead, so an installed package's own file is never touched by the source installer. - uninstall.sh checks the same package-ownership before removing either the current or the pre-migration path, so a package coexisting with a source install keeps its own file. Updates the install-smoke.sh assertion for the new path. Fixes AprilNEA#1545
install.sh now installs the /usr/lib rule before it touches the old /etc copy, and removes that copy only when it is byte-identical to the bundled rule and no package owns it. Any other file there is an administrator's override: it is kept, with a warning that it takes precedence. The in-app installer still writes to /etc/udev/rules.d, since /usr may be read-only, but now skips the write when the package already installed identical rules under /usr/lib. Before, it wrote a second copy into /etc that overrode the packaged rule on every later upgrade.
…p grant The in-app grant skipped its write whenever the package already installed identical rules under /usr/lib. A different copy left in /etc/udev/rules.d by an earlier grant then kept shadowing the packaged rules, and the grant could no longer fix it. Skip the write only when /etc holds no copy.
4e2ff8e to
a2fcc1d
Compare
|
|
||
| ```sh | ||
| sudo cp packaging/linux/udev/70-openlogi.rules /etc/udev/rules.d/ | ||
| sudo cp packaging/linux/udev/70-openlogi.rules /usr/lib/udev/rules.d/ |
There was a problem hiding this comment.
Required guides omit the change
Blocking. The command at docs/INSTALL-linux.md:238 changes where users install the rule, but none of docs/CONFIGURATION.md, docs/USAGE.md, or docs/DECISIONS.md changes. The repository requires user-visible behavior changes to be documented in one of those guides. Add a short entry explaining the new location and how an existing /etc copy takes precedence.
Rule Used: Severity: medium. A user-visible behaviour change or a known limitation left by a fix (state lost on restart, a race window not covered, Ctrl-C skipping a hand-back) is stated in docs/CONFIGURATION.md, docs/USAGE.md, or docs/DECISIONS.md in the... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
The Debian package (
nfpm.yaml) and the manualinstall.shboth installed70-openlogi.rulesto/etc/udev/rules.d, which is meant for administrator overrides, not for files a package ships. pacman's udev-reload hook (35-systemd-udev-reload.hook) only watches/usr/lib/udev/rules.d. So the AURopenlogi-binpackage, which is built from the same .deb, installed a rule that nothing reloaded. The device-permission grants did not apply until a manualudevadm control --reload-rulesor a reboot.udev reads a file in
/etcin place of the same name under/usr/lib, so a copy left in/etcwould hide the packaged rule. The installer and the in-app grant now account for that.Changes
packaging/linux/nfpm.yaml:dstmoves to/usr/lib/udev/rules.d/70-openlogi.rules.packaging/linux/install.sh:--helplisting matches./usr/librule first, then handles an existing/etccopy:packaging/linux/uninstall.sh: removes the rule from the new path, and from the old/etcpath if a previousinstall.shrun left one there.crates/openlogi-permissions(udev.rs), the in-app grant:/etc/udev/rules.d, because/usrmay be read-only./usr/libalready holds identical rules and/etchas no copy. Before this, it wrote a second copy that hid the packaged rule after every later upgrade./etccopy is still refreshed, so the grant can repair it. A test covers all three cases.packaging/linux/udev/70-openlogi.rulesanddocs/INSTALL-linux.md: the manual-install instructions match the new path.packaging/linux/package.nixalready installed to$out/lib/udev/rules.d. All three install paths now agree.The
install.shmigration and the in-app skip come from @felipe-NR's follow-up commit, kept with its authorship. On top of it, a stale/etccopy is refreshed instead of left in place.Testing
Rebased onto current master. Full local gate on the final tree:
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspace: 4751 passed, 0 failedcargo docfor the non-GUI crates withRUSTDOCFLAGS="-D warnings"shfmt -d packaging/linux/install.shNot run locally: shellcheck, typos, cargo-deny and the Nix checks, because those tools are not installed on this host. The
nfpmpackage build was not run either.Not runtime-tested on hardware: I did not install a .deb or AUR package to confirm that the rule now reloads without a manual
udevadmcall on a pacman system. To test it, install the package on Arch and check that the mouse is accessible without a reload or reboot.Fixes #1545