diff mbox series

[bug#49056] services: pcscd: Fix daemon signal handling.

Message ID 20210616063818.12656-1-brice@waegenei.re
State Accepted
Headers show
Series [bug#49056] services: pcscd: Fix daemon signal handling. | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Brice Waegeneire June 16, 2021, 6:38 a.m. UTC
"pcscd" wouldn't handle SIGTERM as it inherited ignoring this
signal (and others) from its parent shepherd.  The constructor
make-forkexec, restore signal handling.  Fixes
<https://issues.guix.gnu.org/45202>.

* gnu/services/security-token.scm (pcscd)[start]: Use
make-fork-exec-constructor to start "pcscd".
---
Depend on patch <https://issues.guix.gnu.org/48987>.

 gnu/services/security-token.scm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Ludovic Courtès June 26, 2021, 8:59 p.m. UTC | #1
Hi,

Brice Waegeneire <brice@waegenei.re> skribis:

> "pcscd" wouldn't handle SIGTERM as it inherited ignoring this
> signal (and others) from its parent shepherd.  The constructor
> make-forkexec, restore signal handling.  Fixes
> <https://issues.guix.gnu.org/45202>.
>
> * gnu/services/security-token.scm (pcscd)[start]: Use
> make-fork-exec-constructor to start "pcscd".

Well done!

> +        (start #~(lambda args
>                     (let ((socket "/run/pcscd/pcscd.comm"))
>                       (when (file-exists? socket)
>                         (delete-file socket)))
> -                   (invoke #$(file-append pcsc-lite "/sbin/pcscd"))
> -                   (call-with-input-file "/run/pcscd/pcscd.pid" read)))
> +                   (apply (make-forkexec-constructor
> +                           (list #$(file-append pcsc-lite "/sbin/pcscd")
> +                                 "--foreground")
> +                           #:log-file "/var/log/pcscd.log")
> +                          args)))

We can probably call ‘fork+exec-command’ directly instead of going
through ‘make-forkexec-constructor’, no?

Otherwise LGTM, thanks!

Ludo’.
Brice Waegeneire July 3, 2021, 6:18 p.m. UTC | #2
Ludovic Courtès <ludo@gnu.org> writes:

> We can probably call ‘fork+exec-command’ directly instead of going
> through ‘make-forkexec-constructor’, no?
>
> Otherwise LGTM, thanks!

Changed to use ‘fork+exec-command’ and pushed as
e789ce538ed848bacb8f4eb5742f78b965ccf57c.
diff mbox series

Patch

diff --git a/gnu/services/security-token.scm b/gnu/services/security-token.scm
index 0cbb591e10..822984b70b 100644
--- a/gnu/services/security-token.scm
+++ b/gnu/services/security-token.scm
@@ -57,12 +57,15 @@ 
         (provision '(pcscd))
         (requirement '(syslogd))
         (modules '((gnu build shepherd)))
-        (start #~(lambda _
+        (start #~(lambda args
                    (let ((socket "/run/pcscd/pcscd.comm"))
                      (when (file-exists? socket)
                        (delete-file socket)))
-                   (invoke #$(file-append pcsc-lite "/sbin/pcscd"))
-                   (call-with-input-file "/run/pcscd/pcscd.pid" read)))
+                   (apply (make-forkexec-constructor
+                           (list #$(file-append pcsc-lite "/sbin/pcscd")
+                                 "--foreground")
+                           #:log-file "/var/log/pcscd.log")
+                          args)))
         (stop #~(make-kill-destructor)))))))
 
 (define pcscd-activation