aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-05-16 14:56:03 +0200
committerBjörn Gustavsson <[email protected]>2016-05-16 15:07:15 +0200
commitcc59f962511733c5dfcb1be27a274f9298736006 (patch)
treee466cf70e5673971c08d42851bab597dccef9a7a /erts/preloaded/src
parentf4c71989ae8dc3c290e9236f38543bee0a6a8e77 (diff)
downloadotp-cc59f962511733c5dfcb1be27a274f9298736006.tar.gz
otp-cc59f962511733c5dfcb1be27a274f9298736006.tar.bz2
otp-cc59f962511733c5dfcb1be27a274f9298736006.zip
Tolerate bad directories in the code path
A bad directory in the path would prevent the run-time system from starting: $ echo >foobar $ erl -pa foobar {"init terminating in do_boot",{load_failed,[supervisor,kernel,gen_server,file_io_server,filename,file,erl_parse,error_logger,code_server,erl_lint,proc_lib,code,application_controller,application_master,gen_event,application,error_handler,lists,heart,gen,file_server,ets,erl_eval]}} Crash dump is being written to: erl_crash.dump...done init terminating in do_boot () The reason is that when attempting to read each of the BEAM files, there would be an 'enotdir' error which erl_prim_load:get_modules/2,3 assumed was a fatal error. Update erl_prim_load:get_modules/2,3 to ignore any error and try the next directory in the path. Reported-by: http://bugs.erlang.org/browse/ERL-142 Reported-by: Michael Truog
Diffstat (limited to 'erts/preloaded/src')
-rw-r--r--erts/preloaded/src/erl_prim_loader.erl6
1 files changed, 2 insertions, 4 deletions
diff --git a/erts/preloaded/src/erl_prim_loader.erl b/erts/preloaded/src/erl_prim_loader.erl
index e18e187cb7..b3ec73a60e 100644
--- a/erts/preloaded/src/erl_prim_loader.erl
+++ b/erts/preloaded/src/erl_prim_loader.erl
@@ -558,11 +558,9 @@ efile_gm_get_1([P|Ps], File0, Mod, {Parent,Ref}=PR, Process) ->
Res = try prim_file:read_file(File) of
{ok,Bin} ->
gm_process(Mod, File, Bin, Process);
- {error,enoent} ->
- efile_gm_get_1(Ps, File0, Mod, PR, Process);
Error ->
- check_file_result(get_modules, File, Error),
- Error
+ _ = check_file_result(get_modules, File, Error),
+ efile_gm_get_1(Ps, File0, Mod, PR, Process)
catch
_:Reason ->
{error,{crash,Reason}}