Configuration Information [Automatically generated, do not change]:
Machine: aarch64
OS: darwin24.4.0
Compiler: clang
Compilation CFLAGS: -DSSH_SOURCE_BASHRC
-DDEFAULT_LOADABLE_BUILTINS_PATH='/opt/homebrew/lib/bash:/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:.'
uname output: Darwin MacBookPro 24.5.0 Darwin Kernel Version 24.5.0: Tue
Apr 22 19:54:49 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6000 arm64
Machine Type: aarch64-apple-darwin24.4.0

Bash Version: 5.3
Patch Level: 0
Release Status: release

Description:
MacOS Homebrew bash '5.3.0(1)-release' (apparently?) breaks 'wait'

bash-settings are as follows (in my experiments,
the sole critical setting is "posix on")

"${BASH_VERSION}" == '5.3.0(1)-release'
allexport      off
braceexpand    on
emacs          on
errexit        off
errtrace       off
functrace      off
hashall        on
histexpand     on
history        on
ignoreeof      off
interactive-comments on
keyword        off
monitor        on
noclobber      off
noexec         off
noglob         off
nolog          off
notify         off
nounset        off
onecmd         off
physical       off
pipefail       off
posix          on
privileged     off
verbose        off
vi             off
xtrace         off

Repeat-By:
# SUMMARY: the following three commands
#   minimally elicit a failure-to-wait bug
set -o posix ;
mapfile -t JOBS < <(jobs -rp);
sleep 10 & wait -f -n $! ;
# FAILURE: 'wait' DOES NOT WAIT

Fix:
(1) failure-to-wait occurs not only for 'sleep',
   but for ANY asynchronous process (yikes!)
(2) 'set +o posix' is a workaround (but alas,
   my existing scripts all assume posix-mode).
(3) "$(ls -lad "$(which bash)")" returns (for me)
      /opt/homebrew/bin/bash ->
         ../Cellar/bash/5.3_1/bin/bash
   hence Homebrew's (recent) bash-update to '5.3_1'
   has NOT FIXED this (apparent) 'wait'-bug.
(4) this (apparent) 'wait'-bug was NOT present
   in Homebrew's bash-releases prior to 5.3.0

Reply via email to