From 3b7d11186613191ee9acdb20243cf29243813c56 Mon Sep 17 00:00:00 2001 From: Alexey Lebedeff Date: Mon, 15 Feb 2016 19:19:13 +0300 Subject: [PATCH] Fix rabbitmqctl segfaults Backport upstream fix https://github.com/rabbitmq/rabbitmq-common/pull/54 rabbitmqctl causes erlang undefined behaviour while printing error messages. When erlang 18.X is used it's actually causing segfault. Change-Id: I8a1c741086a6f37b57b70de59488e44e59def23b Closes-Bug: #1541819 --- debian/changelog | 6 +++++ debian/patches/erlang-18-segfault.diff | 31 ++++++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 38 insertions(+) create mode 100644 debian/patches/erlang-18-segfault.diff diff --git a/debian/changelog b/debian/changelog index cc4dff8..b7f3432 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +rabbitmq-server (3.5.6-1~u14.04+mos5) mos8.0; urgency=medium + + * Backport https://github.com/rabbitmq/rabbitmq-common/pull/54 + + -- Alexey Lebedeff Mon, 15 Feb 2016 19:17:40 +0300 + rabbitmq-server (3.5.6-1~u14.04+mos4) mos8.0; urgency=medium * Backport https://github.com/rabbitmq/rabbitmq-common/pull/26 diff --git a/debian/patches/erlang-18-segfault.diff b/debian/patches/erlang-18-segfault.diff new file mode 100644 index 0000000..b9eaa03 --- /dev/null +++ b/debian/patches/erlang-18-segfault.diff @@ -0,0 +1,31 @@ +Description: Fix rabbitmqctl segfault + Rabbitmq contains code that is actually undefined behaviour. While it worked in R16, 17 and will + work in 19, it was causing segfaults in 18.X +Author: Alexey Lebedeff +Origin: upstream +Bug: https://github.com/rabbitmq/rabbitmq-common/issues/53 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/src/rabbit_misc.erl ++++ b/src/rabbit_misc.erl +@@ -652,19 +652,7 @@ format_many(List) -> + lists:flatten([io_lib:format(F ++ "~n", A) || {F, A} <- List]). + + format_stderr(Fmt, Args) -> +- case os:type() of +- {unix, _} -> +- Port = open_port({fd, 0, 2}, [out]), +- port_command(Port, io_lib:format(Fmt, Args)), +- port_close(Port); +- {win32, _} -> +- %% stderr on Windows is buffered and I can't figure out a +- %% way to trigger a fflush(stderr) in Erlang. So rather +- %% than risk losing output we write to stdout instead, +- %% which appears to be unbuffered. +- io:format(Fmt, Args) +- end, +- ok. ++ io:format(standard_error, Fmt, Args). + + unfold(Fun, Init) -> + unfold(Fun, [], Init). diff --git a/debian/patches/series b/debian/patches/series index 651a942..c1b8dbe 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ fix-pmon-demonitor-function.diff fix-management-startup-after-split.diff detect-stuck-queue-on-declare.diff +erlang-18-segfault.diff -- 2.45.2