bug-bash
[Top][All Lists]
Advanced

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

Re: --with-installed-readline breaks tilde-expansion


From: Eric Blake
Subject: Re: --with-installed-readline breaks tilde-expansion
Date: Fri, 12 Aug 2005 15:21:04 -0600
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 8/12/2005 7:20 AM:
> According to Eric Blake on 7/23/2005 7:14 AM:
> 
>>>The following patch, to both readline and bash, allows readline to export
>>>a hook (rather than trying to import a function, which doesn't work in
>>>dynamic libraries for at least cygwin), so that bash can then override
>>>getenv() even within the context of a dynamic readline library.  It fixes
>>>not only tilde expansion (HOME), but also other uses of sh_get_env_value,
>>>where readline needs to read environment variables from bash, rather than
>>>the original program environ: INPUTRC, LC_ALL, LANG, EMACS, TERM, COLUMNS,
>>>and LINES.
> 
> 
> [Patch is available at
> http://lists.gnu.org/archive/html/bug-bash/2005-07/msg00135.html]
> 
> This patch is still needed with bash-3.1-alpha, when dynamically linked
> against readline-5.1-alpha.  Even with the bash-3.1 trick of setting
> environ, cygwin's getenv() does not track the new environ from within the
> shared library.

Actually, setting the environ works, it is just not done enough.  So a
simpler patch may be finding the extra places where environ needs to be
set so that the readline library will see the new environment:

$ echo $HOME
/home/eblake
$ ./bash --version
GNU bash, version 3.1.0(1)-alpha1 (i686-pc-cygwin)
Copyright (C) 2005 Free Software Foundation, Inc.
$ ./bash -c 'HOME=/; /bin/echo -n; echo ~'
/
$ ./bash -c 'HOME=/; echo -n; echo ~'
/home/eblake

Notice that 3.1-alpha is currently setting environ just before executing a
disk command, but not after changing an assignment of one of the variables
that readline cares about.  If only built-in commands are executed between
the change in the variable, then environ is not updated, and readline's
use of the stale environ prints the wrong results.

- --
Life is short - so eat dessert first!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFC/RLA84KuGfSFAYARAv65AJ0WN1KBH81xGQhErt+rjzikwxhHtwCg0LlP
0WYiaS72CQdDIIOa9ypJJEE=
=DsR2
-----END PGP SIGNATURE-----




reply via email to

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