unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#18439: [PATCH] guile-readline: Use an empty string if HOME is unset
@ 2014-09-10  0:13 David Michael
  2014-09-20 14:09 ` Mark H Weaver
  2014-09-20 14:43 ` bug#18439: [PATCH] guile-readline: Use the current directory " David Michael
  0 siblings, 2 replies; 4+ messages in thread
From: David Michael @ 2014-09-10  0:13 UTC (permalink / raw)
  To: 18439

* 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





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#18439: [PATCH] guile-readline: Use an empty string if HOME is unset
  2014-09-10  0:13 bug#18439: [PATCH] guile-readline: Use an empty string if HOME is unset David Michael
@ 2014-09-20 14:09 ` Mark H Weaver
  2014-09-20 14:43 ` bug#18439: [PATCH] guile-readline: Use the current directory " David Michael
  1 sibling, 0 replies; 4+ messages in thread
From: Mark H Weaver @ 2014-09-20 14:09 UTC (permalink / raw)
  To: David Michael; +Cc: 18439

Hi David,

David Michael <fedora.dm0@gmail.com> writes:
> * guile-readline/ice-9/readline.scm (history-file): When the HOME
>   environment variable is unset, use the empty string in its place.

I would prefer to use "." in its place, instead of the empty string.
Otherwise, the patch looks good to me.

Can you send an updated patch?

     Thanks!
       Mark





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#18439: [PATCH] guile-readline: Use the current directory if HOME is unset
  2014-09-10  0:13 bug#18439: [PATCH] guile-readline: Use an empty string if HOME is unset David Michael
  2014-09-20 14:09 ` Mark H Weaver
@ 2014-09-20 14:43 ` David Michael
  2014-09-22  3:26   ` Mark H Weaver
  1 sibling, 1 reply; 4+ messages in thread
From: David Michael @ 2014-09-20 14:43 UTC (permalink / raw)
  To: 18439

* guile-readline/ice-9/readline.scm (history-file): When the HOME
  environment variable is unset, use the current directory instead.
---
 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..df2edaf 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






^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#18439: [PATCH] guile-readline: Use the current directory if HOME is unset
  2014-09-20 14:43 ` bug#18439: [PATCH] guile-readline: Use the current directory " David Michael
@ 2014-09-22  3:26   ` Mark H Weaver
  0 siblings, 0 replies; 4+ messages in thread
From: Mark H Weaver @ 2014-09-22  3:26 UTC (permalink / raw)
  To: David Michael; +Cc: 18439-done

severity 18439 wishlist
tags 18439 notabug
thanks

David Michael <fedora.dm0@gmail.com> writes:

> * guile-readline/ice-9/readline.scm (history-file): When the HOME
>   environment variable is unset, use the current directory instead.
> ---
>  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..df2edaf 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)

Pushed to the stable-2.0 branch, commit
3a3316e200ac49f0e8e9004c233747efd9f54a04.
I'm closing this ticket now.

     Thanks!
       Mark





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-22  3:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-10  0:13 bug#18439: [PATCH] guile-readline: Use an empty string if HOME is unset David Michael
2014-09-20 14:09 ` Mark H Weaver
2014-09-20 14:43 ` bug#18439: [PATCH] guile-readline: Use the current directory " David Michael
2014-09-22  3:26   ` Mark H Weaver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).