elixir
elixir copied to clipboard
Mix.Release script requires absolute execution path
Elixir and Erlang/OTP versions
Elixir 16.2 OTP 26.2.5
Operating system
NetBSD
Current behavior
After producing a release with mix release, resulting main script for a release expects absolute directory path for the invocation.
https://github.com/elixir-lang/elixir/blob/61acf336c190652edb61ca454038bd2a1a524229/lib/mix/lib/mix/tasks/release.init.ex#L90-L92
It works if you're executing script directly, or if you're making an absolute symlink; in both cases $SELF is an absolute path.
However if one would create a symlink like that:
ln -s ../lib/whatever/bin/test_release bin/test_release
Script execution will fail:
$ test_release
cd: can't cd to ../lib/whatever/bin/..
Usecase:
Trying to make a binary package out of release folder requires either custom prefix (e.g. release folder is copied to /opt/whatever and then PATH is updated) or creating an absolute symlink to /usr/bin or other prefix which is used on a target system.
Relative symlink would allow much easier deployment of Mix.Releases, because it will eliminate post-install step which may not be available for a particular distribution method/system.
Thank you!
Expected behavior
Script works
A pull request to tackle this is welcome. We may not have time to prioritize this. :)