From 971073d42930bf3a40935fd5a132f69260f90b8c Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 18 Sep 2021 14:00:17 -0700 Subject: [PATCH] Disable posix_spawn on OpenBSD OpenBSD has a posix_spawn implementation which fails to return ENOEXEC on a shebangless script, causing us to fail the shebangless tests. Disable posix_spawn on OpenBSD. --- src/env_dispatch.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/env_dispatch.cpp b/src/env_dispatch.cpp index 85d4135a7..67787d188 100644 --- a/src/env_dispatch.cpp +++ b/src/env_dispatch.cpp @@ -271,6 +271,11 @@ const char *gnu_get_libc_version(); // Disallow posix_spawn entirely on glibc <= 2.24. // See #8021. static bool allow_use_posix_spawn() { + // OpenBSD's posix_spawn returns status 127, instead of erroring with ENOEXEC, when faced with a + // shebangless script. Disable posix_spawn on OpenBSD. +#if defined(__OpenBSD__) + return false; +#endif bool result = true; // uClibc defines __GLIBC__. #if defined(__GLIBC__) && !defined(__UCLIBC__)