[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug-report: debug trap messes up pipestatus if containing command su
From: |
Chet Ramey |
Subject: |
Re: bug-report: debug trap messes up pipestatus if containing command substitution |
Date: |
Wed, 22 May 2019 10:27:39 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 |
On 5/21/19 12:51 AM, Hengyang Zhao wrote:
> 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
Thanks for the report. This appears to be a Linux-only problem (at least I
can't reproduce it on Mac OS X). I'll fix it for the next devel 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/