Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keep attributes when stripping beams #906

Merged
merged 2 commits into from
May 18, 2022

Conversation

sg2342
Copy link
Contributor

@sg2342 sg2342 commented Feb 17, 2022

release_handler:install_release/1 depends on the 'vsn' attribute in the beam
files of the to-be-installed release.

Without this, a release created with {debug_info, strip} (which is the default in
rebar3 'prod' and 'minimal' modes) cannot be installed by the release_handler.

release_handler:install_release/1 depends on the 'vsn' attribute in the beam
files of the to-be-installed release.

Without this, a release created with {debug_info, strip} (which is the default in
rebar3 'prod' and 'minimal' modes) cannot be installed by the release_handler.
@sg2342
Copy link
Contributor Author

sg2342 commented Feb 17, 2022

unfortunately i forgot to check for the presence of beam_lib:strip_release/2 in older OTP releases.
beam_lib:strip_release/2 was introduced in OTP 22.0; this makes this PR useless.

i think the 'debug_info' 'strip' | 'keep' option is dangerously named (it does strip debug_info but also everything else). and i also think the fact that {debug_info, strip} makes the created release uninstallable by release_handler should be documented somewhere.

@sg2342 sg2342 closed this Feb 17, 2022
@tsloughter
Copy link
Member

Definitely should be documented, but we should only be supporting 22+ anyway, so you should reopen this PR and can remove anything older than 22 from CI.

@sg2342 sg2342 reopened this Feb 17, 2022
@sg2342
Copy link
Contributor Author

sg2342 commented Feb 17, 2022

the inclusion of this change in a new rebar3 release would fix erlang/rebar3#2558

@sg2342 sg2342 mentioned this pull request Feb 25, 2022
@sg2342
Copy link
Contributor Author

sg2342 commented May 18, 2022

@tsloughter : is there anything i can do to bring this and #907 forward?

@tsloughter
Copy link
Member

Just poking me :). Sorry about that.

I think it makes sense to merge this as is but I'm curious about why strip_release wouldn't by default keep attributes if they are needed by install. I'm guessing their answer would be that it could be called after the release is installed, but still worth bringing up.

Also probably worth making it configurable so a user can configure a list of what to keep.

But that can be a separate PR.

@tsloughter tsloughter merged commit dfa5fb8 into erlware:main May 18, 2022
@sg2342
Copy link
Contributor Author

sg2342 commented May 18, 2022

Also probably worth making it configurable so a user can configure a list of what to keep.

But that can be a separate PR.

there is a related work happening in reltool: erlang/otp#5936 (but otoh reltool does the debug_strip on file by file basis)

@sg2342 sg2342 deleted the never_strip_vsn_attribute branch May 18, 2022 21:35
@tsloughter
Copy link
Member

Oh, thanks, I've also commented there about this now.

ferd added a commit to erlang/rebar3 that referenced this pull request Jun 18, 2022
- [Use `erlexec` directly in relx helper functions](erlware/relx#902)
- [Make rlx_util:parse_vsn parse integer versions](erlware/relx#913)
- [fix awk script check_name() in extended_bin](erlware/relx#915)
- [avoid crash when overlay is malformed](erlware/relx#916)
- [keep attributes when stripping beams](erlware/relx#906)
- [Fix {include_erts,true} in Windows releases](erlware/relx#914)
- [ensure the erl file is writable before copying dyn_erl to it](erlware/relx#903)
- Various tests added
ferd added a commit to erlang/rebar3 that referenced this pull request Jun 18, 2022
New features:

- [Add --offline option and REBAR_OFFLINE environment variable](#2643)
- [Add support for project-local plugins](#2697)
- [Add eunit --test flag](#2684)

Experimental features for which we promise no backwards compatibility in
the near future:

- [Experimental vendoring provider](#2689)
  - [Support plugins in experimental vendor provider](#2702)

Other changes:

- [Support OTP 23..25 inclusively](#2706)
- [Bump Relx to 4.7.0](#2718)
  - [Use `erlexec` directly in relx helper functions](erlware/relx#902)
  - [Make rlx_util:parse_vsn parse integer versions](erlware/relx#913)
  - [fix awk script check_name() in extended_bin](erlware/relx#915)
  - [avoid crash when overlay is malformed](erlware/relx#916)
  - [keep attributes when stripping beams](erlware/relx#906)
  - [Fix {include_erts,true} in Windows releases](erlware/relx#914)
  - [ensure the erl file is writable before copying dyn_erl to it](erlware/relx#903)
  - Various tests added
- [Properly carry overlay_vars settings for files in relx](#2711)
- [Track mib compilation artifacts](#2709)
- [Attempt to find apps in git subdirs (sparse checkouts)](#2687)
- [Do not discard parameters --system_libs and --include-erts when duplicate values exist](#2695)
- [Use default `depth` parameter for SSL](#2690)
- [Fix global cache config overriding](#2683)
- [Error out on unknown templates in 'new' command](#2676)
- [Fix a typo](#2674)
- [Bump certifi to 2.9.0](#2673)
- [add a debug message in internal dependency fetching code](#2672)
- [Use SPDX id for license in template and test](#2668)
- [Use default branch for git and git_subdir resources with no revision](#2663)

Signed-off-by: Fred Hebert <[email protected]>
weiss added a commit to processone/eturnal that referenced this pull request Aug 24, 2022
Remove the 'stripped' profile from the Rebar3 configuration to avoid
duplication and confusion.  Just use the 'prod' profile for building
release binaries instead.  Compared to 'stripped', this adds the SASL
application (400 KiB) to support hot release upgrades and the Recon
application (120 KiB) for debugging purposes.

Note that hot release upgrades no longer depend on keeping debug info,
see: erlware/relx#906

Also not that the 'runtime_tools' application is now removed from all
profiles, as it's probably overkill to include it in addition to Recon
and the 'p1_prof' tools.

For those who'd still like to build using the old 'stripped'
configuration, the rebar.config.script file now auto-generates a
'prod_minimal' profile, which omits the SASL and Recon applications.
However, we won't use nor document that profile.
weiss added a commit to processone/eturnal that referenced this pull request Aug 24, 2022
Remove the 'stripped' profile from the Rebar3 configuration to avoid
duplication and confusion.  Just use the 'prod' profile for building
release binaries instead.  Compared to 'stripped', this adds the SASL
application (150 KiB) to support hot release upgrades and the Recon
application (50 KiB) for debugging purposes.

Note that hot release upgrades no longer depend on keeping debug info,
see: erlware/relx#906

Also not that the 'runtime_tools' application is now removed from all
profiles, as it's probably overkill to include it in addition to Recon
and the 'p1_prof' tools.

For those who'd still like to build using the old 'stripped'
configuration, the rebar.config.script file now auto-generates a
'prod_minimal' profile, which omits the SASL and Recon applications.
However, we won't use nor document that profile.
weiss added a commit to weiss/textgroup that referenced this pull request Aug 26, 2022
Hot code upgrades no longer depend on keeping debug info, see:

erlware/relx#906
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants