File 0103-Do-not-call-which_applications.patch of Package erlang

From daca8c42a2ca170c0e187ad99203f2fa16d589eb Mon Sep 17 00:00:00 2001
From: Dan Gudmundsson <dgud@erlang.org>
Date: Tue, 2 May 2017 12:22:44 +0200
Subject: [PATCH 1/2] Do not call which_applications()

Which may hang if an application start does wait for tables
during initilization.
---
 lib/mnesia/src/mnesia_schema.erl | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/lib/mnesia/src/mnesia_schema.erl b/lib/mnesia/src/mnesia_schema.erl
index b0d796588..5f269a082 100644
--- a/lib/mnesia/src/mnesia_schema.erl
+++ b/lib/mnesia/src/mnesia_schema.erl
@@ -866,18 +866,18 @@ list2cs(List, ExtTypes) when is_list(List) ->
     is_list(DetsOpts) orelse mnesia:abort({badarg, Name, {dets, DetsOpts}}),
     [CheckProp(Prop, BadDetsOpts) || Prop <- DetsOpts],
 
-    case lists:keymember(mnesia, 1, application:which_applications()) of
-        true ->
-            Keys = check_keys(Name, List),
-            check_duplicates(Name, Keys);
-        false ->
+    case whereis(mnesia_controller) of
+        undefined ->
             %% check_keys/2 cannot be executed when mnesia is not
             %% running, due to it not being possible to read what ext
             %% backends are loaded.
-            %%% this doesn't work - disabled for now:
-	    %%%Keys = check_keys(Name, List, record_info(fields, cstruct)),
-	    %%%check_duplicates(Name, Keys)
-            ignore
+            %% this doesn't work - disabled for now:
+            %%Keys = check_keys(Name, List, record_info(fields, cstruct)),
+            %%check_duplicates(Name, Keys)
+            ignore;
+        Pid when is_pid(Pid) ->
+            Keys = check_keys(Name, List),
+            check_duplicates(Name, Keys)
     end,
 
     Cs0 = #cstruct{name = Name,
-- 
2.12.2

openSUSE Build Service is sponsored by