Commit ID: 1005084678C510CF7E4
CVSROOT: /cvs
Module name: src
Changes by: [email protected] 2012/10/21 21:26:43 UTC
Modified files:
bin/mksh : exec.c main.c sh.h
Log message:
EXPERIMENTAL optimisation for “sh -c 'foo'” to equal “sh -c 'exit foo'” iff
several conditions are met as outlined below; for more background, refer to
http://www.FreeBSD.org/cgi/query-pr.cgi?pr=113860
We don’t yet optimise 「% sh -c '{ echo a; sleep 10;}&'; sleep 1; ps T」 so
the FreeBSD® sh approach cannot work for us, but scanning the “sh -c” argu‐
ment for disallowed characters and, if not, setting a flag that enables the
shell to exec the tree when parsed as TCOM *and not c_trap()* was possible.
Disallowed characters are currently C_QUOTE except space, that is:
Tab Newline " # $ & ' ( ) * ; < = > ? [ \ ] ` |
This should catch all cases of magic, variables, subshells, pipelines, etc.
To generate a diff of this changeset, execute the following commands:
cvs -R rdiff -kk -upr1.101 -r1.102 src/bin/mksh/exec.c
cvs -R rdiff -kk -upr1.229 -r1.230 src/bin/mksh/main.c
cvs -R rdiff -kk -upr1.592 -r1.593 src/bin/mksh/sh.h