[Bash-completion-devel] [bash-completion-Bugs][311399] DBTS 313514: bash-completion fails with e.g., ls and newlines in file names

bash-completion-bugs at alioth.debian.org bash-completion-bugs at alioth.debian.org
Fri Jan 30 09:05:04 UTC 2009


Bugs item #311399, was opened at 30/01/2009 10:03
Status: Open
Priority: 2
Submitted By: David Paleino (hanska-guest)
Assigned to: Nobody (None)
Summary: DBTS 313514: bash-completion fails with e.g., ls and newlines in file names  
Distribution: None
Originally reported in: Debian BTS
Original bug number: 313514


Initial Comment:
From: Anthony DeRobertis <asd at suespammers.org>
To: Debian Bug Tracking System <submit at bugs.debian.org>
Subject: bash-completion fails with e.g., ls and newlines in file names
Date: Tue, 14 Jun 2005 01:37:41 -0400

Package: bash
Version: 3.0-15
Severity: minor
File: /etc/bash_completion

anthony at bohr:foo$ touch "$(echo -e 'foo\nbar')"
anthony at bohr:foo$ ls -b
foo\nbar
anthony at bohr:foo$ ls f<tab><tab>
bar  foo  

Notice how instead of completing foo?bar (where ? = newline) it offers
to complete either foo or bar.


----------------------------------------------------------------------

>Comment By: David Paleino (hanska-guest)
Date: 30/01/2009 10:05

Message:
From: Michael Tweedale <mpt at ic.ac.uk>
To: 313514 at bugs.debian.org
Subject: Re: bash-completion fails with e.g., ls and newlines in file names - workaround
Date: Thu, 18 May 2006 12:29:44 +0100

Package: bash
Version: 3.1-4
Followup-For: Bug #313514

On  8 Nov 2005 at 11:29, Mike Dornberger wrote:
> Interesting point is, that it _only_ seems to break on 
> newlines.

It also chokes on filenames with an equals sign:
$ touch x=y
then
$ ls x<TAB>
completes correctly;
$ ls x=<TAB>
completes (bizarrely) to x=x\=y and
$ x=<TAB>
as expected completes to a list of all filenames in cwd 
(though if . is in $PATH maybe it should complete to x=y ?).

Best,
Michael

----------------------------------------------------------------------

Comment By: David Paleino (hanska-guest)
Date: 30/01/2009 10:04

Message:
From: Mike Dornberger <Mike.Dornberger at gmx.de>
To: Debian Bug Tracking System <313514 at bugs.debian.org>
Subject: Re: bash-completion fails with e.g., ls and newlines in file names - workaround
Date: Tue, 8 Nov 2005 11:29:30 +0100

Package: bash
Version: 2.05b-26
Followup-For: Bug #313514

Hi,

this bug hit me today, too, when I wanted to delete filenames with
newlines.

Completion for mv, rm and ls (haven't tested others) show this bug, even if
you use M-* (insert-completions).

$ rm fo<M-*>

results even to:

$ rm bar foo 

It does not fail on e. g. echo:

$ echo fo<tab>

$ echo 'foo
bar' 

(M-* works here correctly, too.)

Interesting point is, that it _only_ seems to break on newlines. Doing

$ touch "$(echo -e 'evil filename with\nan LF and other special chars ($bla) : , "')"
$ rm ev<M-*>

results in:

$ rm an\ LF\ and\ other\ special\ chars\ \(\$bla\)\ \:\ \,\ \" evil\ filename\ with 

As a little workaround one can either write

$ echo rm ev<tab>

or

$ xrm ev<tab>

then using C-a or Home and deleting "echo " or "x" before execution. The
last one maybe only works if there isn't a xrm file/function/alias or
something. And oh, I just found out, you can even do

$ rm ev<M-/>

(M-/ is by default bound to complete-filename. M-x BTW can be entered as ESC
x, too.)

Greetings,
 Mike


----------------------------------------------------------------------

You can respond by visiting: 
http://alioth.debian.org/tracker/?func=detail&atid=413095&aid=311399&group_id=100114



More information about the Bash-completion-devel mailing list