erlware / relx

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

ensure the erl file is writable before copying dyn_erl to it #903

Closed tsloughter closed 2 years ago

tsloughter commented 2 years ago

It was discovered that in some installs, like on MacOS, that the erl file is not writable and would result in copying dyn_erl to erl to fail silently. This patch adds the writable perm to the file and will error if that or the copying fail.

Resolves https://github.com/aeternity/aeternity/issues/3789

eproxus commented 2 years ago

I think this change broke our rebar3_grisp plug-in because it makes a release from an Erlang build which doesn't have a dyn_erl file in it (cross-compiled to ARM and stripped of unnecessary files). This implementation assumes the file dyn_erl will always exist for any Erlang build (which may or may not be true):

===> Copying ~/grisp/grisp_demo/_build/grisp/rel/grisp_demo/erts-12.3.2.1/bin/dyn_erl to ~/grisp/grisp_demo/_build/grisp/rel/grisp_demo/erts-12.3.2.1/bin/erl failed with reason: no such file or directory

Would it be acceptable with a PR fix that only overwrites erl with dyn_erl if dyn_erl actually exists?

tsloughter commented 2 years ago

@eproxus yes, definitely. I believe I only did that because we only support OTP versions that have dyn_erl, but since there aren't we shouldn't assume it.

eproxus commented 2 years ago

@tsloughter See https://github.com/erlware/relx/pull/926