diff options
71 files changed, 642 insertions, 381 deletions
diff --git a/.github/workflows/rabbitmq_peer_discovery_aws.yaml b/.github/workflows/rabbitmq_peer_discovery_aws.yaml index c9df1f30b0..37d378ca88 100644 --- a/.github/workflows/rabbitmq_peer_discovery_aws.yaml +++ b/.github/workflows/rabbitmq_peer_discovery_aws.yaml @@ -1,14 +1,5 @@ name: Peer Discovery AWS Integration Test on: - push: - branches: - - master - - v3.10.x - - v3.9.x - - v3.8.x - paths: - - 'deps/rabbitmq_peer_discovery_aws/**' - - .github/workflows/rabbitmq_peer_discovery_aws.yaml workflow_dispatch: jobs: peer-discovery-aws-integration-test: @@ -16,8 +7,6 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - image_tag_suffix: - - otp-max include: - image_tag_suffix: otp-max erlang_version: "24" diff --git a/.github/workflows/update-otp-for-oci.yaml b/.github/workflows/update-otp-for-oci.yaml index 3c846c18b7..cccaabb514 100644 --- a/.github/workflows/update-otp-for-oci.yaml +++ b/.github/workflows/update-otp-for-oci.yaml @@ -52,7 +52,7 @@ jobs: git diff - name: CREATE PULL REQUEST if: steps.check-for-branch.outputs.c != 0 - uses: peter-evans/create-pull-request@v4.0.3 + uses: peter-evans/create-pull-request@v4.0.4 with: token: ${{ secrets.REPO_SCOPED_TOKEN }} committer: GitHub <noreply@github.com> diff --git a/.github/workflows/update-rbe-images.yaml b/.github/workflows/update-rbe-images.yaml index ba66fc0f4b..a48a638704 100644 --- a/.github/workflows/update-rbe-images.yaml +++ b/.github/workflows/update-rbe-images.yaml @@ -42,7 +42,7 @@ jobs: echo "$(cat WORKSPACE.bazel | npx buildozer 'set commit "${{ steps.find-commit.outputs.SHA }}"' -:rbe_${{ matrix.short_version }})" > WORKSPACE.bazel git diff - name: CREATE PULL REQUEST - uses: peter-evans/create-pull-request@v4.0.3 + uses: peter-evans/create-pull-request@v4.0.4 with: token: ${{ secrets.REPO_SCOPED_TOKEN }} committer: GitHub <noreply@github.com> diff --git a/.github/workflows/update-rules_erlang.yaml b/.github/workflows/update-rules_erlang.yaml index 1c40215dbb..1f6b069462 100644 --- a/.github/workflows/update-rules_erlang.yaml +++ b/.github/workflows/update-rules_erlang.yaml @@ -30,7 +30,7 @@ jobs: echo "$(cat WORKSPACE.bazel | npx buildozer 'set commit "${{ steps.find-commit.outputs.SHA }}"' -:rules_erlang)" > WORKSPACE.bazel git diff - name: CREATE PULL REQUEST - uses: peter-evans/create-pull-request@v4.0.3 + uses: peter-evans/create-pull-request@v4.0.4 with: token: ${{ secrets.REPO_SCOPED_TOKEN }} committer: GitHub <noreply@github.com> @@ -29,11 +29,24 @@ DEP_PLUGINS = rabbit_common/mk/rabbitmq-dist.mk \ DISABLE_DISTCLEAN = 1 -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp +XREF_SCOPE = app deps + +# We add all the applications that are in non-standard paths +# so they are included in the analyses as well. +XREF_EXTRA_APP_DIRS = $(filter-out deps/rabbitmq_cli/_build/dev/lib/rabbit_common/,$(wildcard deps/rabbitmq_cli/_build/dev/lib/*/)) deps/rabbit/apps/rabbitmq_prelaunch/ + +# For Elixir protocols the right fix is to include the consolidated/ +# folders in addition to ebin/. However this creates conflicts because +# some modules are duplicated. So instead we ignore warnings from +# protocols directly. +XREF_IGNORE = [ \ + {'Elixir.CSV.Encode',impl_for,1}, \ + {'Elixir.JSON.Decoder',impl_for,1}, \ + {'Elixir.JSON.Encoder',impl_for,1}, \ + {'Elixir.RabbitMQ.CLI.Core.DataCoercion',impl_for,1}] + +# Include Elixir libraries in the Xref checks. +xref: ERL_LIBS := $(ERL_LIBS):$(CURDIR)/apps:$(CURDIR)/deps:$(dir $(shell elixir --eval ":io.format '~s~n', [:code.lib_dir :elixir ]")) ifneq ($(wildcard deps/.hex/cache.erl),) deps:: restore-hex-cache-ets-file diff --git a/deps/amqp10_common/development.post.mk b/deps/amqp10_common/development.post.mk index 3f8301acd1..b7f960a7e7 100644 --- a/deps/amqp10_common/development.post.mk +++ b/deps/amqp10_common/development.post.mk @@ -2,7 +2,7 @@ # Framing sources generation. # -------------------------------------------------------------------- -PYTHON ?= python +PYTHON ?= python3 CODEGEN = $(CURDIR)/codegen.py CODEGEN_DIR ?= $(DEPS_DIR)/rabbitmq_codegen CODEGEN_AMQP = $(CODEGEN_DIR)/amqp_codegen.py diff --git a/deps/amqp_client/Makefile b/deps/amqp_client/Makefile index 3e113c471d..2200154c09 100644 --- a/deps/amqp_client/Makefile +++ b/deps/amqp_client/Makefile @@ -53,8 +53,6 @@ DEP_PLUGINS = rabbit_common/mk/rabbitmq-build.mk \ PLT_APPS = ssl public_key -WITHOUT = plugins/proper - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbit/Makefile b/deps/rabbit/Makefile index a18f5f0c14..5e45f5b84d 100644 --- a/deps/rabbit/Makefile +++ b/deps/rabbit/Makefile @@ -164,12 +164,6 @@ DEP_PLUGINS = rabbit_common/mk/rabbitmq-build.mk \ rabbit_common/mk/rabbitmq-test.mk \ rabbit_common/mk/rabbitmq-tools.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbit/apps/rabbitmq_prelaunch/BUILD.bazel b/deps/rabbit/apps/rabbitmq_prelaunch/BUILD.bazel index c8a618cdd2..fdc256395a 100644 --- a/deps/rabbit/apps/rabbitmq_prelaunch/BUILD.bazel +++ b/deps/rabbit/apps/rabbitmq_prelaunch/BUILD.bazel @@ -46,6 +46,12 @@ dialyze( warnings_as_errors = False, ) -rabbitmq_suite( - name = "rabbit_logger_std_h_SUITE", -) +suites = [ + rabbitmq_suite( + name = "rabbit_logger_std_h_SUITE", + ), + rabbitmq_suite( + name = "rabbit_prelaunch_file_SUITE", + size = "small", + ), +] diff --git a/deps/rabbit/apps/rabbitmq_prelaunch/src/rabbit_logger_fmt_helpers.erl b/deps/rabbit/apps/rabbitmq_prelaunch/src/rabbit_logger_fmt_helpers.erl index 315b57e190..70ef4f6b80 100644 --- a/deps/rabbit/apps/rabbitmq_prelaunch/src/rabbit_logger_fmt_helpers.erl +++ b/deps/rabbit/apps/rabbitmq_prelaunch/src/rabbit_logger_fmt_helpers.erl @@ -132,8 +132,8 @@ level_4letter_uc_name(emergency) -> "EMGC". format_msg(Msg, Meta, #{single_line := true} = Config) -> FormattedMsg = format_msg1(Msg, Meta, Config), %% The following behavior is the same as the one in the official - %% `logger_formatter'; the code is taken from that module (as of - %% c5ed910098e9c2787e2c3f9f462c84322064e00d in the master branch). + %% `logger_formatter'; the code is taken from: + %% https://github.com/erlang/otp/blob/c5ed910098e9c2787e2c3f9f462c84322064e00d/lib/kernel/src/logger_formatter.erl FormattedMsg1 = string:strip(FormattedMsg, both), re:replace( FormattedMsg1, diff --git a/deps/rabbit/apps/rabbitmq_prelaunch/src/rabbit_prelaunch_conf.erl b/deps/rabbit/apps/rabbitmq_prelaunch/src/rabbit_prelaunch_conf.erl index d1ba318189..990e017b1e 100644 --- a/deps/rabbit/apps/rabbitmq_prelaunch/src/rabbit_prelaunch_conf.erl +++ b/deps/rabbit/apps/rabbitmq_prelaunch/src/rabbit_prelaunch_conf.erl @@ -201,7 +201,7 @@ determine_config_format(File) -> 0 -> cuttlefish; _ -> - case file:consult(File) of + case rabbit_prelaunch_file:consult_file(File) of {ok, _} -> erlang; _ -> cuttlefish end @@ -384,7 +384,7 @@ override_with_advanced_config(Config, AdvancedConfigFile) -> "Override with advanced configuration file \"~ts\"", [AdvancedConfigFile], #{domain => ?RMQLOG_DOMAIN_PRELAUNCH}), - case file:consult(AdvancedConfigFile) of + case rabbit_prelaunch_file:consult_file(AdvancedConfigFile) of {ok, [AdvancedConfig]} -> cuttlefish_advanced:overlay(Config, AdvancedConfig); {ok, OtherTerms} -> @@ -578,4 +578,4 @@ disable_kernel_overlapping_partitions() -> %% This new "fixed" behavior seriously affects our own partition handling, %% and potentially even libraries such as Aten and Ra, %% so disable this to be forward-compatible with Erlang 25 - application:set_env(kernel, prevent_overlapping_partitions, false).
\ No newline at end of file + application:set_env(kernel, prevent_overlapping_partitions, false). diff --git a/deps/rabbit/apps/rabbitmq_prelaunch/src/rabbit_prelaunch_file.erl b/deps/rabbit/apps/rabbitmq_prelaunch/src/rabbit_prelaunch_file.erl new file mode 100644 index 0000000000..ac524181a3 --- /dev/null +++ b/deps/rabbit/apps/rabbitmq_prelaunch/src/rabbit_prelaunch_file.erl @@ -0,0 +1,95 @@ +%% +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. +%% +%% Copyright Ericsson AB 2011-2022. All Rights Reserved. +%% Copyright (c) 2022 VMware, Inc. or its affiliates. All rights reserved. +%% +%% This code originated here and has been modified to suit RabbitMQ: +%% https://github.com/erlang/otp/blob/2d43af53899d35423f1c83887026089c91bce010/lib/ssl/src/ssl_dist_sup.erl +%% + +-module(rabbit_prelaunch_file). + +-export([consult_file/1, consult_string/1]). + +%% +%% consult_file/consult_string API +%% + +-spec consult_file(atom() | string()) -> + {'error',{'badfile',atom() | string() | {_,_} | {'scan_error',{_,_,_},non_neg_integer() | {_,_}}}} | {'ok',_}. +consult_file(Path) -> + case erl_prim_loader:get_file(Path) of + {ok, Binary, _FullName} -> + Encoding = + case epp:read_encoding_from_binary(Binary) of + none -> + latin1; + Enc -> + Enc + end, + case unicode:characters_to_list(Binary, Encoding) of + {error, _String, Rest} -> + {error, {badfile, {encoding_error, Rest}}}; + {incomplete, _String, Rest} -> + {error, {badfile, {encoding_incomplete, Rest}}}; + String when is_list(String) -> + consult_string(String) + end; + error -> + {error, {badfile, Path}} + end. + +-spec consult_string(string()) -> + {'error',{'badfile',{_,_} | {'scan_error',{_,_,_},non_neg_integer() | {_,_}}}} | {'ok',_}. +consult_string(String) -> + case erl_scan:string(String) of + {error, Info, Location} -> + {error, {badfile, {scan_error, Info, Location}}}; + {ok, Tokens, _EndLocation} -> + consult_tokens(Tokens) + end. + +%% +%% consult_file / consult_string implementation +%% + +consult_tokens(Tokens) -> + case erl_parse:parse_exprs(Tokens) of + {error, Info} -> + {error, {badfile, {parse_error, Info}}}; + {ok, [Expr]} -> + consult_expression(Expr); + {ok, Other} -> + {error, {badfile, {parse_error, Other}}} + end. + +consult_expression(Expr) -> + Result = try + erl_eval:expr(Expr, erl_eval:new_bindings()) + catch + Class:Error0 -> + {error, {badfile, {Class, Error0}}} + end, + case Result of + {value, Value, Bs} -> + case erl_eval:bindings(Bs) of + [] -> + {ok, [Value]}; + Other -> + {error, {badfile, {bindings, Other}}} + end; + Error1 -> + Error1 + end. + diff --git a/deps/rabbit/apps/rabbitmq_prelaunch/test/rabbit_prelaunch_file_SUITE.erl b/deps/rabbit/apps/rabbitmq_prelaunch/test/rabbit_prelaunch_file_SUITE.erl new file mode 100644 index 0000000000..b5173ae49b --- /dev/null +++ b/deps/rabbit/apps/rabbitmq_prelaunch/test/rabbit_prelaunch_file_SUITE.erl @@ -0,0 +1,82 @@ +%% This Source Code Form is subject to the terms of the Mozilla Public +%% License, v. 2.0. If a copy of the MPL was not distributed with this +%% file, You can obtain one at https://mozilla.org/MPL/2.0/. +%% +%% Copyright (c) 2022 VMware, Inc. or its affiliates. All rights reserved. +%% + +-module(rabbit_prelaunch_file_SUITE). + +-compile(nowarn_export_all). +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). +-include_lib("eunit/include/eunit.hrl"). + +%%%=================================================================== +%%% Common Test callbacks +%%%=================================================================== + +all() -> + [{group, tests}]. + +all_tests() -> + [consult_advanced_config, consult_rabbitmq_config, consult_badfile]. + +groups() -> + [{tests, [], all_tests()}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_Group, Config) -> + Config. + +end_per_group(_Group, _Config) -> + ok. + +init_per_testcase(_TestCase, Config) -> + Config. + +end_per_testcase(_TestCase, _Config) -> + ok. + +%%%=================================================================== +%%% Test cases +%%%=================================================================== + +consult_advanced_config(Config) -> + MatchFun = public_key:pkix_verify_hostname_match_fun(https), + AdvancedConfigPath = + filename:join(?config(data_dir, Config), "advanced.config"), + {ok, [AdvancedConfig]} = rabbit_prelaunch_file:consult_file(AdvancedConfigPath), + ?assertMatch([{rabbit, [{log, [{console, [{enabled, true}, {level, debug}]}]}, + {loopback_users, []}, + {ssl_listeners, [5671]}, + {ssl_options, + [{cacertfile, "/path/to/certs/ca_certificate.pem"}, + {certfile, "/path/to/certs/server_certificate.pem"}, + {keyfile, "/path/to/certs/server_key.pem"}, + {fail_if_no_peer_cert, true}, + {verify, verify_peer}, + {customize_hostname_check, [{match_fun, MatchFun}]}]}, + {background_gc_enabled, true}, + {background_gc_target_interval, 1000}]}], AdvancedConfig), + _Json = rabbit_json:encode(AdvancedConfig). + +consult_rabbitmq_config(Config) -> + RabbitMQConfigPath = filename:join(?config(data_dir, Config), "rabbitmq.config"), + {ok, [RabbitMQConfig]} = rabbit_prelaunch_file:consult_file(RabbitMQConfigPath), + ?assertMatch( + [{rabbit,[{consumer_timeout,none}]}, + {kernel, + [{inet_dist_use_interface,{127,0,0,1}}]}], RabbitMQConfig). + +consult_badfile(Config) -> + AdvancedConfigPath = + filename:join(?config(data_dir, Config), "bad-advanced.config"), + ?assertMatch({error, {badfile, {error, undef}}}, + rabbit_prelaunch_file:consult_file(AdvancedConfigPath)). diff --git a/deps/rabbit/apps/rabbitmq_prelaunch/test/rabbit_prelaunch_file_SUITE_data/advanced.config b/deps/rabbit/apps/rabbitmq_prelaunch/test/rabbit_prelaunch_file_SUITE_data/advanced.config new file mode 100644 index 0000000000..ae417216f6 --- /dev/null +++ b/deps/rabbit/apps/rabbitmq_prelaunch/test/rabbit_prelaunch_file_SUITE_data/advanced.config @@ -0,0 +1,24 @@ +[ + {rabbit, [ + {log, [ + {console, [ + {enabled, true}, + {level, debug} + ]} + ]}, + {loopback_users, []}, + {ssl_listeners, [5671]}, + {ssl_options, [ + {cacertfile, "/path/to/certs/ca_certificate.pem"}, + {certfile, "/path/to/certs/server_certificate.pem"}, + {keyfile, "/path/to/certs/server_key.pem"}, + {fail_if_no_peer_cert, true}, + {verify, verify_peer}, + {customize_hostname_check, [ + {match_fun, public_key:pkix_verify_hostname_match_fun(https)} + ]} + ]}, + {background_gc_enabled, true}, + {background_gc_target_interval, 1000} + ]} +]. diff --git a/deps/rabbit/apps/rabbitmq_prelaunch/test/rabbit_prelaunch_file_SUITE_data/bad-advanced.config b/deps/rabbit/apps/rabbitmq_prelaunch/test/rabbit_prelaunch_file_SUITE_data/bad-advanced.config new file mode 100644 index 0000000000..445441f5d4 --- /dev/null +++ b/deps/rabbit/apps/rabbitmq_prelaunch/test/rabbit_prelaunch_file_SUITE_data/bad-advanced.config @@ -0,0 +1,24 @@ +[ + {rabbit, [ + {log, [ + {console, [ + {enabled, true}, + {level, debug} + ]} + ]}, + {loopback_users, []}, + {ssl_listeners, [5671]}, + {ssl_options, [ + {cacertfile, "/path/to/certs/ca_certificate.pem"}, + {certfile, "/path/to/certs/server_certificate.pem"}, + {keyfile, "/path/to/certs/server_key.pem"}, + {fail_if_no_peer_cert, true}, + {verify, verify_peer}, + {customize_hostname_check, [ + {match_fun, foobar:bazbat(https)} + ]} + ]}, + {background_gc_enabled, true}, + {background_gc_target_interval, 1000} + ]} +]. diff --git a/deps/rabbit/apps/rabbitmq_prelaunch/test/rabbit_prelaunch_file_SUITE_data/rabbitmq.config b/deps/rabbit/apps/rabbitmq_prelaunch/test/rabbit_prelaunch_file_SUITE_data/rabbitmq.config new file mode 100644 index 0000000000..61b186fe68 --- /dev/null +++ b/deps/rabbit/apps/rabbitmq_prelaunch/test/rabbit_prelaunch_file_SUITE_data/rabbitmq.config @@ -0,0 +1,9 @@ +[ + {rabbit, [ + {consumer_timeout, none} + ]}, + + {kernel, [ + {inet_dist_use_interface, {127,0,0,1}} + ]} +]. diff --git a/deps/rabbit/src/rabbit_exchange.erl b/deps/rabbit/src/rabbit_exchange.erl index 9ec9675230..db16b48390 100644 --- a/deps/rabbit/src/rabbit_exchange.erl +++ b/deps/rabbit/src/rabbit_exchange.erl @@ -167,8 +167,7 @@ store(X = #exchange{durable = false}) -> store_ram(X) -> X1 = rabbit_exchange_decorator:set(X), - ok = mnesia:write(rabbit_exchange, rabbit_exchange_decorator:set(X1), - write), + ok = mnesia:write(rabbit_exchange, X1, write), X1. %% Used with binaries sent over the wire; the type may not exist. diff --git a/deps/rabbit/src/rabbit_fifo.erl b/deps/rabbit/src/rabbit_fifo.erl index 09da591cd4..5910de24e5 100644 --- a/deps/rabbit/src/rabbit_fifo.erl +++ b/deps/rabbit/src/rabbit_fifo.erl @@ -55,6 +55,7 @@ normalize/1, get_msg_header/1, get_header/2, + get_msg/1, %% protocol helpers make_enqueue/3, @@ -87,7 +88,7 @@ msg_id :: msg_id(), index :: ra:index(), header :: msg_header(), - msg :: msg()}). + msg :: raw_msg()}). -record(register_enqueuer, {pid :: pid()}). -record(checkout, {consumer_id :: consumer_id(), spec :: checkout_spec(), @@ -985,10 +986,7 @@ handle_aux(leader, cast, {#return{msg_ids = MsgIds, %% crashed and the message got removed case ra_log:fetch(Idx, L0) of {{_, _, {_, _, Cmd, _}}, L} -> - Msg = case Cmd of - #enqueue{msg = M} -> M; - #requeue{msg = M} -> M - end, + Msg = get_msg(Cmd), {L, [{MsgId, Idx, Header, Msg} | Acc]}; {undefined, L} -> {L, Acc} @@ -1056,10 +1054,7 @@ handle_aux(_RaState, {call, _From}, {peek, Pos}, Aux0, {ok, ?MSG(Idx, Header)} -> %% need to re-hydrate from the log {{_, _, {_, _, Cmd, _}}, Log} = ra_log:fetch(Idx, Log0), - Msg = case Cmd of - #enqueue{msg = M} -> M; - #requeue{msg = M} -> M - end, + Msg = get_msg(Cmd), {reply, {ok, {Header, Msg}}, Aux0, Log}; Err -> {reply, Err, Aux0, Log0} @@ -1920,26 +1915,18 @@ delivery_effect({CTag, CPid}, Msgs, _State) -> {log, RaftIdxs, fun(Log) -> DelMsgs = lists:zipwith( - fun (#enqueue{msg = Msg}, - {MsgId, Header}) -> - {MsgId, {Header, Msg}}; - (#requeue{msg = Msg}, - {MsgId, Header}) -> - {MsgId, {Header, Msg}} - end, Log, Data), + fun (Cmd, {MsgId, Header}) -> + {MsgId, {Header, get_msg(Cmd)}} + end, Log, Data), [{send_msg, CPid, {delivery, CTag, DelMsgs}, [local, ra_event]}] end, {local, node(CPid)}}. reply_log_effect(RaftIdx, MsgId, Header, Ready, From) -> {log, [RaftIdx], - fun - ([#enqueue{msg = Msg}]) -> - [{reply, From, {wrap_reply, - {dequeue, {MsgId, {Header, Msg}}, Ready}}}]; - ([#requeue{msg = Msg}]) -> + fun ([Cmd]) -> [{reply, From, {wrap_reply, - {dequeue, {MsgId, {Header, Msg}}, Ready}}}] + {dequeue, {MsgId, {Header, get_msg(Cmd)}}, Ready}}}] end}. checkout_one(#{system_time := Ts} = Meta, ExpiredMsg0, InitState0, Effects0) -> @@ -2421,3 +2408,8 @@ can_immediately_deliver(#?MODULE{service_queue = SQ, incr(I) -> I + 1. + +get_msg(#enqueue{msg = M}) -> + M; +get_msg(#requeue{msg = M}) -> + M. diff --git a/deps/rabbit/src/rabbit_fifo_dlx.erl b/deps/rabbit/src/rabbit_fifo_dlx.erl index 711139a5c8..0671f1382c 100644 --- a/deps/rabbit/src/rabbit_fifo_dlx.erl +++ b/deps/rabbit/src/rabbit_fifo_dlx.erl @@ -150,8 +150,8 @@ discard(Msgs0, Reason, {at_most_once, {Mod, Fun, Args}}, State) -> fun (Log) -> Lookup = maps:from_list(lists:zip(Idxs, Log)), Msgs = [begin - {enqueue, _, _, Msg} = maps:get(Idx, Lookup), - Msg + Cmd = maps:get(Idx, Lookup), + rabbit_fifo:get_msg(Cmd) end || ?MSG(Idx, _) <- Msgs0], [{mod_call, Mod, Fun, Args ++ [Reason, Msgs]}] end}, @@ -224,8 +224,8 @@ delivery_effects(CPid, Msgs0) -> {RaftIdxs, RsnIds} = lists:unzip(Msgs1), [{log, RaftIdxs, fun(Log) -> - Msgs = lists:zipwith(fun ({enqueue, _, _, Msg}, {Reason, MsgId}) -> - {MsgId, {Reason, Msg}} + Msgs = lists:zipwith(fun (Cmd, {Reason, MsgId}) -> + {MsgId, {Reason, rabbit_fifo:get_msg(Cmd)}} end, Log, RsnIds), [{send_msg, CPid, {dlx_delivery, Msgs}, [ra_event]}] end}]. diff --git a/deps/rabbit/test/dead_lettering_SUITE.erl b/deps/rabbit/test/dead_lettering_SUITE.erl index e7688d6366..3c6ae8ebf5 100644 --- a/deps/rabbit/test/dead_lettering_SUITE.erl +++ b/deps/rabbit/test/dead_lettering_SUITE.erl @@ -32,6 +32,7 @@ groups() -> dead_letter_reject_many, dead_letter_reject_requeue, dead_letter_max_length_drop_head, + dead_letter_reject_requeue_reject_norequeue, dead_letter_missing_exchange, dead_letter_routing_key, dead_letter_routing_key_header_CC, @@ -116,8 +117,7 @@ init_per_group(quorum_queue, Config) -> ok -> rabbit_ct_helpers:set_config( Config, - [{queue_args, [{<<"x-queue-type">>, longstr, <<"quorum">>}, - {<<"x-delivery-limit">>, long, 100}]}, + [{queue_args, [{<<"x-queue-type">>, longstr, <<"quorum">>}]}, {queue_durable, true}]); Skip -> Skip @@ -411,6 +411,11 @@ dead_letter_reject_requeue(Config) -> DLXQName = ?config(queue_name_dlx, Config), declare_dead_letter_queues(Ch, Config, QName, DLXQName), + %% Setting a delivery-limit will cause a quorum queue to requeue at the head of the queue + %% (same behaviour as in classic queues). + ok = rabbit_ct_broker_helpers:set_policy(Config, 0, ?config(policy, Config), QName, + <<"queues">>, [{<<"delivery-limit">>, 50}]), + P1 = <<"msg1">>, P2 = <<"msg2">>, P3 = <<"msg3">>, @@ -471,6 +476,38 @@ dead_letter_max_length_drop_head(Config) -> consume_empty(Ch, DLXQName), ?assertEqual(2, counted(messages_dead_lettered_maxlen_total, Config)). +%% https://github.com/rabbitmq/rabbitmq-server/issues/4940 +dead_letter_reject_requeue_reject_norequeue(Config) -> + {_Conn, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, 0), + QName = ?config(queue_name, Config), + DLXQName = ?config(queue_name_dlx, Config), + declare_dead_letter_queues(Ch, Config, QName, DLXQName), + + P = <<"msg">>, + publish(Ch, QName, [P]), + + %% Reject with requeue + wait_for_messages(Config, [[QName, <<"1">>, <<"1">>, <<"0">>]]), + [DTag0] = consume(Ch, QName, [P]), + wait_for_messages(Config, [[QName, <<"1">>, <<"0">>, <<"1">>]]), + amqp_channel:cast(Ch, #'basic.reject'{delivery_tag = DTag0, + requeue = true}), + + %% If QName is a quorum queue, Ra log contains #requeue{} command + %% instead of #enqueue{} command because no delivery-limit is set. + wait_for_messages(Config, [[QName, <<"1">>, <<"1">>, <<"0">>]]), + + %% Reject without requeue + [DTag1] = consume(Ch, QName, [P]), + wait_for_messages(Config, [[QName, <<"1">>, <<"0">>, <<"1">>]]), + amqp_channel:cast(Ch, #'basic.reject'{delivery_tag = DTag1, + requeue = false}), + wait_for_messages(Config, [[DLXQName, <<"1">>, <<"1">>, <<"0">>]]), + _ = consume(Ch, DLXQName, [P]), + consume_empty(Ch, DLXQName), + consume_empty(Ch, QName), + ?assertEqual(1, counted(messages_dead_lettered_rejected_total, Config)). + %% Another strategy: reject-publish-dlx dead_letter_max_length_reject_publish_dlx(Config) -> {_Conn, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, 0), diff --git a/deps/rabbit/test/quorum_queue_SUITE.erl b/deps/rabbit/test/quorum_queue_SUITE.erl index b6e0bf5c6a..464c2c23ae 100644 --- a/deps/rabbit/test/quorum_queue_SUITE.erl +++ b/deps/rabbit/test/quorum_queue_SUITE.erl @@ -1057,8 +1057,7 @@ invalid_policy(Config) -> Info = rpc:call(Server, rabbit_quorum_queue, infos, [rabbit_misc:r(<<"/">>, queue, QQ)]), ?assertEqual('', proplists:get_value(policy, Info)), - ok = rabbit_ct_broker_helpers:clear_policy(Config, 0, <<"ha">>), - ok. + ok = rabbit_ct_broker_helpers:clear_policy(Config, 0, <<"ha">>). pre_existing_invalid_policy(Config) -> [Server | _] = rabbit_ct_broker_helpers:get_node_configs(Config, nodename), diff --git a/deps/rabbit_common/Makefile b/deps/rabbit_common/Makefile index 684627a071..389c737c4a 100644 --- a/deps/rabbit_common/Makefile +++ b/deps/rabbit_common/Makefile @@ -47,8 +47,6 @@ DEP_PLUGINS = $(PROJECT)/mk/rabbitmq-build.mk \ $(PROJECT)/mk/rabbitmq-test.mk \ $(PROJECT)/mk/rabbitmq-tools.mk -WITHOUT = plugins/proper - PLT_APPS += mnesia crypto ssl include ../../rabbitmq-components.mk diff --git a/deps/rabbit_common/development.post.mk b/deps/rabbit_common/development.post.mk index 65708dbcd7..ec905a4615 100644 --- a/deps/rabbit_common/development.post.mk +++ b/deps/rabbit_common/development.post.mk @@ -2,7 +2,7 @@ # Framing sources generation. # -------------------------------------------------------------------- -PYTHON ?= python +PYTHON ?= python3 CODEGEN = $(CURDIR)/codegen.py CODEGEN_DIR ?= $(DEPS_DIR)/rabbitmq_codegen CODEGEN_AMQP = $(CODEGEN_DIR)/amqp_codegen.py diff --git a/deps/rabbit_common/src/rabbit_data_coercion.erl b/deps/rabbit_common/src/rabbit_data_coercion.erl index 8832856367..a470a0643c 100644 --- a/deps/rabbit_common/src/rabbit_data_coercion.erl +++ b/deps/rabbit_common/src/rabbit_data_coercion.erl @@ -11,10 +11,11 @@ -export([to_atom/2, atomize_keys/1, to_list_of_binaries/1]). -spec to_binary(Val :: binary() | list() | atom() | integer()) -> binary(). -to_binary(Val) when is_list(Val) -> list_to_binary(Val); -to_binary(Val) when is_atom(Val) -> atom_to_binary(Val, utf8); -to_binary(Val) when is_integer(Val) -> integer_to_binary(Val); -to_binary(Val) -> Val. +to_binary(Val) when is_list(Val) -> list_to_binary(Val); +to_binary(Val) when is_atom(Val) -> atom_to_binary(Val, utf8); +to_binary(Val) when is_integer(Val) -> integer_to_binary(Val); +to_binary(Val) when is_function(Val) -> list_to_binary(io_lib:format("~w", [Val])); +to_binary(Val) -> Val. -spec to_list(Val :: integer() | list() | binary() | atom() | map()) -> list(). to_list(Val) when is_list(Val) -> Val; diff --git a/deps/rabbit_common/src/rabbit_json.erl b/deps/rabbit_common/src/rabbit_json.erl index e434dee14e..a2cee6043e 100644 --- a/deps/rabbit_common/src/rabbit_json.erl +++ b/deps/rabbit_common/src/rabbit_json.erl @@ -44,15 +44,13 @@ encode(Term) -> -spec encode(jsx:json_term(), jsx_to_json:config()) -> jsx:json_text(). encode(Term, Opts) -> - jsx:encode(Term, Opts). - + jsx:encode(fixup_terms(Term), Opts). -spec try_encode(jsx:json_term()) -> {ok, jsx:json_text()} | {error, Reason :: term()}. try_encode(Term) -> try_encode(Term, []). - -spec try_encode(jsx:json_term(), jsx_to_term:config()) -> {ok, jsx:json_text()} | {error, Reason :: term()}. try_encode(Term, Opts) -> @@ -61,3 +59,23 @@ try_encode(Term, Opts) -> catch error: Reason -> {error, Reason} end. + +%% Fixup for JSON encoding. Transforms any Funs into strings +%% See rabbit_mgmt_format:format_nulls/1 +fixup_terms(Items) when is_list(Items) -> + [fixup_item(Pair) || Pair <- Items]; +fixup_terms(Item) -> + fixup_item(Item). + +fixup_item({Key, Value}) when is_function(Value) -> + {Key, rabbit_data_coercion:to_binary(Value)}; +fixup_item({Key, Value}) when is_list(Value) -> + {Key, fixup_terms(Value)}; +fixup_item({Key, Value}) -> + {Key, Value}; +fixup_item([{_K, _V} | _T] = L) -> + fixup_terms(L); +fixup_item(Value) when is_function(Value) -> + rabbit_data_coercion:to_binary(Value); +fixup_item(Value) -> + Value. diff --git a/deps/rabbitmq_amqp1_0/Makefile b/deps/rabbitmq_amqp1_0/Makefile index e764ed1f4a..11f08ca22b 100644 --- a/deps/rabbitmq_amqp1_0/Makefile +++ b/deps/rabbitmq_amqp1_0/Makefile @@ -23,12 +23,6 @@ DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk .DEFAULT_GOAL = all $(PROJECT).d:: $(EXTRA_SOURCES) -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_amqp1_0/src/rabbit_amqp1_0_reader.erl b/deps/rabbitmq_amqp1_0/src/rabbit_amqp1_0_reader.erl index 2d7b876733..a77e8e3ba7 100644 --- a/deps/rabbitmq_amqp1_0/src/rabbit_amqp1_0_reader.erl +++ b/deps/rabbitmq_amqp1_0/src/rabbit_amqp1_0_reader.erl @@ -671,6 +671,9 @@ auth_phase_1_0(Response, {ok, User = #user{username = Username}} -> case rabbit_access_control:check_user_loopback(Username, Sock) of ok -> + rabbit_log_connection:info( + "AMQP 1.0 connection ~p: user '~s' authenticated", + [self(), Username]), rabbit_core_metrics:auth_attempt_succeeded(<<>>, Username, amqp10), ok; not_allowed -> @@ -709,6 +712,10 @@ send_to_new_1_0_session(Channel, Frame, State) -> put({channel, Channel}, {ch_fr_pid, ChFrPid}), put({ch_sup_pid, ChSupPid}, {{channel, Channel}, {ch_fr_pid, ChFrPid}}), put({ch_fr_pid, ChFrPid}, {channel, Channel}), + rabbit_log_connection:info( + "AMQP 1.0 connection ~p: " + "user '~s' authenticated and granted access to vhost '~s'", + [self(), User#user.username, vhost(Hostname)]), ok = rabbit_amqp1_0_session:process_frame(ChFrPid, Frame); {error, {not_allowed, _}} -> rabbit_log:error("AMQP 1.0: user '~s' is not allowed to access virtual host '~s'", diff --git a/deps/rabbitmq_auth_backend_cache/Makefile b/deps/rabbitmq_auth_backend_cache/Makefile index d9b1c38763..4a91fb69bb 100644 --- a/deps/rabbitmq_auth_backend_cache/Makefile +++ b/deps/rabbitmq_auth_backend_cache/Makefile @@ -22,11 +22,5 @@ TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_auth_backend_http/Makefile b/deps/rabbitmq_auth_backend_http/Makefile index 21a71d0939..692dfeefb5 100644 --- a/deps/rabbitmq_auth_backend_http/Makefile +++ b/deps/rabbitmq_auth_backend_http/Makefile @@ -25,11 +25,5 @@ TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers cowboy DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_auth_backend_ldap/Makefile b/deps/rabbitmq_auth_backend_ldap/Makefile index b81a3624c9..6d97b82a39 100644 --- a/deps/rabbitmq_auth_backend_ldap/Makefile +++ b/deps/rabbitmq_auth_backend_ldap/Makefile @@ -42,11 +42,5 @@ dep_ct_helper = git https://github.com/extend/ct_helper.git master DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_auth_backend_oauth2/Makefile b/deps/rabbitmq_auth_backend_oauth2/Makefile index 7824e3d657..5ef0909c66 100644 --- a/deps/rabbitmq_auth_backend_oauth2/Makefile +++ b/deps/rabbitmq_auth_backend_oauth2/Makefile @@ -11,11 +11,5 @@ DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk dep_jose = git https://github.com/potatosalad/erlang-jose 2b1d66b dep_base64url = hex 1.0.1 -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_auth_mechanism_ssl/Makefile b/deps/rabbitmq_auth_mechanism_ssl/Makefile index 583668789e..d082725245 100644 --- a/deps/rabbitmq_auth_mechanism_ssl/Makefile +++ b/deps/rabbitmq_auth_mechanism_ssl/Makefile @@ -17,11 +17,5 @@ DEPS = rabbit_common rabbit DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_aws/Makefile b/deps/rabbitmq_aws/Makefile index 85c1fc9d11..1f55d79882 100644 --- a/deps/rabbitmq_aws/Makefile +++ b/deps/rabbitmq_aws/Makefile @@ -12,11 +12,5 @@ BUILD_DEPS = rabbit_common DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk TEST_DEPS = meck -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_cli/Makefile b/deps/rabbitmq_cli/Makefile index dc87ec8814..403d56fd80 100644 --- a/deps/rabbitmq_cli/Makefile +++ b/deps/rabbitmq_cli/Makefile @@ -21,19 +21,6 @@ ifeq ($(VERBOSE_TEST),true) MIX_TEST := $(MIX_TEST) --trace endif -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - -WITHOUT = plugins/cover \ - plugins/ct \ - plugins/dialyzer \ - plugins/eunit \ - plugins/proper \ - plugins/triq - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_cli/README.md b/deps/rabbitmq_cli/README.md index 1d1c1664d0..dca99a26ac 100644 --- a/deps/rabbitmq_cli/README.md +++ b/deps/rabbitmq_cli/README.md @@ -21,7 +21,7 @@ Team RabbitMQ wanted a set of tools that ## Supported RabbitMQ Versions Long lived branches in this repository track the same branch in RabbitMQ core and related -repositories. So `master` tracks `master` in rabbitmq-server, `v3.7.x` tracks branch `v3.7.x` in +repositories. So `master` tracks `master` in rabbitmq-server, `v3.10.x` tracks branch `v3.10.x` in rabbitmq-server and so on. Please use the version of CLI tools that come with the RabbitMQ distribution version installed. @@ -33,8 +33,8 @@ Please use the version of CLI tools that come with the RabbitMQ distribution ver Building this project requires - * Erlang/OTP 21.3 (or later) - * [Elixir](https://elixir-lang.org/) 1.10.0 (or later). + * Erlang/OTP 23.3 (or later) + * [Elixir](https://elixir-lang.org/) 1.12.0 (or later). Command line tools depend on [rabbitmq-common](https://github.com/rabbitmq/rabbitmq-common). Dependencies are being resolved by `erlang.mk` diff --git a/deps/rabbitmq_consistent_hash_exchange/Makefile b/deps/rabbitmq_consistent_hash_exchange/Makefile index b1b5b07f68..4d02f402cc 100644 --- a/deps/rabbitmq_consistent_hash_exchange/Makefile +++ b/deps/rabbitmq_consistent_hash_exchange/Makefile @@ -11,11 +11,5 @@ TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers amqp_client DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_ct_client_helpers/Makefile b/deps/rabbitmq_ct_client_helpers/Makefile index eb18f4fbad..43fc9e37c2 100644 --- a/deps/rabbitmq_ct_client_helpers/Makefile +++ b/deps/rabbitmq_ct_client_helpers/Makefile @@ -3,12 +3,6 @@ PROJECT_DESCRIPTION = Common Test helpers for RabbitMQ (client-side helpers) DEPS = rabbit_common rabbitmq_ct_helpers amqp_client -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - DEP_PLUGINS = rabbit_common/mk/rabbitmq-build.mk \ rabbit_common/mk/rabbitmq-tools.mk diff --git a/deps/rabbitmq_ct_helpers/Makefile b/deps/rabbitmq_ct_helpers/Makefile index 45f3d99c45..54628feecd 100644 --- a/deps/rabbitmq_ct_helpers/Makefile +++ b/deps/rabbitmq_ct_helpers/Makefile @@ -8,12 +8,6 @@ dep_rabbit_common = git-subfolder https://github.com/rabbitmq/rabbitmq-server m dep_rabbit = git-subfolder https://github.com/rabbitmq/rabbitmq-server master deps/rabbit dep_inet_tcp_proxy = git https://github.com/rabbitmq/inet_tcp_proxy master -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - DEP_PLUGINS = rabbit_common/mk/rabbitmq-build.mk \ rabbit_common/mk/rabbitmq-dist.mk \ rabbit_common/mk/rabbitmq-run.mk \ diff --git a/deps/rabbitmq_event_exchange/Makefile b/deps/rabbitmq_event_exchange/Makefile index 9058e29d26..f1f5ff81d9 100644 --- a/deps/rabbitmq_event_exchange/Makefile +++ b/deps/rabbitmq_event_exchange/Makefile @@ -11,10 +11,5 @@ TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers amqp_client DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_federation/Makefile b/deps/rabbitmq_federation/Makefile index e9883aae9f..72b356986b 100644 --- a/deps/rabbitmq_federation/Makefile +++ b/deps/rabbitmq_federation/Makefile @@ -19,11 +19,5 @@ TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_federation_management/Makefile b/deps/rabbitmq_federation_management/Makefile index 4442a79502..5a97cb8318 100644 --- a/deps/rabbitmq_federation_management/Makefile +++ b/deps/rabbitmq_federation_management/Makefile @@ -11,11 +11,5 @@ TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_jms_topic_exchange/Makefile b/deps/rabbitmq_jms_topic_exchange/Makefile index c5d4a51afd..7d1dd52bfe 100644 --- a/deps/rabbitmq_jms_topic_exchange/Makefile +++ b/deps/rabbitmq_jms_topic_exchange/Makefile @@ -7,11 +7,5 @@ TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers amqp_client DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_management/Makefile b/deps/rabbitmq_management/Makefile index 8168111e6a..c092c90f5e 100644 --- a/deps/rabbitmq_management/Makefile +++ b/deps/rabbitmq_management/Makefile @@ -31,12 +31,6 @@ BUILD_DEPS += ranch DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_management_agent/Makefile b/deps/rabbitmq_management_agent/Makefile index 4df0236560..cfffcfc5c9 100644 --- a/deps/rabbitmq_management_agent/Makefile +++ b/deps/rabbitmq_management_agent/Makefile @@ -23,12 +23,6 @@ LOCAL_DEPS += xmerl mnesia ranch ssl crypto public_key DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk TEST_DEPS := $(filter-out rabbitmq_test,$(TEST_DEPS)) include ../../erlang.mk diff --git a/deps/rabbitmq_management_agent/src/rabbit_mgmt_format.erl b/deps/rabbitmq_management_agent/src/rabbit_mgmt_format.erl index b3742bd42d..765040360c 100644 --- a/deps/rabbitmq_management_agent/src/rabbit_mgmt_format.erl +++ b/deps/rabbitmq_management_agent/src/rabbit_mgmt_format.erl @@ -252,7 +252,7 @@ format_socket_opts([{ssl_opts, Value} | Tail], Acc) -> %% exclude options that have values that are nested %% data structures or may include functions. They are fairly %% obscure and not worth reporting via HTTP API. -format_socket_opts([{verify_fun, _Value} | Tail], Acc) -> +format_socket_opts([{customize_hostname_check, _Value} | Tail], Acc) -> format_socket_opts(Tail, Acc); format_socket_opts([{crl_cache, _Value} | Tail], Acc) -> format_socket_opts(Tail, Acc); @@ -277,7 +277,10 @@ format_socket_opts([{ciphers, _Value} | Tail], Acc) -> format_socket_opts([Head | Tail], Acc) when is_atom(Head) -> format_socket_opts(Tail, [{Head, true} | Acc]); %% verify_fun value is a tuple that includes a function -format_socket_opts([_Head = {verify_fun, _Value} | Tail], Acc) -> +format_socket_opts([{verify_fun, _Value} | Tail], Acc) -> + format_socket_opts(Tail, Acc); +%% match_fun value is a tuple that includes a function +format_socket_opts([{match_fun, _Value} | Tail], Acc) -> format_socket_opts(Tail, Acc); format_socket_opts([Head = {Name, Value} | Tail], Acc) when is_list(Value) -> case io_lib:printable_unicode_list(Value) of diff --git a/deps/rabbitmq_mqtt/Makefile b/deps/rabbitmq_mqtt/Makefile index 9c2bcbdca0..81919d0e85 100644 --- a/deps/rabbitmq_mqtt/Makefile +++ b/deps/rabbitmq_mqtt/Makefile @@ -40,12 +40,6 @@ dep_emqttc = git https://github.com/rabbitmq/emqttc.git remove-logging DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_peer_discovery_aws/Makefile b/deps/rabbitmq_peer_discovery_aws/Makefile index 6ec7bdddba..4052fec455 100644 --- a/deps/rabbitmq_peer_discovery_aws/Makefile +++ b/deps/rabbitmq_peer_discovery_aws/Makefile @@ -9,11 +9,5 @@ dep_ct_helper = git https://github.com/extend/ct_helper.git master DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_peer_discovery_common/Makefile b/deps/rabbitmq_peer_discovery_common/Makefile index d7a42a699c..9ac0691e8e 100644 --- a/deps/rabbitmq_peer_discovery_common/Makefile +++ b/deps/rabbitmq_peer_discovery_common/Makefile @@ -10,11 +10,5 @@ dep_ct_helper = git https://github.com/extend/ct_helper.git master DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_peer_discovery_consul/Makefile b/deps/rabbitmq_peer_discovery_consul/Makefile index fe3395c548..f51ce7c8bd 100644 --- a/deps/rabbitmq_peer_discovery_consul/Makefile +++ b/deps/rabbitmq_peer_discovery_consul/Makefile @@ -9,11 +9,5 @@ dep_ct_helper = git https://github.com/extend/ct_helper.git master DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_peer_discovery_etcd/Makefile b/deps/rabbitmq_peer_discovery_etcd/Makefile index 53943852a0..5f83b51e37 100644 --- a/deps/rabbitmq_peer_discovery_etcd/Makefile +++ b/deps/rabbitmq_peer_discovery_etcd/Makefile @@ -11,11 +11,5 @@ dep_eetcd = hex 0.3.5 DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_peer_discovery_k8s/Makefile b/deps/rabbitmq_peer_discovery_k8s/Makefile index 9a12e3bc10..01a791551c 100644 --- a/deps/rabbitmq_peer_discovery_k8s/Makefile +++ b/deps/rabbitmq_peer_discovery_k8s/Makefile @@ -9,11 +9,5 @@ dep_ct_helper = git https://github.com/extend/ct_helper.git master DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_prometheus/Makefile b/deps/rabbitmq_prometheus/Makefile index 333a3a3823..9a092a5e27 100644 --- a/deps/rabbitmq_prometheus/Makefile +++ b/deps/rabbitmq_prometheus/Makefile @@ -15,12 +15,6 @@ EUNIT_OPTS = no_tty, {report, {eunit_progress, [colored, profile]}} DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - ifneq ($(DISABLE_METRICS_COLLECTOR),) RABBITMQ_CONFIG_FILE = $(CURDIR)/rabbitmq-disable-metrics-collector.conf export RABBITMQ_CONFIG_FILE diff --git a/deps/rabbitmq_random_exchange/Makefile b/deps/rabbitmq_random_exchange/Makefile index 3804919948..1b047d791e 100644 --- a/deps/rabbitmq_random_exchange/Makefile +++ b/deps/rabbitmq_random_exchange/Makefile @@ -7,11 +7,5 @@ TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers amqp_client DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_recent_history_exchange/Makefile b/deps/rabbitmq_recent_history_exchange/Makefile index e0eeabcecf..d4b71fdc4f 100644 --- a/deps/rabbitmq_recent_history_exchange/Makefile +++ b/deps/rabbitmq_recent_history_exchange/Makefile @@ -11,11 +11,5 @@ TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers amqp_client DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_sharding/Makefile b/deps/rabbitmq_sharding/Makefile index 544033327e..ce296c4a5e 100644 --- a/deps/rabbitmq_sharding/Makefile +++ b/deps/rabbitmq_sharding/Makefile @@ -11,11 +11,5 @@ TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers amqp_client DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_shovel/Makefile b/deps/rabbitmq_shovel/Makefile index 493372cb80..df31371fb5 100644 --- a/deps/rabbitmq_shovel/Makefile +++ b/deps/rabbitmq_shovel/Makefile @@ -29,12 +29,5 @@ DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk elvis_mk dep_elvis_mk = git https://github.com/inaka/elvis.mk.git master - -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_shovel_management/Makefile b/deps/rabbitmq_shovel_management/Makefile index ddd55a891a..7d0ee2b5d6 100644 --- a/deps/rabbitmq_shovel_management/Makefile +++ b/deps/rabbitmq_shovel_management/Makefile @@ -11,11 +11,5 @@ TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers rabbitmq_amqp1_0 DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_stomp/Makefile b/deps/rabbitmq_stomp/Makefile index fa72edacaa..753ffcf489 100644 --- a/deps/rabbitmq_stomp/Makefile +++ b/deps/rabbitmq_stomp/Makefile @@ -36,11 +36,5 @@ TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_stream/Makefile b/deps/rabbitmq_stream/Makefile index ac7c2e7472..97002560a3 100644 --- a/deps/rabbitmq_stream/Makefile +++ b/deps/rabbitmq_stream/Makefile @@ -27,11 +27,5 @@ TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers amqp_client DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_stream_common/Makefile b/deps/rabbitmq_stream_common/Makefile index 726ede0394..57ee5cb313 100644 --- a/deps/rabbitmq_stream_common/Makefile +++ b/deps/rabbitmq_stream_common/Makefile @@ -14,11 +14,5 @@ TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_stream_management/Makefile b/deps/rabbitmq_stream_management/Makefile index 1d66057f23..abd9565514 100644 --- a/deps/rabbitmq_stream_management/Makefile +++ b/deps/rabbitmq_stream_management/Makefile @@ -14,11 +14,5 @@ TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_top/Makefile b/deps/rabbitmq_top/Makefile index 4e38544d44..e841d34414 100644 --- a/deps/rabbitmq_top/Makefile +++ b/deps/rabbitmq_top/Makefile @@ -11,11 +11,5 @@ DEPS = rabbit_common rabbit amqp_client rabbitmq_management DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_tracing/Makefile b/deps/rabbitmq_tracing/Makefile index 5c63c75693..46216f4154 100644 --- a/deps/rabbitmq_tracing/Makefile +++ b/deps/rabbitmq_tracing/Makefile @@ -20,11 +20,5 @@ TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_trust_store/Makefile b/deps/rabbitmq_trust_store/Makefile index ac001d0eec..75e43f411e 100644 --- a/deps/rabbitmq_trust_store/Makefile +++ b/deps/rabbitmq_trust_store/Makefile @@ -19,11 +19,5 @@ dep_trust_store_http = git https://github.com/rabbitmq/trust_store_http.git DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_web_dispatch/Makefile b/deps/rabbitmq_web_dispatch/Makefile index fd377840ab..e54df3ae58 100644 --- a/deps/rabbitmq_web_dispatch/Makefile +++ b/deps/rabbitmq_web_dispatch/Makefile @@ -15,12 +15,6 @@ dep_cowboy = hex 2.0.0 DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk TEST_DEPS := $(filter-out rabbitmq_test,$(TEST_DEPS)) include ../../erlang.mk diff --git a/deps/rabbitmq_web_mqtt/Makefile b/deps/rabbitmq_web_mqtt/Makefile index 7084d2f15e..e31f164954 100644 --- a/deps/rabbitmq_web_mqtt/Makefile +++ b/deps/rabbitmq_web_mqtt/Makefile @@ -23,11 +23,5 @@ BUILD_DEPS += ranch DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_web_mqtt_examples/Makefile b/deps/rabbitmq_web_mqtt_examples/Makefile index 2362ec929e..78151d80d9 100644 --- a/deps/rabbitmq_web_mqtt_examples/Makefile +++ b/deps/rabbitmq_web_mqtt_examples/Makefile @@ -13,11 +13,5 @@ DEPS = rabbit_common rabbit rabbitmq_web_dispatch rabbitmq_web_mqtt DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_web_stomp/Makefile b/deps/rabbitmq_web_stomp/Makefile index c249da064d..727cbfaf18 100644 --- a/deps/rabbitmq_web_stomp/Makefile +++ b/deps/rabbitmq_web_stomp/Makefile @@ -29,11 +29,5 @@ BUILD_DEPS += ranch DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk diff --git a/deps/rabbitmq_web_stomp_examples/Makefile b/deps/rabbitmq_web_stomp_examples/Makefile index d845375694..c45e738020 100644 --- a/deps/rabbitmq_web_stomp_examples/Makefile +++ b/deps/rabbitmq_web_stomp_examples/Makefile @@ -13,11 +13,5 @@ DEPS = rabbit_common rabbit rabbitmq_web_dispatch rabbitmq_web_stomp DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk -# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be -# reviewed and merged. - -ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git -ERLANG_MK_COMMIT = rabbitmq-tmp - include ../../rabbitmq-components.mk include ../../erlang.mk @@ -17,7 +17,7 @@ ERLANG_MK_FILENAME := $(realpath $(lastword $(MAKEFILE_LIST))) export ERLANG_MK_FILENAME -ERLANG_MK_VERSION = 2019.07.01-53-gd80984c +ERLANG_MK_VERSION = bf7a194 ERLANG_MK_WITHOUT = # Make 3.81 and 3.82 are deprecated. @@ -2735,7 +2735,7 @@ pkg_mochiweb_description = MochiWeb is an Erlang library for building lightweigh pkg_mochiweb_homepage = https://github.com/mochi/mochiweb pkg_mochiweb_fetch = git pkg_mochiweb_repo = https://github.com/mochi/mochiweb -pkg_mochiweb_commit = master +pkg_mochiweb_commit = main PACKAGES += mochiweb_xpath pkg_mochiweb_xpath_name = mochiweb_xpath @@ -3391,7 +3391,7 @@ pkg_relx_description = Sane, simple release creation for Erlang pkg_relx_homepage = https://github.com/erlware/relx pkg_relx_fetch = git pkg_relx_repo = https://github.com/erlware/relx -pkg_relx_commit = master +pkg_relx_commit = main PACKAGES += resource_discovery pkg_resource_discovery_name = resource_discovery @@ -4959,9 +4959,12 @@ endef define dep_autopatch_appsrc_script.erl AppSrc = "$(call core_native_path,$(DEPS_DIR)/$1/src/$1.app.src)", AppSrcScript = AppSrc ++ ".script", - {ok, Conf0} = file:consult(AppSrc), + Conf1 = case file:consult(AppSrc) of + {ok, Conf0} -> Conf0; + {error, enoent} -> [] + end, Bindings0 = erl_eval:new_bindings(), - Bindings1 = erl_eval:add_binding('CONFIG', Conf0, Bindings0), + Bindings1 = erl_eval:add_binding('CONFIG', Conf1, Bindings0), Bindings = erl_eval:add_binding('SCRIPT', AppSrcScript, Bindings1), Conf = case file:script(AppSrcScript, Bindings) of {ok, [C]} -> C; @@ -5829,6 +5832,8 @@ endef define bs_relx_config {release, {$p_release, "1"}, [$p, sasl, runtime_tools]}. +{dev_mode, false}. +{include_erts, true}. {extended_start_script, true}. {sys_config, "config/sys.config"}. {vm_args, "config/vm.args"}. @@ -6185,6 +6190,8 @@ endif $(verbose) mkdir config/ $(verbose) $(call core_render,bs_sys_config,config/sys.config) $(verbose) $(call core_render,bs_vm_args,config/vm.args) + $(verbose) awk '/^include erlang.mk/ && !ins {print "BUILD_DEPS += relx";ins=1};{print}' Makefile > Makefile.bak + $(verbose) mv Makefile.bak Makefile new-app: ifndef in @@ -7460,15 +7467,13 @@ endif # Copyright (c) 2013-2016, Loïc Hoguin <essen@ninenines.eu> # This file is part of erlang.mk and subject to the terms of the ISC License. +ifeq ($(filter relx,$(BUILD_DEPS) $(DEPS) $(REL_DEPS)),relx) .PHONY: relx-rel relx-relup distclean-relx-rel run # Configuration. -RELX ?= $(ERLANG_MK_TMP)/relx RELX_CONFIG ?= $(CURDIR)/relx.config -RELX_URL ?= https://erlang.mk/res/relx-v3.27.0 -RELX_OPTS ?= RELX_OUTPUT_DIR ?= _rel RELX_REL_EXT ?= RELX_TAR ?= 1 @@ -7477,12 +7482,6 @@ ifdef SFX RELX_TAR = 1 endif -ifeq ($(firstword $(RELX_OPTS)),-o) - RELX_OUTPUT_DIR = $(word 2,$(RELX_OPTS)) -else - RELX_OPTS += -o $(RELX_OUTPUT_DIR) -endif - # Core targets. ifeq ($(IS_DEP),) @@ -7497,21 +7496,59 @@ distclean:: distclean-relx-rel # Plugin-specific targets. -$(RELX): | $(ERLANG_MK_TMP) - $(gen_verbose) $(call core_http_get,$(RELX),$(RELX_URL)) - $(verbose) chmod +x $(RELX) +define relx_release.erl + {ok, Config} = file:consult("$(call core_native_path,$(RELX_CONFIG))"), + {release, {Name, Vsn0}, _} = lists:keyfind(release, 1, Config), + Vsn = case Vsn0 of + {cmd, Cmd} -> os:cmd(Cmd); + semver -> ""; + {semver, _} -> ""; + VsnStr -> Vsn0 + end, + {ok, _} = relx:build_release(#{name => Name, vsn => Vsn}, Config), + halt(0). +endef + +define relx_tar.erl + {ok, Config} = file:consult("$(call core_native_path,$(RELX_CONFIG))"), + {release, {Name, Vsn0}, _} = lists:keyfind(release, 1, Config), + Vsn = case Vsn0 of + {cmd, Cmd} -> os:cmd(Cmd); + semver -> ""; + {semver, _} -> ""; + VsnStr -> Vsn0 + end, + {ok, _} = relx:build_tar(#{name => Name, vsn => Vsn}, Config), + halt(0). +endef + +define relx_relup.erl + {ok, Config} = file:consult("$(call core_native_path,$(RELX_CONFIG))"), + {release, {Name, Vsn0}, _} = lists:keyfind(release, 1, Config), + Vsn = case Vsn0 of + {cmd, Cmd} -> os:cmd(Cmd); + semver -> ""; + {semver, _} -> ""; + VsnStr -> Vsn0 + end, + {ok, _} = relx:build_relup(Name, Vsn, undefined, Config ++ [{output_dir, "$(RELX_OUTPUT_DIR)"}]), + halt(0). +endef -relx-rel: $(RELX) rel-deps app - $(verbose) $(RELX) $(if $(filter 1,$V),-V 3) -c $(RELX_CONFIG) $(RELX_OPTS) release +relx-rel: rel-deps app + $(call erlang,$(call relx_release.erl),-pa ebin/) $(verbose) $(MAKE) relx-post-rel ifeq ($(RELX_TAR),1) - $(verbose) $(RELX) $(if $(filter 1,$V),-V 3) -c $(RELX_CONFIG) $(RELX_OPTS) tar + $(call erlang,$(call relx_tar.erl),-pa ebin/) endif -relx-relup: $(RELX) rel-deps app - $(verbose) $(RELX) $(if $(filter 1,$V),-V 3) -c $(RELX_CONFIG) $(RELX_OPTS) release +relx-relup: rel-deps app + $(call erlang,$(call relx_release.erl),-pa ebin/) $(MAKE) relx-post-rel - $(verbose) $(RELX) $(if $(filter 1,$V),-V 3) -c $(RELX_CONFIG) $(RELX_OPTS) relup $(if $(filter 1,$(RELX_TAR)),tar) + $(call erlang,$(call relx_relup.erl),-pa ebin/) +ifeq ($(RELX_TAR),1) + $(call erlang,$(call relx_tar.erl),-pa ebin/) +endif distclean-relx-rel: $(gen_verbose) rm -rf $(RELX_OUTPUT_DIR) @@ -7568,6 +7605,7 @@ help:: " run Compile the project, build the release and run it" endif +endif # Copyright (c) 2015-2016, Loïc Hoguin <essen@ninenines.eu> # Copyright (c) 2014, M Robert Martin <rob@version2beta.com> @@ -7739,45 +7777,224 @@ triq: test-build cover-data-dir endif endif -# Copyright (c) 2016, Loïc Hoguin <essen@ninenines.eu> -# Copyright (c) 2015, Erlang Solutions Ltd. +# Copyright (c) 2022, Loïc Hoguin <essen@ninenines.eu> # This file is part of erlang.mk and subject to the terms of the ISC License. -.PHONY: xref distclean-xref +.PHONY: xref # Configuration. -ifeq ($(XREF_CONFIG),) - XREFR_ARGS := -else - XREFR_ARGS := -c $(XREF_CONFIG) -endif +# We do not use locals_not_used or deprecated_function_calls +# because the compiler will error out by default in those +# cases with Erlang.mk. Deprecated functions may make sense +# in some cases but few libraries define them. We do not +# use exports_not_used by default because it hinders more +# than it helps library projects such as Cowboy. Finally, +# undefined_functions provides little that undefined_function_calls +# doesn't already provide, so it's not enabled by default. +XREF_CHECKS ?= [undefined_function_calls] + +# Instead of predefined checks a query can be evaluated +# using the Xref DSL. The $q variable is used in that case. + +# The scope is a list of keywords that correspond to +# application directories, being essentially an easy way +# to configure which applications to analyze. With: +# +# - app: . +# - apps: $(ALL_APPS_DIRS) +# - deps: $(ALL_DEPS_DIRS) +# - otp: Built-in Erlang/OTP applications. +# +# The default is conservative (app) and will not be +# appropriate for all types of queries (for example +# application_call requires adding all applications +# that might be called or they will not be found). +XREF_SCOPE ?= app # apps deps otp + +# If the above is not enough, additional application +# directories can be configured. +XREF_EXTRA_APP_DIRS ?= -XREFR ?= $(CURDIR)/xrefr -export XREFR +# As well as additional non-application directories. +XREF_EXTRA_DIRS ?= -XREFR_URL ?= https://github.com/inaka/xref_runner/releases/download/1.1.0/xrefr +# Erlang.mk supports -ignore_xref([...]) with forms +# {M, F, A} | {F, A} | M, the latter ignoring whole +# modules. Ignores can also be provided project-wide. +XREF_IGNORE ?= [] + +# All callbacks may be ignored. Erlang.mk will ignore +# them automatically for exports_not_used (unless it +# is explicitly disabled by the user). +XREF_IGNORE_CALLBACKS ?= # Core targets. help:: $(verbose) printf '%s\n' '' \ 'Xref targets:' \ - ' xref Run Xrefr using $$XREF_CONFIG as config file if defined' - -distclean:: distclean-xref + ' xref Analyze the project using Xref' \ + ' xref q=QUERY Evaluate an Xref query' # Plugin-specific targets. -$(XREFR): - $(gen_verbose) $(call core_http_get,$(XREFR),$(XREFR_URL)) - $(verbose) chmod +x $(XREFR) - -xref: deps app $(XREFR) - $(gen_verbose) $(XREFR) $(XREFR_ARGS) +define xref.erl + {ok, Xref} = xref:start([]), + Scope = [$(call comma_list,$(XREF_SCOPE))], + AppDirs0 = [$(call comma_list,$(foreach d,$(XREF_EXTRA_APP_DIRS),"$d"))], + AppDirs1 = case lists:member(otp, Scope) of + false -> AppDirs0; + true -> + RootDir = code:root_dir(), + AppDirs0 ++ [filename:dirname(P) || P <- code:get_path(), lists:prefix(RootDir, P)] + end, + AppDirs2 = case lists:member(deps, Scope) of + false -> AppDirs1; + true -> [$(call comma_list,$(foreach d,$(ALL_DEPS_DIRS),"$d"))] ++ AppDirs1 + end, + AppDirs3 = case lists:member(apps, Scope) of + false -> AppDirs2; + true -> [$(call comma_list,$(foreach d,$(ALL_APPS_DIRS),"$d"))] ++ AppDirs2 + end, + AppDirs = case lists:member(app, Scope) of + false -> AppDirs3; + true -> ["../$(notdir $(CURDIR))"|AppDirs3] + end, + [{ok, _} = xref:add_application(Xref, AppDir, [{builtins, true}]) || AppDir <- AppDirs], + ExtraDirs = [$(call comma_list,$(foreach d,$(XREF_EXTRA_DIRS),"$d"))], + [{ok, _} = xref:add_directory(Xref, ExtraDir, [{builtins, true}]) || ExtraDir <- ExtraDirs], + ok = xref:set_library_path(Xref, code:get_path() -- (["ebin", "."] ++ AppDirs ++ ExtraDirs)), + Checks = case {$1, is_list($2)} of + {check, true} -> $2; + {check, false} -> [$2]; + {query, _} -> [$2] + end, + FinalRes = [begin + IsInformational = case $1 of + query -> true; + check -> + is_tuple(Check) andalso + lists:member(element(1, Check), + [call, use, module_call, module_use, application_call, application_use]) + end, + {ok, Res0} = case $1 of + check -> xref:analyze(Xref, Check); + query -> xref:q(Xref, Check) + end, + Res = case IsInformational of + true -> Res0; + false -> + lists:filter(fun(R) -> + {Mod, InMFA, MFA} = case R of + {InMFA0 = {M, _, _}, MFA0} -> {M, InMFA0, MFA0}; + {M, _, _} -> {M, R, R} + end, + Attrs = try + Mod:module_info(attributes) + catch error:undef -> + [] + end, + InlineIgnores = lists:flatten([ + [case V of + M when is_atom(M) -> {M, '_', '_'}; + {F, A} -> {Mod, F, A}; + _ -> V + end || V <- Values] + || {ignore_xref, Values} <- Attrs]), + BuiltinIgnores = [ + {eunit_test, wrapper_test_exported_, 0} + ], + DoCallbackIgnores = case {Check, "$(strip $(XREF_IGNORE_CALLBACKS))"} of + {exports_not_used, ""} -> true; + {_, "0"} -> false; + _ -> true + end, + CallbackIgnores = case DoCallbackIgnores of + false -> []; + true -> + Behaviors = lists:flatten([ + [BL || {behavior, BL} <- Attrs], + [BL || {behaviour, BL} <- Attrs] + ]), + [{Mod, CF, CA} || B <- Behaviors, {CF, CA} <- B:behaviour_info(callbacks)] + end, + WideIgnores = if + is_list($(XREF_IGNORE)) -> + [if is_atom(I) -> {I, '_', '_'}; true -> I end + || I <- $(XREF_IGNORE)]; + true -> [$(XREF_IGNORE)] + end, + Ignores = InlineIgnores ++ BuiltinIgnores ++ CallbackIgnores ++ WideIgnores, + not (lists:member(InMFA, Ignores) + orelse lists:member(MFA, Ignores) + orelse lists:member({Mod, '_', '_'}, Ignores)) + end, Res0) + end, + case Res of + [] -> ok; + _ when IsInformational -> + case Check of + {call, {CM, CF, CA}} -> + io:format("Functions that ~s:~s/~b calls:~n", [CM, CF, CA]); + {use, {CM, CF, CA}} -> + io:format("Function ~s:~s/~b is called by:~n", [CM, CF, CA]); + {module_call, CMod} -> + io:format("Modules that ~s calls:~n", [CMod]); + {module_use, CMod} -> + io:format("Module ~s is used by:~n", [CMod]); + {application_call, CApp} -> + io:format("Applications that ~s calls:~n", [CApp]); + {application_use, CApp} -> + io:format("Application ~s is used by:~n", [CApp]); + _ when $1 =:= query -> + io:format("Query ~s returned:~n", [Check]) + end, + [case R of + {{InM, InF, InA}, {M, F, A}} -> + io:format("- ~s:~s/~b called by ~s:~s/~b~n", + [M, F, A, InM, InF, InA]); + {M, F, A} -> + io:format("- ~s:~s/~b~n", [M, F, A]); + ModOrApp -> + io:format("- ~s~n", [ModOrApp]) + end || R <- Res], + ok; + _ -> + [case {Check, R} of + {undefined_function_calls, {{InM, InF, InA}, {M, F, A}}} -> + io:format("Undefined function ~s:~s/~b called by ~s:~s/~b~n", + [M, F, A, InM, InF, InA]); + {undefined_functions, {M, F, A}} -> + io:format("Undefined function ~s:~s/~b~n", [M, F, A]); + {locals_not_used, {M, F, A}} -> + io:format("Unused local function ~s:~s/~b~n", [M, F, A]); + {exports_not_used, {M, F, A}} -> + io:format("Unused exported function ~s:~s/~b~n", [M, F, A]); + {deprecated_function_calls, {{InM, InF, InA}, {M, F, A}}} -> + io:format("Deprecated function ~s:~s/~b called by ~s:~s/~b~n", + [M, F, A, InM, InF, InA]); + {deprecated_functions, {M, F, A}} -> + io:format("Deprecated function ~s:~s/~b~n", [M, F, A]); + _ -> + io:format("~p: ~p~n", [Check, R]) + end || R <- Res], + error + end + end || Check <- Checks], + stopped = xref:stop(Xref), + case lists:usort(FinalRes) of + [ok] -> halt(0); + _ -> halt(1) + end +endef -distclean-xref: - $(gen_verbose) rm -rf $(XREFR) +xref: deps app +ifdef q + $(verbose) $(call erlang,$(call xref.erl,query,"$q"),-pa ebin/) +else + $(verbose) $(call erlang,$(call xref.erl,check,$(XREF_CHECKS)),-pa ebin/) +endif # Copyright (c) 2016, Loïc Hoguin <essen@ninenines.eu> # Copyright (c) 2015, Viktor Söderqvist <viktor@zuiderkwast.se> diff --git a/release-notes/3.10.5.md b/release-notes/3.10.5.md index b8d58d9016..dc93538427 100644 --- a/release-notes/3.10.5.md +++ b/release-notes/3.10.5.md @@ -13,6 +13,15 @@ Erlang version requirements for RabbitMQ. Release notes can be found on GitHub at [rabbitmq-server/release-notes](https://github.com/rabbitmq/rabbitmq-server/tree/v3.10.x/release-notes). +### Core Server + +#### Bug Fixes + + * Quorum queue could run into an exception when dead lettering a message + under certain conditions. + + GitHub issue: [#4947](https://github.com/rabbitmq/rabbitmq-server/pull/4947) + ### Debian Package * RabbitMQ Debian package now lists Erlang 25.0 as supported. |