Age | Commit message (Collapse) | Author |
|
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>
|
|
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>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
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>
|
|
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>
|
|
halt::0:0::/:/sbin/halt
function old new delta
run_applet_and_exit 748 751 +3
run_applet_no_and_exit 467 459 -8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Add a testcase which tests all ASCII punctuation escapes.
NB: hush is failing this test!
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>
|
|
$ PATH=/extra/path:/usr/sbin:/usr/bin:/sbin:/bin \
> busybox sh -xc 'command -V ls; command -V ls; command -Vp ls; command -vp ls'
+ command -V ls
ls is /bin/ls
+ command -V ls
ls is a tracked alias for /bin/ls
+ command -Vp ls
ls is a tracked alias for (null)
+ command -vp ls
Segmentation fault
describe_command should respect `path' argument. Looking up in the hash table
may gives incorrect index in entry.u.index and finally causes incorrect output
or SIGSEGV.
function old new delta
describe_command 386 313 -73
Signed-off-by: Youfu Zhang <zhangyoufu@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
readcmd 169 217 +48
shell_builtin_read 1087 1097 +10
localcmd 366 364 -2
builtin_read 197 193 -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 58/-6) Total: 52 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
By klemens <ka7@github.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
execcmd 71 112 +41
shellexec 221 224 +3
evalcommand 1158 1161 +3
localcmd 364 366 +2
unaliascmd 163 154 -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/1 up/down: 49/-9) Total: 40 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
execcmd 71 78 +7
shellexec 221 224 +3
evalcommand 1158 1161 +3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 13/0) Total: 13 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
When using musl libc glob() a very long string can cause glob() to fail,
which leads to an out of memory error being raised by ash.
This can happen easily if a very long quoted string contains *, even
though no glob expansion should ever be performed on it (since it's
quoted).
Fix this by properly parsing control characters and escaping and only
accept unquoted metacharacters. While we're at it, unify this check for
libc and built-in glob expansion
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
It confused me more than once
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
bash has a feature: it restores termios after a successful wait for
a foreground job which had at least one stopped or sigkilled member.
The probable rationale is that SIGSTOP and SIGKILL can preclude task from
properly restoring tty state. Should we do this too?
A reproducer: ^Z an interactive python:
$ python
Python 2.7.12 (...)
>>> ^Z
{ python leaves tty in -icanon -echo state. We do survive that... }
[1]+ Stopped python
{ ...however, next program (python no.2) does not survive it well: }
$ python
Python 2.7.12 (...)
>>> Traceback (most recent call last):
{ above, I typed "qwerty<CR>", but -echo state is still in effect }
File "<stdin>", line 1, in <module>
NameError: name 'qwerty' is not defined
The implementation is modeled on bash code and seems to work.
However, I'm not sure we should do this. For one: what if I'd fg
the stopped python instead? It'll be confused by "restored" tty state.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
getoptscmd 527 540 +13
getjob 280 286 +6
makejob 278 282 +4
forkchild 602 600 -2
waitcmd 208 205 -3
showjob 382 379 -3
getstatus 83 80 -3
dowait 408 405 -3
freejob 93 89 -4
fg_bgcmd 290 286 -4
forkshell 260 255 -5
killcmd 224 218 -6
jobno 17 11 -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/10 up/down: 23/-39) Total: -16 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Splitting these options makes it self-documenting about what
bash-compatible features we have.
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Reverts this:
commit 8ad78e1ec7b2e873953f9f476fb63b5893526c39
Author: Denis Vlasenko <vda.linux@googlemail.com>
Date: Sun Feb 15 12:40:30 2009 +0000
ash: make dot command search current directory first, as bash does.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This makes hash and ash more symmetrical wrt config menu and config
options.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Redundant help texts (one which only repeats the description)
are deleted.
Descriptions and help texts are trimmed.
Some config options are moved, even across menus.
No config option _names_ are changed.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
if sourced file "shift"ed argvs so that $1 is NULL, restore wasn't done.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
commit e19923f6652a638ac39c84012e97f52cf5a7568e deleted clearredir()
call in shellexec():
ash: [REDIR] Remove redundant CLOEXEC calls
Upstream commit:
Now that we're marking file descriptors as CLOEXEC in savefd, we no longer
need to close them on exec or in setinputfd.
but it missed one place where we don't set CLOEXEC. Fixing this.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This would makes all ash options indented inside "ash" in menuconfig.
It appears that menuconfig has a limit at tracking multiple dependency
lines like this (it looks like a "diamond problem" but I'm not sure if
it is):
---ASH <----------
/ \ ASH_OPTIMIZE_FOR_SIZE
!NOMMU <-*----SH_IS_ASH <----[OR] <--ASH_INTERNAL_GLOB
\ / ASH_RANDOM_SUPPORT
---BASH_IS_ASH <-- [...]
The kconfig-language document [1] states that:
> If a menu entry somehow depends on the previous entry, it can be
> made a submenu of it. First, the previous (parent) symbol must be
> part of the dependency list and then one of these two conditions
> must be true:
> - the child entry must become invisible, if the parent is set to 'n'
[BusyBox ash used to satisfy this, but no longer does]
> - the child entry must only be visible, if the parent is visible
[BusyBox ash configs actually satisfy this, but because of
"diamond" above this might not be easily detected]
So I found out a direct workaround: by making ash options explicitly
depend on !NOMMU, we can tell menuconfig that rule 2 above is satisfied
without any more tracking.
---------------------
/ \
!NOMMU <-*-----ASH <-------- \
\ \ \ ASH_OPTIMIZE_FOR_SIZE
*---SH_IS_ASH <---[OR]-[AND] <--ASH_INTERNAL_GLOB
\ / ASH_RANDOM_SUPPORT
--BASH_IS_ASH <- [...]
So all ash options would now be indented under "ash".
[1] "Documentation/kbuild/kconfig-language.txt" in Linux kernel source
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
The commit 'ash,hush: set exit code 127 in "sh /does/not/exist" case'
only partly implemented the dash commit '[ERROR] Allow the originator
of EXERROR to set the exit status'. This resulted in incorrect error
codes for a syntax error:
$ )
$ echo $?
0
or a redirection error for a special builtin:
$ rm -f xxx
$ eval cat <xxx
$ echo $?
0
Signed-off-by: Ron Yorston <rmy@pobox.com>
Reported-by: Martijn Dekker <martijn@inlv.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
The same can be done for msh, but we are probably better off just deleting it
in a next versio or two.
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>
|
|
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>
|