Debian Bug report logs - #131101
bash: File completion bug with executables inside a control structure

version graph

Package: bash-completion; Maintainer for bash-completion is Gabriel F. T. Gomes <gabriel@debian.org>; Source for bash-completion is src:bash-completion (PTS, buildd, popcon).

Reported by: Ajay Shah <ajayshah@mayin.org>

Date: Sun, 27 Jan 2002 07:48:01 UTC

Severity: normal

Fixed in version bash-completion/20060301-4

Done: David Paleino <d.paleino@gmail.com>

Bug is archived. No further changes may be made.

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>, bash@packages.qa.debian.org:
Bug#131101; Package bash. (full text, mbox, link).


Acknowledgement sent to Ajay Shah <ajayshah@mayin.org>:
New Bug report received and forwarded. Copy sent to Matthias Klose <doko@debian.org>, bash@packages.qa.debian.org. (full text, mbox, link).


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

From: Ajay Shah <ajayshah@mayin.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: bash: File completion bug with executables inside a control structure
Date: Sun, 27 Jan 2002 13:12:54 +0530
Package: bash
Version: 2.05a-4
Severity: normal

The . directory is not on my PATH.
I happened to have an executable named 'pauseplay' in the . directory.

In bash, if I say

 $ pause[TAB]

bash behaves correctly -- there is no executable starting with 'pause'
on my $PATH.

But if I say

  $ while [ 1 ] ; do pause[TAB]

bash wrongly completes this! :) He should force me to say

  $ while [ 1 ] ; do ./pau[TAB]

which is consistent with $PATH.

Hope this helps,

     -ans.

-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux sanna 2.4.17 #1 Sun Dec 30 18:27:06 IST 2001 i686
Locale: LANG=C, LC_CTYPE=C

Versions of packages bash depends on:
ii  base-files                3.0            Debian base system miscellaneous f
ii  libc6                     2.2.4-7        GNU C Library: Shared libraries an
ii  libncurses5               5.2.20010318-3 Shared libraries for terminal hand

-- 
Ajay Shah                                           ajayshah@mayin.org
Consultant,                             http://www.mayin.org/~ajayshah
Department of Economic Affairs,
Ministry of Finance, New Delhi



Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>, bash@packages.qa.debian.org:
Bug#131101; Package bash. (full text, mbox, link).


Acknowledgement sent to Peter Moulder <pmoulder@bowman.csse.monash.edu.au>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>, bash@packages.qa.debian.org. (full text, mbox, link).


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

From: Peter Moulder <pmoulder@bowman.csse.monash.edu.au>
To: 131101@bugs.debian.org
Subject: Possible fix: define completion for do/then
Date: 16 Jul 2002 19:57:41 +1000
A hacky fix is to define a custom completion for "do" and "then"
(and perhaps xargs, env, su etc. at the same time).

The tricky bit is getting the right completion for the command being
executed (e.g. do bunzip2 <TAB>).  As a stop-gap solution, I suggest
something like the code appended to this message.  Preferably a
version that handles spaces in filenames [Why is there no easy way for
completion to be robust?  compgen appears to be broken by design.],
and preferably something that handles directory names properly.  (My
existing code completes the directory name, but appends space rather
than "/".)


Unfortunately, I can't see how this approach can be extended to do the
right thing for "FOO=BAR my_command_nam<TAB>".

pjm.


_thendo () {
	local cur
	cur="${COMP_WORDS[$COMP_CWORD]}"
	if [[ "$COMP_CWORD" = 1 ]]; then
		COMPREPLY=( `compgen -c -- "$cur" ` )
	else
		#_filedir
		#COMPREPLY=( `compgen -f -- "$cur" ` )
		COMPREPLY=( `compgen -o filenames -- "$cur" ` )
	fi
	return 0
}
complete -F _thendo do then



Noted your statement that Bug has been forwarded to ian@caliban.org. Request was from Matthias Klose <doko@cs.tu-berlin.de> to control@bugs.debian.org. (full text, mbox, link).


Bug reassigned from package `bash' to `bash-completion'. Request was from Luk Claes <luk@debian.org> to control@bugs.debian.org. (Sun, 02 Mar 2008 15:24:39 GMT) (full text, mbox, link).


Bug marked as fixed in version 20060301-4. Request was from David Paleino <d.paleino@gmail.com> to control@bugs.debian.org. (Fri, 16 May 2008 22:12:12 GMT) (full text, mbox, link).


Reply sent to David Paleino <d.paleino@gmail.com>:
You have taken responsibility. (full text, mbox, link).


Notification sent to Ajay Shah <ajayshah@mayin.org>:
Bug acknowledged by developer. (full text, mbox, link).


Message #21 received at 131101-done@bugs.debian.org (full text, mbox, reply):

From: David Paleino <d.paleino@gmail.com>
To: 131101-done@bugs.debian.org
Cc: Ajay Shah <ajayshah@mayin.org>, Peter Moulder <pmoulder@bowman.csse.monash.edu.au>, Bash-Completion Developers <bash-completion-devel@lists.alioth.debian.org>
Subject: Re: bash: File completion bug with executables inside a control structure
Date: Sat, 17 May 2008 00:10:34 +0200
[Message part 1 (text/plain, inline)]
fixed 131101 20060301-4
thanks

Hi Ajay, hi Peter,

On Sun, 27 Jan 2002 13:12:54 +0530, Ajay Shah wrote:

> The . directory is not on my PATH.
> I happened to have an executable named 'pauseplay' in the . directory.
> 
> In bash, if I say
> 
>   $ pause[TAB]
> 
> bash behaves correctly -- there is no executable starting with 'pause'
> on my $PATH.
> 
> But if I say
> 
>   $ while [ 1 ] ; do pause[TAB]
> 
> bash wrongly completes this! :) He should force me to say
> 
>   $ while [ 1 ] ; do ./pau[TAB]
> 
> which is consistent with $PATH.

On 16 Jul 2002 19:57:41 +1000, Peter Moulder wrote:

> A hacky fix is to define a custom completion for "do" and "then"
> (and perhaps xargs, env, su etc. at the same time).
> [..]


This has been fixed in newer versions of bash (and bash-completion, which has
been split from bash in February 2008). In particular, you won't find it in
20060301-4 (the current testing/unstable version), but I can't really say which
was the first version fixing this.


Thanks for your report,
David

-- 
 . ''`.  Debian maintainer | http://wiki.debian.org/DavidPaleino
 : :'  : Linuxer #334216 --|-- http://www.hanskalabs.net/
 `. `'`  GPG: 1392B174 ----|---- http://snipr.com/qa_page
   `-   2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174
[signature.asc (application/pgp-signature, attachment)]

Removed annotation that Bug had been forwarded to ian@caliban.org. Request was from David Paleino <d.paleino@gmail.com> to control@bugs.debian.org. (Fri, 16 May 2008 22:27:17 GMT) (full text, mbox, link).


Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sat, 14 Jun 2008 07:26:03 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: Sun Jul 2 09:14:21 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.