> On Tue, Jan 03, 2006 at 12:12:42PM +0100, Matus UHLAR - fantomas wrote:
> > However, hostname -s does not just strip the system hostname until the
> > first dot, but it searches name services for hostname:
On 12.02 16:36, Graham Wilson wrote:
> Correct, hostname (with no arguments) does this.
So this means that hostname does not do what is documented in its manpage:
-s, --short
Display the short host name. This is the host name cut at the
first dot.
so it's a bug either in hostname program or in its manual page. If you want to
fix the man page, change last sentence to:
"This is the canonical host name cut at the first dot".
However, I found it silly. Do I have to use `hostname | cut -f1 -d.` instead
of `hostname -s` to get the desired behaviour, just because hostname
meaninglessly canonicalizes system hostname when it's asked to return only
part of it?
I don't see any point in canonicalizing system hostname if short version is
requested.
> > I expected the 'hostname -s' return string 'fnote' if the system
> > hostname is set to 'fnote' or the 'fnote.local', but not to search name
> > services. This is how e.g. FreeBSD's hostname works (-s is the only
> > switch available at least on FreeBSD-4.11)
>
> I believe this bug results in a configuration error on your part. You
> should have an IP address listed in /etc/hosts (e.g. the IP address of
> eth0 if that is your primary interface) followed by the canonical name of
> that host, and then aliases. For example:
>
> 127.0.0.1 localhost
> 192.168.1.1 fnote.local fnote
'fnote' is a notebook - it does not have eth0 as its primary interface and
it does not have any permanent IP address except 127.0.0.1, so I can not
put anything other into /etc/hosts. I believe the hostname should be in
/etc/hosts, otherwise hostname complains:
% hostname -s
hostname: Host name lookup failure
I hope you don't want me to use fake address just for hostname to work
correctly.
> When configured like this, hostname -s will return what you expect.
>
> Since this is not a bug in hostname, I'm closing this.
Please reconsider.
--
Matus UHLAR - fantomas, [EMAIL PROTECTED] ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Despite the cost of living, have you noticed how popular it remains?
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]