BASH PATCH REPORT
=================
Bash-Release: 5.3
Patch-ID: bash53-016
Bug-Reported-by: Ethan Pini <[email protected]>
Bug-Reference-ID:
<sm8ZxfcmgU7_eiVLIsjNlax7oyAwwe1_uk2vaO0hp6nypbGnV7WStfE3rrHg_RV8BMSNRhhQmS2-7TpvzPxuK1NLLEWAyL9kbsZ2cA3nqIg=@pini.dev>
Bug-Reference-URL:
https://lists.gnu.org/archive/html/bug-bash/2026-06/msg00126.html
Bug-Description:
On recent versions of macOS, the pipe size is dynamic and changes due to
system-wide total pipe usage, so we have to check whether or not bash can
use the size determined at compile time.
Patch (apply with `patch -p0'):
*** ../bash-5.3-patched/redir.c Fri Mar 7 18:49:37 2025
--- redir.c Tue Jul 7 11:21:09 2026
***************
*** 473,477 ****
--- 473,500 ----
#endif
+ #if defined (PIPESIZE_DYNAMIC)
+ /* If we can't count on the pipe size determined at compile time to be
+ constant across systems, define PIPESIZE_DYNAMIC in configure.ac.
+ We set the pipe's write end to be non-blocking, try to write, and
+ fall back to a temp file on error. */
+ if (sh_setnodelay (herepipe[1]) < 0)
+ {
+ close (herepipe[0]);
+ close (herepipe[1]);
+ goto use_tempfile;
+ }
+ #endif
+
r = heredoc_write (herepipe[1], document, document_len);
+
+ #if defined (PIPESIZE_DYNAMIC)
+ if (r == ENOSPC || r == EAGAIN)
+ {
+ close (herepipe[0]);
+ close (herepipe[1]);
+ goto use_tempfile;
+ }
+ #endif
+
if (document != redirectee->word)
free (document);
*** ../bash-5.3-patched/general.c Wed Jun 25 15:54:35 2025
--- general.c Tue Jul 7 11:12:10 2026
***************
*** 596,599 ****
--- 596,620 ----
}
+ int
+ sh_setnodelay (int fd)
+ {
+ int flags;
+
+ if ((flags = fcntl (fd, F_GETFL, 0)) < 0)
+ return -1;
+
+ /* This is defined to O_NDELAY in filecntl.h if O_NONBLOCK is not present
+ and O_NDELAY is defined. */
+ #ifdef O_NONBLOCK
+ flags |= O_NONBLOCK;
+ #endif
+
+ #ifdef O_NDELAY
+ flags |= O_NDELAY;
+ #endif
+
+ return (fcntl (fd, F_SETFL, flags));
+ }
+
/* Just a wrapper for the define in include/filecntl.h */
int
*** ../bash-5.3-patched/general.h Wed Jun 25 15:52:47 2025
--- general.h Tue Jul 7 11:13:48 2026
***************
*** 318,321 ****
--- 318,322 ----
extern int sh_unset_nodelay_mode (int);
+ extern int sh_setnodelay (int);
extern int sh_setclexec (int);
extern int sh_validfd (int);
*** ../bash-5.3-patched/configure.ac Mon Jun 30 10:05:24 2025
--- configure.ac Tue Jul 7 11:25:32 2026
***************
*** 1210,1214 ****
isc*) LOCAL_CFLAGS=-Disc386 ;;
rhapsody*) LOCAL_CFLAGS=-DRHAPSODY ;;
! darwin*) LOCAL_CFLAGS=-DMACOSX ;;
sco3.2v5*) LOCAL_CFLAGS="-b elf -DWAITPID_BROKEN -DPATH_MAX=1024" ;;
sco3.2v4*) LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DPATH_MAX=1024" ;;
--- 1210,1214 ----
isc*) LOCAL_CFLAGS=-Disc386 ;;
rhapsody*) LOCAL_CFLAGS=-DRHAPSODY ;;
! darwin*) LOCAL_CFLAGS="-DMACOSX -DPIPESIZE_DYNAMIC" ;;
sco3.2v5*) LOCAL_CFLAGS="-b elf -DWAITPID_BROKEN -DPATH_MAX=1024" ;;
sco3.2v4*) LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DPATH_MAX=1024" ;;
*** ../bash-5.3-patched/configure Mon Jun 30 10:05:30 2025
--- configure Tue Jul 7 11:25:36 2026
***************
*** 23134,23138 ****
isc*) LOCAL_CFLAGS=-Disc386 ;;
rhapsody*) LOCAL_CFLAGS=-DRHAPSODY ;;
! darwin*) LOCAL_CFLAGS=-DMACOSX ;;
sco3.2v5*) LOCAL_CFLAGS="-b elf -DWAITPID_BROKEN -DPATH_MAX=1024" ;;
sco3.2v4*) LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DPATH_MAX=1024" ;;
--- 23134,23138 ----
isc*) LOCAL_CFLAGS=-Disc386 ;;
rhapsody*) LOCAL_CFLAGS=-DRHAPSODY ;;
! darwin*) LOCAL_CFLAGS="-DMACOSX -DPIPESIZE_DYNAMIC" ;;
sco3.2v5*) LOCAL_CFLAGS="-b elf -DWAITPID_BROKEN -DPATH_MAX=1024" ;;
sco3.2v4*) LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DPATH_MAX=1024" ;;
*** ../bash-5.3/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 15
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 16
#endif /* _PATCHLEVEL_H_ */
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/