]> review.fuel-infra Code Review - packages/trusty/rabbitmq-server.git/commitdiff
Fix rabbitmqctl segfaults 98/18898/1 8.0
authorAlexey Lebedeff <alebedev@mirantis.com>
Mon, 15 Feb 2016 16:19:13 +0000 (19:19 +0300)
committerAlexey Lebedeff <alebedev@mirantis.com>
Tue, 29 Mar 2016 15:24:30 +0000 (18:24 +0300)
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
debian/patches/erlang-18-segfault.diff [new file with mode: 0644]
debian/patches/series

index cc4dff8d5d85e23e61bfa7ffff472e3bc52de13a..b7f34327978a7a32b9663a30eaeb7ffe00ad8783 100644 (file)
@@ -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 <alebedev@mirantis.com>  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 (file)
index 0000000..b9eaa03
--- /dev/null
@@ -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 <alebedev@mirantis.com>
+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).
index 651a942ba8039c76510c9a0e7322ab203c29820a..c1b8dbe36e8c22246a3978cb172955e83c598819 100644 (file)
@@ -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