Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15513

Signal ignore flags unexpectedly reset after "trap ... EXIT"

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Isaac To <isaac.to@gmail.com>
Newsgroups gnu.bash.bug
Subject Signal ignore flags unexpectedly reset after "trap ... EXIT"
Date Tue, 15 Oct 2019 17:22:39 +0800
Lines 62
Approved bug-bash@gnu.org
Message-ID <mailman.776.1571143362.9715.bug-bash@gnu.org> (permalink)
References <CAOArY3X4VXAkmoCh0vsRZuHsJpw=jOF4_uLocsap1bG+QpK1iQ@mail.gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
X-Trace usenet.stanford.edu 1571143363 31770 209.51.188.17 (15 Oct 2019 12:42:43 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=FeN+9NbDCdqmq92V4X/j2CzdNVCwESacGX7SccrpQQE=; b=QnZpOiWL552dd8adLnS4PHuH0lckDjRLPoWA5pSrBB+qxjftb71vHqPQhYiY8SQIy+ gErvtkyk2FuyXfMv5i33o7mZkHsGmP0lBI7R/BITH+kMpwkzUOOK5l/i22k5zPQ5SA1B vj+Oko/zirbg6I6yLcbSwpsJa6FZSRCjC/LCeDVNfMbYa/kWe+1BYV1pdInAXpkkj8qK PWRj4QeI0k17G2aXDPUgs5PJ9/kjVIqDQt5mE3m84gCNxYmHNaRuXlW/z+1HQs5osYL1 lIyDO7YbzacrBIctD1OXDPkvLteOi5OxCkYJnN6shyPwa4E2+1d9pDP/6/OjU737n/gy LgAg==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=FeN+9NbDCdqmq92V4X/j2CzdNVCwESacGX7SccrpQQE=; b=AIkNOKNtxk+3z0+uCG2XQOUueEfHPx+2zSFQPlKBUamHXm/HOZ0suo1V91TLiimqSS PZW1vVtrOvjEo+BjncAai6Cu8ScYG3kV6GQnn0w8ecx/YoDPydsge2p9oJjW6FvqaET2 Rl8DvYIO+ay7fjnjPFby6sASFFS9SXPiUBrILXeHX+QhRYy5CumBiVLgnT4CaG2h5Fv7 b8hjgFGsBnDph55+oWj+aHDZyEqvYccWWdT0XBlZWEIjHYsDkrZUnIqbdmcbkhg9kepP R8WvTKG8TQX8pUR+kZIRLuBLr91m95RRovo8w1wpEOBtM+FtkRPIh7GIeNig7+PyC1vy /HNA==
X-Gm-Message-State APjAAAXAF4F/Kn5d8egsGKK16SIke/c4Yf2YY9yroxQeIsGbp19Zap6V R9fSfsWHvhXlS8SNNUd1T023fOAPbf1AG6ZTp2VRKA+m
X-Google-Smtp-Source APXvYqzExLZyqLBqdr6g9YyXyaPwf5/HTBlrOEgBXQ9USBIQeVsimoXCnoZGFfEypQIaYJBhYtYWLO13yGgYo8Q8jsA=
X-Received by 2002:a9d:578b:: with SMTP id q11mr26635452oth.38.1571131370478; Tue, 15 Oct 2019 02:22:50 -0700 (PDT)
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2607:f8b0:4864:20::341
X-Mailman-Approved-At Tue, 15 Oct 2019 08:42:41 -0400
X-Content-Filtered-By Mailman/MimeDel 2.1.23
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <CAOArY3X4VXAkmoCh0vsRZuHsJpw=jOF4_uLocsap1bG+QpK1iQ@mail.gmail.com>
Xref csiph.com gnu.bash.bug:15513

Show key headers only | View raw


Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-LQgi2O/bash-5.0=.
-fstack-protector-strong -Wformat -Werror=format-security -Wall
-Wno-parentheses -Wno-format-security
uname output: Linux superposition 5.0.0-25-generic #26-Ubuntu SMP Thu Aug 1
12:04:58 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.0
Patch Level: 3
Release Status: release

Description:

When trying to write a program and start it in an initrc script, I observed
a strange behavior: if a subshell is started by a subshell of that script,
and the inner subshell runs "trap ... EXIT", it unsets the signal ignore
flag of other signals.  I'm not sure whether this should be called a bug,
or whether it is a problem caused by my own configuration.  Anyway here is
how I reproduce my problem.

Repeat-By:

$ cat t.sh
echo t $BASHPID
trap '' USR1
grep SigIgn /proc/$BASHPID/status
bash --rcfile t2.sh
$ cat t2.sh
echo t2 $BASHPID
grep SigIgn /proc/$BASHPID/status
(
    echo subshell $BASHPID
    grep SigIgn /proc/$BASHPID/status
    (
        echo subsubshell $BASHPID
        grep SigIgn /proc/$BASHPID/status
        echo trap $BASHPID
        trap 'echo hello' EXIT
        grep SigIgn /proc/$BASHPID/status
    )
)
$ ./t.sh
t 15141
SigIgn: 0000000000000204
t2 15143
SigIgn: 0000000000380004
subshell 15145
SigIgn: 0000000000000200
subsubshell 15147
SigIgn: 0000000000000200
trap 15147
SigIgn: 0000000000000000
hello
$

Note that the final SigIgn flag is completely reset, which is what I won't
expect.  The same problem won't occur if --rcfile is not used in t.sh.  And
the problem also didn't show up in bash 4.4.

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Signal ignore flags unexpectedly reset after "trap ... EXIT" Isaac To <isaac.to@gmail.com> - 2019-10-15 17:22 +0800

csiph-web