Age | Commit message (Collapse) | Author |
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
If STANDALONE and we run a NOEXEC applet, saved copies of redirected fds
were visible for the child. They have CLOEXEC bit, yes, but we do not exec
in this case.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
parse_dollar 786 820 +34
expand_one_var 1579 1592 +13
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 47/0) Total: 47 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Upstream commit:
Date: Thu, 7 Jul 2011 13:58:48 +0800
[SHELL] Optimize dash -c "command" to avoid a fork
On Sun, Apr 10, 2011 at 07:36:49AM +0000, Jonathan Nieder wrote:
> From: Jilles Tjoelker <jilles@stack.nl>
> Date: Sat, 13 Jun 2009 16:17:45 -0500
>
> This change only affects strings passed to -c, when the -s option is
> not used.
>
> Use the EV_EXIT flag to inform the eval machinery that the string
> being passed is the entirety of input. This way, a fork may be
> omitted in many special cases.
>
> If there are empty lines after the last command, the evalcmd will not
> see the end early enough and forks will not be omitted. The same thing
> seems to happen in bash.
>
> Example:
> sh -c 'ps lT'
> No longer shows a shell process waiting for ps to finish.
>
> [jn: ported from FreeBSD SVN r194128. Bugs are mine.]
>
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Instead of detecting EOF using the input layer, I'm going to
use the parser instead. In either case, we always have to read
ahead in order to complete the parsing of the previous node.
Therefore we always know whether there is more to come, except
in the case where we see a newline/semicolon or similar.
For the purposes of sh -c, this should be sufficient.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
function old new delta
evalstring 190 224 +34
ash_main 1014 1022 +8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 42/0) Total: 42 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
While at it, make get_signum() return -1 for numeric strings >= NSIG.
function old new delta
trapcmd 292 306 +14
get_signum 295 300 +5
builtin_trap 413 412 -1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 19/-1) Total: 18 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Upstream commit:
Date: Thu, 10 Mar 2011 16:52:13 +0800
[REDIR] Replace GPL noclobberopen code with the FreeBSD version
Replace noclobberopen() from bash with the FreeBSD code for noclobber
opens.
This also reduces code size by eliminating an unnecessary check.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
function old new delta
changepath 192 194 +2
localcmd 366 364 -2
expmeta 521 517 -4
redirect 1210 1135 -75
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 2/-81) Total: -79 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
We fixed the problem differently than they. Let's not deviate.
Upstream commit:
Date: Thu, 27 May 2010 20:07:29 +1000
[EXPAND] Fix corruption of redirections with byte 0x81
In other ash variants, a partial implementation of ksh-like cmd >file*
adds and removes CTLESC bytes ('\x81') in redirection filenames,
preserving 8-bit transparency. Long ago, dash removed the code to add
the CTLESC bytes, but not the code to remove them, causing corruption of
filenames containing CTLESC. This commit removes the code to remove the
CTLESC bytes.
The CTLESC byte occurs frequently in UTF-8 encoded non-Latin text.
This bug has been reported various times to Ubuntu and Debian (e.g.
Launchpad Ubuntu #422298). This patch is the same as the one submitted
by Alexander Korolkov in Ubuntu #422298.
Signed-off-by: Jilles Tjoelker <jilles@stack.nl>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
function old new delta
changepath 194 192 -2
expandarg 1000 984 -16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-18) Total: -18 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Upstream commit:
Date: Tue, 25 May 2010 20:55:05 +0800
[VAR] Move unsetvar functionality into setvareq
This patch moves the unsetvar code into setvareq so that we can
no have a pathological case of an unset variable hanging around
unless it has a bit pinning it like VEXPORT.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
function old new delta
setvareq 227 303 +76
expmeta 517 521 +4
localcmd 364 366 +2
unsetcmd 96 76 -20
unsetvar 129 7 -122
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 82/-142) Total: -60 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
ash passes these.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
setup_redirects 200 245 +45
append_squirrel - 41 +41
save_fds_on_redirect 256 221 -35
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 86/-35) Total: 51 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
All pass.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
o_addblock 58 42 -16
expand_one_var 1618 1555 -63
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-79) Total: -79 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
"mempcpy(q, s, len) + len" is obviously no good :(
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Most changes are taken from dash.
function old new delta
single_quote 127 129 +2
stack_nputstr 28 29 +1
path_advance 209 202 -7
rmescapes 346 308 -38
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 3/-45) Total: -42 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Basen on the patch from Martijn Dekker <martijn@inlv.org>
function old new delta
evalcommand 1161 1302 +141
maybe_single_quote - 60 +60
getoptscmd 527 546 +19
readtoken1 2819 2823 +4
localcmd 366 364 -2
evaltreenr 495 479 -16
evaltree 495 479 -16
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/3 up/down: 224/-34) Total: 190 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Those two spaces after tab have no effect, and always a nuisance when editing.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
shell_builtin_read 1097 1277 +180
dump_procs 353 359 +6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Currently fails.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
helper_export_local 185 214 +29
run_pipe 1549 1560 +11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 40/0) Total: 40 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
helper_export_local 174 185 +11
set_local_var 424 420 -4
run_list 1048 1044 -4
set_vars_and_save_old 88 83 -5
set_local_var_from_halves 27 22 -5
run_pipe 1554 1549 -5
builtin_export 173 168 -5
set_pwd_var 40 34 -6
builtin_readonly 70 64 -6
expand_one_var 1625 1618 -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/9 up/down: 11/-47) Total: -36 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
builtin_readonly - 70 +70
helper_export_local 152 174 +22
bltins1 348 360 +12
expand_one_var 1620 1625 +5
builtin_export 168 173 +5
set_pwd_var 36 40 +4
set_local_var 410 414 +4
set_vars_and_save_old 85 88 +3
set_local_var_from_halves 24 27 +3
run_pipe 1551 1554 +3
run_list 1046 1048 +2
builtin_type 116 114 -2
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 10/1 up/down: 133/-2) Total: 131 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
subevalvar 1171 1202 +31
localcmd 364 366 +2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
die_if_script() indeed dies only in scripts! Must handle the case where it continues.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
expand_one_var 1602 1615 +13
builtin_type 114 116 +2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
done_pipe 234 238 +4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
done_pipe 133 218 +85
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This change fixes the build in setups where there are
no headers defining WIFSTOPPED and WSTOPSIG (where JOBS has to be
set to 0).
This partially reverts 4700fb5be (ash: make dowait() a bit more
readable. Logic is unchanged, 2015-10-09).
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Example script:
sleep 1 | (sleep 1;exit 3) &
sleep 2
echo Zero:$?
wait %1
echo Three:$?
function old new delta
clean_up_last_dead_job - 24 +24
process_wait_result 426 447 +21
builtin_wait 285 293 +8
insert_job_into_table 264 269 +5
builtin_jobs 68 73 +5
remove_job_from_table 59 57 -2
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/1 up/down: 63/-2) Total: 61 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
builtin_wait 291 285 -6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|