diff options
author | Björn Gustavsson <[email protected]> | 2016-03-17 10:16:27 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-03-17 10:16:27 +0100 |
commit | 28f3bae60a4edb9432c29469f6a3c031e0859104 (patch) | |
tree | 852089f6c59811361af4cdabb652ac0892ec2967 | |
parent | ae61174845dde2ddda537d57ace5b1124b7f4191 (diff) | |
parent | 577125cc69feb5c14fa7e13edd3c3157f9c4a0ec (diff) | |
download | otp-28f3bae60a4edb9432c29469f6a3c031e0859104.tar.gz otp-28f3bae60a4edb9432c29469f6a3c031e0859104.tar.bz2 otp-28f3bae60a4edb9432c29469f6a3c031e0859104.zip |
Merge branch 'bjorn/kernel/code_server-normalized-paths/OTP-13410'
* bjorn/kernel/code_server-normalized-paths/OTP-13410:
code_server: Normalize the pathnames for all loaded modules
Update preloaded modules
init: Correct spec for fetch_loaded/1
-rw-r--r-- | erts/preloaded/ebin/init.beam | bin | 44588 -> 44608 bytes | |||
-rw-r--r-- | erts/preloaded/src/init.erl | 2 | ||||
-rw-r--r-- | lib/kernel/src/code_server.erl | 4 | ||||
-rw-r--r-- | lib/kernel/test/code_SUITE.erl | 21 |
4 files changed, 23 insertions, 4 deletions
diff --git a/erts/preloaded/ebin/init.beam b/erts/preloaded/ebin/init.beam Binary files differindex 8ac7f5b471..9d2dd38f3a 100644 --- a/erts/preloaded/ebin/init.beam +++ b/erts/preloaded/ebin/init.beam diff --git a/erts/preloaded/src/init.erl b/erts/preloaded/src/init.erl index ed65c57c0d..5de3732c20 100644 --- a/erts/preloaded/src/init.erl +++ b/erts/preloaded/src/init.erl @@ -129,7 +129,7 @@ bs2ss(L) -> get_status() -> request(get_status). --spec fetch_loaded() -> [atom()]. +-spec fetch_loaded() -> [{module(),file:filename()}]. fetch_loaded() -> request(fetch_loaded). diff --git a/lib/kernel/src/code_server.erl b/lib/kernel/src/code_server.erl index 6262407354..fb08b4c22b 100644 --- a/lib/kernel/src/code_server.erl +++ b/lib/kernel/src/code_server.erl @@ -67,7 +67,9 @@ init(Ref, Parent, [Root,Mode]) -> %% Pre-loaded modules are always sticky. ets:insert(Db, [{M,preloaded},{{sticky,M},true}]) end, erlang:pre_loaded()), - ets:insert(Db, init:fetch_loaded()), + Loaded0 = init:fetch_loaded(), + Loaded = [{M,filename:join([P])} || {M,P} <- Loaded0], %Normalize. + ets:insert(Db, Loaded), IPath = case Mode of diff --git a/lib/kernel/test/code_SUITE.erl b/lib/kernel/test/code_SUITE.erl index 298c1f7d6b..abea23e854 100644 --- a/lib/kernel/test/code_SUITE.erl +++ b/lib/kernel/test/code_SUITE.erl @@ -34,7 +34,8 @@ purge_stacktrace/1, mult_lib_roots/1, bad_erl_libs/1, code_archive/1, code_archive2/1, on_load/1, on_load_binary/1, on_load_embedded/1, on_load_errors/1, big_boot_embedded/1, - native_early_modules/1, get_mode/1]). + native_early_modules/1, get_mode/1, + normalized_paths/1]). -export([init_per_testcase/2, end_per_testcase/2, init_per_suite/1, end_per_suite/1]). @@ -61,7 +62,7 @@ all() -> purge_stacktrace, mult_lib_roots, bad_erl_libs, code_archive, code_archive2, on_load, on_load_binary, on_load_embedded, on_load_errors, - big_boot_embedded, native_early_modules, get_mode]. + big_boot_embedded, native_early_modules, get_mode, normalized_paths]. groups() -> []. @@ -1451,6 +1452,22 @@ native_early_modules_1(Architecture) -> get_mode(Config) when is_list(Config) -> interactive = code:get_mode(). +%% Make sure that the paths for all loaded modules have been normalized. +normalized_paths(_Config) -> + do_normalized_paths(erlang:loaded()). + +do_normalized_paths([M|Ms]) -> + case code:which(M) of + Special when is_atom(Special) -> + do_normalized_paths(Ms); + File when is_list(File) -> + File = filename:join([File]), + do_normalized_paths(Ms) + end; +do_normalized_paths([]) -> + ok. + + %%----------------------------------------------------------------- %% error_logger handler. %% (Copied from stdlib/test/proc_lib_SUITE.erl.) |