[squeak-dev] finding the unix localhost name

Vanessa Freudenberg vanessa at codefrau.net
Thu Mar 30 18:29:48 UTC 2023

While all of that is true, there is a difference between a routable name
(which obviously is interface-specific) and the standard host name for the
current machine, which is for humans, not for other machines. That's what
the primHostName is supposed to answer. It should be equivalent to running
`hostname -s` on a unix command line. It is useful, as long as users are
aware of what it actually refers to.

Now the actual implementation of primHostName across VMs is not unified
because (I believe) the intention of that primitive was not
well-documented. On my machine (macOS VM) it answers the IPv4 address of
the first external interface, apparently, which is not what I think it
should answer.


On Thu, Mar 30, 2023 at 10:33 AM Bruce O'Neel <bruce.oneel at pckswarms.ch>

> Oh it is worse than that.
> A system really doesn't have a canonical host name per se.  It can have:
> 1. One IP address and no host names
> 2. One IP address and one host name
> 3. One IP address and multiple host names
> 4. Multiple IP addresses and one host name (different disconnected
> networks, say IPv6/IPv4 or 1G/10G/40G)
> 5. Multiple IP addresses and multiple host names (but not necessarily a
> one to one mapping)
> and of course one hostname can map to multiple IP addresses on different
> independent machines.
> The idea is that a hostname resolves to an address and that address lets
> you reach an interface on a machine.
> The result of the hostname command does not even have to map in such a way
> that from outside the machine that hostname will allow you reach that
> machine.
> cheers
> bruce
> On 2023-03-30T18:53:50.000+02:00, tim Rowledge <tim at rowledge.org> wrote:
>   On 2023-03-29, at 11:32 PM, Jakob Reschke <jakres+squeak at gmail.com> wrote:
>  Hi,
>  I cannot contribute to the concrete question, but note that a host can have multiple addresses and can therefore be reachable under multiple host names. Depending on what you try to do, it may matter and you better check that you actually get the name that you expect in your production environment.
> Yup, we've managed to make it very complicated. I'm sure OS people had excellent reasons but, boy, I wish somebody had seen a way to make it simpler. Anyway, my hypothesis is that using the hostname command means that we (Squeak) do do at least as well as we (commandline) can sensibly manage. If it is really the case that the question isn't properly answerable then we ought to remove the related methods etc so as to remove a point of confusion and error.
> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> Strange OpCodes: START: Cancel preceding jobs in queue
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20230330/02436101/attachment.html>

More information about the Squeak-dev mailing list