2014-08-11 20:47 GMT+02:00 Greg Wooledge <wool...@eeg.ccf.org>: > On Tue, Aug 12, 2014 at 02:21:18AM +0800, lolilolicon wrote: > > The following code segfaults when run by bash 4.3.022 > > > > set -E > > shopt -s lastpipe > > trap -- 'true' ERR > > true | { true | false; } > > I could not reproduce this, on HP-UX or Linux. I tried from an > interactive shell, just typing these commands. Did you use a script? > Is your bash 4.3.22 from an OS distribution package, or did you compile > it yourself? If it's a script, is BASH_ENV set? Can you still trigger > the bug with an interactive shell, or with an interactive shell started > with --norc? >
I can reproduce this on linux for non-interactive bash (which makes sense since lastpipe doesn't do much when set -m is in effect), but it's not limited to 4.3.22, and set -E does not appear to affect the outcome. $ bash42 -c 'echo "$BASH_VERSION";shopt -s lastpipe; trap -- "printf x" ERR; true | { true | false; }' 4.2.47(2)-release xxSegmentation fault $ bash43 -c 'shopt -s lastpipe; trap -- "printf x" ERR; true | { true | false; }' 4.3.22(1)-release xxSegmentation fault And lastly, in interactive mode $ set +m; shopt -s lastpipe; trap -- "printf x" ERR; true | { true | false; } xxx Can't quite understand why it would trigger the ERR trap thrice. -- Geir Hauge