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