bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DEBUG trap in a background shell steals controlling terminal forcing


From: Mark March
Subject: Re: DEBUG trap in a background shell steals controlling terminal forcing parent shell to exit
Date: Mon, 1 Jul 2024 17:27:04 +0000 (UTC)

 Thank you for a quick fix. Bash 5.2.21 with the patch applied no longer 
exhibits the problem in my tests.
-Mark

    On Thursday, June 27, 2024 at 06:05:28 AM PDT, Chet Ramey 
<chet.ramey@case.edu> wrote:  
 
 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/

  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]