diff options
author | Gustav Simonsson <[email protected]> | 2012-02-14 14:56:51 +0100 |
---|---|---|
committer | Gustav Simonsson <[email protected]> | 2012-02-14 14:56:51 +0100 |
commit | 13ac3c70d2c4c1906db3f34291ca87c23c7f2490 (patch) | |
tree | 683165116ec6d187a9d326ff8535f766c5ecc961 /lib | |
parent | f44819b6caa42697cbf2b6b52f95f7b87baf683f (diff) | |
parent | 42550aa765f0336aaa103f059491d2f6a7df3a51 (diff) | |
download | otp-13ac3c70d2c4c1906db3f34291ca87c23c7f2490.tar.gz otp-13ac3c70d2c4c1906db3f34291ca87c23c7f2490.tar.bz2 otp-13ac3c70d2c4c1906db3f34291ca87c23c7f2490.zip |
Merge branch 'maint'
Diffstat (limited to 'lib')
-rw-r--r-- | lib/orber/src/orber_ifr.erl | 2 | ||||
-rw-r--r-- | lib/orber/test/orber_SUITE.erl | 36 | ||||
-rw-r--r-- | lib/sasl/src/release_handler.erl | 2 | ||||
-rw-r--r-- | lib/sasl/test/release_handler_SUITE.erl | 56 | ||||
-rw-r--r-- | lib/ssh/src/Makefile | 5 | ||||
-rw-r--r-- | lib/ssh/src/ssh.app.src | 1 | ||||
-rw-r--r-- | lib/ssh/src/ssh_file.erl | 2 | ||||
-rw-r--r-- | lib/ssh/src/ssh_key_api.erl | 45 |
8 files changed, 142 insertions, 7 deletions
diff --git a/lib/orber/src/orber_ifr.erl b/lib/orber/src/orber_ifr.erl index c23374cd68..6799bc1db4 100644 --- a/lib/orber/src/orber_ifr.erl +++ b/lib/orber/src/orber_ifr.erl @@ -478,7 +478,7 @@ get_module(Id, Type) -> What -> orber:dbg("[~p] ~p:get_module(~p, ~p).~n" "Id doesn't exist, mismatch Id vs Type or DB error: ~p", - [?LINE, ?MODULE, Id, What], ?DEBUG_LEVEL), + [?LINE, ?MODULE, Id, Type, What], ?DEBUG_LEVEL), corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}) end. diff --git a/lib/orber/test/orber_SUITE.erl b/lib/orber/test/orber_SUITE.erl index be6ffa201c..72b0db1e0d 100644 --- a/lib/orber/test/orber_SUITE.erl +++ b/lib/orber/test/orber_SUITE.erl @@ -20,7 +20,6 @@ -module(orber_SUITE). -include_lib("test_server/include/test_server.hrl"). - -define(default_timeout, ?t:minutes(15)). -define(application, orber). @@ -31,7 +30,11 @@ % Test cases must be exported. -export([app_test/1, undefined_functions/1, install_load_order/1, - install_local_content/1]). + install_local_content/1, + otp_9887/1]). + +%% Exporting error handler callbacks for use in otp_9887 +-export([init/1, handle_event/2]). %% %% all/1 @@ -40,7 +43,8 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [app_test, undefined_functions, install_load_order, - install_local_content]. + install_local_content, + otp_9887]. groups() -> []. @@ -76,6 +80,27 @@ app_test(_Config) -> ?line ok=?t:app_test(orber), ok. +otp_9887(_Config) -> + orber:jump_stop(), + application:set_env(orber, orber_debug_level, 10), + orber:jump_start([]), + + mnesia:create_table(orber_light_ifr, []), + + error_logger:add_report_handler(?MODULE,[self()]), + catch orber_ifr:get_module(foo, bar), + + receive + {stolen,Reason} -> + {error,_Pid1, {_Pid2, _ErrorString, ArgumentList}} = Reason, + 5 = length(ArgumentList) + after 500 -> + test_server:fail("OTP_9887 TIMED OUT") + end, + + orber:jump_stop(), + ok. + %% Install Orber using the load_order option. install_load_order(suite) -> []; @@ -192,5 +217,10 @@ key1search(Key, L) -> fail(Reason) -> exit({suite_failed, Reason}). +%% Error handler +init([Proc]) -> {ok,Proc}. +handle_event(Event, Proc) -> + Proc ! {stolen,Event}, + {ok,Proc}. diff --git a/lib/sasl/src/release_handler.erl b/lib/sasl/src/release_handler.erl index 522c7b496b..8d2b9c35d3 100644 --- a/lib/sasl/src/release_handler.erl +++ b/lib/sasl/src/release_handler.erl @@ -1572,7 +1572,7 @@ memlib(_Lib, []) -> false. %% recursively remove file or directory remove_file(File) -> - case file:read_file_info(File) of + case file:read_link_info(File) of {ok, Info} when Info#file_info.type==directory -> case file:list_dir(File) of {ok, Files} -> diff --git a/lib/sasl/test/release_handler_SUITE.erl b/lib/sasl/test/release_handler_SUITE.erl index ac616dab72..467d1226b3 100644 --- a/lib/sasl/test/release_handler_SUITE.erl +++ b/lib/sasl/test/release_handler_SUITE.erl @@ -59,7 +59,7 @@ win32_cases() -> cases() -> [otp_2740, otp_2760, otp_5761, otp_9402, otp_9417, otp_9395_check_old_code, otp_9395_check_and_purge, - otp_9395_update_many_mods, otp_9395_rm_many_mods, + otp_9395_update_many_mods, otp_9395_rm_many_mods, otp_9864, instructions, eval_appup, eval_appup_with_restart, supervisor_which_children_timeout, release_handler_which_releases, install_release_syntax_check, @@ -1205,6 +1205,60 @@ otp_9395_rm_many_mods(Conf) when is_list(Conf) -> otp_9395_rm_many_mods(cleanup,_Conf) -> stop_node(node_name(otp_9395_rm_many_mods)). +otp_9864(Conf) -> + %% Set some paths + PrivDir = priv_dir(Conf), + Dir = filename:join(PrivDir,"otp_9864"), + RelDir = filename:join(?config(data_dir, Conf), "app1_app2"), + LibDir1 = filename:join(RelDir, "lib1"), + LibDir2 = filename:join(RelDir, "lib2"), + + %% Create the releases + Rel1 = create_and_install_fake_first_release(Dir, + [{app1,"1.0",LibDir1}, + {app2,"1.0",LibDir1}]), + Rel2 = create_fake_upgrade_release(Dir, + "2", + [{app1,"2.0",LibDir2}, + {app2,"1.0",LibDir2}], + {[Rel1],[Rel1],[LibDir1]}), + Rel1Dir = filename:dirname(Rel1), + Rel2Dir = filename:dirname(Rel2), + + %% Start a slave node + {ok, Node} = t_start_node(otp_9864, Rel1, filename:join(Rel1Dir,"sys.config")), + + %% Unpack rel2 (make sure it does not work if an AppDir is bad) + LibDir3 = filename:join(RelDir, "lib3"), + {error, {no_such_directory, _}} = + rpc:call(Node, release_handler, set_unpacked, + [Rel2++".rel", [{app1,"2.0",LibDir2}, {app2,"1.0",LibDir3}]]), + {ok, RelVsn2} = + rpc:call(Node, release_handler, set_unpacked, + [Rel2++".rel", [{app1,"2.0",LibDir2}, {app2,"1.0",LibDir2}]]), + 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")]), + + %% Install RelVsn2 without {update_paths, true} option + {ok, RelVsn1, []} = + rpc:call(Node, release_handler, install_release, [RelVsn2]), + + %% Install RelVsn1 again + {ok, RelVsn1, []} = + rpc:call(Node, release_handler, install_release, [RelVsn1]), + + TempRel2Dir = filename:join(Dir,"releases/2"), + file:make_symlink(TempRel2Dir, filename:join(TempRel2Dir, "foo_symlink_dir")), + + %% This will fail if symlinks are not handled + ok = rpc:call(Node, release_handler, remove_release, [RelVsn2]), + + ok. + upgrade_supervisor(Conf) when is_list(Conf) -> %% Set some paths diff --git a/lib/ssh/src/Makefile b/lib/ssh/src/Makefile index cd9618c139..7be97abf66 100644 --- a/lib/ssh/src/Makefile +++ b/lib/ssh/src/Makefile @@ -36,7 +36,11 @@ RELSYSDIR = $(RELEASE_PATH)/lib/ssh-$(VSN) # Common Macros # ---------------------------------------------------- +# Behaviour (api) modules are first so they are compiled when +# the compiler reaches a callback module using them. MODULES= \ + ssh_sftpd_file_api \ + ssh_key_api \ ssh \ ssh_sup \ sshc_sup \ @@ -63,7 +67,6 @@ MODULES= \ ssh_sftp \ ssh_sftpd \ ssh_sftpd_file\ - ssh_sftpd_file_api \ ssh_transport \ ssh_userreg \ ssh_xfer diff --git a/lib/ssh/src/ssh.app.src b/lib/ssh/src/ssh.app.src index 154c72485e..7a58dbe54f 100644 --- a/lib/ssh/src/ssh.app.src +++ b/lib/ssh/src/ssh.app.src @@ -21,6 +21,7 @@ sshd_sup, ssh_file, ssh_io, + ssh_key_api, ssh_math, ssh_no_io, ssh_sftp, diff --git a/lib/ssh/src/ssh_file.erl b/lib/ssh/src/ssh_file.erl index 97ebf77e82..8569051bee 100644 --- a/lib/ssh/src/ssh_file.erl +++ b/lib/ssh/src/ssh_file.erl @@ -23,6 +23,8 @@ -module(ssh_file). +-behaviour(ssh_key_api). + -include_lib("public_key/include/public_key.hrl"). -include_lib("kernel/include/file.hrl"). diff --git a/lib/ssh/src/ssh_key_api.erl b/lib/ssh/src/ssh_key_api.erl new file mode 100644 index 0000000000..8085c12e21 --- /dev/null +++ b/lib/ssh/src/ssh_key_api.erl @@ -0,0 +1,45 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2011-2012. 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 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. +%% +%% %CopyrightEnd% +%% + +-module(ssh_key_api). + +-include_lib("public_key/include/public_key.hrl"). +-include("ssh.hrl"). + +-type ssh_algorithm() :: string(). +-type file_error() :: file:posix() | badarg | system_limit | terminated. + +-callback host_key(Algorithm :: ssh_algorithm(), Options :: list()) -> + {ok, [{public_key(), Attributes::list()}]} | public_key() + | {error, string()}. + +-callback user_key(Algorithm :: ssh_algorithm(), Options :: list()) -> + {ok, [{public_key(), Attributes::list()}]} | public_key() + | {error, string()}. + +-callback is_host_key(Key :: public_key(), PeerName :: string(), + Algorithm :: ssh_algorithm(), Options :: list()) -> + boolean(). + +-callback add_host_key(Host :: string(), Key :: public_key(), Options :: list()) -> + ok | {error, file_error()}. + +-callback is_auth_key(Key :: public_key(), User :: string(), + Algorithm :: ssh_algorithm(), Options :: list()) -> + boolean(). |