Hi ksh maintainers,

I have noticed a change in handling of the pipefail option in ksh. The
change occurred somewhere between ksh-93t+ and ksh-93u+.

When the pipefail option is set, command pipelines return an error
(non-zero) status if any process in a pipeline returns an error status.
In ksh-93t+, an error status from any pipeline stage triggers an ERR
trap or errexit. In ksh-93u+, a pipeline returns the expected error
status if any command returns an error, but execution continues as
though the error did not occur (unless the error comes from the last
pipeline stage). For example:

#!/bin/ksh
set -o pipefail
set -e errexit
trap 'echo ERR' ERR
false | true
echo "Continued past error $?"

Without the pipefail option, "false | true" would return 0, but with the
pipefail option, it returns 1. In ksh-93t+, the above commands display
"ERR" and exit the shell. But in ksh-93u+, the message "Continued after
error 1" is displayed without exiting the shell, indicating that the
error status from the pipeline is not triggering either the ERR trap or
errexit option.

Is this change in behaviour a deliberate feature, or does it indicate a
bug?

Regards,
Milton.

_______________________________________________
ast-users mailing list
ast-users@lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to