summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2021-05-04 14:30:17 -0400
committerChet Ramey <chet.ramey@case.edu>2021-05-04 14:30:17 -0400
commitf3cd936b81006df41a1c8509891dea1edeaef8e6 (patch)
treecc1e1718105d9025f9f268b61972bd769d579fe4
parentcc978a670597afc3251baca3a7db553f36946c22 (diff)
downloadbash-f3cd936b81006df41a1c8509891dea1edeaef8e6.tar.gz
Bash-5.1 patch 6: make sure child processes forked to execute command substitutions are in the right process group
-rw-r--r--patchlevel.h2
-rw-r--r--subst.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/patchlevel.h b/patchlevel.h
index c7f39aec..6257aeeb 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -25,6 +25,6 @@
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
looks for to find the patch level (for the sccs version string). */
-#define PATCHLEVEL 5
+#define PATCHLEVEL 6
#endif /* _PATCHLEVEL_H_ */
diff --git a/subst.c b/subst.c
index 1d24188e..462752de 100644
--- a/subst.c
+++ b/subst.c
@@ -6412,6 +6412,13 @@ command_substitute (string, quoted, flags)
/* The currently executing shell is not interactive. */
interactive = 0;
+#if defined (JOB_CONTROL)
+ /* Invariant: in child processes started to run command substitutions,
+ pipeline_pgrp == shell_pgrp. Other parts of the shell assume this. */
+ if (pipeline_pgrp > 0 && pipeline_pgrp != shell_pgrp)
+ shell_pgrp = pipeline_pgrp;
+#endif
+
set_sigint_handler (); /* XXX */
free_pushed_string_input ();