aboutsummaryrefslogtreecommitdiff
path: root/shell/ash.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
| * hush: fix quoted_punct.tests failureDenys Vlasenko2017-07-051-1/+3
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: fix escaping of a few characters (broken by last commits)Denys Vlasenko2017-07-051-2/+7
| | | | | | | | | | | | | | Add a testcase which tests all ASCII punctuation escapes. NB: hush is failing this test! Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: tweak in commentDenys Vlasenko2017-07-051-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: note which versions of glibc exhibit "rho bug"Denys Vlasenko2017-07-051-1/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: fix matching of unicode greek letter rho (cf 81) and similar casesDenys Vlasenko2017-07-051-1/+22
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: fix $HOME/.profile reading if !ASH_EXPAND_PRMT, take 2Denys Vlasenko2017-07-011-8/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: fix 'trap - 65'Denys Vlasenko2017-07-011-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: fix $HOME/.profile reading if !ASH_EXPAND_PRMTDenys Vlasenko2017-06-271-6/+0
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | ash: fix POSIX buildRon Yorston2017-07-141-5/+5
| |
* | Merge branch 'busybox' into mergeRon Yorston2017-05-291-37/+41
|\|
| * ash: fix incorrect path in describe_commandYoufu Zhang2017-05-261-13/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | $ 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>
| * ash,hush: fix SIGCHLD interrupting read builtinDenys Vlasenko2017-05-221-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Spelling fixes in comments, documentation, tests and examplesDenys Vlasenko2017-04-171-6/+6
| | | | | | | | | | | | By klemens <ka7@github.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: implement "exec -a ARGV0 CMD ARGV1..."Denys Vlasenko2017-04-121-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * ash: make shellexec capable of using separate argv[0] and filename to execDenys Vlasenko2017-04-121-11/+10
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'busybox' into mergeRon Yorston2017-02-081-171/+294
|\|
| * ash: add INT_OFF/ON around allocationsDenys Vlasenko2017-02-031-2/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: improve / fix glob expansionFelix Fietkau2017-01-311-17/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * *: add comment about APPLET_ODDNAME formatDenys Vlasenko2017-01-291-1/+2
| | | | | | | | | | | | It confused me more than once Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: commented-out possible fix for 7694Denys Vlasenko2017-01-111-4/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * ash: 16-bit ->nprocs field is a pain for many CPUsDenys Vlasenko2017-01-111-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * ash: split bash compatible extensions into separate defines. No code changesDenys Vlasenko2017-01-111-74/+101
| | | | | | | | | | | | | | | | 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>
| * ash: revert "make dot command search current directory first"Denys Vlasenko2017-01-101-9/+0
| | | | | | | | | | | | | | | | | | | | 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>
| * shells: make hush test optional, rename ASH_BUILTIN_foo -> ASH_fooDenys Vlasenko2017-01-101-13/+13
| | | | | | | | | | | | | | This makes hash and ash more symmetrical wrt config menu and config options. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Big cleanup in config help and descriptionDenys Vlasenko2017-01-101-49/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * ash: fix a bug in argv restoration after sourcing a fileDenys Vlasenko2017-01-091-2/+4
| | | | | | | | | | | | if sourced file "shift"ed argvs so that $1 is NULL, restore wasn't done. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | ash: make the noconsole option configurable at build timeRon Yorston2017-02-071-4/+20
| | | | | | | | | | | | | | | | | | The noconsole option depends on APIs that aren't available in all incarnations of Microsoft Windows. Allow it to be disabled at build time. Note that, by default, 'noconsole' is enabled in 32-bit builds but disabled in 64-bit builds.
* | Merge branch 'busybox' into mergeRon Yorston2017-01-081-4/+14
|\|
| * ash: fix open fds leaking in redirects. Closes 9561Denys Vlasenko2017-01-071-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * ash: explicltly group ash optionsKang-Che Sung2017-01-061-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'busybox' into mergeRon Yorston2017-01-041-135/+158
|\|
| * ash: fix error code regressionRon Yorston2017-01-031-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Make it possible to select "sh" and "bash" aliases without selecting ash or hushDenys Vlasenko2016-12-231-49/+46
| | | | | | | | | | | | | | 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>
| * shell: move "config" blocks above their use in coditional includesDenys Vlasenko2016-12-221-82/+81
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Tweak some config defaults; fix MODPROBE_SMALL ordering in "make config"Denys Vlasenko2016-12-221-3/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: clarify uclibc glob() bug in commentDenys Vlasenko2016-12-211-0/+3
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: error out if ASH_INTERNAL_GLOB is not selected on uClibcDenys Vlasenko2016-12-211-0/+8
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: fix signed char expansion bugDenys Vlasenko2016-12-121-9/+21
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell: suppress "unused var/func" warnings on some configsDenys Vlasenko2016-12-121-6/+6
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2016-11-291-3/+6
|\|
| * ash,hush: make ^C in interactive mode visually much closer to bash behaviorDenys Vlasenko2016-11-251-1/+3
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash,hush: ^C from command line should set $? to 128+SIGINTDenys Vlasenko2016-11-241-0/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * test: make [ and [[ forms individually selectableDenys Vlasenko2016-11-231-2/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2016-11-101-8/+26
|\|
| * ash: fix "duplicate local" code (forgot to re-enable interrupts)Denys Vlasenko2016-11-041-3/+20
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: while (!got_sig) pause() is not reliable, use sigsuspend()Denys Vlasenko2016-11-031-5/+6
| | | | | | | | | | | | | | dash was doing it for a reason. Unfortunately, it had no comment why... now I know. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Post-merge fixRon Yorston2016-11-021-1/+1
| |
* | Merge branch 'busybox' into mergeRon Yorston2016-11-021-41/+81
|\|
| * ash: if using libc glob(), skip it if no metachars are in wordDenys Vlasenko2016-10-301-0/+15
| | | | | | | | | | | | | | | | | | This saves making tons of pointless stat() calls function old new delta expandarg 888 921 +33 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: fix bit-rotten debug infrastructureDenys Vlasenko2016-10-301-14/+7
| | | | | | | | | | | | DEBUG = 2 output was a bit messed up Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>