bug-bash
[Top][All Lists]
Advanced

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

Re: Bash ONESHOT optimization in conjunction with interactive mode break


From: Chet Ramey
Subject: Re: Bash ONESHOT optimization in conjunction with interactive mode breaks
Date: Wed, 7 Jun 2023 15:05:29 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.11.2

On 6/4/23 9:07 PM, Andrew Hamon wrote:

Bash Version: 5.1
Patch Level: 16
Release Status: release


Description:

     When running a command in interactive mode (i.e. bash -ic '/some/command')
     a bash script will stop itself and put it in the background unexpectedly.

Thanks for the report. The problem is, as you suspected, with the fork
optimization performed when ONESHOT is enabled. The issue is running a
command in interactive mode with -c (very rare, very odd).

The -i option forces the shell to be interactive, which triggers an
action to initialize job control, and, since the shell is interactive,
change the terminal process group to the process group of the command
being executed (/usr/bin/env). However, since the fork gets optimized
away, the shell isn't around to change the terminal's process group
back to its original value before the shell exits.

I'll fix it in the next devel branch push.

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]