]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
Bash-5.2 patch 28: fix terminal pgrp handling in DEBUG trap
authorChet Ramey <chet.ramey@case.edu>
Thu, 1 Aug 2024 15:33:15 +0000 (11:33 -0400)
committerChet Ramey <chet.ramey@case.edu>
Thu, 1 Aug 2024 15:33:15 +0000 (11:33 -0400)
patchlevel.h
trap.c

index b534802b940d4d72d8a4817f8293132adacfbd40..7abb1edb666997635fb2172a855f4d18afa2c383 100644 (file)
@@ -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 27
+#define PATCHLEVEL 28
 
 #endif /* _PATCHLEVEL_H_ */
diff --git a/trap.c b/trap.c
index e56f6cc365e9c183fd73240dc784bcb341d33779..465c336052a23705641324bfb6a69b15f79bfc76 100644 (file)
--- a/trap.c
+++ b/trap.c
@@ -1216,7 +1216,9 @@ run_debug_trap ()
       close_pgrp_pipe ();
       restore_pgrp_pipe (save_pipe);
 #  endif
-      if (pipeline_pgrp > 0 && ((subshell_environment & (SUBSHELL_ASYNC|SUBSHELL_PIPE)) == 0))
+      /* If the trap command gave the terminal to another process group,
+        restore it. XXX - check running_in_background? */
+      if (job_control && pipeline_pgrp > 0 && ((subshell_environment & (SUBSHELL_ASYNC|SUBSHELL_PIPE)) == 0))
        give_terminal_to (pipeline_pgrp, 1);
 
       notify_and_cleanup ();