strange issue with bash-completion and .ssh/config host entries

eliott eliott at cactuswax.net
Wed Aug 12 12:27:59 PDT 2009


I specifically do not want to edit the hosts file, nor use local dns overrides.

1. It requires root access. My .ssh/config is portable across N
different systems with no need for hosts file modification nor root
level access.
2. I don't want all my users editing the hosts file just to get ssh completion
3. It worked fine before I updated, and continues to work fine on many
other *nix systems.

So, while I can appreciate your work around, I was looking for
something that would actually work for my needs.

After doing some _serious_ poking around with bash -v, I found a
single sed line that worked on centos, but failed on osx.
sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t
'"']\+\([^#*?]*\)\(#.*\)\?$/\2/p'  .ssh/config

Installing gsed from macports (gnu-sed, which bash_completion checks
for to use as a preference if it can), .ssh/config host completion
works again!

Hooray!

On Tue, Aug 11, 2009 at 10:45 PM, Panagiotis
Atmatzidis<atma at convalesco.org> wrote:
> Greetings,
>
> Isn't a better to use /etc/hosts for pointing hostnames to specific? imho
> it's better for two reasons:
>
> 1) it's system wide and it's the standard procedure
> 2) you don't get this kind of issues in specific program updgrades that
> require hostnames resolv
>
> I even use dnsmasq configured on my LAN to avoid this kind of fuzz.
>
>
> regards
>
>
> On 12 Αυγ 2009, at 3:14 ΠΜ, eliott wrote:
>
>> I have two machines that have bash-completion installed via macports.
>> They both had the older version of bash-completion (20060301), but
>> have been subsequently updated to the current version (1.0).
>>
>> On both machines, before the upgrade, I had the following 'good' behavior.
>>
>> if the .ssh/config file had this in it:
>>
>> host foobar
>>  hostname 1.1.1.1
>>
>> Then at a bash prompt i could type: ssh foo<tab> and it would complete
>> to foobar appropriately.
>> *Note that I have _no_ data in known_hosts or /etc/hosts for the name
>> 'foobar' (removed for testing)*
>>
>> After the upgrade to bash-completion 1.0, this no longer works on my
>> systems.
>> On other another *nix box (centos-5.x) with bash_completion (1.0
>> version), this still works, with the same .bashrc and the same
>> .ssh/config file as in use on my 10.5 installs.
>>
>> I have gone so far as to compare the bash_completion and
>> bash_completion.d/ssh scripts from macports to the other system. The
>> is no functional difference that I can tell. A few comments are
>> different, and one function testing for bash-4.0.
>>
>> The other system has a slightly newer version of bash compared to the
>> 10.5 default.
>>
>> 10.5 -- GNU bash, version 3.2.17(1)-release (i386-apple-darwin9.0)
>> centos5.3 -- GNU bash, version 3.2.25(1)-release (i686-redhat-linux-gnu)
>>
>> Has anyone else run across this issue, and know a workaround or a fix?
>> Is it an issue with bash-completion, or something goofy with the
>> version of bash in 10.5?
>>
>> I appreciate any insight anyone can provide.
>>
>> --eliott
>> _______________________________________________
>> macports-users mailing list
>> macports-users at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macports-users
>
>


More information about the macports-users mailing list