diff options
44 files changed, 553 insertions, 242 deletions
diff --git a/lib/asn1/doc/src/notes.xml b/lib/asn1/doc/src/notes.xml index 4d4600b3ab..e619408591 100644 --- a/lib/asn1/doc/src/notes.xml +++ b/lib/asn1/doc/src/notes.xml @@ -31,6 +31,27 @@ <p>This document describes the changes made to the asn1 application.</p> +<section><title>Asn1 2.0.1.1</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p>The generated decoder for the 'per' and 'uper' + backends did not correctly decode ENUMERATEDs with a + single value.</p> + <p>The generated encoder for the 'per' and 'uper' + backends generated an empty binary for a top-level type + that did not need to be encoded (such as an ENUMERATED + with a single value). The correct result should be a + binary containing a 0 byte.</p> + <p> + Own Id: OTP-10916 Aux Id: seq12270 </p> + </item> + </list> + </section> + +</section> + <section><title>Asn1 2.0.1</title> <section><title>Fixed Bugs and Malfunctions</title> diff --git a/lib/asn1/src/asn1ct_imm.erl b/lib/asn1/src/asn1ct_imm.erl index 869bda5d52..4b2c3b1b65 100644 --- a/lib/asn1/src/asn1ct_imm.erl +++ b/lib/asn1/src/asn1ct_imm.erl @@ -61,6 +61,8 @@ optimize_alignment(Imm, Al) -> per_dec_boolean() -> {map,{get_bits,1,[1]},[{0,false},{1,true}]}. +per_dec_enumerated([{V,_}], _Aligned) -> + {value,V}; per_dec_enumerated(NamedList0, Aligned) -> Ub = length(NamedList0) - 1, Constraint = [{'ValueRange',{0,Ub}}], @@ -375,6 +377,8 @@ opt_al({call,Fun,E0}, A0) -> opt_al({convert,Op,E0}, A0) -> {E,A} = opt_al(E0, A0), {{convert,Op,E},A}; +opt_al({value,V}=Term, A) when is_integer(V); is_atom(V) -> + {Term,A}; opt_al({value,E0}, A0) -> {E,A} = opt_al(E0, A0), {{value,E},A}; @@ -391,8 +395,6 @@ opt_al({'case',Cs0}, A0) -> opt_al({map,E0,Cs}, A0) -> {E,A} = opt_al(E0, A0), {{map,E,Cs},A}; -opt_al('NULL'=Null, A) -> - {Null,A}; opt_al(I, A) when is_integer(I) -> {I,A}. @@ -480,8 +482,8 @@ flatten({map,E0,Cs0}, Buf0, St0) -> {Dst,St2} = new_var("Int", St1), Cs = flatten_map_cs(Cs0, E), {{Dst,DstBuf},Pre++[{'map',E,Cs,{Dst,DstBuf}}],St2}; -flatten({value,'NULL'}, Buf0, St0) -> - {{"'NULL'",Buf0},[],St0}; +flatten({value,V}, Buf0, St0) when is_atom(V) -> + {{"'"++atom_to_list(V)++"'",Buf0},[],St0}; flatten({value,V0}, Buf0, St0) when is_integer(V0) -> {{V0,Buf0},[],St0}; flatten({value,V0}, Buf0, St0) -> diff --git a/lib/asn1/src/asn1rtt_per.erl b/lib/asn1/src/asn1rtt_per.erl index 84ff809912..aa6cf4da0a 100644 --- a/lib/asn1/src/asn1rtt_per.erl +++ b/lib/asn1/src/asn1rtt_per.erl @@ -963,7 +963,10 @@ encode_relative_oid(Val) when is_list(Val) -> %% complete(L) -> - asn1rt_nif:encode_per_complete(L). + case asn1rt_nif:encode_per_complete(L) of + <<>> -> <<0>>; + Bin -> Bin + end. octets_to_complete(Len,Val) when Len < 256 -> [20,Len,Val]; diff --git a/lib/asn1/src/asn1rtt_uper.erl b/lib/asn1/src/asn1rtt_uper.erl index ad0678f3c3..8efe9a7b0f 100644 --- a/lib/asn1/src/asn1rtt_uper.erl +++ b/lib/asn1/src/asn1rtt_uper.erl @@ -1016,8 +1016,11 @@ complete(InList) when is_list(InList) -> Bits -> <<Res/bitstring,0:(8-Bits)>> end end; -complete(InList) when is_binary(InList) -> - InList; +complete(Bin) when is_binary(Bin) -> + case Bin of + <<>> -> <<0>>; + _ -> Bin + end; complete(InList) when is_bitstring(InList) -> PadLen = 8 - (bit_size(InList) band 7), <<InList/bitstring,0:PadLen>>. diff --git a/lib/asn1/test/asn1_SUITE_data/Prim.asn1 b/lib/asn1/test/asn1_SUITE_data/Prim.asn1 index 17a5d3490a..c3d54dbbb3 100644 --- a/lib/asn1/test/asn1_SUITE_data/Prim.asn1 +++ b/lib/asn1/test/asn1_SUITE_data/Prim.asn1 @@ -22,6 +22,8 @@ BEGIN Enum ::= ENUMERATED {monday(1),tuesday(2),wednesday(3),thursday(4), friday(5),saturday(6),sunday(7)} + SingleEnumVal ::= ENUMERATED {true} + SingleEnumValExt ::= ENUMERATED {true, ...} ObjId ::= OBJECT IDENTIFIER @@ -35,4 +37,15 @@ BEGIN base (2), exponent (-125..128) } ) + Seq ::= SEQUENCE { + n Null, + i1 INTEGER (0..63), + e1 SingleEnumVal, + i2 INTEGER (0..63), + e2 SingleEnumVal, + i3 INTEGER (0..63), + b Bool, + i4 INTEGER (0..63) + } + END diff --git a/lib/asn1/test/testPrim.erl b/lib/asn1/test/testPrim.erl index 0d4427ba69..91fb9fffca 100644 --- a/lib/asn1/test/testPrim.erl +++ b/lib/asn1/test/testPrim.erl @@ -513,6 +513,14 @@ enum(Rules) -> case catch asn1_wrapper:encode('Prim','Enum',4) of Enum -> Enum end, ok end, + + case Rules of + Per when Per =:= per; Per =:= uper -> + {ok,<<0>>} = 'Prim':encode('SingleEnumVal', true), + {ok,<<0>>} = 'Prim':encode('SingleEnumValExt', true); + ber -> + ok + end, ok. diff --git a/lib/asn1/vsn.mk b/lib/asn1/vsn.mk index aaa060c806..3c4f3ff122 100644 --- a/lib/asn1/vsn.mk +++ b/lib/asn1/vsn.mk @@ -1,2 +1,2 @@ #next version number to use is 2.0 -ASN1_VSN = 2.0.1 +ASN1_VSN = 2.0.1.1 diff --git a/lib/common_test/src/ct_slave.erl b/lib/common_test/src/ct_slave.erl index 1fd8c04f8b..872c39de04 100644 --- a/lib/common_test/src/ct_slave.erl +++ b/lib/common_test/src/ct_slave.erl @@ -1,7 +1,7 @@ %%-------------------------------------------------------------------- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2012. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -43,12 +43,13 @@ %%% @spec start(Node) -> Result %%% Node = atom() %%% Result = {ok, NodeName} | -%%% {error, already_started, NodeName} | -%%% {error, started_not_connected, NodeName} | -%%% {error, boot_timeout, NodeName} | -%%% {error, init_timeout, NodeName} | -%%% {error, startup_timeout, NodeName} | -%%% {error, not_alive, NodeName} +%%% {error, Reason, NodeName} +%%% Reason = already_started | +%%% started_not_connected | +%%% boot_timeout | +%%% init_timeout | +%%% startup_timeout | +%%% not_alive %%% NodeName = atom() %%% @doc Starts an Erlang node with name <code>Node</code> on the local host. %%% @see start/3 @@ -56,20 +57,28 @@ start(Node) -> start(gethostname(), Node). %%%----------------------------------------------------------------- -%%% @spec start(Host, Node) -> Result -%%% Node = atom() -%%% Host = atom() +%%% @spec start(HostOrNode, NodeOrOpts) -> Result +%%% HostOrNode = atom() +%%% NodeOrOpts = atom() | list() %%% Result = {ok, NodeName} | -%%% {error, already_started, NodeName} | -%%% {error, started_not_connected, NodeName} | -%%% {error, boot_timeout, NodeName} | -%%% {error, init_timeout, NodeName} | -%%% {error, startup_timeout, NodeName} | -%%% {error, not_alive, NodeName} +%%% {error, Reason, NodeName} +%%% Reason = already_started | +%%% started_not_connected | +%%% boot_timeout | +%%% init_timeout | +%%% startup_timeout | +%%% not_alive %%% NodeName = atom() -%%% @doc Starts an Erlang node with name <code>Node</code> on host -%%% <code>Host</code> with the default options. +%%% @doc Starts an Erlang node with default options on a specified +%%% host, or on the local host with specified options. That is, +%%% the call is interpreted as <code>start(Host, Node)</code> when the +%%% second argument is atom-valued and <code>start(Node, Opts)</code> +%%% when it's list-valued. %%% @see start/3 +start(_HostOrNode = Node, _NodeOrOpts = Opts) %% match to satiate edoc + when is_list(Opts) -> + start(gethostname(), Node, Opts); + start(Host, Node) -> start(Host, Node, []). @@ -102,12 +111,14 @@ start(Host, Node) -> %%% ErlangFlags = string() %%% EnvVar = string() %%% Value = string() -%%% Result = {ok, NodeName} | {error, already_started, NodeName} | -%%% {error, started_not_connected, NodeName} | -%%% {error, boot_timeout, NodeName} | -%%% {error, init_timeout, NodeName} | -%%% {error, startup_timeout, NodeName} | -%%% {error, not_alive, NodeName} +%%% Result = {ok, NodeName} | +%%% {error, Reason, NodeName} +%%% Reason = already_started | +%%% started_not_connected | +%%% boot_timeout | +%%% init_timeout | +%%% startup_timeout | +%%% not_alive %%% NodeName = atom() %%% @doc Starts an Erlang node with name <code>Node</code> on host %%% <code>Host</code> as specified by the combination of options in @@ -169,7 +180,7 @@ start(Host, Node) -> %%% <code>NodeName</code> is the name of current node in this case.</item> %%% </list></p> %%% -start(Host, Node, Options) -> +start(Host, Node, Opts) -> ENode = enodename(Host, Node), case erlang:is_alive() of false-> @@ -177,7 +188,7 @@ start(Host, Node, Options) -> true-> case is_started(ENode) of false-> - OptionsRec = fetch_options(Options), + OptionsRec = fetch_options(Opts), do_start(Host, Node, OptionsRec); {true, not_connected}-> {error, started_not_connected, ENode}; @@ -189,9 +200,11 @@ start(Host, Node, Options) -> %%% @spec stop(Node) -> Result %%% Node = atom() %%% Result = {ok, NodeName} | -%%% {error, not_started, NodeName} | -%%% {error, not_connected, NodeName} | -%%% {error, stop_timeout, NodeName} +%%% {error, Reason, NodeName} +%%% Reason = not_started | +%%% not_connected | +%%% stop_timeout + %%% NodeName = atom() %%% @doc Stops the running Erlang node with name <code>Node</code> on %%% the localhost. @@ -202,9 +215,10 @@ stop(Node) -> %%% Host = atom() %%% Node = atom() %%% Result = {ok, NodeName} | -%%% {error, not_started, NodeName} | -%%% {error, not_connected, NodeName} | -%%% {error, stop_timeout, NodeName} +%%% {error, Reason, NodeName} +%%% Reason = not_started | +%%% not_connected | +%%% stop_timeout %%% NodeName = atom() %%% @doc Stops the running Erlang node with name <code>Node</code> on %%% host <code>Host</code>. diff --git a/lib/common_test/test/ct_cover_SUITE.erl b/lib/common_test/test/ct_cover_SUITE.erl index cb49dc423f..ec2680f664 100644 --- a/lib/common_test/test/ct_cover_SUITE.erl +++ b/lib/common_test/test/ct_cover_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2012. All Rights Reserved. +%% Copyright Ericsson AB 2012-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -59,10 +59,8 @@ init_per_testcase(TestCase, Config) -> ct_test_support:init_per_testcase(TestCase, Config). end_per_testcase(TestCase, Config) -> - Node = fullname(existing_node), - case lists:member(Node,nodes()) of - true -> rpc:call(Node,erlang,halt,[]); - false -> ok + try apply(?MODULE,TestCase,[cleanup,Config]) + catch error:undef -> ok end, ct_test_support:end_per_testcase(TestCase, Config). @@ -125,33 +123,35 @@ slave_start_slave(Config) -> %% spec file. %% Check that cover is collected from test node and slave node. cover_node_option(Config) -> - {ok, HostStr}=inet:gethostname(), - Host = list_to_atom(HostStr), DataDir = ?config(data_dir,Config), - {ok,Node} = ct_slave:start(Host,existing_node, - [{erl_flags,"-pa " ++ DataDir}]), + {ok,Node} = start_slave(existing_node_1, "-pa " ++ DataDir), false = check_cover(Node), CoverSpec = default_cover_file_content() ++ [{nodes,[Node]}], CoverFile = create_cover_file(cover_node_option,CoverSpec,Config), {ok,Events} = run_test(cover_node_option,cover_node_option, [{cover,CoverFile}],Config), check_calls(Events,2), - {ok,Node} = ct_slave:stop(existing_node), + {ok,Node} = ct_slave:stop(existing_node_1), + ok. + +cover_node_option(cleanup,_Config) -> + _ = ct_slave:stop(existing_node_1), ok. %% Test ct_cover:add_nodes/1 and ct_cover:remove_nodes/1 %% Check that cover is collected from added node ct_cover_add_remove_nodes(Config) -> - {ok, HostStr}=inet:gethostname(), - Host = list_to_atom(HostStr), DataDir = ?config(data_dir,Config), - {ok,Node} = ct_slave:start(Host,existing_node, - [{erl_flags,"-pa " ++ DataDir}]), + {ok,Node} = start_slave(existing_node_2, "-pa " ++ DataDir), false = check_cover(Node), {ok,Events} = run_test(ct_cover_add_remove_nodes,ct_cover_add_remove_nodes, [],Config), check_calls(Events,2), - {ok,Node} = ct_slave:stop(existing_node), + {ok,Node} = ct_slave:stop(existing_node_2), + ok. + +ct_cover_add_remove_nodes(cleanup,_Config) -> + _ = ct_slave:stop(existing_node_2), ok. %% Test that the test suite itself can be cover compiled and that @@ -310,3 +310,12 @@ create_cover_file(Filename,Terms,Config) -> end,Terms), ok = file:close(Fd), File. + +start_slave(Name,Args) -> + {ok, HostStr}=inet:gethostname(), + Host = list_to_atom(HostStr), + ct_slave:start(Host,Name, + [{erl_flags,Args}, + {boot_timeout,10}, % extending some timers for slow test hosts + {init_timeout,10}, + {startup_timeout,10}]). diff --git a/lib/common_test/test/ct_cover_SUITE_data/cover_SUITE.erl b/lib/common_test/test/ct_cover_SUITE_data/cover_SUITE.erl index fdc3323f0a..d967590c72 100644 --- a/lib/common_test/test/ct_cover_SUITE_data/cover_SUITE.erl +++ b/lib/common_test/test/ct_cover_SUITE_data/cover_SUITE.erl @@ -1,7 +1,7 @@ %%-------------------------------------------------------------------- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2012. All Rights Reserved. +%% Copyright Ericsson AB 2012-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -76,7 +76,7 @@ slave(Config) -> cover_compiled = code:which(cover_test_mod), cover_test_mod:foo(), N1 = nodename(slave,1), - {ok,Node} = ct_slave:start(N1), + {ok,Node} = start_slave(N1), cover_compiled = rpc:call(Node,code,which,[cover_test_mod]), rpc:call(Node,cover_test_mod,foo,[]), {ok,Node} = ct_slave:stop(N1), @@ -87,7 +87,7 @@ slave_start_slave(Config) -> cover_test_mod:foo(), N1 = nodename(slave_start_slave,1), N2 = nodename(slave_start_slave,2), - {ok,Node} = ct_slave:start(N1), + {ok,Node} = start_slave(N1), cover_compiled = rpc:call(Node,code,which,[cover_test_mod]), rpc:call(Node,cover_test_mod,foo,[]), {ok,Node2} = rpc:call(Node,ct_slave,start,[N2]), @@ -99,7 +99,7 @@ slave_start_slave(Config) -> cover_node_option(Config) -> cover_compiled = code:which(cover_test_mod), cover_test_mod:foo(), - Node = fullname(existing_node), + Node = fullname(existing_node_1), cover_compiled = rpc:call(Node,code,which,[cover_test_mod]), rpc:call(Node,cover_test_mod,foo,[]), ok. @@ -107,7 +107,7 @@ cover_node_option(Config) -> ct_cover_add_remove_nodes(Config) -> cover_compiled = code:which(cover_test_mod), cover_test_mod:foo(), - Node = fullname(existing_node), + Node = fullname(existing_node_2), Beam = rpc:call(Node,code,which,[cover_test_mod]), false = (Beam == cover_compiled), @@ -154,3 +154,11 @@ kill_slaves(Case, [Node|Nodes]) -> kill_slaves(Case,Nodes); kill_slaves(_,[]) -> ok. + +start_slave(Name) -> + {ok, HostStr}=inet:gethostname(), + Host = list_to_atom(HostStr), + ct_slave:start(Host,Name, + [{boot_timeout,10}, % extending some timers for slow test hosts + {init_timeout,10}, + {startup_timeout,10}]). diff --git a/lib/inets/src/http_client/httpc.erl b/lib/inets/src/http_client/httpc.erl index ede649a5a9..64a60b82aa 100644 --- a/lib/inets/src/http_client/httpc.erl +++ b/lib/inets/src/http_client/httpc.erl @@ -163,8 +163,13 @@ request(Method, {error, Reason} -> {error, Reason}; {ok, ParsedUrl} -> - handle_request(Method, Url, ParsedUrl, Headers, [], [], - HTTPOptions, Options, Profile) + case header_parse(Headers) of + {error, Reason} -> + {error, Reason}; + _ -> + handle_request(Method, Url, ParsedUrl, Headers, [], [], + HTTPOptions, Options, Profile) + end end; request(Method, @@ -1247,7 +1252,12 @@ uri_parse(URI, Opts) -> %%-------------------------------------------------------------------------- - +header_parse([]) -> + ok; +header_parse([{Field, Value}|T]) when is_list(Field), is_list(Value) -> + header_parse(T); +header_parse(_) -> + {error, {headers_error, not_strings}}. child_name2info(undefined) -> {error, no_such_service}; child_name2info(httpc_manager) -> diff --git a/lib/inets/src/http_lib/http_request.erl b/lib/inets/src/http_lib/http_request.erl index c214aca4a4..fbfbe7c632 100644 --- a/lib/inets/src/http_lib/http_request.erl +++ b/lib/inets/src/http_lib/http_request.erl @@ -248,13 +248,8 @@ key_value_str(Key = 'content-language', Headers) -> key_value_str(atom_to_list(Key), Headers#http_request_h.'content-language'); key_value_str(Key = 'content-length', Headers) -> - case Headers#http_request_h.'content-length' of - "0" -> - undefined; - _ -> - key_value_str(atom_to_list(Key), - Headers#http_request_h.'content-length') - end; + key_value_str(atom_to_list(Key), + Headers#http_request_h.'content-length'); key_value_str(Key = 'content-location', Headers) -> key_value_str(atom_to_list(Key), Headers#http_request_h.'content-location'); diff --git a/lib/inets/test/http_format_SUITE.erl b/lib/inets/test/http_format_SUITE.erl index 04c7358715..c913964094 100644 --- a/lib/inets/test/http_format_SUITE.erl +++ b/lib/inets/test/http_format_SUITE.erl @@ -35,14 +35,15 @@ chunk_decode_trailer/1, http_response/1, http_request/1, validate_request_line/1, esi_parse_headers/1, cgi_parse_headers/1, - is_absolut_uri/1, convert_netscapecookie_date/1]). + is_absolut_uri/1, convert_netscapecookie_date/1, + check_content_length_encoding/1]). suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [{group, chunk}, http_response, http_request, validate_request_line, {group, script}, is_absolut_uri, - convert_netscapecookie_date]. + convert_netscapecookie_date, check_content_length_encoding]. groups() -> [{script, [], [esi_parse_headers, cgi_parse_headers]}, @@ -456,6 +457,25 @@ validate_request_line(Config) when is_list(Config) -> httpd_request:validate("GET", NewForbiddenUri1, "HTTP/1.1"), ok. + +%%------------------------------------------------------------------------- +check_content_length_encoding(doc) -> + ["Test http_request:headers/2. Check that the content-length is" + " encoded even when it is zero." ]; +check_content_length_encoding(suite) -> + []; +check_content_length_encoding(Config) when is_list(Config) -> + + %% Check that the content-length is preserved. + %% Sanity check. + Header1 = http_request:http_headers(#http_request_h{'content-length'="123"}), + true = (string:str(Header1, "content-length: 123\r\n") > 0), + %% Check that content-length=0 is handled correctly. + Header2 = http_request:http_headers(#http_request_h{'content-length'="0"}), + true = (string:str(Header2, "content-length: 0\r\n") > 0), + + ok. + %%------------------------------------------------------------------------- esi_parse_headers(doc) -> ["Test httpd_esi:*. All header values are received in the same" diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl index 8df5964193..c20ec63448 100644 --- a/lib/inets/test/httpc_SUITE.erl +++ b/lib/inets/test/httpc_SUITE.erl @@ -83,7 +83,8 @@ real_requests()-> stream_through_fun, stream_through_mfa, streaming_error, - inet_opts + inet_opts, + invalid_headers ]. only_simulated() -> @@ -795,6 +796,10 @@ headers_dummy(Config) when is_list(Config) -> %%------------------------------------------------------------------------- +invalid_headers(Config) -> + Request = {url(group_name(Config), "/dummy.html", Config), [{"cookie", undefined}]}, + {error, _} = httpc:request(get, Request, [], []). + remote_socket_close(Config) when is_list(Config) -> URL = url(group_name(Config), "/just_close.html", Config), {error, socket_closed_remotely} = httpc:request(URL). diff --git a/lib/jinterface/test/jinterface_SUITE.erl b/lib/jinterface/test/jinterface_SUITE.erl index 82bc878112..b438da12d0 100644 --- a/lib/jinterface/test/jinterface_SUITE.erl +++ b/lib/jinterface/test/jinterface_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2011. All Rights Reserved. +%% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -184,6 +184,10 @@ init_per_testcase(_Case,Config) -> [{watch_dog,Dog}|Config]. end_per_testcase(_Case,Config) -> + case whereis(erl_link_server) of + undefined -> ok; + Pid -> exit(Pid,kill) + end, ?t:timetrap_cancel(?config(watch_dog,Config)), ok. diff --git a/lib/jinterface/test/jitu.erl b/lib/jinterface/test/jitu.erl index 571a2dc9c7..0e1af0ff22 100644 --- a/lib/jinterface/test/jitu.erl +++ b/lib/jinterface/test/jitu.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2012. All Rights Reserved. +%% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -48,7 +48,7 @@ java(Java, Dir, Class, Args, Props) -> -init_all(Config) when list(Config) -> +init_all(Config) when is_list(Config) -> case find_executable(["java"]) of false -> {skip,"Found no Java VM"}; Path -> [{java,Path}|Config] @@ -69,13 +69,13 @@ find_executable([E|T]) -> Path -> Path end. -to_string([H|T]) when integer(H) -> +to_string([H|T]) when is_integer(H) -> integer_to_list(H)++" "++to_string(T); -to_string([H|T]) when atom(H) -> +to_string([H|T]) when is_atom(H) -> atom_to_list(H)++" "++to_string(T); -to_string([H|T]) when pid(H) -> +to_string([H|T]) when is_pid(H) -> pid_to_list(H)++" "++to_string(T); -to_string([H|T]) when list(H) -> +to_string([H|T]) when is_list(H) -> lists:flatten(H)++" "++to_string(T); to_string([]) -> []. @@ -84,35 +84,37 @@ to_string([]) -> []. % filename:join(Dir, File)). classpath(Dir) -> - PS = + {PS,Quote,EscSpace} = case os:type() of - {win32, _} -> ";"; - _ -> ":" + {win32, _} -> {";","\"",""}; + _ -> {":","","\\"} end, es(Dir++PS++ filename:join([code:lib_dir(jinterface),"priv","OtpErlang.jar"])++PS++ case os:getenv("CLASSPATH") of false -> ""; Classpath -> Classpath - end). + end, + Quote, + EscSpace). -es(L) -> - lists:flatmap(fun($ ) -> - "\\ "; - (C) -> - [C] - end,lists:flatten(L)). +es(L,Quote,EscSpace) -> + Quote++lists:flatmap(fun($ ) -> + EscSpace++" "; + (C) -> + [C] + end,lists:flatten(L)) ++ Quote. cmd(Cmd) -> PortOpts = [{line,80},eof,exit_status,stderr_to_stdout], io:format("cmd: ~s~n", [Cmd]), case catch open_port({spawn,Cmd}, PortOpts) of - Port when port(Port) -> + Port when is_port(Port) -> Result = cmd_loop(Port, []), io:format("cmd res: ~w~n", [Result]), case Result of 0 -> ok; - ExitCode when integer(ExitCode) -> {error,ExitCode}; + ExitCode when is_integer(ExitCode) -> {error,ExitCode}; Error -> Error end; {'EXIT',Reason} -> diff --git a/lib/observer/src/etop.erl b/lib/observer/src/etop.erl index 428757e5ce..2610060eae 100644 --- a/lib/observer/src/etop.erl +++ b/lib/observer/src/etop.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2012. All Rights Reserved. +%% Copyright Ericsson AB 2002-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -325,13 +325,40 @@ loadinfo(SysI) -> #etop_info{n_procs = Procs, run_queue = RQ, now = Now, - wall_clock = {_, WC}, - runtime = {_, RT}} = SysI, - Cpu = round(100*RT/WC), + wall_clock = WC, + runtime = RT} = SysI, + Cpu = calculate_cpu_utilization(WC,RT), Clock = io_lib:format("~2.2.0w:~2.2.0w:~2.2.0w", tuple_to_list(element(2,calendar:now_to_datetime(Now)))), {Cpu,Procs,RQ,Clock}. +calculate_cpu_utilization({_,WC},{_,RT}) -> + %% Old version of observer_backend, using statistics(wall_clock) + %% and statistics(runtime) + case {WC,RT} of + {0,0} -> + 0; + {0,_} -> + 100; + _ -> + round(100*RT/WC) + end; +calculate_cpu_utilization(_,undefined) -> + %% First time collecting - no cpu utilization has been measured + %% since scheduler_wall_time flag is not yet on + 0; +calculate_cpu_utilization(_,RTInfo) -> + %% New version of observer_backend, using statistics(scheduler_wall_time) + Sum = lists:foldl(fun({_,A,T},{AAcc,TAcc}) -> {A+AAcc,T+TAcc} end, + {0,0}, + RTInfo), + case Sum of + {0,0} -> + 0; + {Active,Total} -> + round(100*Active/Total) + end. + meminfo(MemI, [Tag|Tags]) -> [round(get_mem(Tag, MemI)/1024)|meminfo(MemI, Tags)]; meminfo(_MemI, []) -> []. diff --git a/lib/observer/src/etop_gui.erl b/lib/observer/src/etop_gui.erl index f5cc0deb38..3971646abc 100644 --- a/lib/observer/src/etop_gui.erl +++ b/lib/observer/src/etop_gui.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2012. All Rights Reserved. +%% Copyright Ericsson AB 2002-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -276,7 +276,12 @@ clear_lines(From, To, Grid) -> end. formatmfa({M, F, A}) -> - io_lib:format("~w:~w/~w",[M, F, A]). + io_lib:format("~w:~w/~w",[M, F, A]); +formatmfa(Other) -> + %% E.g. when running hipe - the current_function for some + %% processes will be 'undefined' + io_lib:format("~w",[Other]). + makegridlines([#etop_proc_info{pid=Pid, mem=Mem, diff --git a/lib/observer/test/etop_SUITE.erl b/lib/observer/test/etop_SUITE.erl index 06577f82cc..6ce3ea59cf 100644 --- a/lib/observer/test/etop_SUITE.erl +++ b/lib/observer/test/etop_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2012. All Rights Reserved. +%% Copyright Ericsson AB 2002-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -21,7 +21,8 @@ %% Test functions -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2,text/1,text_tracing_off/1]). + init_per_group/2,end_per_group/2]). +-export([text/1,text/2,text_tracing_off/1,text_tracing_off/2]). -export([init_per_testcase/2, end_per_testcase/2]). -include_lib("test_server/include/test_server.hrl"). @@ -31,7 +32,10 @@ init_per_testcase(_Case, Config) -> ?line Dog=test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. -end_per_testcase(_Case, Config) -> +end_per_testcase(Case, Config) -> + try apply(?MODULE,Case,[cleanup,Config]) + catch error:undef -> ok + end, Dog=?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. @@ -82,9 +86,12 @@ text() -> ?line timer:sleep(3000), ?line etop:config(sort,msg_q), ?line timer:sleep(3000), - ?line etop:stop(), - ?line ?t:stop_node(Node), ok. +text(cleanup,_Config) -> + etop:stop(), + {ok,Host} = inet:gethostname(), + Node = list_to_atom("node2@"++Host), + ?t:stop_node(Node). text_tracing_off(suite) -> []; @@ -111,7 +118,10 @@ text_tracing_off(Config) when is_list(Config) -> ?line timer:sleep(3000), ?line etop:config(sort,runtime), % this should not crash, but has no effect ?line timer:sleep(3000), - ?line etop:stop(), - ?line ?t:stop_node(Node), ok. +text_tracing_off(cleanup,_Config) -> + etop:stop(), + {ok,Host} = inet:gethostname(), + Node = list_to_atom("node2@"++Host), + ?t:stop_node(Node). diff --git a/lib/observer/test/ttb_SUITE.erl b/lib/observer/test/ttb_SUITE.erl index 695d41b48a..f3fcd9f283 100644 --- a/lib/observer/test/ttb_SUITE.erl +++ b/lib/observer/test/ttb_SUITE.erl @@ -1,7 +1,8 @@ +%% %% %CopyrightBegin% %% %% -%% Copyright Ericsson AB 2002-2010. All Rights Reserved. +%% Copyright Ericsson AB 2002-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -57,7 +58,7 @@ init_per_testcase(Case, Config) -> catch error:undef -> ok end, [{watchdog, Dog}|Config]. -end_per_testcase(Case, Config) -> +end_per_testcase(_Case, Config) -> %% try apply(?MODULE,Case,[cleanup,Config]) %% catch error:undef -> ok %% end, diff --git a/lib/observer/test/ttb_helper.erl b/lib/observer/test/ttb_helper.erl index 76b06cd3ce..05f6d73aef 100644 --- a/lib/observer/test/ttb_helper.erl +++ b/lib/observer/test/ttb_helper.erl @@ -70,7 +70,7 @@ msgs(N) -> msgs_ip(N) -> [c(client, put, [test_msg]) || _ <- lists:seq(1, N)], s(server, received, [a,b]), - timer:sleep(200). %% allow trace messages to arrive over tcp/ip + timer:sleep(500). %% allow trace messages to arrive over tcp/ip run() -> ttb({local, "A"}), diff --git a/lib/public_key/asn1/OTP-PKIX.asn1 b/lib/public_key/asn1/OTP-PKIX.asn1 index 4f20208bce..a90fe2840c 100644 --- a/lib/public_key/asn1/OTP-PKIX.asn1 +++ b/lib/public_key/asn1/OTP-PKIX.asn1 @@ -97,9 +97,9 @@ IMPORTS id-pkix1-implicit(19) } --Keys and Signatures - id-dsa, Dss-Parms, DSAPublicKey, - id-dsa-with-sha1, - md2WithRSAEncryption, + id-dsa, Dss-Parms, DSAPublicKey, + id-dsa-with-sha1, id-dsaWithSHA1, + md2WithRSAEncryption, md5WithRSAEncryption, sha1WithRSAEncryption, rsaEncryption, RSAPublicKey, @@ -115,7 +115,6 @@ IMPORTS FROM PKIX1Algorithms88 { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) id-mod(0) id-mod-pkix1-algorithms(17) } - md2WithRSAEncryption, md5WithRSAEncryption, sha1WithRSAEncryption, @@ -316,8 +315,8 @@ PublicKeyAlgorithm ::= SEQUENCE { OPTIONAL } SupportedSignatureAlgorithms SIGNATURE-ALGORITHM-CLASS ::= { - dsa-with-sha1 | md2-with-rsa-encryption | - md5-with-rsa-encryption | sha1-with-rsa-encryption | + dsa-with-sha1 | dsaWithSHA1 | md2-with-rsa-encryption | + md5-with-rsa-encryption | sha1-with-rsa-encryption | sha-1with-rsa-encryption | sha224-with-rsa-encryption | sha256-with-rsa-encryption | sha384-with-rsa-encryption | @@ -325,7 +324,7 @@ SupportedSignatureAlgorithms SIGNATURE-ALGORITHM-CLASS ::= { ecdsa-with-sha1 } SupportedPublicKeyAlgorithms PUBLIC-KEY-ALGORITHM-CLASS ::= { - dsa | rsa-encryption | dh | kea | ec-public-key } + dsa | rsa-encryption | dh | kea | ec-public-key } -- DSA Keys and Signatures @@ -349,6 +348,11 @@ SupportedPublicKeyAlgorithms PUBLIC-KEY-ALGORITHM-CLASS ::= { ID id-dsa-with-sha1 TYPE DSAParams } + + dsaWithSHA1 SIGNATURE-ALGORITHM-CLASS ::= { + ID id-dsaWithSHA1 + TYPE DSAParams } + -- -- RSA Keys and Signatures -- @@ -367,6 +371,10 @@ SupportedPublicKeyAlgorithms PUBLIC-KEY-ALGORITHM-CLASS ::= { ID sha1WithRSAEncryption TYPE NULL } + sha-1with-rsa-encryption SIGNATURE-ALGORITHM-CLASS ::= { + ID sha-1WithRSAEncryption + TYPE NULL } + sha224-with-rsa-encryption SIGNATURE-ALGORITHM-CLASS ::= { ID sha224WithRSAEncryption TYPE NULL } diff --git a/lib/public_key/asn1/PKCS-1.asn1 b/lib/public_key/asn1/PKCS-1.asn1 index c83289e779..b5754790e7 100644 --- a/lib/public_key/asn1/PKCS-1.asn1 +++ b/lib/public_key/asn1/PKCS-1.asn1 @@ -35,7 +35,9 @@ sha384WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 12 } sha512WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 13 } sha224WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 14 } - +-- ISO oid - equvivalent to sha1WithRSAEncryption +sha-1WithRSAEncryption OBJECT IDENTIFIER ::= { + iso(1) identified-organization(3) oiw(14) secsig(3) algorithms(2) sha-1WithRSAEncryption(29)} id-sha1 OBJECT IDENTIFIER ::= { iso(1) identified-organization(3) oiw(14) secsig(3) diff --git a/lib/public_key/asn1/PKIX1Algorithms88.asn1 b/lib/public_key/asn1/PKIX1Algorithms88.asn1 index f895b6d0cd..74225747d3 100644 --- a/lib/public_key/asn1/PKIX1Algorithms88.asn1 +++ b/lib/public_key/asn1/PKIX1Algorithms88.asn1 @@ -35,6 +35,9 @@ id-dsa-with-sha1 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) x9-57 (10040) x9algorithm(4) 3 } + id-dsaWithSHA1 OBJECT IDENTIFIER ::= { + iso(1) identified-organization(3) oiw(14) secsig(3) algorithms(2) dsaWithSHA1(27) + } -- encoding for DSA signature generated with SHA-1 hash Dss-Sig-Value ::= SEQUENCE { diff --git a/lib/public_key/doc/src/cert_records.xml b/lib/public_key/doc/src/cert_records.xml index ac4b4e4489..c9249d40c3 100644 --- a/lib/public_key/doc/src/cert_records.xml +++ b/lib/public_key/doc/src/cert_records.xml @@ -60,9 +60,6 @@ marker="public_key">public key reference manual </seealso> or follows here.</p> - <p><c>oid() - a tuple of integers - as generated by the ASN1 compiler.</c></p> - <p><c>time() = uct_time() | general_time()</c></p> <p><c>uct_time() = {utcTime, "YYMMDDHHMMSSZ"} </c></p> @@ -158,6 +155,9 @@ oid names see table below. Ex: ?'id-dsa-with-sha1'</p> <cell align="left" valign="middle">id-dsa-with-sha1</cell> </row> <row> + <cell align="left" valign="middle">id-dsaWithSHA1 (ISO alt oid to above)</cell> + </row> + <row> <cell align="left" valign="middle">md2WithRSAEncryption</cell> </row> <row> @@ -166,9 +166,21 @@ oid names see table below. Ex: ?'id-dsa-with-sha1'</p> <row> <cell align="left" valign="middle">sha1WithRSAEncryption</cell> </row> + <row> + <cell align="left" valign="middle">sha-1WithRSAEncryption (ISO alt oid to above)</cell> + </row> + <row> + <cell align="left" valign="middle">sha224WithRSAEncryption</cell> + </row> <row> - <cell align="left" valign="middle">ecdsa-with-SHA1</cell> + <cell align="left" valign="middle">sha256WithRSAEncryption</cell> </row> + <row> + <cell align="left" valign="middle">sha512WithRSAEncryption</cell> + </row> + <row> + <cell align="left" valign="middle">ecdsa-with-SHA1</cell> + </row> <tcaption>Signature algorithm oids </tcaption> </table> @@ -276,15 +288,14 @@ oid names see table below. Ex: ?'id-dsa-with-sha1'</p> <cell align="left" valign="middle">dhpublicnumber</cell> </row> <row> - <cell align="left" valign="middle">ecdsa-with-SHA1</cell> - </row> - <row> <cell align="left" valign="middle">id-keyExchangeAlgorithm</cell> </row> + <row> + <cell align="left" valign="middle">id-ecPublicKey</cell> + </row> <tcaption>Public key algorithm oids </tcaption> </table> - <code> #'Extension'{ extnID, % id_extensions() | oid() diff --git a/lib/public_key/doc/src/public_key.xml b/lib/public_key/doc/src/public_key.xml index 5864de2d57..84300f6e65 100644 --- a/lib/public_key/doc/src/public_key.xml +++ b/lib/public_key/doc/src/public_key.xml @@ -48,7 +48,7 @@ <item>Supports <url href="http://www.ietf.org/rfc/rfc5280.txt">RFC 5280 </url> - Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile </item> <item>Supports <url href="http://www.rsa.com/rsalabs/node.asp?id=2125"> PKCS-1 </url> - RSA Cryptography Standard </item> - <item>Supports <url href="http://csrc.nist.gov/publications/fips/fips186-3/fips_186-3.pdf"> DSA</url>- Digital Signature Algorithm</item> + <item>Supports <url href="http://csrc.nist.gov/publications/fips/fips186-3/fips_186-3.pdf"> DSS</url>- Digital Signature Standard (DSA - Digital Signature Algorithm)</item> <item>Supports <url href="http://www.rsa.com/rsalabs/node.asp?id=2126"> PKCS-3 </url> - Diffie-Hellman Key Agreement Standard </item> <item>Supports <url href="http://www.rsa.com/rsalabs/node.asp?id=2127"> PKCS-5</url> - Password-Based Cryptography Standard </item> <item>Supports <url href="http://www.rsa.com/rsalabs/node.asp?id=2130"> PKCS-8</url> - Private-Key Information Syntax Standard</item> @@ -72,8 +72,10 @@ <code> -include_lib("public_key/include/public_key.hrl"). </code> - <p><em>Data Types </em></p> + <p><em>Data Types </em></p> + <p><code>oid() - a tuple of integers as generated by the ASN1 compiler.</code></p> + <p><code>boolean() = true | false</code></p> <p><code>string() = [bytes()]</code></p> @@ -491,6 +493,21 @@ fun(OtpCert :: #'OTPCertificate'{}, Event :: {bad_cert, Reason :: atom()} | </desc> </func> + <func> + <name>pkix_sign_types(AlgorithmId) -> {DigestType, SignatureType}</name> + <fsummary>Translates signature algorithm oid to erlang digest and signature algorithm types.</fsummary> + <type> + <v>AlgorithmId = oid()</v> + <d>Signature oid from a certificate or a certificate revocation list</d> + <v>DigestType = rsa_digest_type() | dss_digest_type() </v> + <v>SignatureType = rsa | dsa</v> + </type> + <desc> + <p>Translates signature algorithm oid to erlang digest and signature types. + </p> + </desc> + </func> + <func> <name>pkix_verify(Cert, Key) -> boolean()</name> <fsummary> Verify pkix x.509 certificate signature.</fsummary> diff --git a/lib/public_key/src/pubkey_cert.erl b/lib/public_key/src/pubkey_cert.erl index f53c94b334..dc8d68c78f 100644 --- a/lib/public_key/src/pubkey_cert.erl +++ b/lib/public_key/src/pubkey_cert.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2011. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -27,7 +27,7 @@ validate_time/3, validate_signature/6, validate_issuer/4, validate_names/6, validate_extensions/4, - normalize_general_name/1, digest_type/1, is_self_signed/1, + normalize_general_name/1, is_self_signed/1, is_issuer/2, issuer_id/2, is_fixed_dh_cert/1, verify_data/1, verify_fun/4, select_extension/2, match_name/3, extensions_list/1, cert_auth_key_id/1, time_str_2_gregorian_sec/1]). @@ -426,13 +426,12 @@ extensions_list(asn1_NOVALUE) -> extensions_list(Extensions) -> Extensions. - extract_verify_data(OtpCert, DerCert) -> {_, Signature} = OtpCert#'OTPCertificate'.signature, SigAlgRec = OtpCert#'OTPCertificate'.signatureAlgorithm, SigAlg = SigAlgRec#'SignatureAlgorithm'.algorithm, PlainText = encoded_tbs_cert(DerCert), - DigestType = digest_type(SigAlg), + {DigestType,_} = public_key:pkix_sign_types(SigAlg), {DigestType, PlainText, Signature}. verify_signature(OtpCert, DerCert, Key, KeyParams) -> @@ -451,21 +450,6 @@ encoded_tbs_cert(Cert) -> {'Certificate_tbsCertificate', EncodedTBSCert}, _, _} = PKIXCert, EncodedTBSCert. -digest_type(?sha1WithRSAEncryption) -> - sha; -digest_type(?sha224WithRSAEncryption) -> - sha224; -digest_type(?sha256WithRSAEncryption) -> - sha256; -digest_type(?sha384WithRSAEncryption) -> - sha384; -digest_type(?sha512WithRSAEncryption) -> - sha512; -digest_type(?md5WithRSAEncryption) -> - md5; -digest_type(?'id-dsa-with-sha1') -> - sha. - public_key_info(PublicKeyInfo, #path_validation_state{working_public_key_algorithm = WorkingAlgorithm, diff --git a/lib/public_key/src/pubkey_crl.erl b/lib/public_key/src/pubkey_crl.erl index 3e4c3c8b6d..eaba5bfa1b 100644 --- a/lib/public_key/src/pubkey_crl.erl +++ b/lib/public_key/src/pubkey_crl.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2012. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -561,7 +561,7 @@ extract_crl_verify_data(CRL, DerCRL) -> #'AlgorithmIdentifier'{algorithm = SigAlg} = CRL#'CertificateList'.signatureAlgorithm, PlainText = encoded_tbs_crl(DerCRL), - DigestType = pubkey_cert:digest_type(SigAlg), + {DigestType, _} = public_key:pkix_sign_types(SigAlg), {DigestType, PlainText, Signature}. encoded_tbs_crl(CRL) -> diff --git a/lib/public_key/src/public_key.erl b/lib/public_key/src/public_key.erl index e753cf3867..736c18cdd4 100644 --- a/lib/public_key/src/public_key.erl +++ b/lib/public_key/src/public_key.erl @@ -36,6 +36,7 @@ decrypt_public/2, decrypt_public/3, sign/3, verify/4, pkix_sign/2, pkix_verify/2, + pkix_sign_types/1, pkix_is_self_signed/1, pkix_is_fixed_dh_cert/1, pkix_is_issuer/2, @@ -53,6 +54,7 @@ -type dss_digest_type() :: 'none' | 'sha'. %% None is for backwards compatibility -type crl_reason() :: unspecified | keyCompromise | cACompromise | affiliationChanged | superseded | cessationOfOperation | certificateHold | privilegeWithdrawn | aACompromise. +-type oid() :: tuple(). -define(UINT32(X), X:32/unsigned-big-integer). -define(DER_NULL, <<5, 0>>). @@ -335,6 +337,34 @@ format_rsa_private_key(#'RSAPrivateKey'{modulus = N, publicExponent = E, [crypto:mpint(K) || K <- [E, N, D]]. %%-------------------------------------------------------------------- + +-spec pkix_sign_types(SignatureAlg::oid()) -> + %% Relevant dsa digest type is subpart of rsa digest type + { DigestType :: rsa_digest_type(), + SignatureType :: rsa | dsa + }. +%% Description: +%%-------------------------------------------------------------------- +pkix_sign_types(?sha1WithRSAEncryption) -> + {sha, rsa}; +pkix_sign_types(?'sha-1WithRSAEncryption') -> + {sha, rsa}; +pkix_sign_types(?sha224WithRSAEncryption) -> + {sha224, rsa}; +pkix_sign_types(?sha256WithRSAEncryption) -> + {sha256, rsa}; +pkix_sign_types(?sha384WithRSAEncryption) -> + {sha384, rsa}; +pkix_sign_types(?sha512WithRSAEncryption) -> + {sha512, rsa}; +pkix_sign_types(?md5WithRSAEncryption) -> + {md5, rsa}; +pkix_sign_types(?'id-dsa-with-sha1') -> + {sha, dsa}; +pkix_sign_types(?'id-dsaWithSHA1') -> + {sha, dsa}. + +%%-------------------------------------------------------------------- -spec sign(binary() | {digest, binary()}, rsa_digest_type() | dss_digest_type(), rsa_private_key() | dsa_private_key()) -> Signature :: binary(). @@ -406,7 +436,7 @@ pkix_sign(#'OTPTBSCertificate'{signature = = SigAlg} = TBSCert, Key) -> Msg = pkix_encode('OTPTBSCertificate', TBSCert, otp), - DigestType = pubkey_cert:digest_type(Alg), + {DigestType, _} = pkix_sign_types(Alg), Signature = sign(Msg, DigestType, Key), Cert = #'OTPCertificate'{tbsCertificate= TBSCert, signatureAlgorithm = SigAlg, diff --git a/lib/public_key/test/public_key_SUITE.erl b/lib/public_key/test/public_key_SUITE.erl index ea48479f0b..0de80edeac 100644 --- a/lib/public_key/test/public_key_SUITE.erl +++ b/lib/public_key/test/public_key_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2012. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -41,7 +41,8 @@ all() -> {group, ssh_public_key_decode_encode}, encrypt_decrypt, {group, sign_verify}, - pkix, pkix_countryname, pkix_path_validation]. + pkix, pkix_countryname, pkix_path_validation, + pkix_iso_rsa_oid, pkix_iso_dsa_oid]. groups() -> [{pem_decode_encode, [], [dsa_pem, rsa_pem, encrypted_pem, @@ -688,6 +689,31 @@ pkix_path_validation(Config) when is_list(Config) -> public_key:pkix_path_validation(unknown_ca, [Cert1], [{verify_fun, VerifyFunAndState1}]), ok. + +%%-------------------------------------------------------------------- +pkix_iso_rsa_oid() -> + [{doc, "Test workaround for supporting certs that use ISO oids" + " 1.3.14.3.2.29 instead of PKIX/PKCS oid"}]. +pkix_iso_rsa_oid(Config) when is_list(Config) -> + Datadir = ?config(data_dir, Config), + {ok, PemCert} = file:read_file(filename:join(Datadir, "rsa_ISO.pem")), + [{_, Cert, _}] = public_key:pem_decode(PemCert), + OTPCert = public_key:pkix_decode_cert(Cert, otp), + SigAlg = OTPCert#'OTPCertificate'.signatureAlgorithm, + {_, rsa} = public_key:pkix_sign_types(SigAlg#'SignatureAlgorithm'.algorithm). + +%%-------------------------------------------------------------------- +pkix_iso_dsa_oid() -> + [{doc, "Test workaround for supporting certs that use ISO oids" + "1.3.14.3.2.27 instead of PKIX/PKCS oid"}]. +pkix_iso_dsa_oid(Config) when is_list(Config) -> + Datadir = ?config(data_dir, Config), + {ok, PemCert} = file:read_file(filename:join(Datadir, "dsa_ISO.pem")), + [{_, Cert, _}] = public_key:pem_decode(PemCert), + OTPCert = public_key:pkix_decode_cert(Cert, otp), + SigAlg = OTPCert#'OTPCertificate'.signatureAlgorithm, + {_, dsa} = public_key:pkix_sign_types(SigAlg#'SignatureAlgorithm'.algorithm). + %%-------------------------------------------------------------------- %% Internal functions ------------------------------------------------ %%-------------------------------------------------------------------- diff --git a/lib/public_key/test/public_key_SUITE_data/dsa_ISO.pem b/lib/public_key/test/public_key_SUITE_data/dsa_ISO.pem new file mode 100644 index 0000000000..d3541367f0 --- /dev/null +++ b/lib/public_key/test/public_key_SUITE_data/dsa_ISO.pem @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIIEEjCCAqygAwIBAgIQZIIqq4RXfpBKJXV69Jc4BjCCASwGByqGSM44BAMwggEf +AoGBALez5tklY5CdFeTMos899pA6i4u4uCtszgBzrdBk6cl5FVqzdzWMGTQiynnT +pGsrOESinzP06Ip+pG15We2OORwgvCxD/W95aCiN0/+MdiXqlsmboBARMzsa+SmB +ENN3gF/+tuuEAFzOXU1q2cmEywRLyfbM2KIBVE/TChWYw2eRAhUA1R64VvcQ90XA +8SOKVDmMA0dBzukCgYEAlLMYP0pbgBlgHQVO3/avAHlWNrIq52Lxk7SdPJWgMvPj +TK9Z6sv88kxsCcydtjvO439j1yqcwk50GQc+86ktBWWz93/HkIdnFyqafef4mmWv +m2Uq6ClQKS+A0Asfaj8Mys+HUMiI+qsfdjRbyIpwb7MX1nsVdsKzALnZNMW27A0w +HTEbMBkGA1UEAxMSSVNBIFRlc3QgQXV0aG9yaXR5MB4XDTEyMDMyMDE3MTMyMVoX +DTM5MTIzMTIzNTk1OVowHTEbMBkGA1UEAxMSSVNBIFRlc3QgQXV0aG9yaXR5MIGf +MA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqe3oVLIVBVIPI/uZjrciELODKxPEE +SDWoNvycEeP1ERF5kDlRDmLIQ51Nt0vI5pKTasnIDbB1ONiQ2cvMrj2dkWWl/z2v +f9tqQAzBm/r1LcUmL1bbP2bgk+//n5AJicU1FKecfDeZo0SXChDKSfH3ojdbsS5U +68q0qGHgNoPRawIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/ME4GA1UdAQRHMEWA +EEIfCfbwCZs35y8mXWInVuyhHzAdMRswGQYDVQQDExJJU0EgVGVzdCBBdXRob3Jp +dHmCEGSCKquEV36QSiV1evSXOAYwggEsBgcqhkjOOAQDMIIBHwKBgQC3s+bZJWOQ +nRXkzKLPPfaQOouLuLgrbM4Ac63QZOnJeRVas3c1jBk0Isp506RrKzhEop8z9OiK +fqRteVntjjkcILwsQ/1veWgojdP/jHYl6pbJm6AQETM7GvkpgRDTd4Bf/rbrhABc +zl1NatnJhMsES8n2zNiiAVRP0woVmMNnkQIVANUeuFb3EPdFwPEjilQ5jANHQc7p +AoGBAJSzGD9KW4AZYB0FTt/2rwB5VjayKudi8ZO0nTyVoDLz40yvWerL/PJMbAnM +nbY7zuN/Y9cqnMJOdBkHPvOpLQVls/d/x5CHZxcqmn3n+Jplr5tlKugpUCkvgNAL +H2o/DMrPh1DIiPqrH3Y0W8iKcG+zF9Z7FXbCswC52TTFtuwNAzAAMC0CFH/KmkwI +wnL9ecefLjQZ9Au52Kt5AhUAqJ5UEy2hIjCkdBoyuwOVPp5qnUw= +-----END CERTIFICATE----- diff --git a/lib/public_key/test/public_key_SUITE_data/rsa_ISO.pem b/lib/public_key/test/public_key_SUITE_data/rsa_ISO.pem new file mode 100644 index 0000000000..f82efdefc5 --- /dev/null +++ b/lib/public_key/test/public_key_SUITE_data/rsa_ISO.pem @@ -0,0 +1,14 @@ +-----BEGIN CERTIFICATE----- +MIICGjCCAYegAwIBAgIQZIIqq4RXfpBKJXV69Jc4BjAJBgUrDgMCHQUAMB0xGzAZ +BgNVBAMTEklTQSBUZXN0IEF1dGhvcml0eTAeFw0xMjAzMjAxNzEzMjFaFw0zOTEy +MzEyMzU5NTlaMB0xGzAZBgNVBAMTEklTQSBUZXN0IEF1dGhvcml0eTCBnzANBgkq +hkiG9w0BAQEFAAOBjQAwgYkCgYEAqnt6FSyFQVSDyP7mY63IhCzgysTxBEg1qDb8 +nBHj9REReZA5UQ5iyEOdTbdLyOaSk2rJyA2wdTjYkNnLzK49nZFlpf89r3/bakAM +wZv69S3FJi9W2z9m4JPv/5+QCYnFNRSnnHw3maNElwoQyknx96I3W7EuVOvKtKhh +4DaD0WsCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zBOBgNVHQEERzBFgBBCHwn2 +8AmbN+cvJl1iJ1bsoR8wHTEbMBkGA1UEAxMSSVNBIFRlc3QgQXV0aG9yaXR5ghBk +giqrhFd+kEoldXr0lzgGMAkGBSsOAwIdBQADgYEAIlVecua5Cr1z/cdwQ8znlgOU +U+y/uzg0nupKkopzVnRYhwV4hxZt3izAz4C/SJZB7eL0bUKlg1ceGjbQsGEm0fzF +LEV3vym4G51bxv03Iecwo96G4NgjJ7+9/7ciBVzfxZyfuCpYG1M2LyrbOyuevtTy +2+vIueT0lv6UftgBfIE= +-----END CERTIFICATE----- diff --git a/lib/reltool/test/reltool_test_lib.erl b/lib/reltool/test/reltool_test_lib.erl index 61f783190c..3485365ed9 100644 --- a/lib/reltool/test/reltool_test_lib.erl +++ b/lib/reltool/test/reltool_test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2012. All Rights Reserved. +%% Copyright Ericsson AB 2009-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -25,7 +25,7 @@ init_per_suite(Config) when is_list(Config)-> global:register_name(reltool_global_logger, group_leader()), - incr_timetrap(Config, 5). + incr_timetrap(Config, 10). end_per_suite(Config) when is_list(Config)-> global:unregister_name(reltool_global_logger), @@ -51,7 +51,7 @@ set_kill_timer(Config) -> Time = case lookup_config(tc_timeout, Config) of [] -> - timer:minutes(5); + timer:minutes(10); ConfigTime when is_integer(ConfigTime) -> ConfigTime end, diff --git a/lib/runtime_tools/include/observer_backend.hrl b/lib/runtime_tools/include/observer_backend.hrl index 4be9baca5b..91647a4468 100644 --- a/lib/runtime_tools/include/observer_backend.hrl +++ b/lib/runtime_tools/include/observer_backend.hrl @@ -1,26 +1,27 @@ -%% ``The contents of this file are subject to the Erlang Public License, +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2002-2013. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be -%% retrieved via the world wide web at http://www.erlang.org/. -%% +%% retrieved online at http://www.erlang.org/. +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% -%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. -%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings -%% AB. All Rights Reserved.'' -%% -%% $Id$ +%% +%% %CopyrightEnd% %% -record(etop_info, {now = {0, 0, 0}, n_procs = 0, - wall_clock = {0, 0}, - runtime = {0, 0}, + wall_clock, + runtime, run_queue = 0, alloc_areas = [], memi = [{total, 0}, diff --git a/lib/runtime_tools/src/observer_backend.erl b/lib/runtime_tools/src/observer_backend.erl index 9498412505..d1d291d5cb 100644 --- a/lib/runtime_tools/src/observer_backend.erl +++ b/lib/runtime_tools/src/observer_backend.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2012. All Rights Reserved. +%% Copyright Ericsson AB 2002-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -199,34 +199,57 @@ get_table_list(mnesia, Opts) -> lists:foldl(Info, [], mnesia:system_info(tables)). fetch_stats(Parent, Time) -> - erlang:system_flag(scheduler_wall_time, true), process_flag(trap_exit, true), - fetch_stats_loop(Parent, Time), - erlang:system_flag(scheduler_wall_time, false). + fetch_stats_loop(Parent, Time). fetch_stats_loop(Parent, Time) -> + erlang:system_flag(scheduler_wall_time, true), receive - _Msg -> normal + _Msg -> erlang:system_flag(scheduler_wall_time, false) after Time -> _M = Parent ! {stats, 1, erlang:statistics(scheduler_wall_time), erlang:statistics(io), erlang:memory()}, - fetch_stats(Parent, Time) + fetch_stats_loop(Parent, Time) end. %% %% etop backend %% etop_collect(Collector) -> + %% If this is the first time and the scheduler_wall_time flag is + %% false, SchedulerWallTime will be 'undefined' (and show 0 cpu + %% utilization in etop). Next time the flag will be true and then + %% there will be a measurement. + SchedulerWallTime = erlang:statistics(scheduler_wall_time), + + %% Turn off the flag while collecting data per process etc. + case erlang:system_flag(scheduler_wall_time,false) of + false -> + %% First time and the flag was false - start a monitoring + %% process to set the flag back to false when etop is stopped. + spawn(fun() -> flag_holder_proc(Collector) end); + _ -> + ok + end, + ProcInfo = etop_collect(processes(), []), + Collector ! {self(),#etop_info{now = now(), n_procs = length(ProcInfo), run_queue = erlang:statistics(run_queue), - wall_clock = erlang:statistics(wall_clock), - runtime = erlang:statistics(runtime), + runtime = SchedulerWallTime, memi = etop_memi(), procinfo = ProcInfo - }}. + }}, + erlang:system_flag(scheduler_wall_time,true). + +flag_holder_proc(Collector) -> + Ref = erlang:monitor(process,Collector), + receive + {'DOWN',Ref,_,_,_} -> + erlang:system_flag(scheduler_wall_time,false) + end. etop_memi() -> try diff --git a/lib/sasl/test/release_handler_SUITE.erl b/lib/sasl/test/release_handler_SUITE.erl index 82b7a738bb..97ba70c9bd 100644 --- a/lib/sasl/test/release_handler_SUITE.erl +++ b/lib/sasl/test/release_handler_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2011-2012. All Rights Reserved. +%% Copyright Ericsson AB 2011-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -1094,9 +1094,11 @@ otp_9395_update_many_mods(Conf) when is_list(Conf) -> [RelVsn2, filename:join(Rel2Dir, "sys.config")]), %% First, install release directly and check how much time it takes + rpc:call(Node,erlang,system_flag,[scheduler_wall_time,true]), {TInst0,{ok, _, []}} = timer:tc(rpc,call,[Node, release_handler, install_release, [RelVsn2]]), - ct:log("install_release: ~.2f",[TInst0/1000000]), + SWT0 = rpc:call(Node,erlang,statistics,[scheduler_wall_time]), +% ct:log("install_release: ~.2f",[TInst0/1000000]), %% Restore to old release, spawn processes again and load to get old code {_,RelVsn1} = init:script_id(), @@ -1113,15 +1115,32 @@ otp_9395_update_many_mods(Conf) when is_list(Conf) -> {TCheck,{ok, _RelVsn1, []}} = timer:tc(rpc,call,[Node, release_handler, check_install_release, [RelVsn2,[purge]]]), - ct:log("check_install_release with purge: ~.2f",[TCheck/1000000]), +% ct:log("check_install_release with purge: ~.2f",[TCheck/1000000]), %% Finally install release after check and purge, and check that %% this install was faster than the first. + rpc:call(Node,erlang,system_flag,[scheduler_wall_time,false]), + rpc:call(Node,erlang,system_flag,[scheduler_wall_time,true]), {TInst2,{ok, _RelVsn1, []}} = timer:tc(rpc,call,[Node, release_handler, install_release, [RelVsn2]]), - ct:log("install_release: ~.2f",[TInst2/1000000]), - - true = (TInst2 < TInst0), + SWT2 = rpc:call(Node,erlang,statistics,[scheduler_wall_time]), +% ct:log("install_release: ~.2f",[TInst2/1000000]), + + %% Calculate and print real time and CPU utilization + SumFun = fun({_,A,T},{AAcc,TAcc}) -> {A+AAcc,T+TAcc} end, + {SumA0,SumT0} = lists:foldl(SumFun,{0,0},SWT0), + {SumA2,SumT2} = lists:foldl(SumFun,{0,0},SWT2), + TI0=TInst0/1000000, + TI2=TInst2/1000000, + CPU0=SumA0/SumT0, + CPU2=SumA2/SumT2, + X0 = TI0*CPU0, + X2 = TI2*CPU2, + ct:log("First run: T=~.2fsec, CPU=~.2f, T*CPU=~.2f~n" + "Second run: T=~.2fsec, CPU=~.2f, T*CPU=~.2f~n", + [TI0, CPU0, X0, TI2, CPU2, X2]), + + true = (X2 =< X0), % disregarding wait time for file access etc. ok. @@ -1172,9 +1191,11 @@ otp_9395_rm_many_mods(Conf) when is_list(Conf) -> [RelVsn2, filename:join(Rel2Dir, "sys.config")]), %% First, install release directly and check how much time it takes + rpc:call(Node,erlang,system_flag,[scheduler_wall_time,true]), {TInst0,{ok, _, []}} = timer:tc(rpc,call,[Node, release_handler, install_release, [RelVsn2]]), - ct:log("install_release: ~.2f",[TInst0/1000000]), + SWT0 = rpc:call(Node,erlang,statistics,[scheduler_wall_time]), +% ct:log("install_release: ~.2f",[TInst0/1000000]), %% Restore to old release, spawn processes again and load to get old code {_,RelVsn1} = init:script_id(), @@ -1191,15 +1212,32 @@ otp_9395_rm_many_mods(Conf) when is_list(Conf) -> {TCheck,{ok, _RelVsn1, []}} = timer:tc(rpc,call,[Node, release_handler, check_install_release, [RelVsn2,[purge]]]), - ct:log("check_install_release with purge: ~.2f",[TCheck/1000000]), +% ct:log("check_install_release with purge: ~.2f",[TCheck/1000000]), %% Finally install release after check and purge, and check that %% this install was faster than the first. + rpc:call(Node,erlang,system_flag,[scheduler_wall_time,false]), + rpc:call(Node,erlang,system_flag,[scheduler_wall_time,true]), {TInst2,{ok, _RelVsn1, []}} = timer:tc(rpc,call,[Node, release_handler, install_release, [RelVsn2]]), - ct:log("install_release: ~.2f",[TInst2/1000000]), - - true = (TInst2 =< TInst0), + SWT2 = rpc:call(Node,erlang,statistics,[scheduler_wall_time]), +% ct:log("install_release: ~.2f",[TInst2/1000000]), + + %% Calculate and print real time and CPU utilization + SumFun = fun({_,A,T},{AAcc,TAcc}) -> {A+AAcc,T+TAcc} end, + {SumA0,SumT0} = lists:foldl(SumFun,{0,0},SWT0), + {SumA2,SumT2} = lists:foldl(SumFun,{0,0},SWT2), + TI0=TInst0/1000000, + TI2=TInst2/1000000, + CPU0=SumA0/SumT0, + CPU2=SumA2/SumT2, + X0 = TI0*CPU0, + X2 = TI2*CPU2, + ct:log("First run: T=~.2fsec, CPU=~.2f, T*CPU=~.2f~n" + "Second run: T=~.2fsec, CPU=~.2f, T*CPU=~.2f~n", + [TI0, CPU0, X0, TI2, CPU2, X2]), + + true = (X2 =< X0), % disregarding wait time for file access etc. ok. diff --git a/lib/ssl/src/ssl_certificate.erl b/lib/ssl/src/ssl_certificate.erl index 86f5617b54..01a7cd93b5 100644 --- a/lib/ssl/src/ssl_certificate.erl +++ b/lib/ssl/src/ssl_certificate.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2012. All Rights Reserved. +%% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -37,8 +37,7 @@ is_valid_extkey_usage/2, is_valid_key_usage/2, select_extension/2, - extensions_list/1, - signature_type/1 + extensions_list/1 ]). %%==================================================================== @@ -167,22 +166,6 @@ extensions_list(Extensions) -> Extensions. %%-------------------------------------------------------------------- --spec signature_type(term()) -> rsa | dsa . -%% -%% Description: -%%-------------------------------------------------------------------- -signature_type(RSA) when RSA == ?sha1WithRSAEncryption; - RSA == ?md5WithRSAEncryption; - RSA == ?sha224WithRSAEncryption; - RSA == ?sha256WithRSAEncryption; - RSA == ?sha384WithRSAEncryption; - RSA == ?sha512WithRSAEncryption - -> - rsa; -signature_type(?'id-dsa-with-sha1') -> - dsa. - -%%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- certificate_chain(OtpCert, _Cert, CertDbHandle, CertsDbRef, Chain) -> diff --git a/lib/ssl/src/ssl_cipher.erl b/lib/ssl/src/ssl_cipher.erl index 567690a413..d91e2a89a0 100644 --- a/lib/ssl/src/ssl_cipher.erl +++ b/lib/ssl/src/ssl_cipher.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2012. All Rights Reserved. +%% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -483,10 +483,10 @@ filter(undefined, Ciphers) -> filter(DerCert, Ciphers) -> OtpCert = public_key:pkix_decode_cert(DerCert, otp), SigAlg = OtpCert#'OTPCertificate'.signatureAlgorithm, - case ssl_certificate:signature_type(SigAlg#'SignatureAlgorithm'.algorithm) of - rsa -> + case public_key:pkix_sign_types(SigAlg#'SignatureAlgorithm'.algorithm) of + {_, rsa} -> filter_rsa(OtpCert, Ciphers -- dsa_signed_suites()); - dsa -> + {_, dsa} -> Ciphers -- rsa_signed_suites() end. diff --git a/lib/ssl/test/ssl_to_openssl_SUITE.erl b/lib/ssl/test/ssl_to_openssl_SUITE.erl index 4f53132d5d..a3d382f837 100644 --- a/lib/ssl/test/ssl_to_openssl_SUITE.erl +++ b/lib/ssl/test/ssl_to_openssl_SUITE.erl @@ -1202,8 +1202,8 @@ start_erlang_server_and_openssl_client_with_opts(Config, ErlangServerOpts, OpenS {mfa, {?MODULE, erlang_ssl_receive, [Data]}}, {options, ServerOpts}]), Port = ssl_test_lib:inet_port(Server), - - Cmd = "openssl s_client " ++ OpenSSLClientOpts ++ " -msg -port " ++ integer_to_list(Port) ++ + Version = ssl_record:protocol_version(ssl_record:highest_protocol_version([])), + Cmd = "openssl s_client " ++ OpenSSLClientOpts ++ " -msg -port " ++ integer_to_list(Port) ++ version_flag(Version) ++ " -host localhost", ct:print("openssl cmd: ~p~n", [Cmd]), diff --git a/lib/stdlib/doc/src/supervisor.xml b/lib/stdlib/doc/src/supervisor.xml index 9021d02ade..3f36c58d24 100644 --- a/lib/stdlib/doc/src/supervisor.xml +++ b/lib/stdlib/doc/src/supervisor.xml @@ -177,12 +177,6 @@ child_spec() = {Id,StartFunc,Restart,Shutdown,Type,Modules} child process, it must be implemented in a safe way and its cleanup procedure must always return.</p> </warning> - <p><em>Important note on simple-one-for-one supervisors:</em> - The dynamically created child processes of a - simple-one-for-one supervisor are not explicitly killed, - regardless of shutdown strategy, but are expected to terminate - when the supervisor does (that is, when an exit signal from - the parent process is received).</p> <p>Note that all child processes implemented using the standard OTP behavior modules automatically adhere to the shutdown protocol.</p> diff --git a/lib/test_server/src/erl2html2.erl b/lib/test_server/src/erl2html2.erl index 9c0ca64173..5584c1e50c 100644 --- a/lib/test_server/src/erl2html2.erl +++ b/lib/test_server/src/erl2html2.erl @@ -126,7 +126,7 @@ build_html(SFd,DFd,Encoding,Functions) -> build_html(SFd,DFd,Encoding,file:read_line(SFd),1,Functions,false). build_html(SFd,DFd,Encoding,{ok,Str},L,[{F,A,L}|Functions],_IsFuncDef) -> - FALink = http_uri:encode(F++"-"++integer_to_list(A)), + FALink = test_server_ctrl:uri_encode(F++"-"++integer_to_list(A),utf8), file:write(DFd,["<a name=\"",to_raw_list(FALink,Encoding),"\"/>"]), build_html(SFd,DFd,Encoding,{ok,Str},L,Functions,true); build_html(SFd,DFd,Encoding,{ok,Str},L,[{clause,L}|Functions],_IsFuncDef) -> diff --git a/lib/test_server/src/test_server_ctrl.erl b/lib/test_server/src/test_server_ctrl.erl index a5216571c7..21c10adccb 100644 --- a/lib/test_server/src/test_server_ctrl.erl +++ b/lib/test_server/src/test_server_ctrl.erl @@ -5326,31 +5326,28 @@ uri_encode(File,Encoding) -> Components = filename:split(File), filename:join([uri_encode_comp(C,Encoding) || C <- Components]). -uri_encode_comp("/",_) -> - "/"; -uri_encode_comp(Chars,utf8) -> - http_uri:encode(Chars); -uri_encode_comp(Chars,latin1) -> - do_uri_encode(Chars). - -%% Encode a file reference to a latin1 filename so it can be inserted -%% in a utf8 encoded HTML file. -%% This does the same as http_uri:encode/1, except it also encodes all -%% characters >127 - i.e. latin1 but not ASCII. -do_uri_encode([Char|Chars]) -> - case Char>127 orelse sets:is_element(Char, reserved()) of +%% Encode the reference to a "filename of the given encoding" so it +%% can be inserted in a utf8 encoded HTML file. +%% This does almost the same as http_uri:encode/1, except +%% 1. it does not convert @, : and / (in order to preserve nodename and c:/) +%% 2. if the file name is in latin1, it also encodes all +%% characters >127 - i.e. latin1 but not ASCII. +uri_encode_comp([Char|Chars],Encoding) -> + Reserved = sets:is_element(Char, reserved()), + case (Char>127 andalso Encoding==latin1) orelse Reserved of true -> - [ $% | http_util:integer_to_hexlist(Char)] ++ do_uri_encode(Chars); + [ $% | http_util:integer_to_hexlist(Char)] ++ + uri_encode_comp(Chars,Encoding); false -> - [Char | do_uri_encode(Chars)] + [Char | uri_encode_comp(Chars,Encoding)] end; -do_uri_encode([]) -> +uri_encode_comp([],_) -> []. %% Copied from http_uri.erl, but slightly modified -%% (not converting @ and :) +%% (not converting @, : and /) reserved() -> - sets:from_list([$;, $&, $=, $+, $,, $/, $?, + sets:from_list([$;, $&, $=, $+, $,, $?, $#, $[, $], $<, $>, $\", ${, $}, $|, $\\, $', $^, $%, $ ]). diff --git a/lib/test_server/test/test_server_SUITE.erl b/lib/test_server/test/test_server_SUITE.erl index bea2c0dc49..1a2fc632da 100644 --- a/lib/test_server/test/test_server_SUITE.erl +++ b/lib/test_server/test/test_server_SUITE.erl @@ -323,11 +323,7 @@ generate_and_run_unicode_test(Config0,Encoding) -> Config1 = lists:keydelete(node,1,Config0), Config2 = lists:keydelete(work_dir,1,Config1), NodeName = list_to_atom("test_server_tester_" ++ atom_to_list(Encoding)), - ErtsSwitch = case Encoding of - latin1 -> "+fnl"; - utf8 -> "+fnu" - end, - Config = start_node(Config2,NodeName,ErtsSwitch), + Config = start_node(Config2,NodeName,erts_switch(Encoding)), %% Compile the suite Node = proplists:get_value(node,Config), diff --git a/lib/test_server/test/test_server_SUITE_data/test_server_unicode_SUITE.erl b/lib/test_server/test/test_server_SUITE_data/test_server_unicode_SUITE.erl index 662adedd4c..284b51babe 100644 --- a/lib/test_server/test/test_server_SUITE_data/test_server_unicode_SUITE.erl +++ b/lib/test_server/test/test_server_SUITE_data/test_server_unicode_SUITE.erl @@ -21,14 +21,14 @@ -export([all/1, init_per_suite/1, end_per_suite/1]). -export([init_per_testcase/2, end_per_testcase/2]). --export([':#"|@\\ difficult_case_name_äöå'/1, +-export(['#=@: difficult_case_name_äöå'/1, print_and_log_unicode/1, print_and_log_latin1/1]). -include_lib("test_server/include/test_server.hrl"). all(suite) -> - [':#"|@\\ difficult_case_name_äöå', + ['#=@: difficult_case_name_äöå', print_and_log_unicode, print_and_log_latin1]. @@ -57,7 +57,7 @@ cancel_timetrap(Config) -> %%%----------------------------------------------------------------- %%% Test cases -':#"|@\\ difficult_case_name_äöå'(Config) when is_list(Config) -> +'#=@: difficult_case_name_äöå'(Config) when is_list(Config) -> ok. print_and_log_unicode(Config) when is_list(Config) -> |