On Tue, Aug 12, 2014 at 09:15:04AM -0400, Chet Ramey wrote:
> On 8/11/14, 2:21 PM, lolilolicon wrote:
> > The following code segfaults when run by bash 4.3.022
> >
> > set -E
> > shopt -s lastpipe
> > trap -- 'true' ERR
> > true | { true | false; }
>
> Here's a patch for those who would like to test.
On HP-UX, I get these results:
$ bash-4.2 -c 'shopt -s lastpipe; trap -- "printf x" ERR; true | { true |
false; }'
xxSegmentation fault (core dumped)
$ bash-4.3.18 -c 'shopt -s lastpipe; trap -- "printf x" ERR; true | { true |
false; }'
xxSegmentation fault (core dumped)
$ bash-4.3.22 -c 'shopt -s lastpipe; trap -- "printf x" ERR; true | { true |
false; }'
xxx
$ ./bash -c 'shopt -s lastpipe; trap -- "printf x" ERR; true | { true | false;
}'
xxx
(The patch made no difference because the seg fault was already fixed
in 4.3.22.)
On Linux, I get these results:
$ bash-4.3.22 -c 'shopt -s lastpipe; trap -- "printf x" ERR; true | { true |
false; }'
xxSegmentation fault
$ ./bash -c 'shopt -s lastpipe; trap -- "printf x" ERR; true | { true | false;
}'
xx./bash: wait_for: No record of process 7954
x
(The patch stopped the seg fault, and added a new error message.)