From 6163c922a2064131c51ea664c0ed684b427d9e88 Mon Sep 17 00:00:00 2001 From: Pratyush Sharma <56130065+pratyush618@users.noreply.github.com> Date: Sun, 26 Apr 2026 23:31:34 +0530 Subject: [PATCH] gh-149021: Fix AIX build by dropping `-e` from `SHELL` AIX make treats `SHELL` as a literal executable path, so `SHELL = /bin/sh -e` (added in gh-100220) failed with `/bin/sh -e: not found`. Use `.POSIX:` instead, which makes both POSIX make and GNU make invoke the shell with `-e`. --- Makefile.pre.in | 12 ++++++++++-- .../2026-04-26-12-00-00.gh-issue-149021.vo85dd.rst | 6 ++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2026-04-26-12-00-00.gh-issue-149021.vo85dd.rst diff --git a/Makefile.pre.in b/Makefile.pre.in index 8b46db33a2ac18..61a770dba0106c 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -18,6 +18,12 @@ # # See also the section "Build instructions" in the README file. +# Run in POSIX-conforming mode. Among other things this guarantees that the +# shell is invoked with -e (so complex recipes fail on the first error), +# which avoids relying on SHELL = /bin/sh -e -- AIX make interprets that as +# a literal path and fails to find an executable named "/bin/sh -e". +.POSIX: + # === Variables set by makesetup === MODBUILT_NAMES= _MODBUILT_NAMES_ @@ -61,8 +67,10 @@ DSYMUTIL_PATH= @DSYMUTIL_PATH@ GNULD= @GNULD@ -# Shell used by make (some versions default to the login shell, which is bad) -SHELL= /bin/sh -e +# Shell used by make (some versions default to the login shell, which is bad). +# The shell is invoked with -e via the .POSIX: special target above, which +# applies under POSIX make implementations and to GNU make in POSIX mode. +SHELL= /bin/sh # Use this to make a link between python$(VERSION) and python in $(BINDIR) LN= @LN@ diff --git a/Misc/NEWS.d/next/Build/2026-04-26-12-00-00.gh-issue-149021.vo85dd.rst b/Misc/NEWS.d/next/Build/2026-04-26-12-00-00.gh-issue-149021.vo85dd.rst new file mode 100644 index 00000000000000..c6cc9946962c72 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-04-26-12-00-00.gh-issue-149021.vo85dd.rst @@ -0,0 +1,6 @@ +Fix build on AIX by no longer setting ``SHELL = /bin/sh -e`` in the +top-level :file:`Makefile`. AIX :program:`make` interprets ``SHELL`` as a +literal executable path, so the embedded ``-e`` flag caused +:samp:`/bin/sh -e: not found`. The makefile now sets ``SHELL = /bin/sh`` +and declares the ``.POSIX:`` special target, which causes both POSIX +:program:`make` and GNU :program:`make` to invoke the shell with ``-e``.