rabbitmq / rabbitmq-packaging

Debian, RPM, Windows package bits for RabbitMQ
1 stars 6 forks source link

Windows: Fix the value of `$ERLANG_HOME` environment variable #23

Closed dumbbell closed 2 years ago

dumbbell commented 2 years ago

The value was set from a register set after reading the Erlang install path from the Registry.

However, as part of #22, I rewrote how we detect the version of Erlang. While doing this, I used regular variables instead of registers to improve the readability and make sure the code doesn't break because a future change overwrites a register.

This is exactly what happened here: I didn't see the $0 register was used later in the same function. In #22, I stored the Erlang install path in a variable and used the register for temporary storage in several loops. At the time we want to set $ERLANG_HOME, the register holds a file descriptor integer which is meaningless.

As a consequence, the RabbitMQ service fails to be installed and started as part of the installer process. After the install, RabbitMQ CLI tools fail to run. All because $ERLANG_HOME is incorrectly set.

This patch uses the $erlang_otp_dir variable to correctly set $ERLANG_HOME. This should be future-proof this time.

dumbbell commented 2 years ago

@Mergifyio backport v3.11.x

pjk25 commented 2 years ago

@Mergifyio backport v3.11.x

mergify[bot] commented 2 years ago

backport v3.11.x

✅ Backports have been created

* [#24 Windows: Fix the value of `$ERLANG_HOME` environment variable (backport #23)](https://github.com/rabbitmq/rabbitmq-packaging/pull/24) has been created for branch `v3.11.x`
dumbbell commented 2 years ago

@Mergifyio v3.10.x v3.9.x

mergify[bot] commented 2 years ago

Sorry but I didn't understand the command. Please consult the commands documentation 📚.

dumbbell commented 2 years ago

@Mergifyio backport v3.10.x v3.9.x

mergify[bot] commented 2 years ago

backport v3.10.x v3.9.x

✅ Backports have been created

* [#25 Windows: Fix the value of `$ERLANG_HOME` environment variable (backport #23)](https://github.com/rabbitmq/rabbitmq-packaging/pull/25) has been created for branch `v3.10.x` * [#26 Windows: Fix the value of `$ERLANG_HOME` environment variable (backport #23)](https://github.com/rabbitmq/rabbitmq-packaging/pull/26) has been created for branch `v3.9.x`