[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Hostname/Domainname Bug?
From: |
Bob Proulx |
Subject: |
Re: Hostname/Domainname Bug? |
Date: |
Fri, 21 Mar 2003 10:49:16 -0700 |
User-agent: |
Mutt/1.3.28i |
Seemant Kulleen wrote:
> Me again. I added 4.5.11 to gentoo's portage today. Our developer,
> Azarah noticed:
>
> I do not know if this is a bug or feature, but 'hostname'
> symlinked/copied to domainname still sets the hostname.
Hmm...
1. The GNU standards don't allow programs to change their behavior by
being linked or renamed.
http://www.gnu.org/prep/standards_16.html#SEC16
"Please don't make the behavior of a utility depend on the name
used to invoke it. It is useful sometimes to make a link to a
utility with a different name, and that should not change what
it does."
The rationale being that people often need to install GNU project
software by other names to avoid name collisions with the native
programs. The case that gnu compiler is installed gcc instead of
cc for the classic example.
Therefore in general with gnu software (of course there are
exceptions) renaming or linking programs won't change their
behavior into a different program.
2. The 'domainname' program is not part of GNU coreutils. There are
several options here. You may be talking about these programs from
the yp-tools package.
http://www.linux-nis.org/
ftp://ftp.kernel.org/pub/linux/utils/net/NIS
Or possibly you are talking about these programs from the the
net-tools package.
http://www.tazenda.demon.co.uk/phil/net-tools/
The 'domainname' command is an NIS/YP command. It has nothing to
do with hostnames. On NIS/YP systems it returns the YP domain of
the system. The poor choice of command names has led to much
confusion with DNS domain names over the years. But so it is.
Note that there is no "standard" to cover the 'domainname' command.
It usually does not exist on systems unless NIS/YP is installed.
Usually today there are other extensions installed beside it such
as dnsdomainname to try to compensate for the confusion caused by
the poorly named 'domainname' command. I personally would not
write a script that used any of them. However, it would be
perfectly fine to use them in a system startup since presumably
system startup scripts know the capabilities of the system they are
trying to start.
<rant> As a particular point that I have been burned by on a number
of occasions is that the '-f' option to hostname is an extension.
Scripts that use that option tend to change the hostname to '-f' on
non-gnu systems. Please avoid doing that. In any case, the
function of that option is dependent upon the environment in which
the program is run and can't be counted upon. </rant>
Bob