[Hostname-devel] Bug#552482: hostname -s behaviour should be consistent with other unixes (and with documentation)

Jiri Popelka jpopelka at redhat.com
Mon Oct 26 15:21:02 UTC 2009


Package: hostname
Version: 2.95

hostname -s
on a host with a hostname that does not resolve in the DNS
behaves differently on Debian  as on FreeBSD/OpenBSD/AIX/MacOsX.

On Debian when the hostname does not resolve in the DNS
hostname -s
returns "hostname: Unknown host" message.
  
On FreeBSD/OpenBSD/AIX/MacOsX when the hostname does not resolve in the DNS
hostname -s
returns short host name (no matter if the hostname resolves or not).

hostname man page does not say anything about whether the hostname should resolve or not.
-s, --short
   Display the short host name. This is the host name cut at the first dot.


Steps to Reproduce:
run hostname -s on a server whose Fully qualified hostname does not resolve in the DNS.

Actual results:

[root ~]# hostname some.thing.stupid
[root ~]# hostname
some.thing.stupid
[root ~]# hostname -s
hostname: Unknown host

Expected results:

[root ~]# hostname some.thing.stupid
[root ~]# hostname
some.thing.stupid
[root ~]# hostname -s
some

See also
https://bugs.launchpad.net/ubuntu/+source/hostname/+bug/389602
where reporter says that:
"The documentation states that -s just trims the domain off if it exists, but that's not what it does.
Either it should behave exactly that way or the doc should be updated."







More information about the Hostname-devel mailing list