Files
packages/utils/bash/patches/001-bash-5.3-patch-2.patch
Wei-Ting Yang 4a02dcb1c3 bash: update to 5.3 patch level 9
- Fix posix-mode issue with "wait -n", where it can return process IDs
  outside the requested set
- Do not try to use shm_open, there is too much variance in behavior
  across systems
- Remove internal quoting that causes failures when expanding nested
  array subscripts in an arithmetic context
- Fix issue with source when read(2) returns fewer characters than
  fstat(2) says are available
- Fix crash when restoring default disposition for SIGINT in
  asynchronous subshell
- Fix issues with range expressions and non-ascii characters in glob
  patterns when globasciiranges is enabled
- Fix issue where nofork command substitutions can affect
  redirections in the calling shell
- Fix issue with calling mbrtowc too much when translating
  ansic-single-quoted strings
- Fix crash when interrupting reverse i-search with ^C

Signed-off-by: Wei-Ting Yang <williamatcg@gmail.com>
2026-01-18 07:19:05 +02:00

92 lines
2.1 KiB
Diff

From 2ea3d6064911104d8e0437cb75b0e2559b0cd1b2 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Wed, 23 Jul 2025 15:47:12 -0400
Subject: Bash-5.3 patch 2: do not try to use shm_open, there is too much
variance in behavior across systems
--- a/lib/sh/anonfile.c
+++ b/lib/sh/anonfile.c
@@ -25,7 +25,7 @@
#endif
#include <bashtypes.h>
-#if defined (HAVE_MEMFD_CREATE) || defined (HAVE_SHM_OPEN) || defined (HAVE_SHM_MKSTEMP)
+#if defined (HAVE_MEMFD_CREATE) || defined (HAVE_SHM_MKSTEMP)
# include <sys/mman.h>
#endif
#include <filecntl.h>
@@ -41,17 +41,7 @@ static int anonunlink (const char *);
# define MFD_NOEXEC_SEAL 0
#endif
-#if defined (HAVE_SHM_OPEN)
-#ifndef O_NOFOLLOW
-# define O_NOFOLLOW 0
-#endif
-
-static int
-anonshmunlink (const char *fn)
-{
- return (shm_unlink (fn));
-}
-
+#if defined (HAVE_SHM_MKSTEMP)
static int
anonshmopen (const char *name, int flags, char **fn)
{
@@ -62,35 +52,14 @@ anonshmopen (const char *name, int flags
if (fn)
*fn = 0;
-#if defined (HAVE_SHM_MKSTEMP)
fname = savestring ("/shm-XXXXXXXXXX");
fd = shm_mkstemp (fname);
if (fd < 0)
- free (fname);
-#endif
-
- if (fd < 0)
- {
- fname = sh_mktmpname (name, flags);
- fd = shm_open (fname, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW, 0600);
- }
-
- if (fd < 0)
{
free (fname);
return fd;
}
- if (shm_unlink (fname) < 0)
- {
- int o;
- o = errno;
- free (fname);
- close (fd);
- errno = o;
- return -1;
- }
-
if (fn)
*fn = fname;
else
@@ -122,7 +91,7 @@ anonopen (const char *name, int flags, c
/* Heuristic */
flag = (name && *name == '/') ? MT_TEMPLATE : MT_USETMPDIR;
-#if defined (HAVE_SHM_OPEN)
+#if defined (HAVE_SHM_MKSTEMP)
fd = anonshmopen (name, flag, fn);
if (fd >= 0)
return fd; /* anonshmopen sets *FN appropriately */
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -25,6 +25,6 @@
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
looks for to find the patch level (for the sccs version string). */
-#define PATCHLEVEL 1
+#define PATCHLEVEL 2
#endif /* _PATCHLEVEL_H_ */