bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pending signal in EXIT trap causes pattern matching to fail


From: Andreas Schwab
Subject: Pending signal in EXIT trap causes pattern matching to fail
Date: Wed, 12 Oct 2022 17:23:13 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

gmatch in lib/glob/sm_loop.c returns FNM_NOMATCH when a signal is
pending.  This can cause spurious pattern matching failures if a SIGPIPE
is received while executing the EXIT trap:

$ cat trap.sh
trap 'set -x; echo trap; case a in *) echo match >&2;; esac; echo done >&2' EXIT
while :; do :; done
$ bash trap.sh | :
^C++ echo trap
trap.sh: line 1: echo: write error: Broken pipe
++ case a in
++ echo done
done

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]