tab completion with variable expansion broken

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

tab completion with variable expansion broken

William F Hammond-4

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/src/gnu/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -g -O2
uname output: Linux jeanubu 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:32:50 UTC 2012 i686 athlon i386 GNU/Linux
Machine Type: i686-pc-linux-gnu

Bash Version: 4.2
Patch Level: 37
Release Status: release

Description:
        If I have ul=/usr/local in the environment, I may want to
        use a reference to it together with tab completion to go to
        the directory /usr/local/share/emacs/site-lisp.

        If I enter "cd $ul/sh" (which has a unique completion) followed
        by <TAB>, bash turns my input into the string
       
                  "cd \$ul/share "

        Since nearly the beginning of time it was turning that input
        into
                  "cd /usr/local/share/"
       
        The old behavior is correct.  The new behavior is doubly
        clumsy.  I need EXTRA input steps to continue with tab
        completion toward the target.  I can use C-M-E to get
       
                  "cd $ul/share "
                 
        and then a backspace and "/" plus the normal "em" followed
        by <TAB> to get
       
                  "cd \$ul/local/share/emacs "

        Then two more extra steps with the next layer.

        I can't believe that RMS would agree with this change.

Repeat-By:
        See above.

Postscript:
        The first delivery attempt bounced.

        The program bashbug seems not to know how to recognize
a fully qualified domain name (for "From:").  It should be prompting
for that and for SMTP host.  (Then there's the issue of SMTP
authentication.)

                              -- Bill





Reply | Threaded
Open this post in threaded view
|

Re: tab completion with variable expansion broken

Chet Ramey
On 10/14/12 8:52 AM, William F Hammond wrote:

>
> Configuration Information [Automatically generated, do not change]:
> Machine: i686
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/src/gnu/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -g -O2
> uname output: Linux jeanubu 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:32:50 UTC 2012 i686 athlon i386 GNU/Linux
> Machine Type: i686-pc-linux-gnu
>
> Bash Version: 4.2
> Patch Level: 37
> Release Status: release
>
> Description:
> If I have ul=/usr/local in the environment, I may want to
> use a reference to it together with tab completion to go to
> the directory /usr/local/share/emacs/site-lisp.

If you indeed are using bash-4.2.37, you can enable variable expansion
by running `shopt -s direxpand'.  This will produce the behavior you
want.

I'm wondering if you've got programmable completion enabled, or whether
you're running a different version of bash than bashbug indicates, because
stock 4.2.37 doesn't quote the dollar sign.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    [hidden email]    http://cnswww.cns.cwru.edu/~chet/

Reply | Threaded
Open this post in threaded view
|

Re: tab completion with variable expansion broken

William F Hammond-4
Chet --

Many thanks for your reply.

You write:

> On 10/14/12 8:52 AM, William F Hammond wrote:
>>
>> Configuration Information [Automatically generated, do not change]:
>> Machine: i686
>> OS: linux-gnu
>> Compiler: gcc
>> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/src/gnu/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -g -O2
>> uname output: Linux jeanubu 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:32:50 UTC 2012 i686 athlon i386 GNU/Linux
>> Machine Type: i686-pc-linux-gnu
>>
>> Bash Version: 4.2
>> Patch Level: 37
>> Release Status: release
>>
>> Description:
>> If I have ul=/usr/local in the environment, I may want to
>> use a reference to it together with tab completion to go to
>> the directory /usr/local/share/emacs/site-lisp.
>
> If you indeed are using bash-4.2.37, you can enable variable expansion
> by running `shopt -s direxpand'.  This will produce the behavior you
> want.
>
> I'm wondering if you've got programmable completion enabled, or whether
> you're running a different version of bash than bashbug indicates, because
> stock 4.2.37 doesn't quote the dollar sign.

Yes 'shopt -s direxpand' works.  Thanks.

I'm working with Ubuntu 12.04(LTS) which was installed by a
difficult upgrade from Ubuntu 10.04(LTS) about six weeks
ago.  Ubuntu 12.04 comes with bash version 4.2.24, while
10.04 came with 4.1.5.  So the tab completion issue was new
for me with bash 4.2.24.

Over the weekend I built bash 4.2.37 from source with
prefix /usr/local/src/gnu and placed a symlink to the
new executable in /usr/local/bin.

The Ubuntu package bash-completion for programmable completion
is installed, and also was installed with Ubuntu 10.04.  In both
cases the script /etc/bash.bashrc invokes programmable completion
though I have not descended into the details of this.

I have not studied enough to understand why this change
arose nor why 'shopt -s direxpand' should not be present in
/etc/bash.bashrc (though perhaps you now think it should).
(I don't see it in any of the files in
"bash-4.2/examples/startup-files".)

Thanks for your help and for your work on bash.

                              -- Bill



Reply | Threaded
Open this post in threaded view
|

Re: tab completion with variable expansion broken

Aharon Robbins
In reply to this post by William F Hammond-4
In article <[hidden email]>,
Chet Ramey  <[hidden email]> wrote:

>On 10/14/12 8:52 AM, William F Hammond wrote:
>>
>> Configuration Information [Automatically generated, do not change]:
>> Machine: i686
>> OS: linux-gnu
>> Compiler: gcc
>> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
>-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
>-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/src/gnu/share/locale'
>-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib
>-g -O2
>> uname output: Linux jeanubu 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26
>21:32:50 UTC 2012 i686 athlon i386 GNU/Linux
>> Machine Type: i686-pc-linux-gnu
>>
>> Bash Version: 4.2
>> Patch Level: 37
>> Release Status: release
>>
>> Description:
>> If I have ul=/usr/local in the environment, I may want to
>> use a reference to it together with tab completion to go to
>> the directory /usr/local/share/emacs/site-lisp.
>
>If you indeed are using bash-4.2.37, you can enable variable expansion
>by running `shopt -s direxpand'.  This will produce the behavior you
>want.
>
>I'm wondering if you've got programmable completion enabled, or whether
>you're running a different version of bash than bashbug indicates, because
>stock 4.2.37 doesn't quote the dollar sign.
>
>--
>``The lyf so short, the craft so long to lerne.'' - Chaucer
> ``Ars longa, vita brevis'' - Hippocrates
>Chet Ramey, ITS, CWRU    [hidden email]    http://cnswww.cns.cwru.edu/~chet/
>

Is there something that can be done for 4.2.24 (/bin/bash on Ubuntu 12.04)?

Thanks,

Arnold
--
Aharon (Arnold) Robbins arnold AT skeeve DOT com
P.O. Box 354 Home Phone: +972  8 979-0381
Nof Ayalon Cell Phone: +972 50 729-7545
D.N. Shimshon 99785 ISRAEL
Reply | Threaded
Open this post in threaded view
|

Re: tab completion with variable expansion broken

Chet Ramey
In reply to this post by William F Hammond-4
On 10/15/12 11:26 AM, William F Hammond wrote:

>> If you indeed are using bash-4.2.37, you can enable variable expansion
>> by running `shopt -s direxpand'.  This will produce the behavior you
>> want.
>>
>> I'm wondering if you've got programmable completion enabled, or whether
>> you're running a different version of bash than bashbug indicates, because
>> stock 4.2.37 doesn't quote the dollar sign.
>
> Yes 'shopt -s direxpand' works.  Thanks.
>
> I'm working with Ubuntu 12.04(LTS) which was installed by a
> difficult upgrade from Ubuntu 10.04(LTS) about six weeks
> ago.  Ubuntu 12.04 comes with bash version 4.2.24, while
> 10.04 came with 4.1.5.  So the tab completion issue was new
> for me with bash 4.2.24.

Yes, this issue was new with bash-4.2.  Patch 29 contains several
things: the direxpand option, fixes to the treatment of relative
pathnames, and some heuristics that prevent dollar signs from
being quoted in expanded words without direxpand enabled.  The
intent of the direxpand option is to restore the bash-4.1 behavior,
with some bug fixes.

I'm not sure why Ubuntu is waiting to update bash-4.2 to at least patch
29 other than they just haven't gotten to it yet.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    [hidden email]    http://cnswww.cns.cwru.edu/~chet/

Reply | Threaded
Open this post in threaded view
|

Re: tab completion with variable expansion broken

Chet Ramey
In reply to this post by Aharon Robbins
On 10/15/12 1:32 PM, Aharon Robbins wrote:

> Is there something that can be done for 4.2.24 (/bin/bash on Ubuntu 12.04)?

Regrettably, nothing other than upgrading to at least bash-4.2 patch 29,
or requesting that Ubuntu (really Debian) do so.

Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    [hidden email]    http://cnswww.cns.cwru.edu/~chet/

Reply | Threaded
Open this post in threaded view
|

Re: tab completion with variable expansion broken

njhwang
Thanks, this is exactly what I needed to fix the issue on my end as well.

I'm curious if anyone who patched bash in this manner started seeing a weird issue with long commands in the terminal? After building bash-4.2.29, long commands would no longer break into multiple lines in gnome-terminal, and would start overwriting the first line with a '>' character at the beginning. After a lot of searching and attempts to fix it, I ended up just using byobu (a terminal emulator using screen) to make the new line issue go away. Any ideas what the root cause might be?
Reply | Threaded
Open this post in threaded view
|

Re: tab completion with variable expansion broken

Roman Rakus
On 12/11/2012 06:03 PM, njhwang wrote:

> Thanks, this is exactly what I needed to fix the issue on my end as well.
>
> I'm curious if anyone who patched bash in this manner started seeing a weird
> issue with long commands in the terminal? After building bash-4.2.29, long
> commands would no longer break into multiple lines in gnome-terminal, and
> would start overwriting the first line with a '>' character at the
> beginning. After a lot of searching and attempts to fix it, I ended up just
> using byobu (a terminal emulator using screen) to make the new line issue go
> away. Any ideas what the root cause might be?
>
>
>
> --
> View this message in context: http://gnu-bash.2382.n7.nabble.com/tab-completion-with-variable-expansion-broken-tp10798p11122.html
> Sent from the Gnu - Bash mailing list archive at Nabble.com.
>
I would check PS1 especially if you have correctly escaped non-printing
characters.

RR

Reply | Threaded
Open this post in threaded view
|

Re: tab completion with variable expansion broken

njhwang
I actually did this with a stock Ubuntu .bashrc/PS1 setting, and also tried
it with no .bashrc at all and also tried completely clearing PS1, none of
which had any effect on this issue. Any other ideas? Thanks
Reply | Threaded
Open this post in threaded view
|

Re: tab completion with variable expansion broken

Chet Ramey
On 12/11/12 6:38 PM, njhwang wrote:
> I actually did this with a stock Ubuntu .bashrc/PS1 setting, and also tried
> it with no .bashrc at all and also tried completely clearing PS1, none of
> which had any effect on this issue. Any other ideas? Thanks

You don't have the ncurses library installed.  Bash will build without it,
but line editing will be severely limited.  It will not know how to move
the cursor up, and will default to horizontal scrolling.  There are
problems with horizontal scrolling and prompts containing invisible
characters (I'll fix them, but that's little-used code, and I haven't
gotten there yet.)

You can install the ncurses library using

sudo apt-get install libncurses5-dev

Then remove any cache created by configure (rm config.cache) and re-run
configure and make.

Chet



--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    [hidden email]    http://cnswww.cns.cwru.edu/~chet/

Reply | Threaded
Open this post in threaded view
|

Re: tab completion with variable expansion broken

njhwang
Chet, you are awesome. Thanks for doing what you do.