[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug-report: debug trap messes up pipestatus if containing command substi
From: |
Hengyang Zhao |
Subject: |
bug-report: debug trap messes up pipestatus if containing command substitution |
Date: |
Mon, 20 May 2019 21:51:16 -0700 |
Dear bash developers,
I found an unexpected behavior when engineering some code in a callback of
DEBUG trap. The code has been distilled to expose this behavior:
### BEGIN
my_func() {
local x=$(:)
}
trap my_func DEBUG
false | true | false | true | false
echo ${PIPESTATUS[@]}
# expects 1 0 1 0 1
# gets 0 0 0 0 1
### END
Configuration Information:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions
-fstack-protector-strong -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-Wno-parentheses -Wno-format-security
uname output: Linux fedora 5.0.9-301.fc30.x86_64 #1 SMP Tue Apr 23 23:57:35
UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu
This also happens on many of my OSes running bash 4.x.
I'm happy to provide further information if needed.
Thank you,
Hengyang
- bug-report: debug trap messes up pipestatus if containing command substitution,
Hengyang Zhao <=