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

erts_vsn inside ejabberdctl never gets set #4194

Closed
GautaA opened this issue Apr 5, 2024 · 3 comments
Closed

erts_vsn inside ejabberdctl never gets set #4194

GautaA opened this issue Apr 5, 2024 · 3 comments
Assignees

Comments

@GautaA
Copy link

GautaA commented Apr 5, 2024

Environment

  • ejabberd version: 23.04
  • Erlang version: Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 13.1.5
  • OS: Linux (Debian)
  • Installed from: official deb/rpm

Bug description

I'm not sure if this is a bug or not, but I have noticed that inside ejabberdctl script on all of our deployments only the erts_vsn variable never gets set. This usually wouldn't be the problem, but we're trying to manage ejabberdctl ourselves for now because of this issue and this is causing Ansible to throw AnsibleUndefinedVariable: 'erts_vsn' is undefined" errors.

Example how it looks:

# define default environment variables
[ -z "$SCRIPT" ] && SCRIPT=$0
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT")" && pwd -P)"
# shellcheck disable=SC2034
ERTS_VSN="{{erts_vsn}}"
ERL="/usr/bin/erl"
IEX="/opt/ejabberd/bin/iex"
EPMD="/usr/bin/epmd"
INSTALLUSER=""

Does anyone know why this is happening and what's erts_vsn used for?

@badlop
Copy link
Member

badlop commented Apr 10, 2024

That variable was added in 94a733c. The variable is set and used when building an OTP release; but it is useless when using other install methods.

If ejabberd is built into an OTP release with:

./configure --with-rebar=rebar3
# or ./configure --with-rebar=mix
make
make prod
# or make dev

then the file _build/prod/rel/ejabberd/bin/ejabberdctl contains:

ERTS_VSN="14.2.3"
ERL="${SCRIPT_DIR%/*}/erts-${ERTS_VSN#erts-}/bin/erl"
EPMD="${SCRIPT_DIR%/*}/erts-${ERTS_VSN#erts-}/bin/epmd"

This is also the case in the RUN, DEB and RPM binary installers from ProcessOne, as they use OTP release method. And the container images too.


However, when using make relive or make install or make install-rel, the file _build/relive/ejabberdctl (or $PREFIX/sbin/ejabberdctl) contains:

ERTS_VSN="{{erts_vsn}}"
ERL="/home/badlop/.asdf/shims/erl"
EPMD="/home/badlop/.asdf/shims/epmd"

How do you obtain that ejabberdctl script? Did you use make install?

In your script, as you can see, ERTS_VSN is not used, so it isn't a problem for the script that the variable isn't set. If there is another tool that detects this and complains, you could try to remove that variable definition.

@GautaA
Copy link
Author

GautaA commented Apr 11, 2024

Hi!
Thank you for a detailed explanation. I checked, and you were right, make install was used.
We did remove the variable and everything works smoothly so far.

What do you think about omitting the variable if it doesn't get set by not building from the OTP?
It's just a QOL, and not that important, but would clean up the ctl file a bit.

@badlop badlop self-assigned this Apr 12, 2024
@badlop badlop added this to the ejabberd 24.xx milestone Apr 12, 2024
badlop added a commit that referenced this issue Apr 12, 2024
That variable is not used in "make relive" and "make install",
so let's comment the variable in ejabberdctl when preparing
that file for those targets.
@badlop
Copy link
Member

badlop commented Apr 12, 2024

Right, it's easy in Makefile.in to comment that line when it isn't needed. It will be fixed in the next release.

@badlop badlop closed this as completed Apr 12, 2024
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

No branches or pull requests

2 participants