mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
This allows scripts to check for a nonzero exit status on the 'print', 'printf' and 'echo' builtins and prevent possible infinite loops if SIGPIPE is ignored. sfsync() was already returning a negative value on I/O error, so all we need to do is add a check. The stream buffer will need to be filled before an I/O error can be detected, but this is the same on other shells. See manual page: src/lib/libast/man/sfio.3 Ref.: https://github.com/att/ast/issues/1093 https://github.com/att/ast/pull/1363 src/cmd/ksh93/bltins/print.c: b_print(): - Make sure an error result from sfsync() is reflected in the output builtin's exit status (exitval). - Write an I/O error message (e_io) if the exit status is nonzero. src/cmd/ksh93/data/msg.c, src/cmd/ksh93/include/io.h: - Add the e_io[] error message. src/cmd/ksh93/tests/builtins.sh: - Add I/O error regression test, checking for the correct error message and exit status. All three output builtins use the same b_print() function so we only need to test one. src/cmd/ksh93/tests/basic.sh, src/cmd/ksh93/tests/coprocess.sh: - Redirect stderr on a few 'print' commands to /dev/null; these now issue an expected I/O error. This does not cause failures. NEWS, TODO: - Update. (cherry picked from commit 9011fa933552e483dab460f7dd1593d64e059d94) |
||
|---|---|---|
| .. | ||
| cmd | ||
| lib | ||
| Makefile | ||
| Mamfile | ||