NetBSD-Bugs archive

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

PR/52687 CVS commit: [netbsd-8] src/bin/sh



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

From: "Martin Husemann" <martin%netbsd.org@localhost>
To: gnats-bugs%gnats.NetBSD.org@localhost
Cc: 
Subject: PR/52687 CVS commit: [netbsd-8] src/bin/sh
Date: Sat, 25 Aug 2018 11:45:41 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sat Aug 25 11:45:40 UTC 2018
 
 Modified Files:
 	src/bin/sh [netbsd-8]: eval.c
 
 Log Message:
 Pull up following revision(s) (requested by kre in ticket #982):
 
 	bin/sh/eval.c: revision 1.157
 
 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.140.2.3 -r1.140.2.4 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