summaryrefslogtreecommitdiffstats
path: root/external/python3
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2020-12-01 21:36:05 +0200
committerTor Lillqvist <tml@iki.fi>2021-04-06 09:26:08 +0300
commit21354ef11d84224aa90e4b06f77eaa0e79b24878 (patch)
tree5db057a01bccd99591b563d4bac333bc1c24501b /external/python3
parentCheck first if there is such a "bin" directory before attempting to use it (diff)
downloadcore-21354ef11d84224aa90e4b06f77eaa0e79b24878.tar.gz
core-21354ef11d84224aa90e4b06f77eaa0e79b24878.zip
Guard against sysconf(_SC_OPEN_MAX) returning LONG_MAX
That seems to happen in a sandboxed process on macOS, at least. This caused an apparent hang when invoking Python, for instance simply through Tools > Macros > Run Macro... . Change-Id: I6bc055b44f298251ed596084538b98442c215fce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107012 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'external/python3')
-rw-r--r--external/python3/macos-11.patch.020
1 files changed, 20 insertions, 0 deletions
diff --git a/external/python3/macos-11.patch.0 b/external/python3/macos-11.patch.0
index 23fc5f9760c5..3c42d515f6bd 100644
--- a/external/python3/macos-11.patch.0
+++ b/external/python3/macos-11.patch.0
@@ -48,3 +48,23 @@
#else
#error "unknown architecture for universal build."
#endif
+--- Modules/_posixsubprocess.c
++++ Modules/_posixsubprocess.c
+@@ -31,6 +31,8 @@
+ # define SYS_getdents64 __NR_getdents64
+ #endif
+
++#include <limits.h>
++
+ #if defined(__sun) && defined(__SVR4)
+ /* readdir64 is used to work around Solaris 9 bug 6395699. */
+ # define readdir readdir64
+@@ -202,7 +202,7 @@
+ #endif
+ #ifdef _SC_OPEN_MAX
+ local_max_fd = sysconf(_SC_OPEN_MAX);
+- if (local_max_fd == -1)
++ if (local_max_fd == -1 || local_max_fd == LONG_MAX)
+ #endif
+ local_max_fd = 256; /* Matches legacy Lib/subprocess.py behavior. */
+ return local_max_fd;