Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

TRAPDEBUG exit bug?



Correct me if I'm wrong, but I couldn't find anything in the docs that
indicate the following is expected behavior w.r.t. TRAPDEBUG.

Setting TRAPDEBUG seems to make zsh unexpectedly emit SIGEXIT after a
command following a failed && or || conditional expr.

trap "" DEBUG
trap "print exit trap" EXIT

for ((i = 0; i < 2; i++)); do
    false && :
    echo $?
done

$ zsh ./test.sh
1
exit trap
1

Unsetting debug_before_cmd or having more than one command follow
produces the expected behavior.

Ex:
trap "" DEBUG
trap "print exit trap" EXIT

for ((i = 0; i < 2; i++)); do
    false && :
    echo $?
    :
done

$ zsh ./test.sh
1
1
exit trap

Reproducible since patch 27947.

/jsks



Messages sorted by: Reverse Date, Date, Thread, Author