guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/07: services: shepherd: Make /run/booted-system a symlink to the stor


From: guix-commits
Subject: 02/07: services: shepherd: Make /run/booted-system a symlink to the store item.
Date: Thu, 25 Feb 2021 05:42:25 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 412e4f081e9cdf38db9859e1548ef2362cde678e
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Thu Feb 25 10:58:20 2021 +0100

    services: shepherd: Make /run/booted-system a symlink to the store item.
    
    Fixes <https://bugs.gnu.org/46767>.
    
    Previously /run/booted-system would end up referring to
    /var/guix/profiles/system-NNN-link; consequently, the booted system
    would not be GC-protected.
    
    * gnu/services/shepherd.scm (shepherd-boot-gexp): Call
    'canonicalize-path' instead of 'readlink'.
---
 gnu/services/shepherd.scm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index e2ec59f..19a052c 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -97,7 +97,11 @@
   #~(begin
       ;; Keep track of the booted system.
       (false-if-exception (delete-file "/run/booted-system"))
-      (symlink (readlink "/run/current-system")
+
+      ;; Make /run/booted-system, an indirect GC root, point to the store item
+      ;; /run/current-system points to.  Use 'canonicalize-path' rather than
+      ;; 'readlink' to make sure we get the store item.
+      (symlink (canonicalize-path "/run/current-system")
                "/run/booted-system")
 
       ;; Close any remaining open file descriptors to be on the safe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]