From b469a43e931b23ee4ad794c7925101c31dca0902 Mon Sep 17 00:00:00 2001 From: Stefan Grundmann Date: Sat, 31 Jan 2026 15:10:09 +0000 Subject: [PATCH 1/2] regression test for erlang/rebar3#2853 --- test/rlx_release_SUITE.erl | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/test/rlx_release_SUITE.erl b/test/rlx_release_SUITE.erl index a0f94c5b4..9a528cc99 100644 --- a/test/rlx_release_SUITE.erl +++ b/test/rlx_release_SUITE.erl @@ -1281,9 +1281,9 @@ make_prod_mode_release(Config) -> VmArgs = filename:join([LibDir1, "config", "vm.args"]), rlx_file_utils:write(VmArgs, ""), - RelxConfig = [{mode, prod}, - %% osx test fails if debug_info is strip + RelxConfig = [%% osx test fails if debug_info is strip {debug_info, keep}, + {mode, prod}, {sys_config, SysConfig}, {vm_args, VmArgs}, {release, {foo, "0.0.1"}, @@ -1295,6 +1295,10 @@ make_prod_mode_release(Config) -> {output_dir, OutputDir} | RelxConfig]), [{{foo, "0.0.1"}, _Release}] = maps:to_list(rlx_state:realized_releases(State)), + + ?assert(has_debug_info(filename:join([OutputDir, "foo", "lib", + "non_goal_1-0.0.1", "ebin", + "a_real_beamnon_goal_1.beam"]))), case os:type() of {unix, _} -> @@ -1329,9 +1333,9 @@ make_minimal_mode_release(Config) -> VmArgs = filename:join([LibDir1, "config", "vm.args"]), rlx_file_utils:write(VmArgs, ""), - RelxConfig = [{mode, minimal}, - %% osx test fails if debug_info is strip + RelxConfig = [%% osx test fails if debug_info is strip {debug_info, keep}, + {mode, minimal}, {sys_config, SysConfig}, {vm_args, VmArgs}, {release, {foo, "0.0.1"}, @@ -1343,6 +1347,10 @@ make_minimal_mode_release(Config) -> {output_dir, OutputDir} | RelxConfig]), [{{foo, "0.0.1"}, _Release}] = maps:to_list(rlx_state:realized_releases(State)), + + ?assert(has_debug_info(filename:join([OutputDir, "foo", "lib", + "non_goal_1-0.0.1", "ebin", + "a_real_beamnon_goal_1.beam"]))), case os:type() of {unix, _} -> @@ -1370,3 +1378,11 @@ make_minimal_mode_release(Config) -> %%%=================================================================== %%% Helper Functions %%%=================================================================== +has_debug_info(BeamFile) -> + {ok, Bin} = file:read_file(BeamFile), + case beam_lib:chunks(Bin, [debug_info]) of + {ok, _} -> + true; + _ -> + false + end. From 6d98a0cdebabc6cb06d4f2e0c473da3969ab4161 Mon Sep 17 00:00:00 2001 From: Stefan Grundmann Date: Sat, 31 Jan 2026 15:11:41 +0000 Subject: [PATCH 2/2] config: ensure {mode, ..} expansion does not override existing settings see: erlang/rebar3#2853 --- src/rlx_config.erl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rlx_config.erl b/src/rlx_config.erl index 9f12db1c3..86e05fc1d 100644 --- a/src/rlx_config.erl +++ b/src/rlx_config.erl @@ -15,7 +15,11 @@ to_state(Config) -> to_state(Config, rlx_state:new()). -to_state(Config, State) -> +to_state(Config0, State) -> + %% ensure 'mode' elements are at the head of the Config list, + %% this makes it possible to override options the modes expand + Modes = [V || {mode, _} = V <- Config0], + Config = Modes ++ (Config0 -- Modes), %% setup warnings_as_errors before loading the rest so we can error on %% any warning during the load State1 = rlx_state:warnings_as_errors(State, proplists:get_bool(warnings_as_errors, Config)),