[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
crash if HOME is unset
From: |
Simon Josefsson |
Subject: |
crash if HOME is unset |
Date: |
Wed, 18 Dec 2024 17:31:15 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Hi
I'm experimenting with Gash to get a minimalistic Guix container
experience [1], and noticed that it crashes if HOME is unset:
Backtrace:
In ice-9/boot-9.scm:
1752:10 5 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
4 (apply-smob/0 #<thunk 7f69f696d300>)
In ice-9/boot-9.scm:
724:2 3 (call-with-prompt _ _ #<procedure default-prompt-handle?>)
In ice-9/eval.scm:
619:8 2 (_ #(#(#<directory (guile-user) 7f69f6970c80>)))
In gash/gash.scm:
123:28 1 (main _)
In unknown file:
0 (string-append #f "/.gash_history")
ERROR: In procedure string-append:
In procedure string-append: Wrong type (expecting string): #f
The code seems to be gash.scm:
((isatty? (current-input-port))
(let* ((HOME (string-append (getenv "HOME") "/.gash_history"))
(thunk (lambda ()
How about this patch? I haven't tested it in practice, getting the
build environment up and running is too challenging for me right now so
I'm just reading error message and guessing code problems. But this
should be easy to reproduce.
diff --git a/gash/gash.scm b/gash/gash.scm
index 68838e1..7e46738 100644
--- a/gash/gash.scm
+++ b/gash/gash.scm
@@ -120,7 +120,7 @@ There is NO WARRANTY, to the extent permitted by law.
(lambda (port)
(exit (run-repl port parse?))))))
((isatty? (current-input-port))
- (let* ((HOME (string-append (getenv "HOME") "/.gash_history"))
+ (let* ((HOME (string-append (or (getenv "HOME") "")
"/.gash_history"))
(thunk (lambda ()
(let loop ((line (readline (prompt))))
(when (not (eof-object? line))
/Simon
[1] https://gitlab.com/debdistutils/guix/container/
signature.asc
Description: PGP signature
- crash if HOME is unset,
Simon Josefsson <=