user debian-rele...@lists.debian.org
tag 909980 patch
usertag 909980 bsp-2019-02-de-berlin
thank you

Hello,

in the attached patch the get_stacktrace call is replaced with the new
try/catch syntax, as recommended in the erlang docs [0]. To fix the
FTBFS bug, it was also necessary to ignore an unused variable in
averell_sup.erl. Please see the patch for details.

0: http://erlang.org/doc/man/erlang.html#get_stacktrace-0

Micha Rosenbaum
diff -Nru averell-1.2.5/debian/changelog averell-1.2.5/debian/changelog
--- averell-1.2.5/debian/changelog	2016-04-18 18:16:07.000000000 +0200
+++ averell-1.2.5/debian/changelog	2019-02-10 13:33:56.000000000 +0100
@@ -1,3 +1,12 @@
+averell (1.2.5-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Used the new try/catch syntax for retrieving the stack backtrace
+    (Closes: #909980)
+  * Ignored the unused Index variable in averell_sup.erl
+
+ -- Micha David Rosenbaum <mi...@rosetree.de>  Sun, 10 Feb 2019 13:33:56 +0100
+
 averell (1.2.5-1) unstable; urgency=medium
 
   * Initial release
diff -Nru averell-1.2.5/debian/patches/fix-unused-index-variable.patch averell-1.2.5/debian/patches/fix-unused-index-variable.patch
--- averell-1.2.5/debian/patches/fix-unused-index-variable.patch	1970-01-01 01:00:00.000000000 +0100
+++ averell-1.2.5/debian/patches/fix-unused-index-variable.patch	2019-02-10 13:33:56.000000000 +0100
@@ -0,0 +1,19 @@
+Description: Ignore unused Index variable
+  The Index variable was unused in get_http_child. That caused averell
+  to FTBFS. Index is now marked as unused so that erlang will build
+  without errors.
+Author: Micha David Rosenbaum <mi...@rosetree.de>
+Bug-Debian: https://bugs.debian.org/909980
+Last-Update: 2019-02-10
+
+--- a/src/averell_sup.erl
++++ b/src/averell_sup.erl
+@@ -48,7 +48,7 @@
+ get_http_child() ->
+     Dir = application:get_env(averell, dir, undefined),
+     Port = application:get_env(averell, port, 80),
+-    Index = application:get_env(averell, index, noindex),
++    _Index = application:get_env(averell, index, noindex),
+     Dispatch = cowboy_router:compile([
+ 				      {'_', 
+ 				       [
diff -Nru averell-1.2.5/debian/patches/series averell-1.2.5/debian/patches/series
--- averell-1.2.5/debian/patches/series	1970-01-01 01:00:00.000000000 +0100
+++ averell-1.2.5/debian/patches/series	2019-02-10 13:33:56.000000000 +0100
@@ -0,0 +1,2 @@
+use-stacktrace-from-trycatch-syntax.patch
+fix-unused-index-variable.patch
diff -Nru averell-1.2.5/debian/patches/use-stacktrace-from-trycatch-syntax.patch averell-1.2.5/debian/patches/use-stacktrace-from-trycatch-syntax.patch
--- averell-1.2.5/debian/patches/use-stacktrace-from-trycatch-syntax.patch	1970-01-01 01:00:00.000000000 +0100
+++ averell-1.2.5/debian/patches/use-stacktrace-from-trycatch-syntax.patch	2019-02-10 13:33:56.000000000 +0100
@@ -0,0 +1,43 @@
+Description: Use the try/catch syntax for retrieving the stack backtrace
+ This previously used the deprecated erlang:get_stacktrace() for
+ retrieving the stack backtrace. As warnings were treated as errors,
+ this caused an FTBFS bug on averell. Using the new try/catch syntax
+ for retrieving the Stacktraced fixes this FTBFS bug.
+Author: Micha David Rosenbaum <mi...@rosetree.de>
+Bug-Debian: https://bugs.debian.org/909980
+Last-Update: 2019-02-10
+
+--- a/src/averell_cors.erl
++++ b/src/averell_cors.erl
+@@ -45,13 +45,13 @@
+     try Policy:policy_init(Req) of
+         {ok, Req1, PolicyState} ->
+             allowed_origins(Req1, State#state{policy_state = PolicyState})
+-    catch Class:Reason ->
++    catch Class:Reason:Stacktrace ->
+                 error_logger:error_msg(
+                   "** Cowboy CORS policy ~p terminating in ~p/~p~n"
+                   "   for the reason ~p:~p~n"
+                   "** Request was ~p~n** Stacktrace: ~p~n~n",
+                   [Policy, policy_init, 1, Class, Reason,
+-                   cowboy_req:to_list(Req), erlang:get_stacktrace()]),
++                   cowboy_req:to_list(Req), Stacktrace]),
+             error_terminate(Req, State)
+     end.
+ 
+@@ -198,13 +198,13 @@
+         true ->
+             try
+                 Policy:Callback(Req, PolicyState)
+-            catch Class:Reason ->
++            catch Class:Reason:Stacktrace ->
+                     error_logger:error_msg(
+                       "** Cowboy CORS policy ~p terminating in ~p/~p~n"
+                       "   for the reason ~p:~p~n"
+                       "** Request was ~p~n** Stacktrace: ~p~n~n",
+                       [Policy, Callback, 2, Class, Reason,
+-                       cowboy_req:to_list(Req), erlang:get_stacktrace()]),
++                       cowboy_req:to_list(Req), Stacktrace]),
+                     error_terminate(Req, State)
+             end;
+         false ->

Attachment: signature.asc
Description: PGP signature

Reply via email to