NOEXEC'ed applets which use getopt() need this.
function old new delta
builtin_getopts 403 413 +10
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
It is always nicer to give the user some sort of indication why an
operation failed.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Looks biggish and not particularly useful, but may be easier to just eat
the impact if future backports from dash would be otherwise increasingly
difficult.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Upstream commit:
Date: Thu, 30 Oct 2014 11:53:35 +0800
[PARSER] Catch variable length expansions on non-existant specials
Currently we only check special variable names that follow directly
after $ or ${. So errors such as ${#&} are not caught. This patch
fixes that by moving the is_special check to just before we print out
the special variable name.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
function old new delta
readtoken1 2630 2635 +5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
The POSIX standard only requires the 'read' builtin to handle '-r':
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/read.html
However, Bash introduced the option '-d <DELIM>' to override IFS for
just one invocation, and it is quite useful.
We already support this in ash, let's add it to hush, too.
function old new delta
builtin_read 263 284 +21
.rodata 163587 163589 +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 23/0) Total: 23 bytes
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
The POSIX standard only requires the read builtin to handle -r:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/read.html
However, Bash introduced the option -d <DELIM> to override IFS for
just one invocation, and it is quite useful.
It is also super easy to implement in BusyBox' ash, so let's do that.
The motivation: This option is used by Git's test suite.
function old new delta
.rodata 163505 163587 +82
shell_builtin_read 1244 1289 +45
readcmd 233 259 +26
builtin_read 258 263 +5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 158/0) Total: 158 bytes
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
hush -c 'yes | head -1' was not happy.
function old new delta
tryexec 159 169 +10
pseudo_exec_argv 328 338 +10
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
The applets with "<applet> [opts] PROG ARGS" API very quickly exec
another program, noexec is okay for them:
chpst/envdir/envuidgid/softlimit/setuidgid
chroot
chrt
ionice
nice
nohup
setarch/linux32/linux64
taskset
cttyhack
"reset" and "sulogin" applets don't have this form, but also exec
another program at once, thus made noexec too.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Based on patch by Johannes Schindelin <johannes.schindelin@gmx.de>
function old new delta
evalcommand 1447 1500 +53
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
As of 035486c75 (ash: significant overhaul of redirect saving logic,
2017-07-31), the sv_pos variable is no longer used (just assigned to,
with no further effect).
Let's just remove it.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
$ echo $$
18448
$ echo $? <wait here, run "kill -INT 18448" in other shell><press enter>
<=== NOTHING??
$
That empty line does not look right. After this patch:
$ echo $$
18448
$ echo $? <wait here, run "kill -INT 18448" in other shell><press enter>
^C
$
function old new delta
fgetc_interactive 245 246 +1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
"rm -i FILE" and "yes" can now be interrupted by ^C in hush.
This also now works:
$ usleep 19999999
^C
$ echo $?
130
function old new delta
run_pipe 1668 1711 +43
pseudo_exec_argv 312 321 +9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 52/0) Total: 52 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>