unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 48262@debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: [bug#48262] [PATCH version-1.3.0 2/3] services: spice-vdagent: Clear the socket file prior to starting.
Date: Thu,  6 May 2021 13:27:31 -0400	[thread overview]
Message-ID: <20210506172732.12294-2-maxim.cournoyer@gmail.com> (raw)
In-Reply-To: <20210506172732.12294-1-maxim.cournoyer@gmail.com>

This fixes the following issue where spice-vdagent would fail to start if the
spice-vdagent-sock socket file already existed:

  spice-vdagentd: Fatal could not create the server socket
  /run/spice-vdagentd/spice-vdagent-sock: Error binding to address: Address
  already in use

The requirement is also modified to depend on dbus-system, a cue taken from
upstream's own systemd service file (see 'data/spice-vdagentd.service' in the
sources).

* gnu/services/spice.scm (spice-vdagent-activation): Delete procedure.
(spice-vdagent-shepherd-service): Fix indentation.
[requirement]: Replace udev by dbus-system.
[start]: Ensure the spice-vdagentd run-time directory exists and that the
spice-vdagent-sock socket file does *not* exist before forking the daemon.
---
 gnu/services/spice.scm | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/gnu/services/spice.scm b/gnu/services/spice.scm
index a2aee4ab2a..3b88e29043 100644
--- a/gnu/services/spice.scm
+++ b/gnu/services/spice.scm
@@ -34,28 +34,29 @@
   (spice-vdagent spice-vdagent-configuration-spice-vdagent
                  (default spice-vdagent)))
 
-(define (spice-vdagent-activation config)
-  "Return the activation gexp for CONFIG."
-  #~(begin
-      (use-modules (guix build utils))
-      (mkdir-p "/run/spice-vdagentd")))
-
 (define (spice-vdagent-shepherd-service config)
   "Return a <shepherd-service> for spice-vdagentd with CONFIG."
   (define spice-vdagent (spice-vdagent-configuration-spice-vdagent config))
 
   (define spice-vdagentd-command
     (list
-      (file-append spice-vdagent "/sbin/spice-vdagentd")
-      "-x"))
+     (file-append spice-vdagent "/sbin/spice-vdagentd")
+     "-x"))
 
   (list
-    (shepherd-service
-      (documentation "Spice vdagentd service")
-      (requirement '(udev))
-      (provision '(spice-vdagentd))
-      (start #~(make-forkexec-constructor '#$spice-vdagentd-command))
-      (stop #~(make-kill-destructor)))))
+   (shepherd-service
+    (documentation "Spice vdagentd service")
+    (requirement '(dbus-system))
+    (provision '(spice-vdagentd))
+    (start #~(lambda args
+               ;; spice-vdagentd supports being activated upon the client
+               ;; connecting to its socket; when not using such feature, the
+               ;; socket should not exist before vdagentd creates it itself.
+               (mkdir-p "/run/spice-vdagentd")
+               (false-if-exception
+                (delete-file "/run/spice-vdagentd/spice-vdagent-sock"))
+               (fork+exec-command '#$spice-vdagentd-command)))
+    (stop #~(make-kill-destructor)))))
 
 (define spice-vdagent-profile
   (compose list spice-vdagent-configuration-spice-vdagent))
@@ -67,8 +68,6 @@
    (extensions
     (list (service-extension shepherd-root-service-type
                              spice-vdagent-shepherd-service)
-          (service-extension activation-service-type
-                             spice-vdagent-activation)
           (service-extension profile-service-type
                              spice-vdagent-profile)))))
 
-- 
2.31.1





  reply	other threads:[~2021-05-06 17:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-06 17:23 [bug#48262] [PATCH version-1.3.0 0/3] Enable SPICE for the Guix VM image Maxim Cournoyer
2021-05-06 17:27 ` [bug#48262] [PATCH version-1.3.0 1/3] gnu: spice-vdagent: Update to 0.21.0 and enable GTK+ support Maxim Cournoyer
2021-05-06 17:27   ` Maxim Cournoyer [this message]
2021-05-06 17:27   ` [bug#48262] [PATCH version-1.3.0 3/3] gnu: system: Add SPICE capability to the VM image Maxim Cournoyer
2021-05-07 15:36     ` bug#48262: " Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210506172732.12294-2-maxim.cournoyer@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=48262@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).