File 0749-erts-Fix-port-test-error-on-MacOS-catalina.patch of Package erlang

From 4d2d6e820993f6f4713f2404de522bb57290047e Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Wed, 13 Oct 2021 09:46:58 +0200
Subject: [PATCH 02/11] erts: Fix port test error on MacOS catalina

For some reason Catalina (not Mojave or Big Sur) can return
enoent from getwd instead of emfile. So we add a guard to the
test that allows that.
---
 erts/emulator/test/port_SUITE.erl | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/erts/emulator/test/port_SUITE.erl b/erts/emulator/test/port_SUITE.erl
index e7f93b103e..b6910fb378 100644
--- a/erts/emulator/test/port_SUITE.erl
+++ b/erts/emulator/test/port_SUITE.erl
@@ -1493,6 +1493,8 @@ otp_4389(Config)  when is_list(Config) ->
         {unix, _} ->
             ct:timetrap({minutes, 4}),
             TCR = self(),
+            %% On MacOS Catalina libc can return enoent instead of emfile for cwd
+            BrokenCWD = (os:type() =:= {unix,darwin}) andalso element(1,os:version()) == 19,
             case get_true_cmd() of
                 True when is_list(True) ->
                     lists:foreach(
@@ -1513,16 +1515,20 @@ otp_4389(Config)  when is_list(Config) ->
                                                   receive
                                                       {P,{exit_status,_}} ->
                                                           TCR ! {self(),ok};
-                                                      {'EXIT',_,{R2,_}} when R2 == emfile;
-                                                                             R2 == eagain;
-                                                                             R2 == enomem ->
+                                                      {'EXIT',_,{R2,_}}
+                                                        when R2 == emfile;
+                                                             R2 == eagain;
+                                                             R2 == enomem;
+                                                             R2 == enoent andalso BrokenCWD ->
                                                           TCR ! {self(),ok};
                                                       Err2 ->
                                                           TCR ! {self(),{msg,Err2}}
                                                   end;
-                                              {'EXIT',{R1,_}} when R1 == emfile;
-                                                                   R1 == eagain;
-                                                                   R1 == enomem ->
+                                              {'EXIT',{R1,_}}
+                                                when R1 == emfile;
+                                                     R1 == eagain;
+                                                     R1 == enomem;
+                                                     R1 == enoent andalso BrokenCWD ->
                                                   TCR ! {self(),ok};
                                               Err1 ->
                                                   TCR ! {self(), {open_port,Err1}}
-- 
2.31.1

openSUSE Build Service is sponsored by