From 161435d29debb8487dd599d532c871fdb6bcd6ca Mon Sep 17 00:00:00 2001 From: Paulo Zulato Date: Thu, 30 Mar 2023 13:55:02 -0300 Subject: [PATCH 1/2] fix: keep eval command backward compatible with v4 Keeps "eval" command evaluating only Erlang expressions, even on Elixir node. Fixes: https://emqx.atlassian.net/browse/EMQX-8947 --- .ci/docker-compose-file/scripts/run-emqx.sh | 2 +- bin/emqx | 24 +-------------------- bin/node_dump | 4 ++-- changes/ce/fix-10297.en.md | 1 + 4 files changed, 5 insertions(+), 26 deletions(-) create mode 100644 changes/ce/fix-10297.en.md diff --git a/.ci/docker-compose-file/scripts/run-emqx.sh b/.ci/docker-compose-file/scripts/run-emqx.sh index e8cdfdf4f..8f124aa63 100755 --- a/.ci/docker-compose-file/scripts/run-emqx.sh +++ b/.ci/docker-compose-file/scripts/run-emqx.sh @@ -29,7 +29,7 @@ esac is_node_up() { local node="$1" docker exec -i "$node" \ - bash -c "emqx eval-erl \"['emqx@node1.emqx.io','emqx@node2.emqx.io'] = maps:get(running_nodes, ekka_cluster:info()).\"" > /dev/null 2>&1 + bash -c "emqx eval \"['emqx@node1.emqx.io','emqx@node2.emqx.io'] = maps:get(running_nodes, ekka_cluster:info()).\"" > /dev/null 2>&1 } is_node_listening() { diff --git a/bin/emqx b/bin/emqx index d8940ad45..442f3ce6e 100755 --- a/bin/emqx +++ b/bin/emqx @@ -159,9 +159,6 @@ usage() { echo "Print EMQX installation root dir" ;; eval) - echo "Evaluate an Erlang or Elixir expression in the EMQX node" - ;; - eval-erl) echo "Evaluate an Erlang expression in the EMQX node, even on Elixir node" ;; eval-ex) @@ -231,7 +228,7 @@ usage() { echo " Install Info: ertspath | root_dir" echo " Runtime Status: pid | ping" echo " Validate Config: check_config" - echo " Advanced: console_clean | escript | rpc | rpcterms | eval | eval-erl | eval-ex" + echo " Advanced: console_clean | escript | rpc | rpcterms | eval | eval-ex" echo '' echo "Execute '$REL_NAME COMMAND help' for more information" ;; @@ -1265,25 +1262,6 @@ case "${COMMAND}" in eval) assert_node_alive - shift - if [ "$IS_ELIXIR" = "yes" ] - then - "$REL_DIR/elixir" \ - --hidden \ - --name "rand-$(relx_gen_id)-$NAME" \ - --cookie "$COOKIE" \ - --boot "$REL_DIR/start_clean" \ - --boot-var RELEASE_LIB "$ERTS_LIB_DIR" \ - --vm-args "$REL_DIR/remote.vm.args" \ - --erl "-start_epmd false -epmd_module ekka_epmd" \ - --rpc-eval "$NAME" "$@" - else - relx_nodetool "eval" "$@" - fi - ;; - eval-erl) - assert_node_alive - shift relx_nodetool "eval" "$@" ;; diff --git a/bin/node_dump b/bin/node_dump index 09baf04fd..1c4df08b5 100755 --- a/bin/node_dump +++ b/bin/node_dump @@ -49,7 +49,7 @@ done # Collect system info: { collect "$RUNNER_BIN_DIR"/emqx_ctl broker - collect "$RUNNER_BIN_DIR"/emqx eval-erl "'emqx_node_dump:sys_info()'" + collect "$RUNNER_BIN_DIR"/emqx eval "'emqx_node_dump:sys_info()'" collect uname -a collect uptime @@ -64,7 +64,7 @@ done # Collect information about the configuration: { - collect "$RUNNER_BIN_DIR"/emqx eval-erl "'emqx_node_dump:app_env_dump()'" + collect "$RUNNER_BIN_DIR"/emqx eval "'emqx_node_dump:app_env_dump()'" } > "${CONF_DUMP}" # Collect license info: diff --git a/changes/ce/fix-10297.en.md b/changes/ce/fix-10297.en.md new file mode 100644 index 000000000..305473b22 --- /dev/null +++ b/changes/ce/fix-10297.en.md @@ -0,0 +1 @@ +Keeps `eval` command backward compatible with v4 by evaluating only Erlang expressions, even on Elixir node. For Elixir expressions, use `eval-ex` command. From 2dd10df417279a28bb8f3721e0a67bf15376cdb0 Mon Sep 17 00:00:00 2001 From: Paulo Zulato Date: Fri, 31 Mar 2023 09:24:38 -0300 Subject: [PATCH 2/2] fix: remove redundant text for eval command Co-authored-by: Zaiming (Stone) Shi --- bin/emqx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/emqx b/bin/emqx index 442f3ce6e..884895332 100755 --- a/bin/emqx +++ b/bin/emqx @@ -159,7 +159,7 @@ usage() { echo "Print EMQX installation root dir" ;; eval) - echo "Evaluate an Erlang expression in the EMQX node, even on Elixir node" + echo "Evaluate an Erlang expression in the EMQX node." ;; eval-ex) echo "Evaluate an Elixir expression in the EMQX node. Only applies to Elixir node"