bash52-019.patch 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. BASH PATCH REPORT
  2. =================
  3. Bash-Release: 5.2
  4. Patch-ID: bash52-019
  5. Bug-Reported-by: Steffen Nurpmeso <steffen@sdaoden.eu>
  6. Bug-Reference-ID: <20230116233547.2jFxL%steffen@sdaoden.eu>
  7. Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2023-01/msg00057.html
  8. Bug-Description:
  9. There are some cases where the shell reaped a background (asynchronous) job
  10. and would incorrectly try to set the terminal's process group back to the
  11. shell's. In these cases it never set the terminal process group to that
  12. jobs's process group initially, so resetting it is incorrect.
  13. Patch (apply with `patch -p0'):
  14. *** ../bash-5.2-patched/jobs.c 2022-12-13 12:09:02.000000000 -0500
  15. --- jobs.c 2023-10-26 12:12:10.000000000 -0400
  16. ***************
  17. *** 3078,3084 ****
  18. subshell. Make sure subst.c:command_substitute uses the same
  19. conditions to determine whether or not it should undo this and
  20. ! give the terminal to pipeline_pgrp. */
  21. !
  22. if ((flags & JWAIT_NOTERM) == 0 && running_in_background == 0 &&
  23. (subshell_environment & (SUBSHELL_ASYNC|SUBSHELL_PIPE)) == 0)
  24. give_terminal_to (shell_pgrp, 0);
  25. --- 3036,3046 ----
  26. subshell. Make sure subst.c:command_substitute uses the same
  27. conditions to determine whether or not it should undo this and
  28. ! give the terminal to pipeline_pgrp. We don't give the terminal
  29. ! back to shell_pgrp if an async job in the background exits because
  30. ! we never gave it to that job in the first place. An async job in
  31. ! the foreground is one we started in the background and foregrounded
  32. ! with `fg', and gave it the terminal. */
  33. if ((flags & JWAIT_NOTERM) == 0 && running_in_background == 0 &&
  34. + (job == NO_JOB || IS_ASYNC (job) == 0 || IS_FOREGROUND (job)) &&
  35. (subshell_environment & (SUBSHELL_ASYNC|SUBSHELL_PIPE)) == 0)
  36. give_terminal_to (shell_pgrp, 0);
  37. ***************
  38. *** 3624,3627 ****
  39. --- 3599,3603 ----
  40. get_tty_state ();
  41. save_stty = shell_tty_info;
  42. + jobs[job]->flags &= ~J_ASYNC; /* no longer async */
  43. /* Give the terminal to this job. */
  44. if (IS_JOBCONTROL (job))
  45. *** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
  46. --- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
  47. ***************
  48. *** 26,30 ****
  49. looks for to find the patch level (for the sccs version string). */
  50. ! #define PATCHLEVEL 18
  51. #endif /* _PATCHLEVEL_H_ */
  52. --- 26,30 ----
  53. looks for to find the patch level (for the sccs version string). */
  54. ! #define PATCHLEVEL 19
  55. #endif /* _PATCHLEVEL_H_ */