Bug in gen_shell_function_matches()

View: New views
2 Messages — Rating Filter:   Alert me  

Bug in gen_shell_function_matches()

by Vladimir Barbarosh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

I found bug in 'GNU bash, version 4.0.0(18)-release (i686-pc-linux-gnu)'.  In
order to reply it, just type:

        $ ./configure
        $ make
        $ ./bash
        $ ls a<TAB>
        malloc: /Users/chet/src/bash/src/parse.y:5561: assertion botched
        free: called with unallocated block argument
        last command: ./bash
        Aborting...Aborted

In order to fix it:

        1. Open file 'pcomplete.c'.
        2. Go to line 1008.
        3. Change it to 'sh_parser_state_t ps = {0};'

But, this reveals another problem.  Just try to type, under bash sources
directory, 'ls a<TAB>'.  First time you press <TAB> your speaker will beep.
Second time you press <TAB> files will be listed, but cursor go to the left
part of 'xterm'.  You always must press END key on the keyboard in order to
place cursor where it shold be.

The problem as it turned out was in $PS1 variable.  It's hard to say exactly
what is the cause, probably some escape sequence.  I just comment it out in
'.bashrc' file and problem disappear.

        PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"

But one problem remain.  <CTRL-L> doesn't work as expected.  In order to
clear screen you need to type 'clear' rather then just <CTRL-L>.  For now I
just don't know how to correct that.

P.S. Sorry for my bad English.

--
Vladimir Barbarosh



Re: Bug in gen_shell_function_matches()

by Chet Ramey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Vladimir Barbarosh wrote:

> Hi!
>
> I found bug in 'GNU bash, version 4.0.0(18)-release (i686-pc-linux-gnu)'.  In
> order to reply it, just type:
>
> $ ./configure
> $ make
> $ ./bash
> $ ls a<TAB>
> malloc: /Users/chet/src/bash/src/parse.y:5561: assertion botched
> free: called with unallocated block argument
> last command: ./bash
> Aborting...Aborted

This is fixed by bash-4.0 patch 2.

> But, this reveals another problem.  Just try to type, under bash sources
> directory, 'ls a<TAB>'.  First time you press <TAB> your speaker will beep.
> Second time you press <TAB> files will be listed, but cursor go to the left
> part of 'xterm'.  You always must press END key on the keyboard in order to
> place cursor where it shold be.

I would try applying the bash-4.0 patches to see whether or not that
fixes it.

It's hard for me to try to reproduce the problem without knowing the
original value of $PS1, since you use it in the assignment statement
in your report.

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