[Bash-completion-devel] Bug#377935: completion of ':' mangles filename

Klaus Ethgen Klaus at Ethgen.de
Sun Aug 16 17:16:13 UTC 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi,

first let me say that this is the most annoying bug in bash-completions!

I often work with perl files so having to view the manpage:
 > perldoc Locale[Tab]
 Display all 183 possibilities? (y or n)y
 ...
 > perldoc Locale\:\:[Tab again or add more letters and then tab]
 -> nothing happens at all.

There are many other uses where the completed line gets completely
wrong.

Am So den 11. Mai 2008 um 14:20 schrieb David Paleino:
> tags 377935 wontfix

Please reset this tag as this bug is the worse one of bash-completions.

> ":" is a special Bash character [1], and we can't do anything about that.
> However, completion works just fine when not including the colon:

This is simply wrong! ":" is not special, it is just a internal command.
Using it inside of the arguments have no special meaning.

> $ touch foo:foo
> $ rm f[TAB]
> $ rm foo\:foo
> $ rm "f[TAB]
> $ rm "foo:foo"

That works as long as you do not have a file, say "foo:bla" too.

> I believe bash-completion can't do anything in this case.

Well, I believe it just can leave the ":" as it is if it is in the
arguments and leave it as it is if it is the command. That would solve
all problems.

> So, please, if you know there are colons in the completed name (be it
> a filename, or a Perl module manpage), start it with '"', or escape
> the first colon. I'm sorry I can't help any more.

Doesn't work at all:
 > perldoc "Locale::[Tab]
 -> nothing happens.

> Fellow developers, the usual disclaimer: I've tagged this as "wontfix", but
> feel free to retag at will. I believe it might be reassigned to bash, but I'll
> wait for discussion (here or on the mailing list).

But why should it be retagged to bash? Bash do not handle ":" special at
all. There is no need ever to escape it.

> [1] http://tldp.org/LDP/abs/html/special-chars.html#NULLREF

Yes, please read it, there is no evidence that ":" is special. However
it is a internal command. But with that you have to escape exit to like
 > man 2 exit[Tab]
 ...
 > man 2 \e\x\i\t
 (please don't! It is just an example.)

Am So den 11. Mai 2008 um 14:42 schrieb David Paleino:
> $ man Debian[TAB]
> Debian::DictionariesCommon  DebianNet
> $ man Debian:[TAB]
> $ man Debian:
> 
> That means, it does not produce "non-existent, incorrect completions". I have
> bash-completion/20060301-4 installed, try that.

Ok, try:
 > perldoc Locale[Tab]

> I'll wait for other people's comments about this. I've just started hacking
> bash-completion, hence I may have missed something.

So there is a other people, me. :-)

Well, let me go further a bit. There is the following solutions:
   1. Just do not escape the ":" at all.

   2. If you think that you want to escape it, then the following points
      have to be implemented:
      - If there is a verbatim ":", replace it with "\:" and go on with
	completions (This is the way how it is at the moment)
      - If there is still "\:" just go on with the completion (This is
	not implemented at the moment. If there is "\:" you seems to
	stop completion completely.)

Regards
   Klaus

Ps. Ah yes, I do not think that this make any sense but I use version
    1:1.0-3.
- -- 
Klaus Ethgen                            http://www.ethgen.de/
pub  2048R/D1A4EDE5 2000-02-26 Klaus Ethgen <Klaus at Ethgen.de>
Fingerprint: D7 67 71 C4 99 A6 D4 FE  EA 40 30 57 3C 88 26 2B
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iQEVAwUBSog+3Z+OKpjRpO3lAQodowf/TOzqXfsxetsdq9Hfx92NG9jPUGegj9Qg
EusTJ/qeYPQlaVCl/i1quXKjEstuBNIxpHuurRJ0pN6nEZzWcJt42VRCjbn00eM/
D6r9jNmEupjJPvAEMTQZf7NwG1VrA4CRyPmH21MEWusnH8q2oIfIwAEHaULxPfSK
I63Z81Mk1cJ5/c+qNjwfgf2EOydPVBFc//K6b/dKZwIQ2mycEg5OqqXDAv2KNKiV
Oj+gDasmoJx2sy3SdnevGdvoUP/VmUtCNjD+01kQhPvHMAVjbmOSR0QffS4QqysD
Sy2gjYtyG44wOm0d/LpvwJSQJqflMD2HglTPJB3GH13lvGMKVFfP9Q==
=jxXq
-----END PGP SIGNATURE-----






More information about the Bash-completion-devel mailing list