So, who's ever looked through all the weird and wacky vars we hand
into the m4 processor, that you can use to do unnatural things to your
config?

There are 3 hostnames we pass in.  One is CLIENTHOST, which is the
machine where ctwm is running.  That come out of gethostname(3), which
is just getting the system's hostname.  Straightforward.

The second is SERVERHOST, which is the machine where the X server is
running.  We get that by poking through $DISPLAY and finding a
hostname there (or using a copy of CLIENTHOST, if that's a local-ish
thing like ":0" or the like, which probably covers 99.99% of actual
running systems nowadays).  OK; no problems here.


But then there's HOSTNAME.  What the heck.  The manual says "The
canonical hostname running the clients", which tells...  absolutely
thing.  It winds up happening via calling gethostbyname(3) on
CLIENTHOST, and then pulling the h_name out of the response.  Well,
what is that?

That's probably going to vary depending on the system, and just where
the response comes from.  Maybe it comes from the hosts file?  Then I
think it's the first entry on the line, so maybe it can be considered
the more 'real' name of the system, when its hostname is set to an
alias of that (what?  why?  who cares?).  Or then there's DNS, which
from what I can tell means it may be transformed by 'domain' or
'search' directives in resolv.conf?  After getting a response, anyway.
Or <something else> happens if the lookup winds up going via NIS.
Whatever other resolution methods it may use.  And if it doesn't get a
name from any of those, it just quietly falls back to using CLIENTHOST
verbatim anyway.

Ever had a system where [re]starting ctwm bizarrely pauses for a dozen
seconds or so?  Guess what; this is why.  We block startup on
[potentially] doing a DNS lookup of the client's configured hostname.
So if you don't have working DNS, or have a hostname that's not in DNS
(especially one that would be off in a DNS tree that purportedly
exists with unreachable nameservers, so we have to wait on timeouts),
twiddle your thumbs a while.


Does that add enough value to be worth having that block-y a thing in
the startup path?  Or should I just dump it over the side into deep
water, and just leave HOSTNAME as a copy of CLIENTHOST?



(yeah, I'll bet you thought I was through with cackling over my
keyboard looking for things to break...   gotcha!)


-- 
Matthew Fuller     (MF4839)   |  fulle...@over-yonder.net
Systems/Network Administrator |  http://www.over-yonder.net/~fullermd/
           On the Internet, nobody can hear you scream.

Reply via email to