aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--erts/Makefile.in3
-rw-r--r--erts/etc/unix/Install.src2
-rw-r--r--erts/etc/win32/Install.c2
-rw-r--r--erts/start_scripts/Makefile33
-rw-r--r--erts/start_scripts/no_dot_erlang.rel.src21
-rw-r--r--lib/mnesia/src/mnesia.appup.src14
-rw-r--r--lib/mnesia/src/mnesia_locker.erl32
-rw-r--r--lib/mnesia/src/mnesia_monitor.erl6
-rw-r--r--lib/mnesia/src/mnesia_tm.erl6
-rw-r--r--lib/sasl/doc/src/systools.xml4
-rw-r--r--lib/sasl/src/systools_make.erl18
-rw-r--r--lib/sasl/test/release_handler_SUITE.erl33
-rw-r--r--lib/sasl/test/systools_SUITE.erl32
-rw-r--r--system/doc/system_principles/system_principles.xml8
14 files changed, 165 insertions, 49 deletions
diff --git a/erts/Makefile.in b/erts/Makefile.in
index 92fdc7a862..e3db37d3fd 100644
--- a/erts/Makefile.in
+++ b/erts/Makefile.in
@@ -107,7 +107,8 @@ local_setup:
fi
@cd start_scripts && $(MAKE) $(ERL_TOP)/bin/start.script \
$(ERL_TOP)/bin/start_sasl.script \
- $(ERL_TOP)/bin/start_clean.script
+ $(ERL_TOP)/bin/start_clean.script \
+ $(ERL_TOP)/bin/no_dot_erlang.script
# Run the configure script
.PHONY: configure
diff --git a/erts/etc/unix/Install.src b/erts/etc/unix/Install.src
index 0f33258a28..8eb1db75bd 100644
--- a/erts/etc/unix/Install.src
+++ b/erts/etc/unix/Install.src
@@ -137,9 +137,9 @@ case $start_option in
esac
cp -p ../releases/%I_SYSTEM_VSN%/start_*.boot .
+cp -p ../releases/%I_SYSTEM_VSN%/no_dot_erlang.boot .
cp -p $Name.boot start.boot
cp -p ../releases/%I_SYSTEM_VSN%/$Name.script start.script
-
#
# Fixing the man pages
#
diff --git a/erts/etc/win32/Install.c b/erts/etc/win32/Install.c
index 59a5004662..500fd166f8 100644
--- a/erts/etc/win32/Install.c
+++ b/erts/etc/win32/Install.c
@@ -49,7 +49,7 @@ int wmain(int argc, wchar_t **argv)
wchar_t *binaries[] = { L"erl.exe", L"werl.exe", L"erlc.exe",
L"dialyzer.exe", L"typer.exe",
L"escript.exe", L"ct_run.exe", NULL };
- wchar_t *scripts[] = { L"start_clean.boot", L"start_sasl.boot", NULL };
+ wchar_t *scripts[] = { L"start_clean.boot", L"start_sasl.boot", L"no_dot_erlang.boot", NULL };
wchar_t fromname[MAX_PATH];
wchar_t toname[MAX_PATH];
size_t converted;
diff --git a/erts/start_scripts/Makefile b/erts/start_scripts/Makefile
index 3bf233cbb6..32e65a227f 100644
--- a/erts/start_scripts/Makefile
+++ b/erts/start_scripts/Makefile
@@ -1,7 +1,7 @@
#
# %CopyrightBegin%
#
-# Copyright Ericsson AB 1997-2012. All Rights Reserved.
+# Copyright Ericsson AB 1997-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
@@ -34,12 +34,16 @@ INSTALL_SCRIPTS = \
$(SS_ROOT)/start_clean.script \
$(SS_ROOT)/start_clean.boot \
$(SS_ROOT)/start_sasl.boot \
- $(SS_ROOT)/start_sasl.script
+ $(SS_ROOT)/start_sasl.script \
+ $(SS_ROOT)/no_dot_erlang.boot \
+ $(SS_ROOT)/no_dot_erlang.script
+
REL_SCRIPTS = \
$(SS_ROOT)/start_clean.rel \
$(SS_ROOT)/start_sasl.rel \
- $(SS_ROOT)/start_all_example.rel
+ $(SS_ROOT)/start_all_example.rel \
+ $(SS_ROOT)/no_dot_erlang.rel \
ifneq ($(findstring win32,$(TARGET)),win32)
RELEASES_SRC = RELEASES.src
@@ -82,6 +86,13 @@ $(SS_ROOT)/start_sasl.boot: $(SS_ROOT)/start_sasl.rel
$(V_at)( cd $(SS_TMP) && \
$(ERLC) $(SASL_FLAGS) $(SCRIPT_PATH) -o $(SS_ROOT) $< )
+$(SS_ROOT)/no_dot_erlang.script \
+$(SS_ROOT)/no_dot_erlang.boot: $(SS_ROOT)/no_dot_erlang.rel
+ $(gen_verbose)$(INSTALL_DIR) $(SS_TMP)
+ $(V_at)( cd $(SS_TMP) && \
+ $(ERLC) $(SASL_FLAGS) $(SCRIPT_PATH) +no_warn_sasl +no_dot_erlang -o $(SS_ROOT) $< )
+
+
$(SS_ROOT)/start_clean.rel: $(SS_ROOT)/start_clean.rel.src \
../vsn.mk \
$(LIBPATH)/kernel/vsn.mk \
@@ -104,6 +115,16 @@ $(SS_ROOT)/start_sasl.rel: $(SS_ROOT)/start_sasl.rel.src \
-e 's;%SASL_VSN%;$(SASL_VSN);' \
$(SS_ROOT)/start_sasl.rel.src > $(SS_ROOT)/start_sasl.rel
+$(SS_ROOT)/no_dot_erlang.rel: $(SS_ROOT)/no_dot_erlang.rel.src \
+ ../vsn.mk \
+ $(LIBPATH)/kernel/vsn.mk \
+ $(LIBPATH)/stdlib/vsn.mk
+ $(gen_verbose)sed -e 's;%SYS_VSN%;$(SYSTEM_VSN);' \
+ -e 's;%ERTS_VSN%;$(VSN);' \
+ -e 's;%KERNEL_VSN%;$(KERNEL_VSN);' \
+ -e 's;%STDLIB_VSN%;$(STDLIB_VSN);' \
+ $(SS_ROOT)/no_dot_erlang.rel.src > $(SS_ROOT)/no_dot_erlang.rel
+
$(SS_ROOT)/start_all_example.rel: $(SS_ROOT)/start_all_example.rel.src \
../vsn.mk \
$(LIBPATH)/kernel/vsn.mk \
@@ -140,7 +161,13 @@ $(ERL_TOP)/bin/start_clean.script:
$(V_at)( cd $(SS_TMP) && \
$(ERLC) $(SCRIPT_PATH) +no_warn_sasl +otp_build -o $@ $(SS_ROOT)/start_clean.rel )
+$(ERL_TOP)/bin/no_dot_erlang.script:
+ $(gen_verbose)$(INSTALL_DIR) $(SS_TMP)
+ $(V_at)( cd $(SS_TMP) && \
+ $(ERLC) $(SCRIPT_PATH) +no_warn_sasl +otp_build +no_dot_erlang -o $@ $(SS_ROOT)/no_dot_erlang.rel )
+
## Special target used from system/build/Makefile for source code release bootstrap.
+## Add no_dot_erlang after next release
bootstrap_scripts: $(SS_ROOT)/start_clean.rel
$(V_at)$(INSTALL_DIR) $(TESTROOT)/bin
$(V_at)$(INSTALL_DIR) $(SS_TMP)
diff --git a/erts/start_scripts/no_dot_erlang.rel.src b/erts/start_scripts/no_dot_erlang.rel.src
new file mode 100644
index 0000000000..03b64ebf1a
--- /dev/null
+++ b/erts/start_scripts/no_dot_erlang.rel.src
@@ -0,0 +1,21 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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 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%
+%%
+{release, {"OTP APN 181 01","%SYS_VSN%"}, {erts, "%ERTS_VSN%"},
+ [{kernel,"%KERNEL_VSN%"},
+ {stdlib,"%STDLIB_VSN%"}]}.
diff --git a/lib/mnesia/src/mnesia.appup.src b/lib/mnesia/src/mnesia.appup.src
index 355aafb215..c245299740 100644
--- a/lib/mnesia/src/mnesia.appup.src
+++ b/lib/mnesia/src/mnesia.appup.src
@@ -1,22 +1,16 @@
%% -*- erlang -*-
{"%VSN%",
[
- {"4.7.1", [{restart_application, mnesia}]},
- {"4.7", [{restart_application, mnesia}]},
- {"4.6", [{restart_application, mnesia}]},
- {"4.5.1", [{restart_application, mnesia}]},
- {"4.5", [{restart_application, mnesia}]},
+ {<<"4\\.1[0-9].*">>, [{restart_application, mnesia}]},
+ {<<"4\\.[5-9].*">>, [{restart_application, mnesia}]},
{"4.4.19", [{restart_application, mnesia}]},
{"4.4.18", [{restart_application, mnesia}]},
{"4.4.17", [{restart_application, mnesia}]},
{"4.4.16", [{restart_application, mnesia}]}
],
[
- {"4.7.1", [{restart_application, mnesia}]},
- {"4.7", [{restart_application, mnesia}]},
- {"4.6", [{restart_application, mnesia}]},
- {"4.5.1", [{restart_application, mnesia}]},
- {"4.5", [{restart_application, mnesia}]},
+ {<<"4\\.1[0-9].*">>, [{restart_application, mnesia}]},
+ {<<"4\\.[5-9].*">>, [{restart_application, mnesia}]},
{"4.4.19", [{restart_application, mnesia}]},
{"4.4.18", [{restart_application, mnesia}]},
{"4.4.17", [{restart_application, mnesia}]},
diff --git a/lib/mnesia/src/mnesia_locker.erl b/lib/mnesia/src/mnesia_locker.erl
index 14011003d3..c4fe370ec1 100644
--- a/lib/mnesia/src/mnesia_locker.erl
+++ b/lib/mnesia/src/mnesia_locker.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2012. All Rights Reserved.
+%% Copyright Ericsson AB 1996-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
@@ -26,8 +26,8 @@
global_lock/5,
ixrlock/5,
init/1,
- mnesia_down/2,
release_tid/1,
+ mnesia_down/2,
async_release_tid/2,
send_release_tid/2,
receive_release_tid_acc/2,
@@ -137,6 +137,17 @@ receive_release_tid_acc([Node | Nodes], Tid) ->
receive_release_tid_acc([], _Tid) ->
ok.
+mnesia_down(Node, Pending) ->
+ case whereis(?MODULE) of
+ undefined -> {error, node_not_running};
+ Pid ->
+ Ref = make_ref(),
+ Pid ! {{self(), Ref}, {release_remote_non_pending, Node, Pending}},
+ receive %% No need to wait for anything else if process dies we die soon
+ {Ref,ok} -> ok
+ end
+ end.
+
loop(State) ->
receive
{From, {write, Tid, Oid}} ->
@@ -213,9 +224,9 @@ loop(State) ->
reply(From, {tid_released, Tid}),
loop(State);
- {release_remote_non_pending, Node, Pending} ->
+ {{From, Ref},{release_remote_non_pending, Node, Pending}} ->
release_remote_non_pending(Node, Pending),
- mnesia_monitor:mnesia_down(?MODULE, Node),
+ From ! {Ref, ok},
loop(State);
{'EXIT', Pid, _} when Pid == State#state.supervisor ->
@@ -653,19 +664,6 @@ ix_read_res(Tab,IxKey,Pos) ->
%% ********************* end server code ********************
%% The following code executes at the client side of a transactions
-mnesia_down(N, Pending) ->
- case whereis(?MODULE) of
- undefined ->
- %% Takes care of mnesia_down's in early startup
- mnesia_monitor:mnesia_down(?MODULE, N);
- Pid ->
- %% Syncronously call needed in order to avoid
- %% race with mnesia_tm's coordinator processes
- %% that may restart and acquire new locks.
- %% mnesia_monitor ensures the sync.
- Pid ! {release_remote_non_pending, N, Pending}
- end.
-
%% Aquire a write lock, but do a read, used by
%% mnesia:wread/1
diff --git a/lib/mnesia/src/mnesia_monitor.erl b/lib/mnesia/src/mnesia_monitor.erl
index 7f6b56aef0..c7b905a1bf 100644
--- a/lib/mnesia/src/mnesia_monitor.erl
+++ b/lib/mnesia/src/mnesia_monitor.erl
@@ -482,11 +482,7 @@ handle_cast({mnesia_down, mnesia_controller, Node}, State) ->
mnesia_tm:mnesia_down(Node),
{noreply, State};
-handle_cast({mnesia_down, mnesia_tm, {Node, Pending}}, State) ->
- mnesia_locker:mnesia_down(Node, Pending),
- {noreply, State};
-
-handle_cast({mnesia_down, mnesia_locker, Node}, State) ->
+handle_cast({mnesia_down, mnesia_tm, Node}, State) ->
Down = {mnesia_down, Node},
mnesia_lib:report_system_event(Down),
GoingDown = lists:delete(Node, State#state.going_down),
diff --git a/lib/mnesia/src/mnesia_tm.erl b/lib/mnesia/src/mnesia_tm.erl
index e54e5c4e88..17af0cad44 100644
--- a/lib/mnesia/src/mnesia_tm.erl
+++ b/lib/mnesia/src/mnesia_tm.erl
@@ -181,7 +181,7 @@ mnesia_down(Node) ->
%% mnesia_monitor takes care of the sync
case whereis(?MODULE) of
undefined ->
- mnesia_monitor:mnesia_down(?MODULE, {Node, []});
+ mnesia_monitor:mnesia_down(?MODULE, Node);
Pid ->
Pid ! {mnesia_down, Node}
end.
@@ -403,7 +403,9 @@ doit_loop(#state{coordinators=Coordinators,participants=Participants,supervisor=
Tids = gb_trees:keys(Participants),
reconfigure_participants(N, gb_trees:values(Participants)),
NewState = clear_fixtable(N, State),
- mnesia_monitor:mnesia_down(?MODULE, {N, Tids}),
+
+ mnesia_locker:mnesia_down(N, Tids),
+ mnesia_monitor:mnesia_down(?MODULE, N),
doit_loop(NewState);
{From, {unblock_me, Tab}} ->
diff --git a/lib/sasl/doc/src/systools.xml b/lib/sasl/doc/src/systools.xml
index 6d88b228fd..e8076c6752 100644
--- a/lib/sasl/doc/src/systools.xml
+++ b/lib/sasl/doc/src/systools.xml
@@ -139,7 +139,7 @@
<type>
<v>Name = string()</v>
<v>Opt = src_tests | {path,[Dir]} | local | {variables,[Var]} | exref |
- {exref,[App]}] | silent | {outdir,Dir} | no_warn_sasl |
+ {exref,[App]}] | silent | {outdir,Dir} | no_dot_erlang | no_warn_sasl |
warnings_as_errors</v>
<v>&nbsp;Dir = string()</v>
<v>&nbsp;Var = {VarName,Prefix}</v>
@@ -252,6 +252,8 @@
<c>Module:format_error(Error)</c>.</p>
<p>If the option <c>warnings_as_errors</c> is provided, warnings
are treated as errors.</p>
+ <p>If the option <c>no_dot_erlang</c> is provided, the instruction to
+ load the <c>.erlang</c> file during boot is <em>NOT</em> included.</p>
</desc>
</func>
<func>
diff --git a/lib/sasl/src/systools_make.erl b/lib/sasl/src/systools_make.erl
index b86130612d..3d370a93a5 100644
--- a/lib/sasl/src/systools_make.erl
+++ b/lib/sasl/src/systools_make.erl
@@ -1136,10 +1136,10 @@ generate_script(Output, Release, Appls, Flags) ->
load_appl_mods(Appls, Mandatory ++ Preloaded,
PathFlag, Variables) ++
[{path, create_path(Appls, PathFlag, Variables)}] ++
- create_kernel_procs(Appls) ++
- create_load_appls(Appls) ++
- create_start_appls(Appls) ++
- script_end()
+ create_kernel_procs(Appls) ++
+ create_load_appls(Appls) ++
+ create_start_appls(Appls) ++
+ script_end(lists:member(no_dot_erlang, Flags))
},
ScriptFile = Output ++ ".script",
@@ -1233,9 +1233,12 @@ create_load_appls([]) ->
%%______________________________________________________________________
%% The final part of the script.
-script_end() ->
+script_end(false) -> %% Do not skip loading of $HOME/.erlang
[{apply, {c, erlangrc, []}},
- {progress, started}].
+ {progress, started}];
+script_end(true) -> %% Ignore loading of $HOME/.erlang
+ [{progress, started}].
+
%%-----------------------------------------------------------------
%% Function: sort_appls(Appls) -> {ok, Appls'} | throw({error, Error})
@@ -2070,6 +2073,9 @@ cas([no_warn_sasl | Args], X) ->
%%% no_module_tests (kept for backwards compatibility, but ignored) ----
cas([no_module_tests | Args], X) ->
cas(Args, X);
+cas([no_dot_erlang | Args], X) ->
+ cas(Args, X);
+
%%% ERROR --------------------------------------------------------------
cas([Y | Args], X) ->
cas(Args, X++[Y]).
diff --git a/lib/sasl/test/release_handler_SUITE.erl b/lib/sasl/test/release_handler_SUITE.erl
index cb82fdd060..5293381af0 100644
--- a/lib/sasl/test/release_handler_SUITE.erl
+++ b/lib/sasl/test/release_handler_SUITE.erl
@@ -65,7 +65,7 @@ cases() ->
supervisor_which_children_timeout,
release_handler_which_releases, install_release_syntax_check,
upgrade_supervisor, upgrade_supervisor_fail, otp_9864,
- otp_10463_upgrade_script_regexp].
+ otp_10463_upgrade_script_regexp, no_dot_erlang].
groups() ->
[{release,[],
@@ -1780,6 +1780,37 @@ otp_10463_upgrade_script_regexp(_Config) ->
release_handler:upgrade_script(kernel,code:lib_dir(kernel)),
ok.
+no_dot_erlang(Conf) ->
+ PrivDir = priv_dir(Conf),
+ {ok, OrigWd} = file:get_cwd(),
+ try
+ ok = file:set_cwd(PrivDir),
+
+ Erl = filename:join([code:root_dir(),"bin","erl"]),
+ Args = " -noinput -run io put_chars \"TESTOK\" -run erlang halt",
+ ok = file:write_file(".erlang", <<"io:put_chars(\"DOT_ERLANG_READ\\n\").\n">>),
+
+ case os:cmd(Erl ++ Args) of
+ "DOT_ERLANG_READ" ++ _ -> ok;
+ Other1 ->
+ io:format("Failed: ~s~n",[Erl ++ Args]),
+ io:format("Expected: ~s ++ _~n",["DOT_ERLANG_READ "]),
+ io:format("Got: ~s~n",[Other1]),
+ exit(failed_to_start, test_error)
+ end,
+ NO_DOT_ERL = " -boot no_dot_erlang",
+ case os:cmd(Erl ++ NO_DOT_ERL ++ Args) of
+ "TESTOK" ++ _ -> ok;
+ Other2 ->
+ io:format("Failed: ~s~n",[Erl ++ Args]),
+ io:format("Expected: ~s~n",["TESTOK"]),
+ io:format("Got: ~s~n",[Other2]),
+ exit(failed_to_start, no_dot_erlang)
+ end
+ after
+ _ = file:delete(".erlang"),
+ ok = file:set_cwd(OrigWd)
+ end.
%%%=================================================================
%%% Misceleaneous functions
diff --git a/lib/sasl/test/systools_SUITE.erl b/lib/sasl/test/systools_SUITE.erl
index f2569bb616..e3f6933476 100644
--- a/lib/sasl/test/systools_SUITE.erl
+++ b/lib/sasl/test/systools_SUITE.erl
@@ -43,6 +43,7 @@
-export([script_options/1, normal_script/1, unicode_script/1,
unicode_script/2, no_mod_vsn_script/1,
wildcard_script/1, variable_script/1, no_sasl_script/1,
+ no_dot_erlang_script/1,
abnormal_script/1, src_tests_script/1, crazy_script/1,
included_script/1, included_override_script/1,
included_fail_script/1, included_bug_script/1, exref_script/1,
@@ -79,7 +80,8 @@ groups() ->
[{script, [],
[script_options, normal_script, unicode_script, no_mod_vsn_script,
wildcard_script, variable_script, abnormal_script,
- no_sasl_script, src_tests_script, crazy_script,
+ no_sasl_script, no_dot_erlang_script,
+ src_tests_script, crazy_script,
included_script, included_override_script,
included_fail_script, included_bug_script, exref_script,
otp_3065_circular_dependenies, included_and_used_sort_script]},
@@ -457,6 +459,34 @@ no_sasl_script(Config) when is_list(Config) ->
ok = file:set_cwd(OldDir),
ok.
+%% make_script: Create script with no_dot_erlang. Check script contents.
+no_dot_erlang_script(Config) when is_list(Config) ->
+ {ok, OldDir} = file:get_cwd(),
+
+ {LatestDir, LatestName} = create_script(latest1_no_sasl,Config),
+
+ DataDir = filename:absname(?copydir),
+ LibDir = [fname([DataDir, d_normal, lib])],
+ P = [fname([LibDir, '*', ebin]),
+ fname([DataDir, lib, kernel, ebin]),
+ fname([DataDir, lib, stdlib, ebin]),
+ fname([DataDir, lib, sasl, ebin])],
+
+ ok = file:set_cwd(LatestDir),
+
+ {ok, _ , []} =
+ systools:make_script(LatestName,[{path, P},silent, no_warn_sasl]),
+ {ok, [{_, _, LoadDotErlang}]} = read_script_file(LatestName),
+ [erlangrc] = [E || {apply, {c, E, []}} <- LoadDotErlang],
+
+ {ok, _ , []} =
+ systools:make_script(LatestName,[{path, P},silent, no_warn_sasl, no_dot_erlang]),
+ {ok, [{_, _, DoNotLoadDotErlang}]} = read_script_file(LatestName),
+ [] = [E || {apply, {c, E, []}} <- DoNotLoadDotErlang],
+
+ ok = file:set_cwd(OldDir),
+ ok.
+
%% make_script: Do not check date of object file or that source code
%% can be found.
diff --git a/system/doc/system_principles/system_principles.xml b/system/doc/system_principles/system_principles.xml
index dc826916f8..4f2202fdd1 100644
--- a/system/doc/system_principles/system_principles.xml
+++ b/system/doc/system_principles/system_principles.xml
@@ -105,6 +105,14 @@ init:stop()</pre>
<p>Loads the code for and starts the applications Kernel,
STDLIB and SASL.</p>
</item>
+ <tag><c>no_dot_erlang.boot</c></tag>
+ <item>
+ <p>Loads the code for and starts the applications Kernel and
+ STDLIB, skips loading the <c>.erlang</c> file.
+ Useful for scripts and other tools that should be behave the
+ same irregardless of user preferences.
+ </p>
+ </item>
</taglist>
<p>Which of <c>start_clean</c> and <c>start_sasl</c> to use as
default is decided by the user when installing Erlang/OTP using