summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/patches/dmd-getpw.patch19
-rw-r--r--gnu/packages/system.scm3
2 files changed, 21 insertions, 1 deletions
diff --git a/gnu/packages/patches/dmd-getpw.patch b/gnu/packages/patches/dmd-getpw.patch
new file mode 100644
index 0000000000..c4f9c35951
--- /dev/null
+++ b/gnu/packages/patches/dmd-getpw.patch
@@ -0,0 +1,19 @@
+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
diff --git a/gnu/packages/system.scm b/gnu/packages/system.scm
index f92d874099..536234f4aa 100644
--- a/gnu/packages/system.scm
+++ b/gnu/packages/system.scm
@@ -45,7 +45,8 @@
                                  version ".tar.gz"))
              (sha256
               (base32
-               "07mddw0p62fcphwjzgb6rfa0pjz5sy6jzbha0sm2vc3rqf459jxg"))))
+               "07mddw0p62fcphwjzgb6rfa0pjz5sy6jzbha0sm2vc3rqf459jxg"))
+             (patches (list (search-patch "dmd-getpw.patch")))))
     (build-system gnu-build-system)
     (arguments
      '(#:configure-flags '("--localstatedir=/var")))