bb9a7e
From f3cd936b81006df41a1c8509891dea1edeaef8e6 Mon Sep 17 00:00:00 2001
bb9a7e
From: Chet Ramey <chet.ramey@case.edu>
bb9a7e
Date: Tue, 4 May 2021 14:30:17 -0400
bb9a7e
Subject: [PATCH] Bash-5.1 patch 6: make sure child processes forked to execute
bb9a7e
 command substitutions are in the right process group
bb9a7e
bb9a7e
---
bb9a7e
 patchlevel.h | 2 +-
bb9a7e
 subst.c      | 7 +++++++
bb9a7e
 2 files changed, 8 insertions(+), 1 deletion(-)
bb9a7e
bb9a7e
diff --git a/patchlevel.h b/patchlevel.h
bb9a7e
index c7f39aec..6257aeeb 100644
bb9a7e
--- a/patchlevel.h
bb9a7e
+++ b/patchlevel.h
bb9a7e
@@ -25,6 +25,6 @@
bb9a7e
    regexp `^#define[ 	]*PATCHLEVEL', since that's what support/mkversion.sh
bb9a7e
    looks for to find the patch level (for the sccs version string). */
bb9a7e
 
bb9a7e
-#define PATCHLEVEL 5
bb9a7e
+#define PATCHLEVEL 6
bb9a7e
 
bb9a7e
 #endif /* _PATCHLEVEL_H_ */
bb9a7e
diff --git a/subst.c b/subst.c
bb9a7e
index 1d24188e..462752de 100644
bb9a7e
--- a/subst.c
bb9a7e
+++ b/subst.c
bb9a7e
@@ -6412,6 +6412,13 @@ command_substitute (string, quoted, flags)
bb9a7e
       /* The currently executing shell is not interactive. */
bb9a7e
       interactive = 0;
bb9a7e
 
bb9a7e
+#if defined (JOB_CONTROL)
bb9a7e
+      /* Invariant: in child processes started to run command substitutions,
bb9a7e
+	 pipeline_pgrp == shell_pgrp. Other parts of the shell assume this. */
bb9a7e
+      if (pipeline_pgrp > 0 && pipeline_pgrp != shell_pgrp)
bb9a7e
+	shell_pgrp = pipeline_pgrp;
bb9a7e
+#endif
bb9a7e
+
bb9a7e
       set_sigint_handler ();	/* XXX */
bb9a7e
 
bb9a7e
       free_pushed_string_input ();
bb9a7e
-- 
bb9a7e
2.29.2
bb9a7e