bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug in hostname


From: Bob Proulx
Subject: Re: bug in hostname
Date: Thu, 22 Jan 2004 23:14:27 -0700
User-agent: Mutt/1.3.28i

Bruno Haible wrote:
> But OTOH, I didn't follow compatibility with Linux /bin/hostname in two
> points:
>   - When the machine has multiple long names (i.e. some aliases),
>     my "hostname -f" prints them all, one per line. Linux "/bin/hostname -f"
>     prints only the first one, but has an extra option "-a":
>     "/bin/hostname -a" prints the names except the first one, all in one
>     line, each followed by a space.

Personally I have never liked the -f and -s options.  Their purpose
seems counter to The Right Way of just setting the hostname properly
in the first place.  :-)

Let me tell you a story about something that always frustrates me.  A
particular commercial vendor's operating system has a history of going
for years without providing a particular program such that people will
provide their own.  (Think patch, rsync, ssh, perl, rdist, elm, ldd.)
But then suddenly the vendor will start supplying a version of said
program with their OS.  Which should be fine.  Only instead of
providing a version in wide use the vendor will, for no known
rationale, instead provide one that is different in some trivial and
incompatible way.  Arg!  That is very frustrating.  Now there needs to
be two of the programs installed.  The system supplied one and the
"compatible" one.  (The painful part of this is deciding which is
compatible with which.)

Many scripts use fqdn=`hostname -f` as a way to get the fully
qualified name of the host it is running on.  How many?  I don't know.
I did a simple survey of my own machine for a sampling.  But I think
it would cause at least some script breakage if that did not work that
way.  (Certainly it causes breakage now on my older systems without
the -f option.)

One problem I see is that since most hosts have only one name this
would appear to work for many authors and yet would fail on so many
other hosts that do have multiple names.  This is bound to trip up
people.  I fear that many users would find this (may I say "new"?)
behavior frustrating.

On my Debian GNU/Linux system I surveyed the package config scripts of
my installed packages.  These are nothing more than a set of scripts
written by many different people of which I had available for this
survey.  Don't read more into this than the simple brute force single
example which it is.  I found a few packages which use hostname with
an option.  This is out of 731 installed packages.  There are 10,000
more that I don't have installed.

  hostname -f: kdm
  hostname -d: slrn, tin
  hostname --fqdn: postfix
  hostname --domain: postfix

Running 'grep -r hostname.*- /usr/bin' turned up a few with --fqdn
plus 'xon' and 'startx' which both used 'hostname -f'.

>  - "hostname -i" surrounds the IP address with brackets in my implementation,
>    whereas it does not in the Linux /bin/hostname.

I have not yet actually seen a script which used 'hostname -i' in the
wild.  So I don't have an opinion about this difference.  On many
hosts the output of 'hostname -i' is 127.0.0.1 anyway which has
probably kept the usage minimal.  Do the brackets surve a purpose?
Call me a minimalist.

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]