Created attachment 379970 [details, diff] Updated patch from RedHat to fix hostname -s hostname -s will always give "Unknown Host" if the hostname FQDN cannot be resolved in DNS or in /etc/hosts. According to RedHat bug 319981, this is different behavior than on AIX, MacOS X, and FreeBSD. RedHat net-tools maintainers applied a minor patch to always make hostname -s return the short-form of the hostname regardless if it can be fully resolved or not. Example: # hostname foo.bar.baz # hostname foo.bar.baz # hostname -s hostname: Unknown host After patch: # hostname -s foo Per the RH bug comment #11, Debian is also fine with this change. I re-diffed the patch against net-tools-1.60_p20130513023548 to get it to apply and tested it out to make sure the expected behavior works.
If this patch could get pushed upstream too, that'd be great. See the referenced RedHat and Debian bugs for concurrence on this issue.
Created attachment 387044 [details, diff] Updated patch for net-tools-1.60_p20141019041918
sent a patch upstream
i've landed this in upstream now. it'll be in the next snapshot.
The newest ebuild (net-tools-1.60_p20151124144947) has a non-working "hostname -s". Any workarounds on getting this working? I'm using some scripts that depend on it.
Never mind, I added my hostname to /etc/hosts and it seems to work now.