Denys Vlasenko
e56f22ac60
ash: make "jobs" work even in subshells
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-24 00:16:59 +02:00
Denys Vlasenko
86e83ec487
ash: fix debug machinery a bit
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-23 22:07:07 +02:00
Denys Vlasenko
252ccba948
remove msh_function.patch. msh is deprecated
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-19 01:09:42 +02:00
Denys Vlasenko
9038d6f8f5
remove trailing whitespace
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-15 20:02:19 +02:00
Denys Vlasenko
883cea4751
ash: fixes in debug printouts
...
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-11 15:31:59 +02:00
Denys Vlasenko
82a6fb3ea6
ash: fix . builtin
...
Also, move [[ ]] comment to test.c and expand it
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-14 19:42:12 +02:00
Denys Vlasenko
641dd7b080
ash: revert over-zealous usage of FAST_FUNC
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-11 19:30:19 +02:00
Denys Vlasenko
77539190ab
added comments about [[ ]] to ash and hush. no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-10 14:09:48 +02:00
Denys Vlasenko
9ca656b149
hush: add HUSH_BASH_COMPAT, make [[ special handling depend on it
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-10 13:39:35 +02:00
Denys Vlasenko
9d617c44d2
hush: specially handle [[ - suppress globbing & multiword expansion
...
It's a bashism, but is surprisingly easy to do and costs very little code.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-09 18:40:52 +02:00
Denys Vlasenko
2634bf366b
randomconfig fixes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-09 18:40:07 +02:00
Denys Vlasenko
764b2f0ec0
hush: drop REDIRECT_INVALID; other minor tweaks
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-07 16:05:04 +02:00
Denys Vlasenko
df5131cf3d
hush: fix a segfault in export builtin
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-07 16:04:17 +02:00
Denys Vlasenko
d6b05eb9c2
hush: make builtins work in pipes (eval ... | ...) on NOMMU
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-06 20:59:55 +02:00
Denys Vlasenko
71016baf55
printf: accept negative numbers for %x; sh: overflowed numbers are 0
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-05 16:24:29 +02:00
Denys Vlasenko
d5f1b1bbe0
*: add FAST_FUNC to function ptrs where it makes sense
...
function old new delta
evalcommand 1195 1209 +14
testcmd - 10 +10
printfcmd - 10 +10
echocmd - 10 +10
func_exec 270 276 +6
echo_dg 104 109 +5
store_nlmsg 85 89 +4
pseudo_exec_argv 195 198 +3
dotcmd 287 290 +3
machtime_stream 29 31 +2
discard_stream 24 26 +2
argstr 1299 1301 +2
killcmd 108 109 +1
evalfor 226 227 +1
daytime_stream 43 44 +1
run_list 2544 2543 -1
lookupvar 62 61 -1
ipaddr_modify 1310 1309 -1
...
parse_stream 2254 2245 -9
evalpipe 356 347 -9
collect_if 210 197 -13
read_opt 869 851 -18
handle_dollar 681 658 -23
print_addrinfo 1342 1303 -39
iterate_on_dir 156 59 -97
print_route 1709 1609 -100
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 12/130 up/down: 74/-767) Total: -693 bytes
text data bss dec hex filename
841748 467 7872 850087 cf8a7 busybox_old
841061 467 7872 849400 cf5f8 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-05 12:06:05 +02:00
Denys Vlasenko
0821801349
hush: document a TODO in export builtin
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-03 14:43:56 +02:00
Denys Vlasenko
6f22624a91
hush: fix a case when backgrounded cmd makes shell hang
...
Signed-off-by: Bayram Kurumahmut <kbayram@ubicom.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-03 14:37:30 +02:00
Denys Vlasenko
295fef80bc
hush: add support for local builtin
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-03 12:47:26 +02:00
Mike Frysinger
eab40e5885
hush_test: stop mixing tabs/spaces for indentation
...
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-01 16:33:05 -04:00
Mike Frysinger
6a46ab8b8f
hush: unify syntax_error_unterm_{ch,str} a bit
...
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-01 14:16:43 -04:00
Mike Frysinger
ef3e7fdd3b
hush: push down expansion var in handle_dollar()
...
Declare the variable in the scope it is used rather than the entire
function scope so it's obvious it is only used there.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-01 14:16:43 -04:00
Mike Frysinger
dc3bc40578
hush: add support for special vars in braces
...
Some people like to use ${?} rather than $?, so make sure we support all
the special single char vars that use this form.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-01 14:16:43 -04:00
Mike Frysinger
ff64fb9e31
hush_test: filter test output to avoid C lib differences
...
The getopt function in some C libraries wraps the option in single quotes
while others do not. Avoid the issue by running sed on the output and
strip all quotes.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-01 14:16:43 -04:00
Denys Vlasenko
28a105d867
nc, hush: cosmetic cleanups, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-01 11:26:30 +02:00
Denys Vlasenko
4b7db4f2ca
read_key: drop optimization where we read 3 bytes at once
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-29 10:39:06 +02:00
Denys Vlasenko
171932d7ca
hust: trivial simplification in builtin_type
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-28 17:07:22 +02:00
Denys Vlasenko
e640cb4ad1
hush: fix bug 353 (wrong handling of \x in assignments)
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-28 16:49:11 +02:00
Denys Vlasenko
5d7cca2090
hush: optimize type builtin a bit more
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-28 09:58:43 +02:00
Denys Vlasenko
dd6b211921
hush: optimize type builtin a bit
...
function old new delta
builtin_type 130 125 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-28 09:45:50 +02:00
Mike Frysinger
93cadc2fdd
hush: implement type
...
Implement support for the POSIX `type` command. Only POSIX stuff is
supported here, no bash extensions like -p or -P.
In the process, split the $PATH searching code out of builtin_source() and
into its own find_in_path() function so we don't duplicate it.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-05-27 17:06:25 -04:00
Denys Vlasenko
673e945052
hush: remove outdated TODO and superfluous macro; fix compile breakage
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-27 14:39:35 +02:00
Denys Vlasenko
68759edb6e
hush: tweak comment
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-26 14:39:41 +02:00
Denys Vlasenko
e2df5f46d0
hush: rename last_waitpid_was_0 to we_have_children
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-26 14:34:10 +02:00
Denys Vlasenko
8d7be232a3
hush: fix SIGCHLD counting code, but keep it disabled for now.
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-25 16:38:32 +02:00
Denys Vlasenko
4f26c97b9a
make compound.tests executable
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-23 17:00:13 +02:00
Denys Vlasenko
e9bda90e54
hush: fix problems with case in subshells and with "case esac"
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-23 16:50:07 +02:00
Mike Frysinger
342a63d659
hush_test: add some pathological compound list tests
...
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-05-21 18:35:37 -04:00
Mike Frysinger
12bcc76e9b
hush_test: test for subshell function syntax
...
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-05-21 18:35:08 -04:00
Mike Frysinger
7b424fe738
hush_test: add subshelled case tests
...
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-05-21 18:09:24 -04:00
Mike Frysinger
cc9205bda7
hush_test: update test output to match new getopt() output
...
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-05-21 17:58:15 -04:00
Mike Frysinger
33f85eeac5
hush_test: ignore generated files
...
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-05-21 17:45:26 -04:00
Mike Frysinger
38478a600f
hush: fix build failure when jobs are disabled
...
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Reported-by: Thomas Chou <thomas@wytron.com.tw>
2009-05-20 04:48:06 -04:00
Denys Vlasenko
318a8e5ed5
TODO: add some
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-13 02:18:43 +02:00
root
6245202e7f
hush: small fix for unset -f on NOMMU.
...
Signed-off-by: root <root@localhost.localdomain>
2009-05-04 12:00:19 +02:00
Denys Vlasenko
acdc49c073
hush: add more complex case to leak testcase, fix found breakage
...
function old new delta
unset_local_var_len - 167 +167
run_list 2350 2457 +107
set_vars_and_save_old - 87 +87
free_pipe 207 227 +20
builtin_unset 220 229 +9
builtin_exit 49 47 -2
free_strings_and_unset 53 - -53
set_vars_all_and_save_old 87 - -87
unset_local_var 168 - -168
------------------------------------------------------------------------------
(add/remove: 2/3 grow/shrink: 3/1 up/down: 390/-310) Total: 80 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-04 01:58:10 +02:00
Denys Vlasenko
cb6ff25afe
hush: fix bug where in "var=val func" var's value is not visible in func
...
function old new delta
unset_local_var - 168 +168
set_vars_all_and_save_old - 87 +87
get_ptr_to_local_var - 77 +77
free_strings_and_unset - 53 +53
builtin_export 266 274 +8
get_local_var_value 31 33 +2
putenv_all 27 - -27
free_strings_and_unsetenv 53 - -53
get_local_var 68 - -68
run_list 2475 2350 -125
builtin_unset 380 220 -160
------------------------------------------------------------------------------
(add/remove: 4/3 grow/shrink: 2/2 up/down: 395/-433) Total: -38 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-04 00:14:30 +02:00
Denys Vlasenko
e19e1935a3
hush: fix \<newline> handling
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-03 02:15:18 +02:00
Denys Vlasenko
b1cfc45376
hush: fix handling of unterminated subshell: (<eof>. Fixes bug 229.
...
function old new delta
syntax_error_unexpected_ch 31 41 +10
parse_stream 2184 2191 +7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-02 17:18:34 +02:00
Denys Vlasenko
1dd6cf8677
hush: fix multiple redirections of the same fd (bug 227)
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-02 14:17:31 +02:00
Denys Vlasenko
54e0843e7d
hush: make . cmd search $PATH
...
function old new delta
builtin_source 128 249 +121
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-02 02:34:19 +02:00
Denys Vlasenko
690ad2426e
git commit test
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-04-30 21:24:24 +02:00
Denis Vlasenko
c8653f62f2
hush: make it possible to have interactive shell on non-ctty.
...
init=/bin/hush: shows prompt, history works, etc.
function old new delta
hush_main 888 925 +37
block_signals 139 152 +13
builtin_fg_bg 284 293 +9
checkjobs_and_fg_shell 35 41 +6
sigexit 65 66 +1
reset_traps_to_defaults 165 164 -1
parse_stream 2200 2184 -16
run_list 2502 2475 -27
getpgid 35 - -35
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 5/3 up/down: 66/-79) Total: -13 bytes
2009-04-27 23:29:14 +00:00
Denis Vlasenko
42e4af3119
make leak test more robust by unsetting all vars
2009-04-26 23:25:36 +00:00
Denis Vlasenko
28e67966f3
hush: make getopt32 usable in builtins. use it in unset.
...
more uses are expected in the future.
function old new delta
getopt32 1356 1393 +37
builtin_export 256 266 +10
builtin_unset 418 380 -38
2009-04-26 23:22:40 +00:00
Denis Vlasenko
572930027d
hush: nommu fix for function passing
2009-04-26 20:06:14 +00:00
Denis Vlasenko
5b7589eb27
hush: fix SEGV in % expansion
...
function old new delta
expand_variables 2203 2217 +14
2009-04-26 11:25:19 +00:00
Mike Frysinger
26cf2831d7
do not tell people they can enter "help" if help has actually been disabled
2009-04-24 06:40:30 +00:00
Mike Frysinger
67c1c7b456
use get_local_var_value() rather than getenv() when working with PS1/PS2/HOME, respect the PS2 env var, and make sure that the prompt changes whenever PS1/PS2 changes so we dont have to re-exec the shell to get a changed prompt
2009-04-24 06:26:18 +00:00
Denis Vlasenko
f9d4fc3cf8
switch_root: improve behavior on error; improve help text
...
*: make "can't execute '%s'" message uniform
2009-04-21 20:40:51 +00:00
Denis Vlasenko
950bd72966
hush: speed up set_local_var
...
function old new delta
set_local_var 265 290 +25
2009-04-21 11:23:56 +00:00
Denis Vlasenko
5e34ff29bc
*: mass renaming of USE_XXXX to IF_XXXX
...
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially
badly named. It was not skipping anything!
2009-04-21 11:09:40 +00:00
Denis Vlasenko
ad4bd0548a
hush: export -n support
...
function old new delta
builtin_export 206 256 +50
set_local_var 248 265 +17
expand_variables 2204 2203 -1
2009-04-20 22:04:21 +00:00
Denis Vlasenko
d40fa397e4
hush: add two testcases
2009-04-20 10:52:31 +00:00
Denis Vlasenko
8c64e033c0
hush: fix stdin of backgrounded pipe
...
function old new delta
run_list 2450 2502 +52
2009-04-20 00:34:01 +00:00
Denis Vlasenko
dcd78c4d0f
hush: fix "export not_yet_defined_var", fix parsing of "cmd | }"
...
corner case; improve hush_leaktool.sh;
fix some false positives in testsuite
function old new delta
builtin_export 191 206 +15
parse_stream 2196 2200 +4
2009-04-19 23:07:51 +00:00
Denis Vlasenko
9f8d938172
same as previous, but -100 bytes
2009-04-19 14:03:11 +00:00
Denis Vlasenko
bf25fbccb9
hush: fix handling of } which is not a closing one in { cmd; }
...
function old new delta
parse_stream 2176 2302 +126
builtin_unset 381 387 +6
2009-04-19 13:57:51 +00:00
Mike Frysinger
885b6f29ae
fix build errors when function support is turned off
2009-04-18 21:04:25 +00:00
Denis Vlasenko
6008d8a3cc
hush: fix thinko in error msg
2009-04-18 13:05:10 +00:00
Denis Vlasenko
38e626df4d
hush: fix "trap -- handler SIGs..."; escape handlers in "trap" output
2009-04-18 12:58:19 +00:00
Denis Vlasenko
730106767e
hush: fix thinko in unset_func
2009-04-18 11:25:18 +00:00
Denis Vlasenko
40e84374ec
hush: implement unset -f; beautify the handling of signal-killed pipe
...
four TODOs are gone
function old new delta
builtin_unset 271 364 +93
checkjobs 394 428 +34
builtin_exit 49 47 -2
2009-04-18 11:23:38 +00:00
Denis Vlasenko
eb85849b50
hush: deal with umask TODO (symbolic modes)
...
function old new delta
builtin_umask 79 125 +46
2009-04-18 02:06:54 +00:00
Denis Vlasenko
6b9e05392b
hush: implement proper SIGHUP handling
...
function old new delta
check_and_run_traps 164 229 +65
insert_bg_job 376 366 -10
hush_main 937 927 -10
2009-04-18 01:23:21 +00:00
Denis Vlasenko
7b9e5c57ae
builtin_return's parameter is not unused
2009-04-17 23:53:15 +00:00
Denis Vlasenko
3d40d8e655
hush: return builtin by Bayram Kurumahmut (kbayram AT ubicom.com)
...
~+200 bytes
2009-04-17 23:44:18 +00:00
Denis Vlasenko
270b1c3f68
hush: set $n properly for "source" builtin
...
function old new delta
restore_G_args - 78 +78
save_and_replace_G_args - 64 +64
builtin_source 72 107 +35
run_list 2549 2367 -182
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 1/1 up/down: 177/-182) Total: -5 bytes
2009-04-17 18:54:50 +00:00
Denis Vlasenko
4ea187fd62
hush: fix non-interactive response to pipe being stopped.
...
function old new delta
checkjobs 380 394 +14
2009-04-17 14:35:43 +00:00
Denis Vlasenko
e4bd4f2cc8
hush: unblock TERM, INT, HUP in child shells too.
2009-04-17 13:52:51 +00:00
Denis Vlasenko
f8c1f02d2f
hush: disallow "{echo hi; }" (require whitespace)
...
and "{ echo hi }" (require semicolon or &)
function old new delta
parse_stream 2098 2176 +78
done_command 98 84 -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 78/-14) Total: 64 bytes
2009-04-17 11:55:42 +00:00
Denis Vlasenko
fa4ca7889e
hush: add a TODO
2009-04-16 12:00:15 +00:00
Denis Vlasenko
bb929517a8
hush: fix "if { echo foo; } then { echo bar; } fi" parsing
...
function old new delta
done_word 728 793 +65
parse_stream 2084 2098 +14
2009-04-16 10:59:40 +00:00
Denis Vlasenko
74a931ac9e
hush: stop ignoring ^Z in child shells
2009-04-15 23:29:44 +00:00
Denis Vlasenko
c4ada79343
hush: remove old disabled ^Z handling
2009-04-15 23:29:00 +00:00
Denis Vlasenko
41ddecd9ed
hush: fix heredoc_huge.tests broken in last commits
2009-04-15 21:58:14 +00:00
Denis Vlasenko
c376db332c
hush: remove TODO comment itself :)
2009-04-15 21:49:48 +00:00
Denis Vlasenko
27014ed5cb
hush: deal with a TODO: move argv_from_re_execing out of globals
...
function old new delta
generate_stream_from_string 156 165 +9
setup_heredoc 312 320 +8
re_execute_shell 387 391 +4
pseudo_exec_argv 129 133 +4
run_pipe 1790 1783 -7
clean_up_after_re_execute 30 - -30
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 4/1 up/down: 25/-37) Total: -12 bytes
2009-04-15 21:48:23 +00:00
Denis Vlasenko
7f9593753a
randomconfig fixes
2009-04-14 08:06:59 +00:00
Denis Vlasenko
2b2183a77d
hush: make function support configurable
2009-04-13 14:23:12 +00:00
Denis Vlasenko
bc56974062
hush: pass functions to child shells on NOMMU
...
function old new delta
new_function - 123 +123
hush_main 1198 1262 +64
re_execute_shell 341 387 +46
run_pipe 1872 1790 -82
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/1 up/down: 233/-82) Total: 151 bytes
2009-04-12 20:35:19 +00:00
Denis Vlasenko
135cecbbce
ash: fix warning in debug build
2009-04-12 00:00:57 +00:00
Denis Vlasenko
c43430f1b9
hush: remove functions from TODOs
2009-04-11 11:07:22 +00:00
Denis Vlasenko
0701dca88c
hush: improve debugging output
2009-04-11 10:38:47 +00:00
Denis Vlasenko
ed055214bb
hush: fix "while...do f1() {a;}; f1; f1 {b;}; f1; done" bug
2009-04-11 10:37:10 +00:00
Denis Vlasenko
75bccfa375
hush: tweak tests
2009-04-10 23:48:03 +00:00
Denis Vlasenko
ce4acbbab6
hush: add function tests
2009-04-10 23:23:41 +00:00
Denis Vlasenko
6ba6f546ac
hush: pass $n to functions
...
function old new delta
run_pipe 1183 1325 +142
run_list 1219 1220 +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 143/0) Total: 143 bytes
2009-04-10 21:57:50 +00:00
Denis Vlasenko
c0ea329297
hush: fix a few thinkos in function support; make it work on NOMMU;
...
functions in child shells now even have $n passed to them! :)
(in main shell it still doesn't work)
2009-04-10 21:22:02 +00:00
Denis Vlasenko
b7d8c0dbbd
hush: first stab at function support. argv passing is not coded yet.
...
Only very rudimentary testing was done.
With function support off, code growth is zero, with it on:
function old new delta
run_list 2158 2339 +181
parse_stream 1929 2044 +115
find_builtin 24 67 +43
find_function - 36 +36
file_get 244 264 +20
pseudo_exec_argv 145 160 +15
free_strings - 7 +7
free_pipe 183 181 -2
done_word 735 728 -7
expand_variables 2227 2204 -23
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 5/3 up/down: 417/-32) Total: 385 bytes
2009-04-10 19:05:43 +00:00