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

Previous Next

Package: guile;

Reported by: David Michael <fedora.dm0 <at> gmail.com>

Date: Wed, 10 Sep 2014 00:12:02 UTC

Severity: wishlist

Tags: notabug, patch

Done: Mark H Weaver <mhw <at> netris.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18439 in the body.
You can then email your comments to 18439 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#18439; Package guile. (Wed, 10 Sep 2014 00:12:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to David Michael <fedora.dm0 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Wed, 10 Sep 2014 00:12:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: David Michael <fedora.dm0 <at> gmail.com>
To: bug-guile <at> gnu.org
Subject: [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




Information forwarded to bug-guile <at> gnu.org:
bug#18439; Package guile. (Sat, 20 Sep 2014 14:12:02 GMT) Full text and rfc822 format available.

Message #8 received at 18439 <at> debbugs.gnu.org (full text, mbox):

From: Mark H Weaver <mhw <at> netris.org>
To: David Michael <fedora.dm0 <at> gmail.com>
Cc: 18439 <at> debbugs.gnu.org
Subject: Re: bug#18439: [PATCH] guile-readline: Use an empty string if HOME is
 unset
Date: Sat, 20 Sep 2014 10:09:26 -0400
Hi David,

David Michael <fedora.dm0 <at> 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




Information forwarded to bug-guile <at> gnu.org:
bug#18439; Package guile. (Sat, 20 Sep 2014 14:44:02 GMT) Full text and rfc822 format available.

Message #11 received at 18439 <at> debbugs.gnu.org (full text, mbox):

From: David Michael <fedora.dm0 <at> gmail.com>
To: 18439 <at> debbugs.gnu.org
Subject: [PATCH] guile-readline: Use the current directory if HOME is unset
Date: Sat, 20 Sep 2014 10:43:21 -0400
* 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





Reply sent to Mark H Weaver <mhw <at> netris.org>:
You have taken responsibility. (Mon, 22 Sep 2014 03:29:02 GMT) Full text and rfc822 format available.

Notification sent to David Michael <fedora.dm0 <at> gmail.com>:
bug acknowledged by developer. (Mon, 22 Sep 2014 03:29:02 GMT) Full text and rfc822 format available.

Message #16 received at 18439-done <at> debbugs.gnu.org (full text, mbox):

From: Mark H Weaver <mhw <at> netris.org>
To: David Michael <fedora.dm0 <at> gmail.com>
Cc: 18439-done <at> debbugs.gnu.org
Subject: Re: bug#18439: [PATCH] guile-readline: Use the current directory if
 HOME is unset
Date: Sun, 21 Sep 2014 23:26:38 -0400
severity 18439 wishlist
tags 18439 notabug
thanks

David Michael <fedora.dm0 <at> 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




Severity set to 'wishlist' from 'normal' Request was from Mark H Weaver <mhw <at> netris.org> to control <at> debbugs.gnu.org. (Mon, 22 Sep 2014 03:29:03 GMT) Full text and rfc822 format available.

Added tag(s) notabug. Request was from Mark H Weaver <mhw <at> netris.org> to control <at> debbugs.gnu.org. (Mon, 22 Sep 2014 03:29:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 20 Oct 2014 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 200 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.