From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id IECtKaJoIGUr0AAAG6o9tA:P1 (envelope-from ) for ; Fri, 06 Oct 2023 22:05:54 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id IECtKaJoIGUr0AAAG6o9tA (envelope-from ) for ; Fri, 06 Oct 2023 22:05:54 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 13AEE4812C for ; Fri, 6 Oct 2023 22:05:53 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=planete-kraus.eu header.s=albinoniB header.b="M mBsA9O"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1696622754; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=be6t2ay4eoOxj2R/KjUrwfCMlPYQmuqxLkgi2t58P5E=; b=uIg8OfFWFPajsZte5PdsTOiD4ngSHc2v0THrwZD6A1JlpyWFNkLlH1qKIdx0grgdfWuaAj 75w1ZYIzK04HhA9wk6xqHrAxO35Eo9a2jzJXdPs9for4pN7gybU0KdpB6wRPUbv+3PFFcG vX4DbcLraxCZlx397ggfAf1+nI/tARN+eo+oENEZDxlPKdeAiB1JNAknR8CITLBSpeQSWo OliyDxqrLE5/44YEQ4AGO+Ef0DxG/3Mkwe3IRrfXNoxfLarQg/hF/5z/IATeTB4aw2MJVQ l88khqroDaKkyzKyhaZddShXtMMwOxa4MAv5bkUn/RX0KUC7eEpvB0r0hVe4Qw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=planete-kraus.eu header.s=albinoniB header.b="M mBsA9O"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1696622754; a=rsa-sha256; cv=none; b=E0aeM58YzyNgzlY4OnXzdzUf5cnNjjX9ZIx4UxB84gkJavQzRl/U1tk6yRHE5YHLDlof22 ciU37smgzsLTAt9bCku+iedCAWBtU1E6Yo2IA/FxRKA+t1IQCu+ByW0YBgC1oCyqdS+LBX zJ4Ukcw4zIytUbcbt3s/WxKqmZZK8j6FUYp8vkK9073k4spUuFBMvBR8lqBnA4AZrppzmO cZK5xKT+7hN48pekqP/zdxqv/ZGXZ0WB8DYtlJw8rjKsK/g4CstvGcNdVBFp64T+NSCynV YNmRYtrxn70ydzfz1VmkuYeiQLRwgJkQh8fiJmI2qoPpZTpt8pBUTiZ7OMGO1A== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qor4y-0004Gx-Qn; Fri, 06 Oct 2023 16:05:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qor4x-0004Gg-Lz for bug-guix@gnu.org; Fri, 06 Oct 2023 16:05:43 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qor4x-0002Ii-3A for bug-guix@gnu.org; Fri, 06 Oct 2023 16:05:43 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qor5F-0004nn-Kf for bug-guix@gnu.org; Fri, 06 Oct 2023 16:06:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#66339: [PATCH gnome-team v4] gnu: dbus-service: make the session available under /run/dbus Resent-From: Vivien Kraus Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 06 Oct 2023 20:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66339 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Liliana Marie Prikler ,66339@debbugs.gnu.org Cc: rg@raghavgururajan.name, maxim.cournoyer@gmail.com Received: via spool by 66339-submit@debbugs.gnu.org id=B66339.169662270218366 (code B ref 66339); Fri, 06 Oct 2023 20:06:01 +0000 Received: (at 66339) by debbugs.gnu.org; 6 Oct 2023 20:05:02 +0000 Received: from localhost ([127.0.0.1]:52706 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qor4H-0004m0-Nu for submit@debbugs.gnu.org; Fri, 06 Oct 2023 16:05:02 -0400 Received: from planete-kraus.eu ([89.234.140.182]:46228) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qor4B-0004ll-JQ for 66339@debbugs.gnu.org; Fri, 06 Oct 2023 16:05:00 -0400 Received: from planete-kraus.eu (localhost.lan [127.0.0.1]) by planete-kraus.eu (OpenSMTPD) with ESMTP id 5efb9ed2; Fri, 6 Oct 2023 20:04:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=planete-kraus.eu; h= message-id:in-reply-to:references:from:date:subject:to:cc :mime-version; s=albinoniB; bh=RrFTpEFh4MK+bmRQucbQmJtGbbs=; b=M mBsA9O3k/Qk5W2LLzu/hpETgqA1dKxpNXmolnLyova0pDhSk53lfAsQvQuS9IvGm 4Y/WwM6u4Ny+OpHBaqEHjrAYlkFOc8uVZCa6FKwx0SZs2KvnvdmJ8X8c0H0db5bv BuHFl0VuXgInU3M9CPMucvFGbg1GGULAFNT5PAoWiSMBGzABupDZNXIZeHc8SVRk eQxfqytFf0L855aMcnAL+5I380GQuwA/CSmWzo6dWl1rZFhZwsnJqFlE2JznU6/9 sDfgE6ugU40xZue1/FC3Tqo1C/E6ckFiZ28IwAwk4hkUiaPKBiQDU/KURgG1uydX 0fFoavTrMzN7taoTM9HPQ== Received: by planete-kraus.eu (OpenSMTPD) with ESMTPSA id 8dd18645 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Fri, 6 Oct 2023 20:04:34 +0000 (UTC) Message-ID: <0c667260f50d8a098bcec9b312de552584c2e450.1696622314.git.vivien@planete-kraus.eu> In-Reply-To: <2b14a21b9cc4987434a5cd0dd0cfd0b0d015a18a.camel@gmail.com> References: <2b14a21b9cc4987434a5cd0dd0cfd0b0d015a18a.camel@gmail.com> Date: Wed, 4 Oct 2023 12:47:04 +0200 MIME-Version: 1.0 User-Agent: Evolution 3.46.4 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Vivien Kraus From: Vivien Kraus via Bug reports for GNU Guix Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: 13AEE4812C X-Spam-Score: -0.74 X-Migadu-Spam-Score: -0.74 X-Migadu-Scanner: mx1.migadu.com X-TUID: hTLafNk8Gb89 According to https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3101, glib now searches for the session bus socket in runstatedir. The dbus service must thus have its socket in /run/dbus. For interoperability with the dbus standard, /run/dbus is also symlinked to /var/run/dbus. * gnu/services/dbus.scm (dbus-activation): Symlink /run/dbus to /var/run/dbus. (%dbus-accounts): Run dbus in /run/dbus. (dbus-root-service-type): Save the pid file in /run/dbus. --- > Perhaps, but it's not okay to fail if it's a regular directory. We should > move those! I’m not sure I understand. What comes to my mind is: 1. Try to make the symlink. If it fails with EEXIST: 2. Try to read /var/run/dbus as a symlink. If it points to /run/dbus already, stop. Otherwise: 3. Move everything in /var/run/dbus to /run/dbus. 4. Delete the now-empty /var/run/dbus. 5. Symlink /run/dbus to /var/run/dbus. Is it what you meant? Best regards, Vivien gnu/services/dbus.scm | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm index 5a0c634393..44bf0c910b 100644 --- a/gnu/services/dbus.scm +++ b/gnu/services/dbus.scm @@ -163,7 +163,7 @@ (define %dbus-accounts (group "messagebus") (system? #t) (comment "D-Bus system bus user") - (home-directory "/var/run/dbus") + (home-directory "/run/dbus") (shell (file-append shadow "/sbin/nologin"))))) (define dbus-setuid-programs @@ -186,7 +186,39 @@ (define (dbus-activation config) (let ((user (getpwnam "messagebus"))) ;; This directory contains the daemon's socket so it must be ;; world-readable. - (mkdir-p/perms "/var/run/dbus" user #o755)) + (mkdir-p/perms "/run/dbus" user #o755)) + + (catch 'system-error + (lambda () + (symlink "/run/dbus" "/var/run/dbus")) + (lambda args + (let ((errno (system-error-errno args))) + (cond + ((= errno EEXIST) + (let ((existing-name + (false-if-exception + (readlink "/var/run/dbus")))) + (unless (equal? existing-name "/run/dbus") + ;; Move the content of /var/run/dbus to /run/dbus, and + ;; retry. + (let ((dir (opendir "/var/run/dbus"))) + (let move-to-/run/dbus () + (let ((next (readdir dir))) + (unless (or (equal? next ".") + (equal? next "..") + (eof-object? next)) + (rename-file (string-append "/var/run/dbus/" next) + (string-append "/run/dbus/" next))) + (unless (eof-object? next) + (move-to-/run/dbus)))) + (closedir dir) + (rmdir "/var/run/dbus") + (symlink "/run/dbus" "/var/run/dbus"))))) + (else + (format (current-error-port) + "Failed to symlink /run/dbus to /var/run/dbus: ~s~%" + (strerror errno)) + (error "cannot create /var/run/dbus")))))) (unless (file-exists? "/etc/machine-id") (format #t "creating /etc/machine-id...~%") @@ -210,7 +242,7 @@ (define dbus-shepherd-service '(#:environment-variables '("DBUS_VERBOSE=1") #:log-file "/var/log/dbus-daemon.log") '()) - #:pid-file "/var/run/dbus/pid")) + #:pid-file "/run/dbus/pid")) (stop #~(make-kill-destructor))))))) (define dbus-root-service-type base-commit: b18b2d13488f2a92331ccad2dc8cbb54ee15582f -- 2.41.0