[erlang-questions] Different hostname from erl -sname and inet:gethostname()

Ignas Vyšniauskas baliulia@REDACTED
Mon Sep 26 01:20:32 CEST 2011


Hi erlang-questions,

I have the following behaviour:

[~]$ erl -sname foobar
Erlang R14B (erts-5.8.1) [source] [64-bit] [smp:4:4] [rq:4]
[async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.8.1  (abort with ^G)
(foobar@REDACTED)1> inet:gethostname().
{ok,"pufpuf"}

Notice the different 'localhost' and 'pufpuf' hostnames.

I am running Erlang R14B-2 on ArchLinux 3.0.

[~]$ hostname
pufpuf

[~]$ cat /etc/hosts
#<ip-address>	<hostname.domain.org>	<hostname>
127.0.0.1	localhost.localdomain   localhost    pufpuf
::1		localhost.localdomain	localhost

Is it normal behaviour? I am using things like:

{ok, Hostname} = inet:gethostname(),
slave:start(Hostname, slave_node, []).

which obviously fails under such circumstances.
Is there a different approach to this? Is my system misconfigured?

/Ignas



More information about the erlang-questions mailing list