From patchwork Thu Mar 6 02:38:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 39716 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 3224027BBEC; Thu, 6 Mar 2025 02:40:49 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI, PDS_OTHER_BAD_TLD,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 918A927BBE2 for ; Thu, 6 Mar 2025 02:40:48 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tq19e-0005I1-LQ; Wed, 05 Mar 2025 21:40:10 -0500 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 1tq19d-0005Hr-RY for guix-patches@gnu.org; Wed, 05 Mar 2025 21:40:09 -0500 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 1tq19d-0005ff-Hb; Wed, 05 Mar 2025 21:40:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=F4AfId5d2Y9z2u4YgwOqrdZZLaNSI6q68+8WMmQUl5M=; b=lVnqqrbv11judXqx71bRJ3rXB1F/NhXtzR1z6428qGLeb1lyMxnUH+PgtBuecexK+vkbt8bLo2u/9GFy4K/SbHAGLv5qeXkakyW3L8C8u0RdHPcOez6IvJXu1I0ZdNuEMnk4htZfrMBK0gxeCcb9ueF5dcZ0brW+ZJszhv9kPS8G1CSKAatH7pVmKQzSXm0cVjQfbyW37ernOqff8/KIx5rnu+wtAA4dblZEFqYdWTa1NhW9P0roK6PA6uiuc8fzdStd5jsGBz1KVQzEoQz7D57iHMzq9guv3DoM6nOOhjBOfouxlz1ivcEV7DVwJ1cCxPiSKXaDLiVnA1SnlvaYwg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tq19W-000251-O6; Wed, 05 Mar 2025 21:40:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#73494] [PATCH v2 2/3] services: cleanup: Make /var/run a symlink of /run. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: hako@ultrarare.space, maxim.cournoyer@gmail.com, ludo@gnu.org, vagrant@debian.org, guix-patches@gnu.org Resent-Date: Thu, 06 Mar 2025 02:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73494 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73494@debbugs.gnu.org Cc: Hilton Chain , Hilton Chain , Maxim Cournoyer , Ludovic =?utf-8?q?Court=C3=A8s?= , Vagrant Cascadian X-Debbugs-Original-Xcc: Hilton Chain , Maxim Cournoyer , Ludovic =?utf-8?q?Court=C3=A8s?= , Vagrant Cascadian Received: via spool by 73494-submit@debbugs.gnu.org id=B73494.17412287647900 (code B ref 73494); Thu, 06 Mar 2025 02:40:02 +0000 Received: (at 73494) by debbugs.gnu.org; 6 Mar 2025 02:39:24 +0000 Received: from localhost ([127.0.0.1]:40588 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tq18t-00023L-Qt for submit@debbugs.gnu.org; Wed, 05 Mar 2025 21:39:24 -0500 Received: from mx.boiledscript.com ([88.99.243.112]:37814) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tq18r-00022z-BH for 73494@debbugs.gnu.org; Wed, 05 Mar 2025 21:39:21 -0500 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1741228759; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F4AfId5d2Y9z2u4YgwOqrdZZLaNSI6q68+8WMmQUl5M=; b=YARPLnlAoGe6/5Ye8aBFYPqkr3dZ6oZ8AFFqsNL7a9uhkBKr8zw9g89rnC6AbRE2M9YFPV FQKjKITiOfN9SmCwzKFuEGKqRJXAOianw2uYRJGhtN+OueJfNSZOA5ZrVHCtL1ng+XkSJk 9jOFqMipiKNlKUnAaeeiMuCok89Jle+RO7Tx3Jk/4icpVcE6KR+dVK+I0aKtlXQNYL3877 ZEp6d4lESlBcxvZtLR2TnuuYyQX66PO1mnuP8SRLMqQaqNKpxQH/ffHxBS90zozRQyYPk9 pnoUoaw+G1Hn5+5Z/rxEb8GHX/XcNHhP+fb9OEgi+JwB/TuIOhWe/qmQUKzspA== Date: Thu, 6 Mar 2025 10:38:40 +0800 Message-ID: In-Reply-To: References: 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services.scm (cleanup-gexp): Make /var/run a symlink of /run. * doc/guix.texi (File Systems): Document it. * gnu/system/file-systems.scm (file-system-mapping->bind-mount): Use canonicalized source path. * gnu/services/dbus.scm (dbus-activation): Adjust accordingly. Change-Id: I7b94d3e2fe1bef66f435e84bc77f32311dddd0ce --- doc/guix.texi | 3 +++ gnu/services.scm | 5 +++-- gnu/services/dbus.scm | 31 ------------------------------- gnu/system/file-systems.scm | 2 +- 4 files changed, 7 insertions(+), 34 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 70e5db4156..3cec887591 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -18231,6 +18231,9 @@ File Systems @defvar %runtime-variable-data This file system is mounted as @file{/run} and contains system information data describing the system since it was booted. + +Additionally, another directory with same role, @file{/var/run}, is +implemented as a symlink to @file{/run}. @end defvar @defvar %binary-format-file-system diff --git a/gnu/services.scm b/gnu/services.scm index ea855ad193..7805cae971 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -668,8 +668,9 @@ (define (cleanup-gexp _) ;; hence the 'chmod' calls. (mkdir "/tmp" #o1777) (chmod "/tmp" #o1777) - (mkdir "/var/run" #o755) - (chmod "/var/run" #o755)))))) + ;; /run is implemented as tmpfs mounted at early boot. + (mkdir-p "/var") + (symlink "/run" "/var/run")))))) (define cleanup-service-type ;; Service that cleans things up in /tmp and similar. diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm index 76e04bf221..9292172e01 100644 --- a/gnu/services/dbus.scm +++ b/gnu/services/dbus.scm @@ -190,37 +190,6 @@ (define (dbus-activation config) ;; world-readable. (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 loop ((next (readdir dir))) - (cond - ((eof-object? next) (closedir dir)) - ((member next '("." "..")) (loop (readdir dir))) - (else - (begin - (rename-file (string-append "/var/run/dbus/" next) - (string-append "/run/dbus/" next)) - (loop (readdir 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...~%") (invoke (string-append #$(dbus-configuration-dbus config) diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index b2766707a3..8b11489968 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -594,7 +594,7 @@ (define (file-system-mapping->bind-mount mapping) (($ source target writable?) (file-system (mount-point target) - (device source) + (device (canonicalize-path source)) (type "none") (flags (if writable? '(bind-mount)