# Re: bash 4.0 breaks some completion scripts

2 messages from 2010-12-02 to 2010-12-03. Participants: Jonathan Nieder, SZEDER Gábor.
Thread: https://gitlist.dev/t/25930

## Jonathan Nieder, 2010-12-02 23:38

Subject: Re: bash 4.0 breaks some completion scripts
Message-ID: <20101202233848.GA8438@burratino>
URL: https://gitlist.dev/e/20101202233848.GA8438%40burratino
In-Reply-To: <20101027235919.GB30490@burratino>

```
Jonathan Nieder wrote:

> Bash 4.0 changed the rules for completion word splitting so that
> they are incompatible with 3.x.  I think some Breaks: will be needed
> to ensure smooth upgrades.

Just FYI: Ah, at last some clarity!

>From the bash 3 manual:

 COMP_WORDS
	An array variable (see Arrays below) consisting of the
	individual words in the current command line.  The
	words are split on shell metacharacters as the shell
	parser would separate them.  This variable is
	available only in shell functions invoked by the
	programmable completion facilities (see Programmable
	Completion below).

>From the bash 4 manual:

 COMP_WORDS
	An array variable (see Arrays below) consisting of the
	individual words in the current command line.  The
	line is split into words as readline would split it,
	using COMP_WORDBREAKS as described above.  This
	variable is available only in shell functions invoked
	by the programmable completion facilities (see
	Programmable Completion below).

The workaround used by the bash-completion scripts is to paste words
from COMP_WORDS together (in _get_comp_words_by_ref).

If only the NEWS file had mentioned it. :)  

```

## SZEDER Gábor, 2010-12-03 00:11

Subject: Re: bash 4.0 breaks some completion scripts
Message-ID: <20101203001157.GC3577@neumann>
URL: https://gitlist.dev/e/20101203001157.GC3577%40neumann
In-Reply-To: <20101202233848.GA8438@burratino>

```
Hi,


On Thu, Dec 02, 2010 at 05:38:48PM -0600, Jonathan Nieder wrote:
> Jonathan Nieder wrote:
> 
> > Bash 4.0 changed the rules for completion word splitting so that
> > they are incompatible with 3.x.  I think some Breaks: will be needed
> > to ensure smooth upgrades.
> 
> Just FYI: Ah, at last some clarity!
> 
> From the bash 3 manual:
> 
>  COMP_WORDS
> 	An array variable (see Arrays below) consisting of the
> 	individual words in the current command line.  The
> 	words are split on shell metacharacters as the shell
> 	parser would separate them.  This variable is
> 	available only in shell functions invoked by the
> 	programmable completion facilities (see Programmable
> 	Completion below).
> 
> From the bash 4 manual:
> 
>  COMP_WORDS
> 	An array variable (see Arrays below) consisting of the
> 	individual words in the current command line.  The
> 	line is split into words as readline would split it,
> 	using COMP_WORDBREAKS as described above.  This
> 	variable is available only in shell functions invoked
> 	by the programmable completion facilities (see
> 	Programmable Completion below).

Oh dear, oh dear.  I've just sent a reply to your message on the git
list with basically the same findigs. [1]

> The workaround used by the bash-completion scripts is to paste words
> from COMP_WORDS together (in _get_comp_words_by_ref).
> 
> If only the NEWS file had mentioned it. :)  

Actually, the NEWS file does mention it (and Peter noted it right at
the start! [2]):

i.  The programmable completion code now uses the same set of characters as
    readline when breaking the command line into a list of words.

But it's really easy to misinterpret this statement, because there is
and there was a $COMP_WORDBREAKS, so the first thing that
comes to mind is that the set of characters in $COMP_WORDBREAKS is
changed, leaving you puzzled for weeks when you discover that the
set of characters is still the same.


Best,
Gábor


[1] http://marc.info/?l=git&m=129133327312420&w=2
[2] http://thread.gmane.org/gmane.comp.version-control.git/159516/focus=159628

```
