On Mon, Jan 8, 2024 at 7:04 AM Sam Kappen via Bug reports for the GNU Bourne Again SHell <bug-bash@gnu.org> wrote: > We see that bash throws the "Operation not permitted" error when doing > chained pipe operation > along with a debug trap. > > We set a debug trap here "my_debug" to save the terminal commands entered. > The GNU bash, version used is 4.2. > > root@freescale-p2020ds:~/dir# ls -l | grep a | grep b | grep c > -sh: child setpgid (4238 to 4232): Operation not permitted > > > root@freescale-p2020ds:~/dir# trap > trap -- '' TSTP > trap -- '' TTIN > trap -- '' TTOU > trap -- 'my_debug' DEBUG > root@freescale-p2020ds:~/dir# > > Platform: Linux 3.10 kernel on PPC target. > > It seems setpgid is failing because the process group of the pipeline does > not exist at that time. > > This issue is not seen on bash version 4.4.
I'm not sure this is fixed. In all versions, including 4.2, 4.4, 5.2, and the current devel version, I see what seems to be the same error, triggered by a pipeline when job control is enabled and the DEBUG trap executes an external command. $ bash -m -c 'trap /usr/bin/true DEBUG; :|:' bash: child setpgid (49581 to 49579): Operation not permitted And an accompanying warning if Bash is built with -DDEBUG: DEBUG warning: delete_job (0 pgrp 49579): js.c_reaped (-1) < 0 ndel = 2 js.j_ndead = 0 > I am looking to figure out the particular fix that fixed this issue from > the above commit and to backport to bash4-2 version. In general you want to bisect using commits in the devel branch: https://git.savannah.gnu.org/cgit/bash.git/log/?h=devel