Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 554118

Summary: sys-apps/pcsc-lite - systemd-compatible udev hotplug rule
Product: Gentoo Linux Reporter: Marek Szuba <marecki>
Component: Current packagesAssignee: Crypto team [DISABLED] <crypto+disabled>
Status: RESOLVED FIXED    
Severity: normal CC: alonbl, bertrand, lucas.yamanishi, michael, moschlar, systemd, wschlich
Priority: Normal Keywords: PullRequest
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://github.com/gentoo/gentoo/pull/13249
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: 99-pcscd-hotplug-systemd.rules
pcsc-lite-1.8.13-r1.ebuild-systemd-hotplug.patch
Provide merged udev rule with OpenRC helper
sys-apps/pcsc-lite: Provide systemd-aware udev rule

Description Marek Szuba archtester gentoo-dev 2015-07-07 06:48:28 UTC
Created attachment 406290 [details]
99-pcscd-hotplug-systemd.rules

Hello,

Please find attached a new udev rule file which allows hotplugging pcscd on systemd machines. In principle one could just add systemd-related directives to the original rule file, at which point it would work with both systemd and OpenRC, however using two different files eliminates log warnings produced whenever an OpenRC init file is attempted to be run on a systemd host.

A patch for the latest pcsc-lite ebuild file which installs this rule file instead of the original one when USE=systemd is set, has been provided as well.
Comment 1 Marek Szuba archtester gentoo-dev 2015-07-07 06:48:53 UTC
Created attachment 406292 [details, diff]
pcsc-lite-1.8.13-r1.ebuild-systemd-hotplug.patch
Comment 2 Marek Szuba archtester gentoo-dev 2017-03-22 12:01:01 UTC
1.5 years later, the udev rule file is still OpenRC-specific.
Comment 3 Moritz Schlarb 2017-05-05 19:02:14 UTC
Pinging this bug - any chance of having this integrated into the portage tree?

Regards,
Moritz
Comment 4 Michael Weiser 2019-10-05 14:04:56 UTC
Just wrote the same rule to then find it pending here. Can this please be added?
Comment 5 Mike Gilbert gentoo-dev 2019-10-07 17:28:51 UTC
I'm not sure why this bug was assigned to the systemd project. It should be assigned to the package maintainer.
Comment 6 Mike Gilbert gentoo-dev 2019-10-07 17:40:10 UTC
Rather than conditionally installing different udev rules, I would rather see a new script added that makes the OpenRC rule a no-op if the system is not currently booted using OpenRC.
Comment 7 Michael Weiser 2019-10-08 08:29:26 UTC
Created attachment 592118 [details, diff]
Provide merged udev rule with OpenRC helper

As a matter of taste and aesthetics I would argue that it introduces an additional helper script[1] and a redundant spawn of a shell on systemd systems. Still, here you go. Tested with systemd where an strace proves that the helper is indeed executed and correctly behaves as a no-op.

[1] Verified through testing and documentation that in its rules udev accepts neither shell expressions such as "[ ! -e /run/openrc ] || IN_HOTPLUG=1 ..." nor expose udevd's own process environment variables for filtering as in RC_SERVICE=="udev", necessitating the helper script.
Comment 8 Mike Gilbert gentoo-dev 2019-10-08 15:23:45 UTC
Thanks!

If possible, please provide a patch generated by "git format-patch". This way you will get credit for the changes in the git repository.

Also, please ensure you understand our copyright policy [1], and add a Signed-off-by tag to the commit message.

[1] https://www.gentoo.org/glep/glep-0076.html
Comment 9 Michael Weiser 2019-10-08 18:49:10 UTC
Created attachment 592262 [details, diff]
sys-apps/pcsc-lite: Provide systemd-aware udev rule

Here you go.
Comment 10 Larry the Git Cow gentoo-dev 2019-10-10 16:04:57 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1123ad37dafee0cc747fc8e55b18d7f143e08957

commit 1123ad37dafee0cc747fc8e55b18d7f143e08957
Author:     Michael Weiser <michael.weiser@gmx.de>
AuthorDate: 2019-10-10 15:42:43 +0000
Commit:     Craig Andrews <candrews@gentoo.org>
CommitDate: 2019-10-10 16:04:49 +0000

    sys-apps/pcsc-lite: Provide systemd-aware udev rule
    
    Provide a systemd-aware udev rule. Move OpenRC logic to helper script
    which behaves as a no-op on non-OpenRC systems.
    
    Closes: https://bugs.gentoo.org/554118
    Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
    Package-Manager: Portage-2.3.76, Repoman-2.3.17
    Signed-off-by: Craig Andrews <candrews@gentoo.org>

 sys-apps/pcsc-lite/files/99-pcscd-hotplug-r1.rules |   6 ++
 sys-apps/pcsc-lite/files/pcscd-udev                |  14 +++
 sys-apps/pcsc-lite/pcsc-lite-1.8.25-r1.ebuild      | 107 +++++++++++++++++++++
 3 files changed, 127 insertions(+)