BASH PATCH REPORT
                            =================

Bash-Release:   5.1
Patch-ID:       bash51-010

Bug-Reported-by:        Jonas Alfredsson <[email protected]>
Bug-Reference-ID:       <LjAfZaEuZncr2RaqhSSfcaiXdkuK6kdEYxshP3LApXbgMVQzggMGyWHO9knVkXicW2fP-ibsipJ_GZ-YaJRm96Rsozf6PgFmPsljRCtflls=@protonmail.com>
Bug-Reference-URL:      https://lists.gnu.org/archive/html/bug-bash/2021-05/msg00059.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 = 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_ */