diff options
author | Lukas Larsson <[email protected]> | 2019-05-02 09:46:27 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2019-05-02 09:46:27 +0200 |
commit | 067ac828d5cdfb0211f705e11bd5efd864071d1e (patch) | |
tree | cc6499c96345c98dfce5c58ddbe843ba62917cd3 /lib | |
parent | ac6084fd83240355f72e94adbf303e57832d1fab (diff) | |
parent | 4ffb28fa775daf7e157031654bcf7712cce6d0f1 (diff) | |
download | otp-067ac828d5cdfb0211f705e11bd5efd864071d1e.tar.gz otp-067ac828d5cdfb0211f705e11bd5efd864071d1e.tar.bz2 otp-067ac828d5cdfb0211f705e11bd5efd864071d1e.zip |
Merge branch 'lukas/kernel/double-sname-fix/ERL-912/OTP-15786'
* lukas/kernel/double-sname-fix/ERL-912/OTP-15786:
kernel: Multiple -sname or -name would be ignored
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kernel/src/erl_distribution.erl | 6 | ||||
-rw-r--r-- | lib/kernel/test/erl_distribution_SUITE.erl | 8 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/kernel/src/erl_distribution.erl b/lib/kernel/src/erl_distribution.erl index 0bec78e938..cdb2d2f1f6 100644 --- a/lib/kernel/src/erl_distribution.erl +++ b/lib/kernel/src/erl_distribution.erl @@ -21,6 +21,8 @@ -behaviour(supervisor). +-include_lib("kernel/include/logger.hrl"). + -export([start_link/0,start_link/2,init/1,start/1,stop/0]). -define(DBG,erlang:display([?MODULE,?LINE])). @@ -83,6 +85,10 @@ do_start_link([{Arg,Flag}|T]) -> case init:get_argument(Arg) of {ok,[[Name]]} -> start_link([list_to_atom(Name),Flag|ticktime()], true); + {ok,[[Name]|_Rest]} -> + ?LOG_WARNING("Multiple -~p given to erl, using the first, ~p", + [Arg, Name]), + start_link([list_to_atom(Name),Flag|ticktime()], true); _ -> do_start_link(T) end; diff --git a/lib/kernel/test/erl_distribution_SUITE.erl b/lib/kernel/test/erl_distribution_SUITE.erl index 8dd4ef1987..c3a022df0a 100644 --- a/lib/kernel/test/erl_distribution_SUITE.erl +++ b/lib/kernel/test/erl_distribution_SUITE.erl @@ -205,6 +205,9 @@ nodenames(Config) when is_list(Config) -> legal("a-1@b"), legal("a_1@b"), + %% Test that giving two -sname works as it should + test_node("a_1@b", false, long_or_short() ++ "a_0@b"), + illegal("cdé@a"), illegal("te欢st@a"). @@ -258,8 +261,11 @@ illegal(Name) -> test_node(Name) -> test_node(Name, false). test_node(Name, Illigal) -> + test_node(Name, Illigal, ""). +test_node(Name, Illigal, ExtraArgs) -> ProgName = ct:get_progname(), - Command = ProgName ++ " -noinput " ++ long_or_short() ++ Name ++ + Command = ProgName ++ " -noinput " ++ ExtraArgs ++ + long_or_short() ++ Name ++ " -eval \"net_adm:ping('" ++ atom_to_list(node()) ++ "')\"" ++ case Illigal of true -> |