NetBSD/bin
kre 16ccf0eeff PR bin/42184 PR bin/52687 (detailing the same bug).
Fix "command not found" handling so that the error message
goes to stderr (after any redirections are applied).

More importantly, in

	foo > /tmp/junk

/tmp/junk should be created, before any attempt is made
to execute (the assumed non-existing) "foo".

All this was always true for any command (not found command)
containing a / in its name

	foo/bar >/tmp/junk  2>>/tmp/errs

would have created /tmp/junk, then complained (in /tmp/errs)
about foo/bar not being found.   Now that happens for ordinary
commands as well.

The fix (which I found when I saw differences between our
code and FreeBSD's, where, for the benefit of PR 42184,
this has been fixed, sometime in the past 9 years) is
frighteningly simple.   Simply do not short circuit execution
(or print any error) when the initial lookup fails to
find the command - it will fail anyway when we actually
try running it.   The cost is a (seemingly unnecessary,
except that it really is) fork in this case.

This is what I had been planning, but I expected it would
be much more difficult than it turned out....

XXX pullup-8
2018-08-14 13:36:42 +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 Re-order the code to short circuit all the opens and closes if linking. 2018-07-17 13:04:58 +00:00
csh use SUBDIR.roff suggested by uwe@ 2018-06-10 17:55:11 +00:00
date Remove trailing whitespace and Tn macro. 2018-01-27 18:59:38 +00:00
dd Use Ex. 2017-07-04 06:46:51 +00:00
df Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
domainname
echo Use Ex. 2017-07-04 06:46:51 +00:00
ed Prevent shell execution also in the 'r ! dobad' case, pointed out by 2018-06-18 14:56:24 +00:00
expr Add a missing check to handle correctly 0 * 0 in expr(1) 2018-06-27 17:23:36 +00:00
hostname
kill Make arg parsing in kill POSIX compatible with POSIX (XBD 2.12) by 2017-06-26 22:09:16 +00:00
ksh Change typ of tilde_ok from int to unsigned int in ksh(1) 2018-06-12 14:13:55 +00:00
ln
ls Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
mkdir Use Ex. Remove superfluous Pp. 2017-07-04 06:49:35 +00:00
mt
mv Use Ex. 2017-07-04 06:50:04 +00:00
pax PR/53362: Thomas Barabosch: Use strlcpy() to prevent theoretical buffer 2018-06-13 15:14:40 +00:00
ps kvm_geterr() already contains errno, use errx. 2018-04-11 18:52:29 +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
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
sh PR bin/42184 PR bin/52687 (detailing the same bug). 2018-08-14 13:36:42 +00:00
sleep Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
stty Remove Tn. 2017-10-30 15:38:52 +00:00
sync
test Remove unnecessary Tn. 2017-10-18 18:11:54 +00:00
Makefile
Makefile.inc