[erlang-bugs] invalid processing flag '-name'

Constantin Malikov kostiamalikov@REDACTED
Thu Dec 19 05:47:32 CET 2013


    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@REDACTED:~$ erl -name a@REDACTED -setcookie test
(a@REDACTED)>
_____________________________________________________
where 'a' — nodename and 'alf' — hostname

In other shell input:
_____________________________________________________
user@REDACTED:~$ erl -sname b@REDACTED -setcookie test
(b@REDACTED)>
_____________________________________________________
And iput :
_____________________________________________________
(b@REDACTED)>net_adm:ping(a@REDACTED).
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20131219/4d230025/attachment.htm>


More information about the erlang-bugs mailing list