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

Re: where is /etc/hosts supposed to come from?

Vincent Lefevre <vincent@vinc17.org> writes:

> Yes, but a failure is something one can expect to happen under some
> occasions, at least for remote hosts. This doesn't mean that hosts don't
> have a canonical name, just that this canonical name couldn't be
> determined.

> For the local host, I would say that a failure is mostly due to a
> configuration problem (unless a remote DNS is used, in which case it may
> be down, and BTW, that's why I think it is a bad idea to use one for
> something purely local). I'd say that making the request fail on purpose
> is contrary to POSIX, and I find it not surprising that software could
> fail to behave correctly because of that.

I'm having a hard time figuring out what you think the canonical name of
my laptop could possibly be, given that it has no static IP address and no
DNS entry.  In practice, it's whatever arbitrary label that I gave it, and
none of these DNS-based resolution techniques are going to do you much
good or give you any sort of consistent answer, if they work at all.

> I haven't said that. And this is often not the case under Debian,
> i.e. the FQDN is often obtained from /etc/hosts, which has the
> precedence over DNS (see /etc/nsswitch.conf).

I have no entry in /etc/hosts other than and the corresponding
IPv6 entries.  What could I possibly put in there?

> This is implementation-defined, but still, the host has a canonical
> name, that should be obtainable with getaddrinfo, as described.

I don't see where you're finding any justification for that "should" in

> BTW, Debian defines /etc/mailname as containing the FQDN. So, this
> notion is explicitly defined on Debian, and one should expect "hostname
> -f" to return the same name (according to its documentation).

No, it's not.  You have completely misunderstood the purpose of

    If your package needs to know what hostname to use on (for example)
    outgoing news and mail messages which are generated locally, you
    should use the file /etc/mailname. It will contain the portion after
    the username and @ (at) sign for email addresses of users on the
    machine (followed by a newline).

So on my system, for instance, /etc/mailname is "stanford.edu," because
that's what goes on the RHS of e-mail addresses.  Which, of course, is not
the canonical name of my laptop.

Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>

Reply to: