[Bash-completion-devel] [bash-completion-Bugs][314393] _known_hosts_real does not complete hostnames starting with a 't'

bash-completion-bugs at alioth.debian.org bash-completion-bugs at alioth.debian.org
Tue Aug 27 09:53:13 UTC 2013


bash-completion-Bugs item #314393 was changed at 2013-08-27 11:53 by Rainer Müller
You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=314393&group_id=100114

Status: Open
Priority: 3
Submitted By: Rainer Müller (raimue-guest)
Assigned to: Nobody (None)
Summary: _known_hosts_real does not complete hostnames starting with a 't' 
Distribution: None
Originally reported in: None
Milestone: None
Status: Fix Committed
Original bug number: 


Initial Comment:
There is a portability issue with a sed expression used in _known_hosts_real(). In BSD sed, the sequence '\t' does not represent a tab character, but it is recognized as a literal 't'. In Any hostname starting with a 't' was filtered on systems using BSD sed (in this case Mac OS X). GNU sed added '\t' as an extension and matches this as a tab character, which was intended here.

Attached is a patch that changes the occurrence in this sed expression to [[:space:]], which is less restrictive but should be okay in this context.

Original Report: http://trac.macports.org/ticket/32053

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

Comment By: Rainer Müller (raimue-guest)
Date: 2013-08-27 11:53

Message:
You are right I was too greedy when replacing \t there. This still fixed a simple test with a hostname starting with a 't' for me, but not the tab characters. Bad testing of this patch on my part.

I didn't know about $'\t' and this makes perfectly sense. However, it seems the quoting in your patched version is still wrong. The double quotes make this a literal string instead of letting bash expand it.

I removed the double quotes and added some tests that failed for me with the existing version, but pass with my changes applied. This time I tested with both BSD sed from Mac OS X and GNU sed. The new patch is attached.

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

Comment By: Ville Skyttä  (scop-guest)
Date: 2013-08-26 19:47

Message:
The latter change is almost certainly incorrect, $'[:space:]' doesn't make sense to me. The point of $'\t' is to pre-expand the tab using bash, and that approach should work -- we use it a lot.

Could you verify if this works for you?
http://anonscm.debian.org/gitweb/?p=bash-completion/bash-completion.git;a=commitdiff;h=50ae57927365a16c830899cc1714be73237bdcb2

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

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



More information about the Bash-completion-devel mailing list