NetBSD/bin
kre e177ba5371 Fix a bug in the built-in echo in /bin/sh reported in private mail by
Oguz <oguzismailuysal@gmail.com>

If echo detects an I/O error, it does exit(1) (that's fine) but then
the next echo also does exit(1) even without any errors of its own,
and every following echo writing to stdout does the same thing.

eg:

echo foo >&- ; echo $?; echo $?; ( echo $( echo $?; echo $?) ; echo $? )
1
1
1 1
1

The first echo writes nothing (stdout is closed) but does exit(1).
The second echo writes "1" (correct, the exit status of the previous
echo) and should exit(0) - but doesn't.  This pattern continues...

While here, conform to the POSIX requirement on echo (and many other
standard utilities, but definitely not all) that when the utility
does exit(>0) a message must be written to stderr (and vice versa
in many cases).   Our echo (as shown above) did the exit(1) part
when it detected the I/O error, but no message is sent to stderr.
Fix that while we're here.

Similar changes are required for /bin/echo (coming soon), and
/usr/bin/printf (which is also the sh builtin printf) - except
currently that one kind of conforms, as it ignores errors writing
to stdout (as do large numbers of other utilities).  For many
programs that's kind of acceptable, but where the sole purpose of
the program is to write to stdout, it really isn't.   Also to be
fixed soon.
2021-05-18 21:39:06 +00:00
..
cat Add cross reference to tac(1). 2017-10-02 08:24:17 +00:00
chio typo: unvalid -> invalid 2017-10-16 17:08:35 +00:00
chmod Use Ex. 2017-07-04 06:46:51 +00:00
cp fix reversed test. 2020-05-22 14:54:30 +00:00
csh Print real maxrss value like other shells. 2020-10-17 08:46:02 +00:00
date Remove trailing whitespace and Tn macro. 2018-01-27 18:59:38 +00:00
dd dd.1: add an example of writing a NetBSD image 2021-05-18 07:17:09 +00:00
df df: bump man page date 2021-01-06 20:38:09 +00:00
domainname Use __dead 2011-08-29 14:51:17 +00:00
echo Add some commas. 2020-02-26 07:14:47 +00:00
ed Unifdef compatibility for broken realloc. 2019-01-04 19:13:58 +00:00
expr Fix typo 2020-06-11 13:08:07 +00:00
getfacl Fix xrefs, comment out acl(9) which we don't have. 2020-06-18 19:36:13 +00:00
hostname Remove options added in 1.18, commitid: UhxHPgtT2Pzeg4Yw due to some 2014-02-13 12:00:29 +00:00
kill Mark up path with Pa and use Ev for environment variable. 2020-08-30 20:14:07 +00:00
ksh PR/56007: Greg A. Woods: ksh unable to execute ERR traps 2021-02-23 01:31:30 +00:00
ln Update usage to include -w 2018-08-26 23:01:06 +00:00
ls Fix skipping of directories that begin with a '.' in -R mode. 2020-07-07 14:29:06 +00:00
mkdir Use Ex. Remove superfluous Pp. 2017-07-04 06:49:35 +00:00
mt Bump date for previous. 2018-09-01 07:26:56 +00:00
mv Note that -h is an extension to POSIX. Bump date. 2020-06-24 17:00:58 +00:00
pax Move definition of chdname and do_chroot to options.c 2020-04-03 16:13:32 +00:00
ps Remove SCCS workaround. No binary change. 2021-04-17 08:35:33 +00:00
pwd Use Ex. 2017-07-04 06:50:04 +00:00
rcmd Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
rcp In sink(), upon error, avoid multiple replies to the source as this 2020-05-06 18:15:40 +00:00
rm Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
rmdir PR/48182: Fix rmdir -p handling of top-level (root) directory. 2017-08-10 22:52:13 +00:00
setfacl Sync usage with manpage. 2020-06-18 19:44:01 +00:00
sh Fix a bug in the built-in echo in /bin/sh reported in private mail by 2021-05-18 21:39:06 +00:00
sleep Deal with overflow when the sleep duration given is a simple 2019-03-10 15:18:45 +00:00
stty Don't fail when the line discipline ioctl fails (since it secondary 2019-09-06 16:28:53 +00:00
sync Drop main() prototype. 2016-09-05 01:00:07 +00:00
test Allow SMALL (and TINY) builds of test (for SMALL/TINY builds of sh) 2018-09-13 22:00:58 +00:00
Makefile Add ACL support for FFS. From FreeBSD. 2020-05-16 18:31:45 +00:00
Makefile.inc Default to WARNS=5 2012-03-21 05:47:53 +00:00