invalid processing flag '-name'
Constantin Malikov <[email protected]> Thu, 19 Dec 2013 11:47:32 +0700
| Newsgroups | gmane.comp.lang.erlang.bugs,gmane.comp.lang.erlang.patches |
|---|---|
| Message-ID | <CAFAgMi4j0UCiQXjjSeXgZaw-E_ohDs6qSL+WqJ=kWaW3BQ0HrA@mail.gmail.com> |
Hello , friends. I want to tell you about a bug in Erlang:
I have a trouble with using flag '-name' when startup 'erl'. I attached
simple sample, where you can see this problem.
In shell input:
_____________________________________________________
user@alf:~$ erl -name a@alf -setcookie test
(a@alf)>
_____________________________________________________
where 'a' — nodename and 'alf' — hostname
In other shell input:
_____________________________________________________
user@alf:~$ erl -sname b@alf -setcookie test
(b@alf)>
_____________________________________________________
And iput :
_____________________________________________________
(b@alf)>net_adm:ping(a@alf).
pong
_____________________________________________________
You will see pong, but you runs 'erl' with different flag '-name' and
'-sname'.
How can i see, in the net_kernel.erl module, invalid processing flag
'longname' when hi include '@hostname'
Tested by Erlang 16B03, kernel-2.16.4
I can offer the option of a patch that fixes this problem. The person who
is responsible for supporting ssh has the discretion to take it as it is,
or can make own fix.
________________________________________________________________
Left base folder: /home/konstantin/erlang/otp_src_R16B03
Right base folder: /home/konstantin/erlang/otp_src_R16B03_patch
--- lib/kernel/src/net_kernel.erl 2013-12-19 11:02:00.000000000
+++ lib/kernel/src/net_kernel.erl 2013-12-19 10:42:17.000000000
@@ -1229,13 +1229,23 @@
create_hostpart(Name, LongOrShortNames) ->
{Head,Host} = lists:splitwith(fun($@)->false;(_)->true end,
atom_to_list(Name)),
Host1 = case {Host,LongOrShortNames} of
{[$@,_|_],longnames} ->
- {ok,Host};
+ case lists:member($., Host) of
+ true ->
+ {ok, Host};
+ false ->
+ case {inet_db:res_option(domain)} of
+ {D} when is_list(D), length(D) > 0 ->
+ {ok, Host ++ "." ++ D};
+ _ ->
+ {error, long}
+ end
+ end;
{[$@,_|_],shortnames} ->
case lists:member($.,Host) of
true -> {error,short};
_ -> {ok,Host}
end;
{_,shortnames} ->
________________________________________________________________
With best regards,
Malikov Constantin, software developer, Eltex.
_______________________________________________
erlang-bugs mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-bugs