From patchwork Thu May 6 17:27:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 29153 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id CEE1427BC82; Thu, 6 May 2021 18:29:16 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 3E8D727BC86 for ; Thu, 6 May 2021 18:29:15 +0100 (BST) Received: from localhost ([::1]:59488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lehoI-0001Kf-FW for patchwork@mira.cbaines.net; Thu, 06 May 2021 13:29:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leho6-0001KR-VI for guix-patches@gnu.org; Thu, 06 May 2021 13:29:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:55414) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1leho6-0001YS-HN for guix-patches@gnu.org; Thu, 06 May 2021 13:29:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1leho6-0005lg-Ed for guix-patches@gnu.org; Thu, 06 May 2021 13:29:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48262] [PATCH version-1.3.0 2/3] services: spice-vdagent: Clear the socket file prior to starting. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 06 May 2021 17:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48262 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48262@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 48262-submit@debbugs.gnu.org id=B48262.162032208222140 (code B ref 48262); Thu, 06 May 2021 17:29:02 +0000 Received: (at 48262) by debbugs.gnu.org; 6 May 2021 17:28:02 +0000 Received: from localhost ([127.0.0.1]:38720 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lehn8-0005kv-B8 for submit@debbugs.gnu.org; Thu, 06 May 2021 13:28:02 -0400 Received: from mail-qt1-f173.google.com ([209.85.160.173]:37587) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lehn6-0005kX-Cw for 48262@debbugs.gnu.org; Thu, 06 May 2021 13:28:00 -0400 Received: by mail-qt1-f173.google.com with SMTP id g13so4616252qts.4 for <48262@debbugs.gnu.org>; Thu, 06 May 2021 10:28:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FLkC0Ke2hXvvB2RpvZvoheOARp0aZWFxKRyivduEY8M=; b=Z5mt6Cskdr0gNQeeYoHt/kceu/cfxR/NoKl+mEQIpRL2i9D2Lk58seimR17d5XV0Zs +0YmitCtL5dXg1hRNBW1zIq3ePIk+BRvzwllyWL0fRf5LLNmxuhJ8EuAjIlMmStCsPBd d/PadXWbNsxTvxo55oYyjFPrDdd4SQF+Se6Jl7lbu/zFoifhDH8gqF7uKbie2FWM8QUw WmQ5NPzSSHO8vzTJaGCIeygLXeiIYiU+rp89nXYIDgVtiCL1l/OybW8dSxLw/n2lDO4m pJXFcPLQ3dUf/rzIc3MYTXio5rA+UlCQjlPRL6Ql/lYZzRl+tszJMvziGY1nKRUOnTt7 UM4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FLkC0Ke2hXvvB2RpvZvoheOARp0aZWFxKRyivduEY8M=; b=imoeV+dUwnaxZT5Eqxnv3fPOmf9upBrK5RIa01Lo3qj4LxmM71Cnsk3NMP0PpD45yj SGShFR6i31qX7oWatn4nwLInv2dpY41/taIjOtGm+FfwG4+a6iE69P6MlCoNFlefKoYF kwiUCzaBPOK1vtlpfcdd/iuNSOWZ9GQFVucEaQ/bMyGPQ6prnQMxJDInLLuuT6zqz5hF jRVqn6IQV2rGdMWhwzkFjnoa9hMHp/tL9o5H6f1wXD40pTVXxMnWmpBTYbe1h4Ky/cPm SivH2nEtq+wcaXQ6UzRFkLq+/Ya1ynlcOAuFZhwHuGomERFsygboeDq4OKl+FdTq/Z9Q JV3Q== X-Gm-Message-State: AOAM533sSitrRtNwRB0hycR0CVpTeruEUwAQ9tfSM+VnuuN8/hNNVint FU4k5yEB4Yf8kYRJUPdGzV/PrhtRLDwH6Q== X-Google-Smtp-Source: ABdhPJx7S5Vs0wjNKXl/JCX6UfV1vAlC/7Bm6Djq9M9huZyfTPNYYcX5ju0N73QYxNBSZ1OWd3c6ZA== X-Received: by 2002:ac8:7fc5:: with SMTP id b5mr5284725qtk.122.1620322074328; Thu, 06 May 2021 10:27:54 -0700 (PDT) Received: from localhost.localdomain (dsl-10-131-245.b2b2c.ca. [72.10.131.245]) by smtp.gmail.com with ESMTPSA id y13sm2495704qkj.84.2021.05.06.10.27.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 May 2021 10:27:54 -0700 (PDT) From: Maxim Cournoyer Date: Thu, 6 May 2021 13:27:31 -0400 Message-Id: <20210506172732.12294-2-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210506172732.12294-1-maxim.cournoyer@gmail.com> References: <20210506172732.12294-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches 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 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)))))