Skip to content

gh-149021: Fix AIX build by dropping -e from SHELL in Makefile#149022

Closed
pratyush618 wants to merge 1 commit intopython:mainfrom
pratyush618:gh-149021-aix-makefile-shell
Closed

gh-149021: Fix AIX build by dropping -e from SHELL in Makefile#149022
pratyush618 wants to merge 1 commit intopython:mainfrom
pratyush618:gh-149021-aix-makefile-shell

Conversation

@pratyush618
Copy link
Copy Markdown

On AIX, make(1) treats the value of SHELL as a literal executable
path rather than a command line. Since gh-100220 the top-level Makefile
sets SHELL = /bin/sh -e to make complex recipes fail-fast under GNU
make, but AIX then tries to execve("/bin/sh -e", ...) and the build
aborts immediately:

$ make
/bin/sh -e: not found
make: 1254-004 The error code from the last command is 1.

POSIX requires make to invoke the shell with -e by default; GNU
make does the same once a .POSIX: special target is declared (it sets
.SHELLFLAGS = -ec). This PR:

Verified locally with GNU Make 4.3 that a multi-command recipe
(echo a; false; echo b) aborts after false with .POSIX: set,
matching the prior SHELL = /bin/sh -e behavior.

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`.
@picnixz
Copy link
Copy Markdown
Member

picnixz commented Apr 26, 2026

  1. Not sure it's the best way to fix it, we shouldn't change the build for all platforms. It could done for AIX-only in some sense.
  2. We have AIX buildbots I think so it's surprising that this wasn't caught. I want to understand the failure more precisely.
  3. Don't use LLMs to generate PRs. Read https://devguide.python.org/getting-started/generative-ai/ first please.
  4. I'm not entirely sure we assume GNU Make. Maybe we should set .SHELLOPTIONS ourselves? or do some other tricks?

For those reasons, I'm closing the PR until we have a cleaner fix that doesn't mess with the entire build system.

@picnixz picnixz closed this Apr 26, 2026
@pratyush618 pratyush618 deleted the gh-149021-aix-makefile-shell branch April 26, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants