summary refs log tree commit diff
path: root/gnu/packages/patches/dmd-getpw.patch
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches/dmd-getpw.patch')
-rw-r--r--gnu/packages/patches/dmd-getpw.patch19
1 files changed, 19 insertions, 0 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