File 0284-Clear-ERL_AFLAGS-when-starting-a-previous-release.patch of Package erlang

From 21f95e607ea584b84102fd45cb138277760b1c6d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Mon, 8 Apr 2019 14:09:11 +0200
Subject: [PATCH] Clear ERL_AFLAGS when starting a previous release

When starting a slave or peer node, options in ERL_AFLAGS might not
be valid for the previous release. For instance, "-emu_type lcnt"
would only work if the previous release happened to have been built
with a lock counting emulator.
---
 lib/common_test/src/test_server_node.erl | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/common_test/src/test_server_node.erl b/lib/common_test/src/test_server_node.erl
index 3ae4a047d8..c11b9071cf 100644
--- a/lib/common_test/src/test_server_node.erl
+++ b/lib/common_test/src/test_server_node.erl
@@ -598,11 +598,20 @@ pick_erl_program(L) ->
 	{prog, S} ->
 	    S;
 	{release, S} ->
+            clear_erl_aflags(),
 	    find_release(S);
 	this ->
 	    ct:get_progname()
     end.
 
+clear_erl_aflags() ->
+    %% When starting a node with a previous release, options in
+    %% ERL_AFLAGS could prevent the node from starting. For example,
+    %% if ERL_AFLAGS is set to "-emu_type lcnt", the node will only
+    %% start if the previous release happens to also have a lock
+    %% counter emulator installed (unlikely).
+    os:unsetenv("ERL_AFLAGS").
+
 %% This is an attempt to distinguish between spaces in the program
 %% path and spaces that separate arguments. The program is quoted to
 %% allow spaces in the path.
-- 
2.16.4

openSUSE Build Service is sponsored by