Source-Changes archive

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

CVS commit: src/tests/bin/sh



Module Name:    src
Committed By:   kre
Date:           Tue May 18 21:37:56 UTC 2021

Modified Files:
        src/tests/bin/sh: t_builtins.sh

Log Message:
Add two new sub-tests to the echo test case of the t_builtins shell ATF test.

The first verifies that echo exits >0 when it encounters an I/O error on
its output (this part would have succeeded for a long time).  It also
verifies the POSIX requirement that when most standard utilities (or
perhaps many rather than most) exit(>0) they must write a message to stderr.
Our sh's built in echo did not do that (nor does /bin/echo but that's not
relevant here).

The second demonstrates (on an unfixed built-in echo) a bug reported in
private e-mail by Oguz <oguzismailuysal%gmail.com@localhost> where once an instance of
the built-in echo has detected an I/O error, all later invocations of
the built-in echo, with no I/O errors of their own, also exit(1) (the error
status on stdout is not cleared, each echo sees the "I/O error occurred" and
does exit(1)).

In this second sub-test, the "2>&-" on the first echo command is simply
an artifact caused by the test harness - the "check" function verifies
that exit((>0) requires a message on stderr (and vice versa), but that
only applies to most (or many) utilities, echo is one, but sh is not.
In the second test, the exit status comes from sh - sh is permitted to
write to stderr (via the echo command it runs in this case) and still
exit(0).   But the check function in the test does not understand that
subtlety.   So, we simply suppress the stderr message by closing stderr
(the first of these two new sub-tests has verified that the message exists)..


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/bin/sh/t_builtins.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index