From 038b9dd3a1f9bdd86cbb83bf3484ab1529d4fca2 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Tue, 29 Nov 2011 15:37:11 +0100 Subject: Fix dialyzer warnings in supervisor Dialyzer complained over a mismatch between the callback spec of Mod:code_change in gen_server and the spec of supervisor:code_change (which is the implementation of a gen_server Mod:code_change). This commit changes the callback spec to allow {error,Reason} as return value. Also, release_handler is updated to handle this return value. --- lib/sasl/src/release_handler_1.erl | 15 ++++++++++----- lib/stdlib/doc/src/gen_server.xml | 10 +++++++--- lib/stdlib/src/gen_server.erl | 2 +- lib/stdlib/src/supervisor.erl | 2 +- 4 files changed, 19 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/sasl/src/release_handler_1.erl b/lib/sasl/src/release_handler_1.erl index 37275eff45..93d12cf609 100644 --- a/lib/sasl/src/release_handler_1.erl +++ b/lib/sasl/src/release_handler_1.erl @@ -505,15 +505,20 @@ resume(Pids) -> change_code(Pids, Mod, Vsn, Extra, Timeout) -> Fun = fun(Pid) -> - case Timeout of - default -> - ok = sys:change_code(Pid, Mod, Vsn, Extra); - _Else -> - ok = sys:change_code(Pid, Mod, Vsn, Extra, Timeout) + case sys_change_code(Pid, Mod, Vsn, Extra, Timeout) of + ok -> + ok; + {error,Reason} -> + throw({code_change_failed,Pid,Mod,Vsn,Reason}) end end, lists:foreach(Fun, Pids). +sys_change_code(Pid, Mod, Vsn, Extra, default) -> + sys:change_code(Pid, Mod, Vsn, Extra); +sys_change_code(Pid, Mod, Vsn, Extra, Timeout) -> + sys:change_code(Pid, Mod, Vsn, Extra, Timeout). + stop(Mod, Procs) -> lists:zf(fun({undefined, _Name, _Pid, _Mods}) -> false; diff --git a/lib/stdlib/doc/src/gen_server.xml b/lib/stdlib/doc/src/gen_server.xml index 1045766e01..edeb7dff91 100644 --- a/lib/stdlib/doc/src/gen_server.xml +++ b/lib/stdlib/doc/src/gen_server.xml @@ -4,7 +4,7 @@
- 19962010 + 19962011 Ericsson AB. All Rights Reserved. @@ -570,13 +570,14 @@ gen_server:abcast -----> Module:handle_cast/2 - Module:code_change(OldVsn, State, Extra) -> {ok, NewState} + Module:code_change(OldVsn, State, Extra) -> {ok, NewState} | {error, Reason} Update the internal state during upgrade/downgrade. OldVsn = Vsn | {down, Vsn}   Vsn = term() State = NewState = term() Extra = term() + Reason = term()

This function is called by a gen_server when it should @@ -595,7 +596,10 @@ gen_server:abcast -----> Module:handle_cast/2

State is the internal state of the gen_server.

Extra is passed as-is from the {advanced,Extra} part of the update instruction.

-

The function should return the updated internal state.

+

If successful, the function shall return the updated + internal state.

+

If the function returns {error,Reason}, the ongoing + upgrade will fail and roll back to the old release.

diff --git a/lib/stdlib/src/gen_server.erl b/lib/stdlib/src/gen_server.erl index 6f075bbe5a..af07bc988a 100644 --- a/lib/stdlib/src/gen_server.erl +++ b/lib/stdlib/src/gen_server.erl @@ -134,7 +134,7 @@ term(). -callback code_change(OldVsn :: (term() | {down, term()}), State :: term(), Extra :: term()) -> - {ok, NewState :: term()}. + {ok, NewState :: term()} | {error, Reason :: term()}. %%% ----------------------------------------------------------------- %%% Starts a generic server. diff --git a/lib/stdlib/src/supervisor.erl b/lib/stdlib/src/supervisor.erl index 2dd5ccce7a..42ea42f42e 100644 --- a/lib/stdlib/src/supervisor.erl +++ b/lib/stdlib/src/supervisor.erl @@ -37,7 +37,7 @@ %%-------------------------------------------------------------------------- --type child() :: pid() | 'undefined'. +-type child() :: 'undefined' | pid() | [pid()]. -type child_id() :: term(). -type mfargs() :: {M :: module(), F :: atom(), A :: [term()] | undefined}. -type modules() :: [module()] | 'dynamic'. -- cgit v1.2.3 From 3781b5129a3e43c1c2e5e33d1223e1e17a617be7 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Tue, 29 Nov 2011 16:55:10 +0100 Subject: Add test for upgrade of supervisor The test is added in release_handler_SUITE since this makes it possible to test the full upgrade instead of just a simple library test of supervisor:code_change. --- lib/sasl/test/release_handler_SUITE.erl | 106 ++++++++++++++++++++- .../test/release_handler_SUITE_data/Makefile.src | 15 +++ .../test/release_handler_SUITE_data/lib/README | 8 ++ .../lib/a-9.0/ebin/a.app | 8 ++ .../lib/a-9.0/ebin/a.appup | 3 + .../release_handler_SUITE_data/lib/a-9.0/src/a.erl | 56 +++++++++++ .../lib/a-9.0/src/a_sup.erl | 37 +++++++ .../lib/a-9.1/ebin/a.app | 8 ++ .../lib/a-9.1/ebin/a.appup | 3 + .../release_handler_SUITE_data/lib/a-9.1/src/a.erl | 56 +++++++++++ .../lib/a-9.1/src/a_sup.erl | 37 +++++++ 11 files changed, 336 insertions(+), 1 deletion(-) create mode 100644 lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/ebin/a.app create mode 100644 lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/ebin/a.appup create mode 100644 lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a.erl create mode 100644 lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a_sup.erl create mode 100644 lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/ebin/a.app create mode 100644 lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/ebin/a.appup create mode 100644 lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a.erl create mode 100644 lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a_sup.erl (limited to 'lib') diff --git a/lib/sasl/test/release_handler_SUITE.erl b/lib/sasl/test/release_handler_SUITE.erl index 454fe26323..45a1e7640c 100644 --- a/lib/sasl/test/release_handler_SUITE.erl +++ b/lib/sasl/test/release_handler_SUITE.erl @@ -62,7 +62,8 @@ cases() -> otp_9395_update_many_mods, otp_9395_rm_many_mods, instructions, eval_appup, eval_appup_with_restart, supervisor_which_children_timeout, - release_handler_which_releases, install_release_syntax_check]. + release_handler_which_releases, install_release_syntax_check, + upgrade_supervisor, upgrade_supervisor_fail]. groups() -> [{release,[], @@ -1205,6 +1206,109 @@ otp_9395_rm_many_mods(cleanup,_Conf) -> stop_node(node_name(otp_9395_rm_many_mods)). +upgrade_supervisor(Conf) when is_list(Conf) -> + %% Set some paths + PrivDir = priv_dir(Conf), + Dir = filename:join(PrivDir,"upgrade_supervisor"), + LibDir = filename:join(?config(data_dir, Conf), "lib"), + + %% Create the releases + Lib1 = [{a,"1.0",LibDir}], + Lib2 = [{a,"9.0",LibDir}], + Rel1 = create_and_install_fake_first_release(Dir,Lib1), + Rel2 = create_fake_upgrade_release(Dir,"2",Lib2,{[Rel1],[Rel1],[LibDir]}), + Rel1Dir = filename:dirname(Rel1), + Rel2Dir = filename:dirname(Rel2), + + %% Start a slave node + {ok, Node} = t_start_node(upgrade_supervisor, Rel1, + filename:join(Rel1Dir,"sys.config")), + + %% Check path + Dir1 = filename:join([LibDir, "a-1.0"]), + Dir1 = rpc:call(Node, code, lib_dir, [a]), + ASupBeam1 = filename:join([Dir1,ebin,"a_sup.beam"]), + ASupBeam1 = rpc:call(Node, code, which, [a_sup]), + + %% Install second release, with no changed modules + {ok, RelVsn2} = rpc:call(Node, release_handler, set_unpacked, + [Rel2++".rel", Lib2]), + ok = rpc:call(Node, release_handler, install_file, + [RelVsn2, filename:join(Rel2Dir, "relup")]), + ok = rpc:call(Node, release_handler, install_file, + [RelVsn2, filename:join(Rel2Dir, "start.boot")]), + ok = rpc:call(Node, release_handler, install_file, + [RelVsn2, filename:join(Rel2Dir, "sys.config")]), + + {ok, _RelVsn1, []} = + rpc:call(Node, release_handler, install_release, [RelVsn2]), + + %% Check that libdir is changed + Dir2 = filename:join([LibDir, "a-9.0"]), + Dir2 = rpc:call(Node, code, lib_dir, [a]), + ASupBeam2 = filename:join([Dir2,ebin,"a_sup.beam"]), + ASupBeam2 = rpc:call(Node, code, which, [a_sup]), + + %% Check that the restart strategy and child spec is updated + {status, _, {module, _}, [_, _, _, _, [_,_,{data,[{"State",State}]}]]} = + rpc:call(Node,sys,get_status,[a_sup]), + {state,_,RestartStrategy,[Child],_,_,_,_,_,_} = State, + one_for_all = RestartStrategy, % changed from one_for_one + {child,_,_,_,_,brutal_kill,_,_} = Child, % changed from timeout 2000 + + ok. + +%% Check that if the supervisor fails, then the upgrade is rolled back +%% and an ok error message is returned +upgrade_supervisor_fail(Conf) when is_list(Conf) -> + %% Set some paths + PrivDir = priv_dir(Conf), + Dir = filename:join(PrivDir,"upgrade_supervisor_fail"), + LibDir = filename:join(?config(data_dir, Conf), "lib"), + + %% Create the releases + Lib1 = [{a,"1.0",LibDir}], + Lib2 = [{a,"9.1",LibDir}], + Rel1 = create_and_install_fake_first_release(Dir,Lib1), + Rel2 = create_fake_upgrade_release(Dir,"2",Lib2,{[Rel1],[Rel1],[LibDir]}), + Rel1Dir = filename:dirname(Rel1), + Rel2Dir = filename:dirname(Rel2), + + %% Start a slave node + {ok, Node} = t_start_node(upgrade_supervisor_fail, Rel1, + filename:join(Rel1Dir,"sys.config")), + + %% Check path + Dir1 = filename:join([LibDir, "a-1.0"]), + Dir1 = rpc:call(Node, code, lib_dir, [a]), + ASupBeam1 = filename:join([Dir1,ebin,"a_sup.beam"]), + ASupBeam1 = rpc:call(Node, code, which, [a_sup]), + + %% Install second release, with no changed modules + {ok, RelVsn2} = rpc:call(Node, release_handler, set_unpacked, + [Rel2++".rel", Lib2]), + ok = rpc:call(Node, release_handler, install_file, + [RelVsn2, filename:join(Rel2Dir, "relup")]), + ok = rpc:call(Node, release_handler, install_file, + [RelVsn2, filename:join(Rel2Dir, "start.boot")]), + ok = rpc:call(Node, release_handler, install_file, + [RelVsn2, filename:join(Rel2Dir, "sys.config")]), + ok = net_kernel:monitor_nodes(true), + + {error,{code_change_failed,_Pid,a_sup,_Vsn, + {error,{invalid_shutdown,brutal_kil}}}} = + rpc:call(Node, release_handler, install_release, [RelVsn2]), + + %% Check that the upgrade is terminated - normally this would mean + %% rollback, but since this testcase is very simplified the node + %% is not started with heart supervision and will therefore not be + %% restarted. So we just check that the node goes down. + receive {nodedown,Node} -> ok + after 10000 -> ct:fail(failed_upgrade_never_restarted_node) + end, + + ok. + %% Test upgrade and downgrade of applications eval_appup(Conf) when is_list(Conf) -> diff --git a/lib/sasl/test/release_handler_SUITE_data/Makefile.src b/lib/sasl/test/release_handler_SUITE_data/Makefile.src index 6f40088161..55d20aa8b6 100644 --- a/lib/sasl/test/release_handler_SUITE_data/Makefile.src +++ b/lib/sasl/test/release_handler_SUITE_data/Makefile.src @@ -5,6 +5,10 @@ P2B= \ P2B/a-2.0/ebin/a_sup.@EMULATOR@ LIB= \ + lib/a-9.1/ebin/a.@EMULATOR@ \ + lib/a-9.1/ebin/a_sup.@EMULATOR@ \ + lib/a-9.0/ebin/a.@EMULATOR@ \ + lib/a-9.0/ebin/a_sup.@EMULATOR@ \ lib/a-1.2/ebin/a.@EMULATOR@ \ lib/a-1.2/ebin/a_sup.@EMULATOR@ \ lib/a-1.1/ebin/a.@EMULATOR@ \ @@ -101,6 +105,17 @@ lib/a-1.2/ebin/a.@EMULATOR@: lib/a-1.2/src/a.erl lib/a-1.2/ebin/a_sup.@EMULATOR@: lib/a-1.2/src/a_sup.erl erlc $(EFLAGS) -olib/a-1.2/ebin lib/a-1.2/src/a_sup.erl +lib/a-9.0/ebin/a.@EMULATOR@: lib/a-9.0/src/a.erl + erlc $(EFLAGS) -olib/a-9.0/ebin lib/a-9.0/src/a.erl +lib/a-9.0/ebin/a_sup.@EMULATOR@: lib/a-9.0/src/a_sup.erl + erlc $(EFLAGS) -olib/a-9.0/ebin lib/a-9.0/src/a_sup.erl + +lib/a-9.1/ebin/a.@EMULATOR@: lib/a-9.1/src/a.erl + erlc $(EFLAGS) -olib/a-9.1/ebin lib/a-9.1/src/a.erl +lib/a-9.1/ebin/a_sup.@EMULATOR@: lib/a-9.1/src/a_sup.erl + erlc $(EFLAGS) -olib/a-9.1/ebin lib/a-9.1/src/a_sup.erl + + lib/b-1.0/ebin/b_server.@EMULATOR@: lib/b-1.0/src/b_server.erl erlc $(EFLAGS) -olib/b-1.0/ebin lib/b-1.0/src/b_server.erl lib/b-1.0/ebin/b_lib.@EMULATOR@: lib/b-1.0/src/b_lib.erl diff --git a/lib/sasl/test/release_handler_SUITE_data/lib/README b/lib/sasl/test/release_handler_SUITE_data/lib/README index 639a4ca0fb..ffb8c5120b 100644 --- a/lib/sasl/test/release_handler_SUITE_data/lib/README +++ b/lib/sasl/test/release_handler_SUITE_data/lib/README @@ -8,6 +8,14 @@ a-1.2: can be upgraded to from a-1.1. No module have changed, but priv dir is added including one 'file' +a-9.0: +can be upgrade to from a-1.0 +Changes a_sup correctly - to test successful upgrade of supervisor + +a-9.1: +can be upgrade to from a-1.0 +Changes a_sup faulty - to test failing upgrade of supervisor + b-1.0: start version, includes b_lib and b_server diff --git a/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/ebin/a.app b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/ebin/a.app new file mode 100644 index 0000000000..aa436d3e8c --- /dev/null +++ b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/ebin/a.app @@ -0,0 +1,8 @@ +{application, a, + [{description, "A CXC 138 11"}, + {vsn, "9.0"}, + {modules, [a, a_sup]}, + {registered, [a_sup]}, + {applications, [kernel, stdlib]}, + {env, [{key1, val1}]}, + {mod, {a_sup, []}}]}. diff --git a/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/ebin/a.appup b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/ebin/a.appup new file mode 100644 index 0000000000..c4071d57a3 --- /dev/null +++ b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/ebin/a.appup @@ -0,0 +1,3 @@ +{"9.0", + [{"1.0",[{update,a_sup,{advanced,update_supervisor}}]}], + [{"1.0",[{update,a_sup,{advanced,update_supervisor}}]}]}. diff --git a/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a.erl b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a.erl new file mode 100644 index 0000000000..1050e53f35 --- /dev/null +++ b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a.erl @@ -0,0 +1,56 @@ +%% ``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/. +%% +%% 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$ +%% +-module(a). + + +-behaviour(gen_server). + +%% External exports +-export([start_link/0, a/0, b/0]). +%% Internal exports +-export([init/1, handle_call/3, handle_info/2, terminate/2, code_change/3]). + +start_link() -> gen_server:start_link({local, aa}, a, [], []). + +a() -> gen_server:call(aa, a). +b() -> gen_server:call(aa, b). + +%%----------------------------------------------------------------- +%% Callback functions from gen_server +%%----------------------------------------------------------------- +init([]) -> + process_flag(trap_exit, true), + {ok, {state, bval}}. + +handle_call(a, _From, State) -> + X = application:get_all_env(a), + {reply, X, State}; + +handle_call(b, _From, State) -> + {reply, {ok, element(2, State)}, State}. + +handle_info(_, State) -> + {noreply, State}. + +terminate(_Reason, _State) -> + ok. + +code_change(1, Extra, State) -> + {ok, {state, bval}}; +code_change({down,1},Extra,State) -> + {ok, state}. diff --git a/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a_sup.erl b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a_sup.erl new file mode 100644 index 0000000000..ae1d080f58 --- /dev/null +++ b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a_sup.erl @@ -0,0 +1,37 @@ +%% ``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/. +%% +%% 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$ +%% +-module(a_sup). + + +-behaviour(supervisor). + +%% External exports +-export([start/2]). + +%% Internal exports +-export([init/1]). + +start(_, _) -> + supervisor:start_link({local, a_sup}, a_sup, []). + +init([]) -> + SupFlags = {one_for_all, 4, 3600}, + Config = {a, + {a, start_link, []}, + permanent, brutal_kill, worker, [a]}, + {ok, {SupFlags, [Config]}}. diff --git a/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/ebin/a.app b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/ebin/a.app new file mode 100644 index 0000000000..5b467ec4e8 --- /dev/null +++ b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/ebin/a.app @@ -0,0 +1,8 @@ +{application, a, + [{description, "A CXC 138 11"}, + {vsn, "9.1"}, + {modules, [a, a_sup]}, + {registered, [a_sup]}, + {applications, [kernel, stdlib]}, + {env, [{key1, val1}]}, + {mod, {a_sup, []}}]}. diff --git a/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/ebin/a.appup b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/ebin/a.appup new file mode 100644 index 0000000000..efeb7f1fe3 --- /dev/null +++ b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/ebin/a.appup @@ -0,0 +1,3 @@ +{"9.1", + [{"1.0",[{update,a_sup,{advanced,update_supervisor}}]}], + [{"1.0",[{update,a_sup,{advanced,update_supervisor}}]}]}. diff --git a/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a.erl b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a.erl new file mode 100644 index 0000000000..1050e53f35 --- /dev/null +++ b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a.erl @@ -0,0 +1,56 @@ +%% ``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/. +%% +%% 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$ +%% +-module(a). + + +-behaviour(gen_server). + +%% External exports +-export([start_link/0, a/0, b/0]). +%% Internal exports +-export([init/1, handle_call/3, handle_info/2, terminate/2, code_change/3]). + +start_link() -> gen_server:start_link({local, aa}, a, [], []). + +a() -> gen_server:call(aa, a). +b() -> gen_server:call(aa, b). + +%%----------------------------------------------------------------- +%% Callback functions from gen_server +%%----------------------------------------------------------------- +init([]) -> + process_flag(trap_exit, true), + {ok, {state, bval}}. + +handle_call(a, _From, State) -> + X = application:get_all_env(a), + {reply, X, State}; + +handle_call(b, _From, State) -> + {reply, {ok, element(2, State)}, State}. + +handle_info(_, State) -> + {noreply, State}. + +terminate(_Reason, _State) -> + ok. + +code_change(1, Extra, State) -> + {ok, {state, bval}}; +code_change({down,1},Extra,State) -> + {ok, state}. diff --git a/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a_sup.erl b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a_sup.erl new file mode 100644 index 0000000000..b0597dc5c3 --- /dev/null +++ b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a_sup.erl @@ -0,0 +1,37 @@ +%% ``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/. +%% +%% 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$ +%% +-module(a_sup). + + +-behaviour(supervisor). + +%% External exports +-export([start/2]). + +%% Internal exports +-export([init/1]). + +start(_, _) -> + supervisor:start_link({local, a_sup}, a_sup, []). + +init([]) -> + SupFlags = {one_for_all, 4, 3600}, + Config = {a, + {a, start_link, []}, + permanent, brutal_kil, worker, [a]}, + {ok, {SupFlags, [Config]}}. -- cgit v1.2.3 From 9246167aeea52c7ce956dc5c21c5e4992fe822d5 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Wed, 30 Nov 2011 11:28:18 +0100 Subject: Keep unpack_release backwards compatible with old systools:make_tar systools:make_tar has recently been updated to store the .rel file in both releases and releases/ directories. Ths same commit removed copying of this file from releases to releases/ in release_handler:unpack_release. This commit adde this copy again to make sure the file is not lost if the tar file was created with an older systools. --- lib/sasl/src/release_handler.erl | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib') diff --git a/lib/sasl/src/release_handler.erl b/lib/sasl/src/release_handler.erl index ce34674e25..522c7b496b 100644 --- a/lib/sasl/src/release_handler.erl +++ b/lib/sasl/src/release_handler.erl @@ -842,6 +842,13 @@ do_unpack_release(Root, RelDir, ReleaseName, Releases) -> extract_tar(Root, Tar), NewReleases = [Release#release{status = unpacked} | Releases], write_releases(RelDir, NewReleases, false), + + %% Keeping this for backwards compatibility reasons with older + %% systools:make_tar, where there is no copy of the .rel file in + %% the releases/ dir. See OTP-9746. + Dir = filename:join([RelDir, Vsn]), + copy_file(RelFile, Dir, false), + {ok, NewReleases, Vsn}. %% Note that this function is not executed by a client -- cgit v1.2.3