aboutsummaryrefslogtreecommitdiff
path: root/shell (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
| * hush: make export builtin optionalDenys Vlasenko2017-01-081-11/+26
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: make umask builtin optionalDenys Vlasenko2017-01-081-0/+13
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: make set/unset builtins optionalDenys Vlasenko2017-01-081-5/+35
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: make read and trap builtins optionalDenys Vlasenko2017-01-081-71/+118
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: kill builtin and kill %jobspec supportDenys Vlasenko2017-01-081-4/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | Also made it and printf, type and wait builtins optional. function old new delta builtin_kill - 323 +323 bltins1 336 348 +12 builtin_type 114 116 +2 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/0 up/down: 337/0) Total: 337 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: support %%, %+ and % jobspec (meaning "current job")Denys Vlasenko2017-01-081-9/+21
| | | | | | | | | | | | | | | | function old new delta parse_jobspec 83 133 +50 builtin_wait 278 283 +5 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-086-5/+72
|\|
| * ash: fix open fds leaking in redirects. Closes 9561Denys Vlasenko2017-01-075-4/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-062-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * shell: clarify help text of CONFIG_{SH,BASH}_IS_* optionsKang-Che Sung2017-01-041-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | Mention the behavior if user selects CONFIG_SH_IS_ASH but not CONFIG_ASH. We will be explicit that invocations like "busybox ash" will not work for such configuration. Also clarify help text of CONFIG_BASH_IS_* that bash compatibility in ash is not complete. (It shouldn't be anyway - ash can't support every bash quirk out there.) 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-049-229/+275
|\|
| * hush: correct exitcode for unterminated ')' - exitcode2.tests testcaseDenys Vlasenko2017-01-031-2/+7
| | | | | | | | | | | | | | function old new delta parse_stream 2595 2609 +14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: fix error code regressionRon Yorston2017-01-035-2/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-235-110/+93
| | | | | | | | | | | | | | 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-222-111/+110
| | | | | | | | 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-122-10/+10
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2016-11-292-12/+36
|\|
| * ash,hush: make ^C in interactive mode visually much closer to bash behaviorDenys Vlasenko2016-11-252-7/+14
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash,hush: ^C from command line should set $? to 128+SIGINTDenys Vlasenko2016-11-242-5/+22
| | | | | | | | 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-1014-168/+329
|\|
| * hush: make getch/peek functions directly calledDenys Vlasenko2016-11-081-27/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Indirect calls are more difficult to predict. Unfortunately, on x64 direct call is 5 bytes while indirect "call (reg+ofs)" is 3 bytes: function old new delta i_getch - 82 +82 i_peek - 63 +63 parse_stream 2531 2579 +48 parse_dollar 771 797 +26 parse_redirect 296 321 +25 add_till_closing_bracket 408 420 +12 encode_string 256 265 +9 i_peek_and_eat_bkslash_nl 93 99 +6 add_till_backquote 110 114 +4 parse_and_run_stream 139 141 +2 expand_vars_to_list 1143 1144 +1 static_peek 6 - -6 setup_string_in_str 39 18 -21 setup_file_in_str 40 19 -21 static_get 27 - -27 file_peek 52 - -52 file_get 65 - -65 ------------------------------------------------------------------------------ (add/remove: 2/4 grow/shrink: 9/2 up/down: 278/-192) Total: 86 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: renumber PIPE_foo, make PIPE_SEQ = 0Denys Vlasenko2016-11-081-5/+4
| | | | | | | | | | | | | | | | | | | | PIPE_SEQ is used most often, having it zero makes code smaller: function old new delta done_word 719 707 -12 parse_stream 2546 2531 -15 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: small optimization in run_listDenys Vlasenko2016-11-081-7/+8
| | | | | | | | | | | | | | | | | | I thought gcc can detect this itself. It doesn't. function old new delta run_list 1030 1021 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: deindent large block of code, no code changesDenys Vlasenko2016-11-081-58/+57
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: simplify insert_bg_jobsDenys Vlasenko2016-11-081-10/+8
| | | | | | | | | | | | | | function old new delta insert_bg_job 366 281 -85 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: make "wait %1" less likely to play with signal maskDenys Vlasenko2016-11-081-8/+7
| | | | | | | | | | | | | | | | | | | | | | Was playing with "sleep 3 | exit 3 & wait %1" and noticed that often SIGCHLD arrives even before I get to signal masking. Can avoid it in this case. function old new delta wait_for_child_or_signal 228 265 +37 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: rework "wait %jobspec" to work in non-interactive shells tooDenys Vlasenko2016-11-089-13/+28
| | | | | | | | | | | | | | | | | | Also add tests. wait5.tests so far fails (but works for ash and dash). function old new delta builtin_wait 305 283 -22 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: "wait $!; echo $?" should return 127 if $! already exitedDenys Vlasenko2016-11-071-4/+5
| | | | | | | | | | | | | | It would be nice to provide bash-like "remember las exitcode" thingy, but it's a bit complex. For now, match ash and dash. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: implement "wait %jobspec"Denys Vlasenko2016-11-071-29/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta parse_jobspec - 83 +83 job_exited_or_stopped - 79 +79 builtin_wait 236 302 +66 wait_for_child_or_signal 199 228 +29 checkjobs 142 158 +16 builtin_jobs 59 68 +9 process_wait_result 453 408 -45 builtin_fg_bg 272 203 -69 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 4/2 up/down: 282/-114) Total: 168 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: factor out %jobspec parsingDenys Vlasenko2016-11-071-11/+22
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: comment fixDenys Vlasenko2016-11-071-2/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: do not allow sh -c '{ echo boo }'Denys Vlasenko2016-11-071-2/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: case logic for setting $? was still wrongDenys Vlasenko2016-11-041-4/+12
| | | | | | | | | | | | | | Resetting to 0 should happen in "esac". Matched branch must still see previous $?. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: non-matching "case" statement sets $? to 0Denys Vlasenko2016-11-041-0/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: allow { cmd } to not be terminated by semicolon in some casesDenys Vlasenko2016-11-045-6/+58
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * 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-0210-217/+348
|\|
| * 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>
| * ash: make popfile() anfter popallfiles() safeDenys Vlasenko2016-10-301-2/+5
| | | | | | | | | | | | | | | | | | | | | | In this example: ash -c 'readonly x; echo $(command eval x=2)' evalstring() is called after forkchild(), which calls popallfiles(). On exception, evalstring() will popfile(). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: fix "(sleep 1; exit 3) & sleep 2; echo $?; wait $!; echo $?"Denys Vlasenko2016-10-281-4/+14
| | | | | | | | | | | | | | "wait $!" may be just a bit too late: backgrounded $! is gone. Do not bomb out in this case. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: fix "wait PID"Denys Vlasenko2016-10-287-174/+246
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was not properly interruptible, and did not update job status (the exited processes were still thought of as running). function old new delta process_wait_result - 453 +453 wait_for_child_or_signal - 199 +199 run_list 996 1002 +6 checkjobs_and_fg_shell 41 43 +2 builtin_wait 328 215 -113 checkjobs 516 142 -374 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 2/2 up/down: 660/-487) Total: 173 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>