Add a patch, obtained from upstream, which fixes a bug with "wait -n pid"

if that wait is interrupted by a trapped signal.   A later wait for the
same pid would return status 127 (process not found) even though the
process was still running (and still in bash's jobs table).

This was a bug introduced in bash 5.1 (does not occur in 5.0 or earlier).

This patch should be removed when bash is next updated (to 5.2 or beyond)
(the change will be in the bash codebase) or if a patch is released from
upstream to fix this problem.

PGKREVISION++

{ This change is not significant enough to warrant an entry in doc/CHANGES. }
This commit is contained in:
kre 2021-05-17 22:10:43 +00:00
parent 771a04fce8
commit 1a3d935311
3 changed files with 26 additions and 2 deletions

View file

@ -1,8 +1,10 @@
# $NetBSD: Makefile,v 1.98 2021/05/05 11:02:59 kre Exp $
# $NetBSD: Makefile,v 1.99 2021/05/17 22:10:43 kre Exp $
BASH_VERSION= 5.1
BASH_PATCHLEVEL= 8
PKGREVISION= 1
DISTNAME= bash-${BASH_VERSION}
PKGNAME= bash-${BASH_VERSION}.${BASH_PATCHLEVEL}
CATEGORIES= shells

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.63 2021/05/05 11:02:59 kre Exp $
$NetBSD: distinfo,v 1.64 2021/05/17 22:10:43 kre Exp $
SHA1 (bash-5.1.tar.gz) = 063019501ef1f30fad99d2b735a7ae2ce1d11423
RMD160 (bash-5.1.tar.gz) = 3b968e29e3867e201a781c4dc28f71120dbaeed8
@ -40,6 +40,7 @@ SHA1 (patch-af) = e26e3209902247263884cfebc11a2f7e43245062
SHA1 (patch-ag) = cd3b151e3bb045d2bb609c0a03d7d3df2c871f47
SHA1 (patch-aj) = 2e4c15afd9b50d44967ee8e1f85bdc908c0eeeb0
SHA1 (patch-builtins_ulimit.def) = 1390069344607204eb3abbd6ddeb148ff590c55e
SHA1 (patch-builtins_wait.def) = 777ed0528fbd66ea20b039a2ab33ce89221c7312
SHA1 (patch-configure) = c4e1ab53a1ee85f3e6121047f0aca8ceb85e6e5d
SHA1 (patch-examples_loadables_fdflags.c) = dce409c76b7d6c838eb25c3ccc7a89ee57ca69b8
SHA1 (patch-lib_malloc_malloc.c) = fc22c2bb45490c57782d34d62336d168875c3609

View file

@ -0,0 +1,21 @@
$NetBSD: patch-builtins_wait.def,v 1.1 2021/05/17 22:10:43 kre Exp $
Patch from upstream: fix bug when "wait -n pid" is interrupted by
a trapped signal, which caused any future wait for the same pid
to claim the proecss does not exist (when it really does).
This patch should be removed on whichever occurs first of the
next bash version update (5.2 or later), or release of a bash patch
which fixes this problem.
--- builtins/wait.def.orig 2021-05-05 17:57:33.297675698 +0700
+++ builtins/wait.def 2021-05-18 04:50:15.475943116 +0700
@@ -180,6 +180,8 @@
last_command_exit_signal = wait_signal_received;
status = 128 + wait_signal_received;
wait_sigint_cleanup ();
+ if (wflags & JWAIT_WAITING)
+ unset_waitlist ();
WAIT_RETURN (status);
}