From mboxrd@z Thu Jan  1 00:00:00 1970
From: Adolf Belka <adolf.belka@ipfire.org>
To: development@lists.ipfire.org
Subject: Re: [PATCH] bash: Update to version 5.1.8 plus patches 9 to 12
Date: Tue, 07 Dec 2021 13:30:56 +0100
Message-ID: <bdb18990-5b75-b0df-cc9b-046f6b389055@ipfire.org>
In-Reply-To: <D497DD32-7DCB-44BC-9A7F-D732FAC6463B@ipfire.org>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============6628442320405114947=="
List-Id: <development.lists.ipfire.org>

--===============6628442320405114947==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Hi Michael,

On 07/12/2021 12:17, Michael Tremer wrote:
> Hello,
>=20
> Thank you for this patch.
>=20
> Isn=E2=80=99t it a bit odd that upstream released a tarball for 5.1.8 but n=
ot for .12?
>=20
> Isn=E2=80=99t it easier to just import the patches and stick with the origi=
nal 5.1 tarball?
I thought about that but then I saw the 5,1,8 tarball and thought if it is th=
ere why not use it as it has all the patches from 1 to 8 already merged in so=
 saves a little time in patching :-) but I have no real hard view either way.
If you would rather that bash always stays with its first tarball of a series=
 and we use all the patches provided I can also do that.

Regards,
Adolf.
>=20
> It will all result in the same piece of software. I am just curious.
>=20
> -Michael
>=20
>> On 6 Dec 2021, at 21:06, Adolf Belka <adolf.belka(a)ipfire.org> wrote:
>>
>> - Update main file from 5.1 to 5.1.8 (includes patches 1 to 8)
>> - Remove patches 1 to 4
>> - Changelog - Patches 1 to 4 from the previous IPFire version together wit=
h patches 5 to
>>      8 are now included into bash-5.1.8 followed by application of patches=
 9 to 12
>>    Patch 12
>>     There is a possible race condition that arises when a child process re=
ceives
>>      a signal trapped by the parent before it can reset the signal disposi=
tions.
>>      The child process is not supposed to trap the signal in this circumst=
ance.
>>    Patch 11
>>     When reading a compound assignment, and running it through the parser =
to
>>      split it into words, we need to save and restore any alias we're curr=
ently
>>      expanding.
>>    Patch 10
>>     If `wait -n' is interrupted by a trapped signal other than SIGINT, it =
does
>>      not completely clean up state, and that can prevent subsequent calls =
to
>>      `wait -n' from working correctly.
>>    Patch 9
>>     The bash malloc implementation of malloc_usable_size() does not follow=
 the
>>      specification. This can cause library functions that use it to overwr=
ite
>>      memory bounds checking.
>>    Patch 8
>>     Process substitution FIFOs opened by child processes as targets of red=
irections
>>      were not removed appropriately, leaving remnants in the file system.
>>    Patch 7
>>     The code to check readline versions in an inputrc file had the sense o=
f the
>>      comparisons reversed.
>>    Patch 6
>>     Make sure child processes forked to run command substitutions are in t=
he
>>      proper process group.
>>    Patch 5
>>     Fix two memory leaks when assigning arrays using compound assignment s=
yntax.
>>
>> Signed-off-by: Adolf Belka <adolf.belka(a)ipfire.org>
>> ---
>> lfs/bash                    |   6 +-
>> src/patches/bash/bash51-001 |  80 ---------------
>> src/patches/bash/bash51-002 |  57 -----------
>> src/patches/bash/bash51-003 |  53 ----------
>> src/patches/bash/bash51-004 | 126 -----------------------
>> src/patches/bash/bash51-009 |  59 +++++++++++
>> src/patches/bash/bash51-010 |  59 +++++++++++
>> src/patches/bash/bash51-011 |  81 +++++++++++++++
>> src/patches/bash/bash51-012 | 198 ++++++++++++++++++++++++++++++++++++
>> 9 files changed, 400 insertions(+), 319 deletions(-)
>> delete mode 100644 src/patches/bash/bash51-001
>> delete mode 100644 src/patches/bash/bash51-002
>> delete mode 100644 src/patches/bash/bash51-003
>> delete mode 100644 src/patches/bash/bash51-004
>> create mode 100644 src/patches/bash/bash51-009
>> create mode 100644 src/patches/bash/bash51-010
>> create mode 100644 src/patches/bash/bash51-011
>> create mode 100644 src/patches/bash/bash51-012
>>
>> diff --git a/lfs/bash b/lfs/bash
>> index 7b0baccad..1bf3eb2ec 100644
>> --- a/lfs/bash
>> +++ b/lfs/bash
>> @@ -24,7 +24,7 @@
>>
>> include Config
>>
>> -VER        =3D 5.1
>> +VER        =3D 5.1.8
>>
>> THISAPP    =3D bash-$(VER)
>> DL_FILE    =3D $(THISAPP).tar.gz
>> @@ -53,7 +53,7 @@ objects =3D $(DL_FILE)
>>
>> $(DL_FILE)             =3D $(DL_FROM)/$(DL_FILE)
>>
>> -$(DL_FILE)_MD5         =3D bb91a17fd6c9032c26d0b2b78b50aff5
>> +$(DL_FILE)_MD5         =3D 23eee6195b47318b9fd878e590ccb38c
>>
>> install : $(TARGET)
>>
>> @@ -87,7 +87,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
>> 	sed -e "s/filename, RTLD_LAZY/filename, RTLD_NOW/" \
>> 		-i $(DIR_APP)/builtins/enable.def
>>
>> -	for i in $$(seq 1 4); do \
>> +	for i in $$(seq 9 12); do \
>> 		cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/bash/bash51-$$(prin=
tf "%03d" "$${i}") || exit 1; \
>> 	done
>>
>> diff --git a/src/patches/bash/bash51-001 b/src/patches/bash/bash51-001
>> deleted file mode 100644
>> index 6f29981d2..000000000
>> --- a/src/patches/bash/bash51-001
>> +++ /dev/null
>> @@ -1,80 +0,0 @@
>> -			     BASH PATCH REPORT
>> -			     =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> -
>> -Bash-Release:	5.1
>> -Patch-ID:	bash51-001
>> -
>> -Bug-Reported-by:	Fazal Majid <fazal(a)majid.org>
>> -Bug-Reference-ID:	<DEAB7D2C-C626-450C-B2E5-281AFF2D26D4(a)majid.org>
>> -Bug-Reference-URL:	https://lists.gnu.org/archive/html/bug-bash/2020-12/ms=
g00000.html
>> -
>> -Bug-Description:
>> -
>> -There is a missing dependency on a constructed file, which can cause high=
ly
>> -parellel builds to fail.
>> -
>> -Patch (apply with `patch -p0'):
>> -
>> -*** ../bash-5.1-patched/Makefile.in	2020-12-04 09:51:19.000000000 -0500
>> ---- Makefile.in	2020-12-16 11:28:36.000000000 -0500
>> -***************
>> -*** 1316,1319 ****
>> ---- 1316,1320 ----
>> -  bashline.o: pcomplete.h ${BASHINCDIR}/chartypes.h input.h
>> -  bashline.o: ${BASHINCDIR}/shmbutil.h ${BASHINCDIR}/shmbchar.h
>> -+ bashline.o: ${DEFDIR}/builtext.h
>> -  bracecomp.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
>> -  bracecomp.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp=
.h
>> -***************
>> -*** 1436,1439 ****
>> ---- 1437,1441 ----
>> -  builtins/evalstring.o: jobs.h builtins.h flags.h input.h execute_cmd.h
>> -  builtins/evalstring.o: bashhist.h $(DEFSRC)/common.h pathnames.h
>> -+ builtins/evalstring.o: ${DEFDIR}/builtext.h
>> -  builtins/getopt.o: config.h ${BASHINCDIR}/memalloc.h
>> -  builtins/getopt.o: shell.h syntax.h bashjmp.h command.h general.h xmall=
oc.h error.h
>> -
>> -*** ../bash-5.1-patched/builtins/Makefile.in	2019-07-25 08:03:45.00000000=
0 -0400
>> ---- builtins/Makefile.in	2020-12-16 11:29:29.000000000 -0500
>> -***************
>> -*** 362,366 ****
>> -  evalstring.o: $(topdir)/flags.h $(topdir)/input.h $(topdir)/execute_cmd=
.h
>> -  evalstring.o: $(topdir)/bashhist.h $(srcdir)/common.h
>> -! evalstring.o: $(topdir)/trap.h $(topdir)/redir.h ../pathnames.h
>> -  #evalstring.o: $(topdir)/y.tab.h
>> -  getopt.o: ../config.h $(BASHINCDIR)/memalloc.h
>> ---- 362,366 ----
>> -  evalstring.o: $(topdir)/flags.h $(topdir)/input.h $(topdir)/execute_cmd=
.h
>> -  evalstring.o: $(topdir)/bashhist.h $(srcdir)/common.h
>> -! evalstring.o: $(topdir)/trap.h $(topdir)/redir.h ../pathnames.h ./built=
ext.h
>> -  #evalstring.o: $(topdir)/y.tab.h
>> -  getopt.o: ../config.h $(BASHINCDIR)/memalloc.h
>> -
>> -*** ../bash-5.1/patchlevel.h	2020-06-22 14:51:03.000000000 -0400
>> ---- patchlevel.h	2020-10-01 11:01:28.000000000 -0400
>> -***************
>> -*** 1,5 ****
>> -  /* patchlevel.h -- current bash patch level */
>> -
>> -! /* Copyright (C) 2001-2016 Free Software Foundation, Inc.
>> -
>> -     This file is part of GNU Bash, the Bourne Again SHell.
>> ---- 1,5 ----
>> -  /* patchlevel.h -- current bash patch level */
>> -
>> -! /* Copyright (C) 2001-2020 Free Software Foundation, Inc.
>> -
>> -     This file is part of GNU Bash, the Bourne Again SHell.
>> -***************
>> -*** 26,30 ****
>> -     looks for to find the patch level (for the sccs version string). */
>> -
>> -! #define PATCHLEVEL 0
>> -
>> -  #endif /* _PATCHLEVEL_H_ */
>> ---- 26,30 ----
>> -     looks for to find the patch level (for the sccs version string). */
>> -
>> -! #define PATCHLEVEL 1
>> -
>> -  #endif /* _PATCHLEVEL_H_ */
>> diff --git a/src/patches/bash/bash51-002 b/src/patches/bash/bash51-002
>> deleted file mode 100644
>> index 8c991649a..000000000
>> --- a/src/patches/bash/bash51-002
>> +++ /dev/null
>> @@ -1,57 +0,0 @@
>> -			     BASH PATCH REPORT
>> -			     =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> -
>> -Bash-Release:	5.1
>> -Patch-ID:	bash51-002
>> -
>> -Bug-Reported-by:	oguzismailuysal(a)gmail.com
>> -Bug-Reference-ID:	<CAH7i3LoHFUa4aSF5-AD2r80HG-p-YzD_9ZxomarZkhP8NMq63g(a)=
mail.gmail.com>
>> -Bug-Reference-URL:	https://lists.gnu.org/archive/html/bug-bash/2020-12/ms=
g00037.html
>> -
>> -Bug-Description:
>> -
>> -If there are no jobs, and the `-n' and `-p' options are both supplied to
>> -`wait', bash can assign a value to the variable name specified with `-p'
>> -instead of leaving it unset.
>> -
>> -Patch (apply with `patch -p0'):
>> -
>> -*** ../bash-5.1-patched/builtins/wait.def	2020-04-09 15:13:57.000000000 -=
0400
>> ---- builtins/wait.def	2020-12-11 09:46:49.000000000 -0500
>> -***************
>> -*** 214,222 ****
>> -
>> -        status =3D wait_for_any_job (wflags, &pstat);
>> --       if (status < 0)
>> -- 	status =3D 127;
>> --=20
>> -        if (vname && status >=3D 0)
>> -  	bind_var_to_int (vname, pstat.pid);
>> -        if (list)
>> -  	unset_waitlist ();
>> ---- 214,222 ----
>> -
>> -        status =3D wait_for_any_job (wflags, &pstat);
>> -        if (vname && status >=3D 0)
>> -  	bind_var_to_int (vname, pstat.pid);
>> -+
>> -+       if (status < 0)
>> -+ 	status =3D 127;
>> -        if (list)
>> -  	unset_waitlist ();
>> -
>> -*** ../bash-5.1/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 1
>> -
>> -  #endif /* _PATCHLEVEL_H_ */
>> ---- 26,30 ----
>> -     looks for to find the patch level (for the sccs version string). */
>> -
>> -! #define PATCHLEVEL 2
>> -
>> -  #endif /* _PATCHLEVEL_H_ */
>> diff --git a/src/patches/bash/bash51-003 b/src/patches/bash/bash51-003
>> deleted file mode 100644
>> index 68e5dce6a..000000000
>> --- a/src/patches/bash/bash51-003
>> +++ /dev/null
>> @@ -1,53 +0,0 @@
>> -			     BASH PATCH REPORT
>> -			     =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> -
>> -Bash-Release:	5.1
>> -Patch-ID:	bash51-003
>> -
>> -Bug-Reported-by:	oguzismailuysal(a)gmail.com
>> -Bug-Reference-ID:	<CAH7i3LpG91BnNcDtaTUm2Ph7a+PnJkuh6nAc87cVL7_38tOaMQ(a)=
mail.gmail.com>
>> -Bug-Reference-URL:	https://lists.gnu.org/archive/html/bug-bash/2020-12/ms=
g00050.html
>> -
>> -Bug-Description:
>> -
>> -Bash does not put a command substitution process that is started to perfo=
rm an
>> -expansion in a child process into the right process group where it can re=
ceive
>> -keyboard-generated signals.
>> -
>> -Patch (apply with `patch -p0'):
>> -
>> -*** ../bash-5.1-patched/subst.c	2020-11-16 10:33:15.000000000 -0500
>> ---- subst.c	2020-12-12 13:50:11.000000000 -0500
>> -***************
>> -*** 6357,6362 ****
>> -  #if defined (JOB_CONTROL)
>> -    old_pipeline_pgrp =3D pipeline_pgrp;
>> -!   /* Don't reset the pipeline pgrp if we're already a subshell in a pip=
eline. */
>> -!   if ((subshell_environment & SUBSHELL_PIPE) =3D=3D 0)
>> -      pipeline_pgrp =3D shell_pgrp;
>> -    cleanup_the_pipeline ();
>> ---- 6357,6364 ----
>> -  #if defined (JOB_CONTROL)
>> -    old_pipeline_pgrp =3D pipeline_pgrp;
>> -!   /* Don't reset the pipeline pgrp if we're already a subshell in a pip=
eline or
>> -!      we've already forked to run a disk command (and are expanding redi=
rections,
>> -!      for example). */
>> -!   if ((subshell_environment & (SUBSHELL_FORK|SUBSHELL_PIPE)) =3D=3D 0)
>> -      pipeline_pgrp =3D shell_pgrp;
>> -    cleanup_the_pipeline ();
>> -
>> -*** ../bash-5.1/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 2
>> -
>> -  #endif /* _PATCHLEVEL_H_ */
>> ---- 26,30 ----
>> -     looks for to find the patch level (for the sccs version string). */
>> -
>> -! #define PATCHLEVEL 3
>> -
>> -  #endif /* _PATCHLEVEL_H_ */
>> diff --git a/src/patches/bash/bash51-004 b/src/patches/bash/bash51-004
>> deleted file mode 100644
>> index 39a6c647f..000000000
>> --- a/src/patches/bash/bash51-004
>> +++ /dev/null
>> @@ -1,126 +0,0 @@
>> -			     BASH PATCH REPORT
>> -			     =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> -
>> -Bash-Release:	5.1
>> -Patch-ID:	bash51-004
>> -
>> -Bug-Reported-by:	oguzismailuysal(a)gmail.com
>> -Bug-Reference-ID:	<CAH7i3LoHGmwaghDpCWRUfcY04gQmeDTH3RiG=3Dbf2b=3DKbU=3Dg=
yhw(a)mail.gmail.com>
>> -Bug-Reference-URL:	https://lists.gnu.org/archive/html/bug-bash/2020-12/ms=
g00039.html
>> -
>> -Bug-Description:
>> -
>> -If a key-value compound array assignment to an associative array is suppl=
ied
>> -as an assignment statement argument to the `declare' command that declare=
s the
>> -array, the assignment doesn't perform the correct word expansions.
>> -
>> -This patch makes key-value assignment and subscript assignment perform the
>> -same expansions when they're supplied as an argument to `declare'.
>> -
>> -Patch (apply with `patch -p0'):
>> -
>> -*** ../bash-5.1-patched/arrayfunc.c	2020-10-09 11:38:58.000000000 -0400
>> ---- arrayfunc.c	2020-12-11 15:12:22.000000000 -0500
>> -***************
>> -*** 598,601 ****
>> ---- 598,622 ----
>> -      }
>> -  }
>> -+
>> -+ /* Return non-zero if L appears to be a key-value pair associative array
>> -+    compound assignment. */
>> -+ int
>> -+ kvpair_assignment_p (l)
>> -+      WORD_LIST *l;
>> -+ {
>> -+   return (l && (l->word->flags & W_ASSIGNMENT) =3D=3D 0 && l->word->wor=
d[0] !=3D '[');	/*]*/
>> -+ }
>> -+
>> -+ char *
>> -+ expand_and_quote_kvpair_word (w)
>> -+      char *w;
>> -+ {
>> -+   char *t, *r;
>> -+
>> -+   t =3D w ? expand_assignment_string_to_string (w, 0) : 0;
>> -+   r =3D sh_single_quote (t ? t : "");
>> -+   free (t);
>> -+   return r;
>> -+ }
>> -  #endif
>> -
>> -***************
>> -*** 641,645 ****
>> -
>> -  #if ASSOC_KVPAIR_ASSIGNMENT
>> -!   if (assoc_p (var) && nlist && (nlist->word->flags & W_ASSIGNMENT) =3D=
=3D 0 && nlist->word->word[0] !=3D '[')	/*]*/
>> -      {
>> -        iflags =3D flags & ~ASS_APPEND;
>> ---- 662,666 ----
>> -
>> -  #if ASSOC_KVPAIR_ASSIGNMENT
>> -!   if (assoc_p (var) && kvpair_assignment_p (nlist))
>> -      {
>> -        iflags =3D flags & ~ASS_APPEND;
>> -*** ../bash-5.1-patched/arrayfunc.h	2020-04-29 17:24:15.000000000 -0400
>> ---- arrayfunc.h	2020-12-11 14:23:50.000000000 -0500
>> -***************
>> -*** 68,71 ****
>> ---- 68,74 ----
>> -  extern void quote_compound_array_list PARAMS((WORD_LIST *, int));
>> -
>> -+ extern int kvpair_assignment_p PARAMS((WORD_LIST *));
>> -+ extern char *expand_and_quote_kvpair_word PARAMS((char *));
>> -+
>> -  extern int unbind_array_element PARAMS((SHELL_VAR *, char *, int));
>> -  extern int skipsubscript PARAMS((const char *, int, int));
>> -*** ../bash-5.1-patched/subst.c	2020-11-16 10:33:15.000000000 -0500
>> ---- subst.c	2020-12-11 15:11:10.000000000 -0500
>> -***************
>> -*** 11605,11608 ****
>> ---- 11605,11609 ----
>> -    WORD_LIST *l, *nl;
>> -    char *t;
>> -+   int kvpair;
>> -
>> -    if (flags =3D=3D 0)
>> -***************
>> -*** 11619,11622 ****
>> ---- 11620,11627 ----
>> -        /* Associative array */
>> -        l =3D parse_string_to_word_list (value, 1, "array assign");
>> -+ #if ASSOC_KVPAIR_ASSIGNMENT
>> -+       kvpair =3D kvpair_assignment_p (l);
>> -+ #endif
>> -+
>> -        /* For associative arrays, with their arbitrary subscripts, we ha=
ve to
>> -  	 expand and quote in one step so we don't have to search for the
>> -***************
>> -*** 11624,11627 ****
>> ---- 11629,11638 ----
>> -        for (nl =3D l; nl; nl =3D nl->next)
>> -  	{
>> -+ #if ASSOC_KVPAIR_ASSIGNMENT
>> -+ 	  if (kvpair)
>> -+ 	    /* keys and values undergo the same set of expansions */
>> -+ 	    t =3D expand_and_quote_kvpair_word (nl->word->word);
>> -+ 	  else
>> -+ #endif
>> -  	  if ((nl->word->flags & W_ASSIGNMENT) =3D=3D 0)
>> -  	    t =3D sh_single_quote (nl->word->word ? nl->word->word : "");
>> -
>> -*** ../bash-5.1/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 3
>> -
>> -  #endif /* _PATCHLEVEL_H_ */
>> ---- 26,30 ----
>> -     looks for to find the patch level (for the sccs version string). */
>> -
>> -! #define PATCHLEVEL 4
>> -
>> -  #endif /* _PATCHLEVEL_H_ */
>> diff --git a/src/patches/bash/bash51-009 b/src/patches/bash/bash51-009
>> new file mode 100644
>> index 000000000..2796c3b9b
>> --- /dev/null
>> +++ b/src/patches/bash/bash51-009
>> @@ -0,0 +1,59 @@
>> +			     BASH PATCH REPORT
>> +			     =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> +
>> +Bash-Release:	5.1
>> +Patch-ID:	bash51-009
>> +
>> +Bug-Reported-by:	Julien Moutinho <julm+bash(a)sourcephile.fr>
>> +Bug-Reference-ID:	<20211004035906.5kiobuzkpeckmvwg(a)sourcephile.fr>
>> +Bug-Reference-URL:	https://lists.gnu.org/archive/html/bug-bash/2021-10/ms=
g00022.html
>> +
>> +Bug-Description:
>> +
>> +The bash malloc implementation of malloc_usable_size() does not follow the
>> +specification. This can cause library functions that use it to overwrite
>> +memory bounds checking.
>> +
>> +Patch (apply with `patch -p0'):
>> +
>> +*** ../bash-5.1-patched/lib/malloc/malloc.c	2020-07-08 10:19:30.000000000=
 -0400
>> +--- lib/malloc/malloc.c	2021-10-05 16:10:55.000000000 -0400
>> +***************
>> +*** 1287,1297 ****
>> +      }
>> +
>> +!   /* XXX - should we return 0 if ISFREE? */
>> +!   maxbytes =3D binsize(p->mh_index);
>> +!
>> +!   /* So the usable size is the maximum number of bytes in the bin less =
the
>> +!      malloc overhead */
>> +!   maxbytes -=3D MOVERHEAD + MSLOP;
>> +!   return (maxbytes);
>> +  }
>> +
>> +--- 1358,1367 ----
>> +      }
>> +
>> +!   /* return 0 if ISFREE */
>> +!   if (p->mh_alloc =3D=3D ISFREE)
>> +!     return 0;
>> +!
>> +!   /* Since we use bounds checking, the usable size is the last requeste=
d size. */
>> +!   return (p->mh_nbytes);
>> +  }
>> +
>> +*** ../bash-5.1/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 8
>> +
>> +  #endif /* _PATCHLEVEL_H_ */
>> +--- 26,30 ----
>> +     looks for to find the patch level (for the sccs version string). */
>> +
>> +! #define PATCHLEVEL 9
>> +
>> +  #endif /* _PATCHLEVEL_H_ */
>> diff --git a/src/patches/bash/bash51-010 b/src/patches/bash/bash51-010
>> new file mode 100644
>> index 000000000..cfe6fa46b
>> --- /dev/null
>> +++ b/src/patches/bash/bash51-010
>> @@ -0,0 +1,59 @@
>> +			     BASH PATCH REPORT
>> +			     =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> +
>> +Bash-Release:	5.1
>> +Patch-ID:	bash51-010
>> +
>> +Bug-Reported-by:	Jonas Alfredsson <jonas.alfredsson(a)protonmail.com>
>> +Bug-Reference-ID:	<LjAfZaEuZncr2RaqhSSfcaiXdkuK6kdEYxshP3LApXbgMVQzggMGyW=
HO9knVkXicW2fP-ibsipJ_GZ-YaJRm96Rsozf6PgFmPsljRCtflls=3D@protonmail.com>
>> +Bug-Reference-URL:	https://lists.gnu.org/archive/html/bug-bash/2021-05/ms=
g00059.html
>> +
>> +Bug-Description:
>> +
>> +If `wait -n' is interrupted by a trapped signal other than SIGINT, it does
>> +not completely clean up state, and that can prevent subsequent calls to
>> +`wait -n' from working correctly.
>> +
>> +Patch (apply with `patch -p0'):
>> +
>> +*** ../bash-5.1-patched/builtins/wait.def	2020-12-16 17:13:12.000000000 -=
0500
>> +--- builtins/wait.def	2021-11-17 10:25:15.000000000 -0500
>> +***************
>> +*** 112,116 ****
>> +       WORD_LIST *list;
>> +  {
>> +!   int status, code, opt, nflag, wflags;
>> +    char *vname;
>> +    SHELL_VAR *pidvar;
>> +--- 112,117 ----
>> +       WORD_LIST *list;
>> +  {
>> +!   int status, code, opt, nflag;
>> +!   volatile int wflags;
>> +    char *vname;
>> +    SHELL_VAR *pidvar;
>> +***************
>> +*** 181,184 ****
>> +--- 188,193 ----
>> +        status =3D 128 + wait_signal_received;
>> +        wait_sigint_cleanup ();
>> ++       if (wflags & JWAIT_WAITING)
>> ++ 	unset_waitlist ();
>> +        WAIT_RETURN (status);
>> +      }
>> +
>> +*** ../bash-5.1/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 9
>> +
>> +  #endif /* _PATCHLEVEL_H_ */
>> +--- 26,30 ----
>> +     looks for to find the patch level (for the sccs version string). */
>> +
>> +! #define PATCHLEVEL 10
>> +
>> +  #endif /* _PATCHLEVEL_H_ */
>> diff --git a/src/patches/bash/bash51-011 b/src/patches/bash/bash51-011
>> new file mode 100644
>> index 000000000..655c7ec8b
>> --- /dev/null
>> +++ b/src/patches/bash/bash51-011
>> @@ -0,0 +1,81 @@
>> +			     BASH PATCH REPORT
>> +			     =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> +
>> +Bash-Release:	5.1
>> +Patch-ID:	bash51-011
>> +
>> +Bug-Reported-by:	Alex fxmbsw7 Ratchev <fxmbsw7(a)gmail.com>
>> +Bug-Reference-ID:	<CAALKErFrm+yuwy=3DioK+RmjCiwxTDmzeMFWqLF2BEWYtkGS5UFQ(=
a)mail.gmail.com>
>> +Bug-Reference-URL:	https://lists.gnu.org/archive/html/bug-bash/2020-11/ms=
g00064.html
>> +
>> +Bug-Description:
>> +
>> +When reading a compound assignment, and running it through the parser to
>> +split it into words, we need to save and restore any alias we're currently
>> +expanding.
>> +
>> +Patch (apply with `patch -p0'):
>> +
>> +*** ../bash-5.1-patched/parse.y	2020-11-28 12:10:06.000000000 -0500
>> +--- parse.y	2021-10-13 11:04:27.000000000 -0400
>> +***************
>> +*** 6494,6501 ****
>> +
>> +    push_stream (1);
>> +- #if 0 /* TAG: bash-5.2 Alex fxmbsw7 Ratchev <fxmbsw7(a)gmail.com> 11/17=
/2020 */
>> +    if (ea =3D expanding_alias ())
>> +      parser_save_alias ();
>> +- #endif
>> +    last_read_token =3D WORD;		/* WORD to allow reserved words here */
>> +    current_command_line_count =3D 0;
>> +--- 6494,6499 ----
>> +***************
>> +*** 6532,6539 ****
>> +    pop_stream ();
>> +
>> +- #if 0 /* TAG: bash-5.2 */
>> +    if (ea)
>> +      parser_restore_alias ();
>> +- #endif
>> +
>> +  #if defined (HISTORY)
>> +--- 6530,6535 ----
>> +*** ../bash-5.1-patched/y.tab.c	2020-11-28 12:17:19.000000000 -0500
>> +--- y.tab.c	2021-11-17 10:47:35.000000000 -0500
>> +***************
>> +*** 8788,8795 ****
>> +
>> +    push_stream (1);
>> +- #if 0 /* TAG: bash-5.2 Alex fxmbsw7 Ratchev <fxmbsw7(a)gmail.com> 11/17=
/2020 */
>> +    if (ea =3D expanding_alias ())
>> +      parser_save_alias ();
>> +- #endif
>> +    last_read_token =3D WORD;		/* WORD to allow reserved words here */
>> +    current_command_line_count =3D 0;
>> +--- 8777,8782 ----
>> +***************
>> +*** 8826,8833 ****
>> +    pop_stream ();
>> +
>> +- #if 0 /* TAG: bash-5.2 */
>> +    if (ea)
>> +      parser_restore_alias ();
>> +- #endif
>> +
>> +  #if defined (HISTORY)
>> +--- 8813,8818 ----
>> +*** ../bash-5.1/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 10
>> +
>> +  #endif /* _PATCHLEVEL_H_ */
>> +--- 26,30 ----
>> +     looks for to find the patch level (for the sccs version string). */
>> +
>> +! #define PATCHLEVEL 11
>> +
>> +  #endif /* _PATCHLEVEL_H_ */
>> diff --git a/src/patches/bash/bash51-012 b/src/patches/bash/bash51-012
>> new file mode 100644
>> index 000000000..222491884
>> --- /dev/null
>> +++ b/src/patches/bash/bash51-012
>> @@ -0,0 +1,198 @@
>> +			     BASH PATCH REPORT
>> +			     =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> +
>> +Bash-Release:	5.1
>> +Patch-ID:	bash51-012
>> +
>> +Bug-Reported-by:	Nikolay Borisov <nborisov(a)suse.com>
>> +Bug-Reference-ID:	<1a715205-06ce-413b-c1c0-2f5639ce06c0(a)suse.com>
>> +Bug-Reference-URL:	https://lists.gnu.org/archive/html/bug-bash/2020-11/ms=
g00091.html
>> +
>> +Bug-Description:
>> +
>> +There is a possible race condition that arises when a child process recei=
ves
>> +a signal trapped by the parent before it can reset the signal disposition=
s.
>> +The child process is not supposed to trap the signal in this circumstance.
>> +
>> +Patch (apply with `patch -p0'):
>> +
>> +*** ../bash-20201118/command.h	2020-08-14 15:04:39.000000000 -0400
>> +--- command.h	2020-11-27 15:18:02.000000000 -0500
>> +***************
>> +*** 125,128 ****
>> +--- 125,129 ----
>> +  #define SUBSHELL_COPROC	0x40	/* subshell from a coproc pipeline */
>> +  #define SUBSHELL_RESETTRAP 0x80	/* subshell needs to reset trap strings=
 on first call to trap */
>> ++ #define SUBSHELL_IGNTRAP 0x100  /* subshell should reset trapped signal=
s from trap_handler */
>> +
>> +  /* A structure which represents a word. */
>> +
>> +*** ../bash-20201118/execute_cmd.c	2020-11-23 14:16:48.000000000 -0500
>> +--- execute_cmd.c	2020-11-27 16:43:25.000000000 -0500
>> +***************
>> +*** 1548,1551 ****
>> +--- 1548,1554 ----
>> +    reset_signal_handlers ();
>> +    subshell_environment |=3D SUBSHELL_RESETTRAP;
>> ++   /* Note that signal handlers have been reset, so we should no longer
>> ++     reset the handler and resend trapped signals to ourselves. */
>> ++   subshell_environment &=3D ~SUBSHELL_IGNTRAP;
>> +
>> +    /* We are in a subshell, so forget that we are running a trap handler=
 or
>> +***************
>> +*** 4321,4325 ****
>> +  	  cmdflags |=3D CMD_NO_FORK;
>> +
>> +! 	  subshell_environment =3D SUBSHELL_FORK;		/* XXX */
>> +  	  if (pipe_in !=3D NO_PIPE || pipe_out !=3D NO_PIPE)
>> +  	    subshell_environment |=3D SUBSHELL_PIPE;
>> +--- 4324,4329 ----
>> +  	  cmdflags |=3D CMD_NO_FORK;
>> +
>> +! 	  /* We redo some of what make_child() does with SUBSHELL_IGNTRAP */
>> +! 	  subshell_environment =3D SUBSHELL_FORK|SUBSHELL_IGNTRAP;	/* XXX */
>> +  	  if (pipe_in !=3D NO_PIPE || pipe_out !=3D NO_PIPE)
>> +  	    subshell_environment |=3D SUBSHELL_PIPE;
>> +***************
>> +*** 4575,4578 ****
>> +--- 4580,4584 ----
>> +  	  reset_signal_handlers ();
>> +  	  subshell_environment |=3D SUBSHELL_RESETTRAP;
>> ++ 	  subshell_environment &=3D ~SUBSHELL_IGNTRAP;
>> +
>> +  	  if (async)
>> +***************
>> +*** 5515,5518 ****
>> +--- 5521,5525 ----
>> +        /* Cancel traps, in trap.c. */
>> +        restore_original_signals ();
>> ++       subshell_environment &=3D ~SUBSHELL_IGNTRAP;
>> +
>> +  #if defined (JOB_CONTROL)
>> +
>> +*** ../bash-20201118/jobs.c	2020-08-04 10:17:39.000000000 -0400
>> +--- jobs.c	2020-11-27 16:39:56.000000000 -0500
>> +***************
>> +*** 2218,2221 ****
>> +--- 2218,2223 ----
>> +        pid_t mypid;
>> +
>> ++       subshell_environment |=3D SUBSHELL_IGNTRAP;
>> ++
>> +        /* If this ends up being changed to modify or use `command' in the
>> +  	 child process, go back and change callers who free `command' in
>> +diff -rC 2 ../bash-20201118/nojobs.c nojobs.c
>> +*** ../bash-20201118/nojobs.c	2020-07-08 10:11:25.000000000 -0400
>> +--- nojobs.c	2020-11-27 16:38:36.000000000 -0500
>> +***************
>> +*** 576,579 ****
>> +--- 576,581 ----
>> +  #endif
>> +
>> ++       subshell_environment |=3D SUBSHELL_IGNTRAP;
>> ++
>> +        default_tty_job_signals ();
>> +      }
>> +
>> +*** ../bash-20201118/sig.c	2020-11-23 13:22:17.000000000 -0500
>> +--- sig.c	2020-11-28 10:21:43.000000000 -0500
>> +***************
>> +*** 56,60 ****
>> +  #endif
>> +
>> +! extern void initialize_siglist ();
>> +
>> +  #if !defined (JOB_CONTROL)
>> +--- 56,61 ----
>> +  #endif
>> +
>> +! extern void initialize_siglist PARAMS((void));
>> +! extern void set_original_signal PARAMS((int, SigHandler *));
>> +
>> +  #if !defined (JOB_CONTROL)
>> +***************
>> +*** 256,259 ****
>> +--- 257,267 ----
>> +        XHANDLER(i) =3D oact.sa_handler;
>> +        XSAFLAGS(i) =3D oact.sa_flags;
>> ++
>> ++ #if 0
>> ++       set_original_signal (XSIG(i), XHANDLER(i));	/* optimization */
>> ++ #else
>> ++       set_original_signal (XSIG(i), act.sa_handler);	/* optimization */
>> ++ #endif
>> ++
>> +        /* Don't do anything with signals that are ignored at shell entry
>> +  	 if the shell is not interactive. */
>> +
>> +*** ../bash-20201118/subst.c	2020-11-16 10:33:15.000000000 -0500
>> +--- subst.c	2020-11-27 16:07:00.000000000 -0500
>> +***************
>> +*** 5952,5955 ****
>> +--- 5952,5956 ----
>> +        /* Cancel traps, in trap.c. */
>> +        restore_original_signals ();	/* XXX - what about special builtins=
? bash-4.2 */
>> ++       subshell_environment &=3D ~SUBSHELL_IGNTRAP;
>> +        QUIT;	/* catch any interrupts we got post-fork */
>> +        setup_async_signals ();
>> +***************
>> +*** 6383,6386 ****
>> +--- 6384,6388 ----
>> +        QUIT;	/* catch any interrupts we got post-fork */
>> +        subshell_environment |=3D SUBSHELL_RESETTRAP;
>> ++       subshell_environment &=3D ~SUBSHELL_IGNTRAP;
>> +      }
>> +
>> +
>> +diff -rC 2 ../bash-20201118/trap.c trap.c
>> +*** ../bash-20201118/trap.c	2020-11-28 12:04:07.000000000 -0500
>> +--- trap.c	2020-11-28 10:22:10.000000000 -0500
>> +***************
>> +*** 482,485 ****
>> +--- 482,511 ----
>> +      }
>> +
>> ++   /* This means we're in a subshell, but have not yet reset the handler=
 for
>> ++      trapped signals. We're not supposed to execute the trap in this si=
tuation;
>> ++      we should restore the original signal and resend the signal to our=
selves
>> ++      to preserve the Posix "signal traps that are not being ignored sha=
ll be
>> ++      set to the default action" semantics. */
>> ++   if ((subshell_environment & SUBSHELL_IGNTRAP) && trap_list[sig] !=3D =
(char *)IGNORE_SIG)
>> ++     {
>> ++       sigset_t mask;
>> ++
>> ++       /* Paranoia */
>> ++       if (original_signals[sig] =3D=3D IMPOSSIBLE_TRAP_HANDLER)
>> ++ 	original_signals[sig] =3D SIG_DFL;
>> ++
>> ++       restore_signal (sig);
>> ++
>> ++       /* Make sure we let the signal we just caught through */
>> ++       sigemptyset (&mask);
>> ++       sigprocmask (SIG_SETMASK, (sigset_t *)NULL, &mask);
>> ++       sigdelset (&mask, sig);
>> ++       sigprocmask (SIG_SETMASK, &mask, (sigset_t *)NULL);
>> ++
>> ++       kill (getpid (), sig);
>> ++
>> ++       SIGRETURN (0);
>> ++     }
>> ++
>> +    if ((sig >=3D NSIG) ||
>> +        (trap_list[sig] =3D=3D (char *)DEFAULT_SIG) ||
>> +
>> +*** ../bash-5.1/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 11
>> +
>> +  #endif /* _PATCHLEVEL_H_ */
>> +--- 26,30 ----
>> +     looks for to find the patch level (for the sccs version string). */
>> +
>> +! #define PATCHLEVEL 12
>> +
>> +  #endif /* _PATCHLEVEL_H_ */
>> --=20
>> 2.34.1
>>
>=20

--===============6628442320405114947==--