2022年10月1日(土) 4:30 Chet Ramey <chet.ra...@case.edu>: > On 7/17/22 11:52 PM, Koichi Murase wrote: > Thanks for the detailed report and suggested patches. I applied a variant > of your patch 3;
Thank you for taking the time to review and apply the patch. > the change to print_job appears not to be needed (at least > all of your test cases work without it). Maybe it has been fixed in another way, but how about the following test cases? Let us consider the following two functions: $ f1() { echo begin;for a in {0..3}; do (kill -9 $BASHPID); done;echo end; } $ f2() { echo begin;for a in {0..3}; do (kill -9 $BASHPID); done;jobs;echo end; } The difference between the two functions is that `f2` calls `jobs'. I expect the same behavior of `f1' and `f2' as far as there are no background jobs. Also, I expect the same messages of `f1' in the normal context and in the trap handler except that the messages are delayed until the end of the trap handler in the latter case. With the original patch 3, I obtain the result I expect as: $ ./bash-r0022-fix3 --norc $ f1() { echo begin;for a in {0..3}; do (kill -9 $BASHPID); done;echo end; } $ f2() { echo begin;for a in {0..3}; do (kill -9 $BASHPID); done;jobs;echo end; } $ f1 begin Killed Killed Killed Killed end $ trap f1 INT $ ^C begin end Killed Killed Killed Killed $ f2 begin Killed Killed Killed Killed end $ trap f2 INT $ ^C begin end Killed Killed Killed Killed If I drop the change to `print_job' from patch 3, the behavior changes only for `f2' in the trap handler. I get the killed job information in an unexpected format. $ ./bash-r0022-fix3-no_print_job_fix --norc $ f1() { echo begin;for a in {0..3}; do (kill -9 $BASHPID); done;echo end; } $ f2() { echo begin;for a in {0..3}; do (kill -9 $BASHPID); done;jobs;echo end; } $ f1 begin Killed Killed Killed Killed end $ trap f1 INT $ ^C begin end Killed Killed Killed Killed $ f2 begin Killed Killed Killed Killed end $ trap f2 INT $ ^C begin [1] Killed ( kill -9 $BASHPID ) [2] Killed ( kill -9 $BASHPID ) [3] Killed ( kill -9 $BASHPID ) [4] Killed ( kill -9 $BASHPID ) end I feel the former behavior is more consistent. I would like to hear what you think. Thank you. -- Koichi