From 3a058d7ddb670e7fb7f271a9b4efd3cabb1809ca Mon Sep 17 00:00:00 2001 From: Andrew Mayorov Date: Thu, 6 Jan 2022 18:39:08 +0300 Subject: [PATCH 1/2] Use `erlexec` directly in relx helper functions ...Instead of `$BINDIR/erl`. Latter might resolve to system-wide `erl` script, notably when release has been made with `{include_erts, false}` and `{system_libs, true}` (which is usual). In such a case even the smallest discrepancy in versions between an Erlang/OTP used to assemble a release (e.g. 24.1.7) and an OTP running it later (e.g. 24.2.0) will draw such release impossible to start. This happens because relx helper functions employ `start_clean` bootfile from a release, and this bootfile attempts to start core application (kernel / stdlib) versions as seen at the build time, which will not be present system-wide at the run time. --- priv/templates/extended_bin | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/priv/templates/extended_bin b/priv/templates/extended_bin index 3fbee28dd..43773ec1b 100644 --- a/priv/templates/extended_bin +++ b/priv/templates/extended_bin @@ -259,24 +259,24 @@ relx_get_nodename() { id="longname$(relx_gen_id)-${NAME}" if [ -z "$COOKIE" ]; then # shellcheck disable=SC2086 - "$BINDIR/erl" -boot "$REL_DIR"/start_clean \ - -mode interactive \ - -boot_var SYSTEM_LIB_DIR "$SYSTEM_LIB_DIR" \ - -eval '[_,H]=re:split(atom_to_list(node()),"@",[unicode,{return,list}]), io:format("~s~n",[H]), halt()' \ - -dist_listen false \ - ${START_EPMD} \ - -noshell "${NAME_TYPE}" "$id" + "$BINDIR/erlexec" -boot "$REL_DIR"/start_clean \ + -mode interactive \ + -boot_var SYSTEM_LIB_DIR "$SYSTEM_LIB_DIR" \ + -eval '[_,H]=re:split(atom_to_list(node()),"@",[unicode,{return,list}]), io:format("~s~n",[H]), halt()' \ + -dist_listen false \ + ${START_EPMD} \ + -noshell "${NAME_TYPE}" "$id" else # running with setcookie prevents a ~/.erlang.cookie from being created # shellcheck disable=SC2086 - "$BINDIR/erl" -boot "$REL_DIR"/start_clean \ - -mode interactive \ - -boot_var SYSTEM_LIB_DIR "$SYSTEM_LIB_DIR" \ - -eval '[_,H]=re:split(atom_to_list(node()),"@",[unicode,{return,list}]), io:format("~s~n",[H]), halt()' \ - -setcookie "${COOKIE}" \ - -dist_listen false \ - ${START_EPMD} \ - -noshell "${NAME_TYPE}" "$id" + "$BINDIR/erlexec" -boot "$REL_DIR"/start_clean \ + -mode interactive \ + -boot_var SYSTEM_LIB_DIR "$SYSTEM_LIB_DIR" \ + -eval '[_,H]=re:split(atom_to_list(node()),"@",[unicode,{return,list}]), io:format("~s~n",[H]), halt()' \ + -setcookie "${COOKIE}" \ + -dist_listen false \ + ${START_EPMD} \ + -noshell "${NAME_TYPE}" "$id" fi } From deac62a5eb8764546eaff08c086680756c84bacd Mon Sep 17 00:00:00 2001 From: Andrew Mayorov Date: Wed, 15 Jun 2022 17:07:37 +0300 Subject: [PATCH 2/2] Use `erlexec` also with remsh --- priv/templates/extended_bin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/priv/templates/extended_bin b/priv/templates/extended_bin index 43773ec1b..7e1c35fb4 100644 --- a/priv/templates/extended_bin +++ b/priv/templates/extended_bin @@ -305,7 +305,7 @@ relx_rem_sh() { # -dist_listen is new in OTP-23. It keeps the remote node from binding to a listen port # and implies the option -hidden # shellcheck disable=SC2086 - exec "$BINDIR/erl" ${remote_nodename} -remsh "$NAME" -boot "$REL_DIR"/start_clean -mode interactive \ + exec "$BINDIR/erlexec" ${remote_nodename} -remsh "$NAME" -boot "$REL_DIR"/start_clean -mode interactive \ -boot_var SYSTEM_LIB_DIR "$SYSTEM_LIB_DIR" \ -setcookie "$COOKIE" -hidden -kernel net_ticktime "$TICKTIME" \ -dist_listen false \