Skip to content

Conversation

@mkuratczyk
Copy link
Contributor

This is not sufficient to build RabbitMQ on OTP 28.0-rc1 but it fixes the first problem that we hit. It might be that Elixir will support regex module attributes once it supports OTP 28, but we don't have to wait - this minor refactor just makes our code compatible with OTP28 without changing anything of substance.

When trying to use OTP28.0-rc1, Elixir fails to compile these modules
because a module attribute cannot be a regex. It is not yet clear
whether it's something to be fixed in Elixir for OTP28 compatibility
or something that accidentally worked in the past, but either way,
using a string as an attribute is equally good and works all OTP
versions, including OTP28.0-rc1.

```
== Compilation error in file lib/rabbitmq/cli/core/command_modules.ex ==
** (ArgumentError) cannot inject attribute @commands_ns into function/macro because cannot escape #Reference<0.2201422310.1333657602.13657>. The supported values are: lists, tuples, maps, atoms, numbers, bitstrings, PIDs and remote functions in the format &Mod.fun/arity
    (elixir 1.18.2) lib/kernel.ex:3729: Kernel.do_at/5
    (elixir 1.18.2) expanding macro: Kernel.@/1
    lib/rabbitmq/cli/core/command_modules.ex:133: RabbitMQ.CLI.Core.CommandModules.make_module_map/2
```
@michaelklishin
Copy link
Collaborator

We might have to support Erlang 28 for v4.0.x during its "commercial support only" phase, so let's backport this further.

@michaelklishin michaelklishin added this to the 4.1.0 milestone Feb 17, 2025
@michaelklishin michaelklishin merged commit 9222e3b into main Feb 17, 2025
267 of 268 checks passed
@michaelklishin michaelklishin deleted the cli-module-attribute-otp28 branch February 17, 2025 16:49
michaelklishin added a commit that referenced this pull request Feb 17, 2025
CLI: Don't use regex as module attributes (backport #13351)
michaelklishin added a commit that referenced this pull request Feb 17, 2025
CLI: Don't use regex as module attributes (backport #13351) (backport #13355)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants