bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18439: [PATCH] guile-readline: Use an empty string if HOME is unset


From: David Michael
Subject: bug#18439: [PATCH] guile-readline: Use an empty string if HOME is unset
Date: Tue, 09 Sep 2014 20:13:33 -0400

* guile-readline/ice-9/readline.scm (history-file): When the HOME
  environment variable is unset, use the empty string in its place.
---

Hi,

If a Guile program uses the readline module without setting HOME, it
will fail due to string-append getting a #f argument.  In particular,
this necessitates workarounds when starting GNU dmd early in the boot
process.  To illustrate this, try:

    guile -c '(use-modules (ice-9 readline))(display "working\n")'

And then:

    env -u HOME \
    guile -c '(use-modules (ice-9 readline))(display "working\n")'

Let me know if there is a better alternative for handling this case, and
I can send another patch.

Thanks.

David

 guile-readline/ice-9/readline.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/guile-readline/ice-9/readline.scm 
b/guile-readline/ice-9/readline.scm
index 02e68af..0979fd3 100644
--- a/guile-readline/ice-9/readline.scm
+++ b/guile-readline/ice-9/readline.scm
@@ -119,7 +119,8 @@
 (define-once the-readline-port #f)
 
 (define-once history-variable "GUILE_HISTORY")
-(define-once history-file (string-append (getenv "HOME") "/.guile_history"))
+(define-once history-file
+  (string-append (or (getenv "HOME") "") "/.guile_history"))
 
 (define-public readline-port
   (let ((do (lambda (r/w)
-- 
1.9.3





reply via email to

[Prev in Thread] Current Thread [Next in Thread]