guix/gnu/packages/patches/dmd-getpw.patch

20 lines
591 B
Diff
Raw Normal View History

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