[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: «run_pending_traps: bad value in trap_list» when `jobs` is run a tra
From: |
Chet Ramey |
Subject: |
Re: «run_pending_traps: bad value in trap_list» when `jobs` is run a trap |
Date: |
Wed, 3 Jul 2024 09:33:57 -0400 |
User-agent: |
Mozilla Thunderbird |
On 7/1/24 4:45 PM, Gioele Barabucci wrote:
Hi,
the following script (reduced from <https://bugs.debian.org/417946>)
#!/bin/bash
childfinished () { echo "jobs: $(jobs)"; }
trap childfinished SIGCHLD
sleep 1 &
wait
causes bash 5.2.21 to output
./par.sh: line 2: warning: run_pending_traps:
bad value in trap_list[17]: 0x5625e6fa43d0
Does this warning hint at something like a dangling reference that should
be fixed, or can it be safely ignored?
It's warning you that you're recursively calling the SIGCHLD trap handler.
It's clearer when the debugging messages are enabled:
$ ./bash x2
x2: line 2: DEBUG warning: wait_for: recursively setting old_sigint_handler
to wait_sigint_handler: running_trap = 21
jobs: [1]+ Done sleep 1
x2: line 2: DEBUG warning: run_pending_traps: recursive invocation while
running trap for signal 20
x2: line 2: warning: run_pending_traps: bad value in trap_list[20]: 0x102dc8a0c
We use the `bad value' as a sentinel to make sure the user can reset the
SIGCHLD disposition in the trap handler without run_trap_internal restoring
it to the original value.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature