From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Michael Newsgroups: gmane.lisp.guile.devel Subject: [PATCH] guile-readline: Use an empty string if HOME is unset Date: Tue, 09 Sep 2014 17:28:42 -0400 Message-ID: <87vbowa3g5.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1410332966 23154 80.91.229.3 (10 Sep 2014 07:09:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 10 Sep 2014 07:09:26 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Sep 10 09:09:19 2014 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XRc1k-00007H-6F for guile-devel@m.gmane.org; Wed, 10 Sep 2014 09:09:16 +0200 Original-Received: from localhost ([::1]:53931 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRc1j-0003G7-NF for guile-devel@m.gmane.org; Wed, 10 Sep 2014 03:09:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39471) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRSv3-0006c7-FL for guile-devel@gnu.org; Tue, 09 Sep 2014 17:25:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XRSuu-0006nL-EF for guile-devel@gnu.org; Tue, 09 Sep 2014 17:25:45 -0400 Original-Received: from mail-qa0-x236.google.com ([2607:f8b0:400d:c00::236]:61210) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRSuu-0006nB-4G for guile-devel@gnu.org; Tue, 09 Sep 2014 17:25:36 -0400 Original-Received: by mail-qa0-f54.google.com with SMTP id x12so15863660qac.41 for ; Tue, 09 Sep 2014 14:25:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=4rkZf88KkwgMccyWic+dVQtnVk7l5mdNHhTRzhhGA8k=; b=zE/sgAdNnnD5jV0xTcdMFXVOP41D0op2Io/J3YMXKRKU9G/ml2GfdlYyDYpUcWi8fS NXfzVpRK3qWpCTEKWyZv+fciToyiRmd9XcbAbcFXQblAMTGR693WX+1waDzKt+EVEndY E8CpQBcYfdt9PcuBt4npdRYJUtkhxatnDN36ZRQuQ+lOUwoYemQrcZatakNT3C8xKS84 y87wNbnHFkNDS37d/t9d3BPgmZi1L87Igx/vXDUf5LEeXQHGSeBoKoLDhIJ9dptzYBrU E5w1jPRviLb/yFLWQhTgbBzNChvzBI5BQ2LqZvZ0ryUkHnX1CclJhCSd0UNbJRWcinxl Wthw== X-Received: by 10.140.83.17 with SMTP id i17mr53298634qgd.16.1410297934945; Tue, 09 Sep 2014 14:25:34 -0700 (PDT) Original-Received: from callisto (wal-apn.292.wlan.wireless-pennnet.upenn.edu. [165.123.63.37]) by mx.google.com with ESMTPSA id x6sm11281870qas.27.2014.09.09.14.25.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Sep 2014 14:25:34 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c00::236 X-Mailman-Approved-At: Wed, 10 Sep 2014 03:09:08 -0400 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:17433 Archived-At: * 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