[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: DEBUG trap in a background shell steals controlling terminal forcing
From: |
Chet Ramey |
Subject: |
Re: DEBUG trap in a background shell steals controlling terminal forcing parent shell to exit |
Date: |
Thu, 27 Jun 2024 09:04:03 -0400 |
User-agent: |
Mozilla Thunderbird |
On 6/18/24 4:55 PM, Mark March wrote:
I am working with a large Bash code base where most scripts disable job control
and the DEBUG trap is used extensively. I noticed that if I tried to run my
scripts in the background, the interactive shell that started them would
immediately exit on any keyboard input. A simple repro is to run
bash +m -c "/bin/echo ; trap 'trap DEBUG' DEBUG ; sleep 10" &
in an interactive shell with job control enabled. Hit Enter a few times. The
shell that launched this background process exits. The background process
itself appears to be killed by a signal.
Thanks for the report. The attached patch should fix your issue, though
there might be some corner cases. Let me know.
Chet
--
``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/
debug-trap-tprgp.patch
Description: Text document
OpenPGP_signature.asc
Description: OpenPGP digital signature