NetBSD-Bugs archive

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

PR/52687 CVS commit: src/bin/sh

The following reply was made to PR bin/52687; it has been noted by GNATS.

From: "Robert Elz" <>
Subject: PR/52687 CVS commit: src/bin/sh
Date: Tue, 14 Aug 2018 13:36:42 +0000

 Module Name:	src
 Committed By:	kre
 Date:		Tue Aug 14 13:36:42 UTC 2018
 Modified Files:
 	src/bin/sh: eval.c
 Log Message:
 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
 To generate a diff of this commit:
 cvs rdiff -u -r1.156 -r1.157 src/bin/sh/eval.c
 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