summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-02-03 22:26:33 +0100
committerLudovic Courtès <ludo@gnu.org>2016-02-03 22:28:28 +0100
commit37dd1e6a34698e5bccaf99b6681c503b1a4e5efc (patch)
treeb326e9fae56e1476b9e884f4de67992de61b2467
parent240b57f0ca576708ebf6cfa0dfe2803fa9ff2323 (diff)
downloadguix-37dd1e6a34698e5bccaf99b6681c503b1a4e5efc.tar.gz
services: 'file-union' makes sure each source file exists.
Before that, specifying an invalid timezone in 'operating-system' would
lead to a dangling symlink in the 'etc' directory, which in turn would
lead to a kernel panic at boot time.

Reported by pizzaiolo on #guix.

* gnu/services.scm (file-union): Add 'stat' call for SOURCE.
-rw-r--r--gnu/services.scm7
1 files changed, 6 insertions, 1 deletions
diff --git a/gnu/services.scm b/gnu/services.scm
index 056bb2a1c9..1ad573787f 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -291,7 +291,12 @@ file."
                      (chdir #$output)
                      #$@(map (match-lambda
                                ((target source)
-                                #~(symlink #$source #$target)))
+                                #~(begin
+                                    ;; Stat the source to abort early if it
+                                    ;; does not exist.
+                                    (stat #$source)
+
+                                    (symlink #$source #$target))))
                              files))))
 
 (define (directory-union name things)