erlware / relx

Sane, simple release creation for Erlang
http://erlware.github.io/relx
Apache License 2.0
696 stars 233 forks source link

keep attributes when stripping beams #906

Closed sg2342 closed 2 years ago

sg2342 commented 2 years ago

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 commented 2 years ago

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.

tsloughter commented 2 years ago

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 commented 2 years ago

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

sg2342 commented 2 years ago

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

tsloughter commented 2 years ago

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.

sg2342 commented 2 years ago

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: https://github.com/erlang/otp/pull/5936 (but otoh reltool does the debug_strip on file by file basis)

tsloughter commented 2 years ago

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