~ruther/guix-local

ref: 6dc99317fb581d99f1298ca67fc79ee121676b3a guix-local/gnu/packages/patches/dmd-getpw.patch -rw-r--r-- 591 bytes
6dc99317 — Ludovic Courtès doc: List what's in the chroot. 12 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
When bootstrapping and running as PID 1, /etc/{passwd,shadow} may be unavailable.
Gracefully handle that.

diff --git a/modules/dmd/support.scm b/modules/dmd/support.scm
index 9b592c5..602e409 100644
--- a/modules/dmd/support.scm
+++ b/modules/dmd/support.scm
@@ -151,7 +151,10 @@ There is NO WARRANTY, to the extent permitted by law.")))
 
 
 ;; Home directory of the user.
-(define user-homedir (passwd:dir (getpwuid (getuid))))
+(define user-homedir
+  (or (false-if-exception (passwd:dir (getpwuid (getuid))))
+      (getenv "HOME")
+      "/"))
 
 ;; Logfile.
 (define default-logfile