Debian Bug report logs - #674084
bash: please let [TAB] complete whole word, ignoring $COMP_WORDBREAKS, unless there are no matches

version graph

Package: bash; Maintainer for bash is Matthias Klose <doko@debian.org>; Source for bash is src:bash (PTS, buildd, popcon).

Reported by: Vincent Lefevre <vincent@vinc17.net>

Date: Tue, 22 May 2012 23:54:01 UTC

Severity: wishlist

Tags: upstream

Found in version bash/4.2-2

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#674084; Package bash. (Tue, 22 May 2012 23:54:04 GMT) (full text, mbox, link).


Acknowledgement sent to Vincent Lefevre <vincent@vinc17.net>:
New Bug report received and forwarded. Copy sent to Matthias Klose <doko@debian.org>. (Tue, 22 May 2012 23:54:04 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Vincent Lefevre <vincent@vinc17.net>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: bash: completion on files starting with a colon (:) is broken
Date: Wed, 23 May 2012 01:51:41 +0200
Package: bash
Version: 4.2-2
Severity: normal

Completion on files starting with a colon (:) is broken.
For instance:

$ ls -l :*
-rw-r--r-- 1 root root 16768 2012-05-23 01:44:45 :0-greeter.log.1
-rw-r--r-- 1 root root   285 2012-05-23 01:44:29 :0-slave.log.1
-rw-r--r-- 1 root root 33117 2012-05-23 01:43:52 :0.log.1
$ echo :[TAB]

I get:

$ echo :\:0

And if I do

$ echo :0[TAB]

then bash tries to complet on the files that start with "0".

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages bash depends on:
ii  base-files   6.9
ii  dash         0.5.7-3
ii  debianutils  4.3
ii  libc6        2.13-32
ii  libtinfo5    5.9-7

Versions of packages bash recommends:
ii  bash-completion  1:1.99-3

Versions of packages bash suggests:
pn  bash-doc  <none>

-- no debconf information




Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#674084; Package bash. (Wed, 23 May 2012 00:09:04 GMT) (full text, mbox, link).


Acknowledgement sent to Jonathan Nieder <jrnieder@gmail.com>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. (Wed, 23 May 2012 00:09:05 GMT) (full text, mbox, link).


Message #10 received at 674084@bugs.debian.org (full text, mbox, reply):

From: Jonathan Nieder <jrnieder@gmail.com>
To: Vincent Lefevre <vincent@vinc17.net>
Cc: 674084@bugs.debian.org
Subject: Re: bash: completion on files starting with a colon (:) is broken
Date: Tue, 22 May 2012 19:06:21 -0500
tags 674084 + upstream
severity 674084 wishlist
quit

Hi Vincent,

Vincent Lefevre wrote:

[...]
> And if I do
>
> $ echo :0[TAB]
>
> then bash tries to complet on the files that start with "0".

I think this is by design.  The manual tells me:

	COMP_WORDBREAKS
		The set of characters that the readline library
		treats as word separators when performing word
		completion.

The default value of COMP_WORDBREAKS is $" \t\"'@><=;|&(:." (that's
space, tab, dq, sq, at, gt, lt, eq, ...).  This ensures that tab
completion will do the right thing for commands like

	PATH=/usr/bin:/foo/ba[TAB]

without requiring any logic more complicated than the word splitting
rules already built in to readline.  One can use

	echo \:0[TAB]

when a colon should be considered part of a path.

Hope that helps,
Jonathan




Added tag(s) upstream. Request was from Jonathan Nieder <jrnieder@gmail.com> to control@bugs.debian.org. (Wed, 23 May 2012 00:09:06 GMT) (full text, mbox, link).


Severity set to 'wishlist' from 'normal' Request was from Jonathan Nieder <jrnieder@gmail.com> to control@bugs.debian.org. (Wed, 23 May 2012 00:09:07 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#674084; Package bash. (Wed, 23 May 2012 00:21:05 GMT) (full text, mbox, link).


Acknowledgement sent to Vincent Lefevre <vincent@vinc17.net>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. (Wed, 23 May 2012 00:21:05 GMT) (full text, mbox, link).


Message #19 received at 674084@bugs.debian.org (full text, mbox, reply):

From: Vincent Lefevre <vincent@vinc17.net>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: 674084@bugs.debian.org
Subject: Re: bash: completion on files starting with a colon (:) is broken
Date: Wed, 23 May 2012 02:20:04 +0200
Hi Jonathan,

On 2012-05-22 19:06:21 -0500, Jonathan Nieder wrote:
> Vincent Lefevre wrote:
> 
> [...]
> > And if I do
> >
> > $ echo :0[TAB]
> >
> > then bash tries to complet on the files that start with "0".
> 
> I think this is by design.  The manual tells me:
> 
> 	COMP_WORDBREAKS
> 		The set of characters that the readline library
> 		treats as word separators when performing word
> 		completion.
> 
> The default value of COMP_WORDBREAKS is $" \t\"'@><=;|&(:." (that's
> space, tab, dq, sq, at, gt, lt, eq, ...).

The default value is here different:

$ echo $COMP_WORDBREAKS
"'><=;|&(:

(I think yours is buggy because you definitely don't want the dot to
be part of $COMP_WORDBREAKS, as many filenames have a dot in them.)

> This ensures that tab completion will do the right thing for
> commands like
> 
> 	PATH=/usr/bin:/foo/ba[TAB]

zsh works fine with both kinds of completion, but...

> without requiring any logic more complicated than the word splitting
> rules already built in to readline.

it has a more advanced completion system. However I think that
bash could "easily" be improved: IMHO, $COMP_WORDBREAKS should
be taken into account only if [TAB] wouldn't find any match
without $COMP_WORDBREAKS.

> One can use
> 
> 	echo \:0[TAB]
> 
> when a colon should be considered part of a path.

Thanks, this works.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#674084; Package bash. (Wed, 23 May 2012 00:33:04 GMT) (full text, mbox, link).


Acknowledgement sent to Jonathan Nieder <jrnieder@gmail.com>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. (Wed, 23 May 2012 00:33:04 GMT) (full text, mbox, link).


Message #24 received at 674084@bugs.debian.org (full text, mbox, reply):

From: Jonathan Nieder <jrnieder@gmail.com>
To: Vincent Lefevre <vincent@vinc17.net>
Cc: 674084@bugs.debian.org
Subject: Re: bash: completion on files starting with a colon (:) is broken
Date: Tue, 22 May 2012 19:29:09 -0500
retitle 674084 bash: please let [TAB] complete whole word, ignoring $COMP_WORDBREAKS, unless there are no matches
quit

Vincent Lefevre wrote:

> The default value is here different:
>
> $ echo $COMP_WORDBREAKS
> "'><=;|&(:
>
> (I think yours is buggy because you definitely don't want the dot to
> be part of $COMP_WORDBREAKS, as many filenames have a dot in them.)

Thanks.  Yeah, I'm not sure what the @-sign is about in mine.  (The
dot was just a transcription error.)

[...]
>                                           However I think that
> bash could "easily" be improved: IMHO, $COMP_WORDBREAKS should
> be taken into account only if [TAB] wouldn't find any match
> without $COMP_WORDBREAKS.

That sounds reasonable to me at first glance.  Chet can be reached
at bug-bash@gnu.org or using the bashbug command, if you find
yourself with time to pursue it.

Ciao,
Jonathan




Changed Bug title to 'bash: please let [TAB] complete whole word, ignoring $COMP_WORDBREAKS, unless there are no matches' from 'bash: completion on files starting with a colon (:) is broken' Request was from Jonathan Nieder <jrnieder@gmail.com> to control@bugs.debian.org. (Wed, 23 May 2012 00:33:06 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Wed Dec 6 07:38:13 2023; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.