Denys Vlasenko
b347df9131
randomconfig fixes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-09 22:49:15 +02:00
Denys Vlasenko
6e42b89b8d
hush: fix remaining known two bugs with IFS expansion. Closes 4027.
...
function old new delta
expand_vars_to_list 1054 1140 +86
parse_stream 2425 2479 +54
expand_on_ifs 258 310 +52
builtin_umask 133 132 -1
done_word 820 779 -41
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 192/-42) Total: 150 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-01 18:16:43 +02:00
Denys Vlasenko
4fb53fb08c
hush: partially fix wrong expansion on $IFS (bug 4027).
...
In the added testcase, before patch we failed 8 out of 9 tests,
now we fail only 2 (4th and 5th).
function old new delta
expand_on_ifs 225 258 +33
expand_vars_to_list 1038 1054 +16
o_save_ptr_helper 115 119 +4
builtin_umask 132 133 +1
o_addQstr 165 161 -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/1 up/down: 54/-4) Total: 50 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-01 14:06:20 +02:00
Kevin Cernekee
43a668b2ee
cttyhack: fail gracefully if the device node is missing
...
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-13 09:30:36 +02:00
Kevin Cernekee
064e99646a
cttyhack: check sysfs for the name of the active console
...
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-13 09:26:58 +02:00
Denys Vlasenko
56a3b82e96
hush: better comment. No code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-01 12:47:07 +02:00
Denys Vlasenko
00ae989ee5
hush: fix a corner case of empty "do \n done" structure
...
The structure is:
while cmd; do
done
bash doesn't accept it at all. We were accepting it but execution
was buggy.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-31 17:35:45 +02:00
Denys Vlasenko
29f9b7268a
hush: fix misparsing of "... do eval a= ...". Closes 3721
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-14 11:27:36 +02:00
Denys Vlasenko
60a9414cad
fix "variable 'foo' set but not used" warnings
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-13 20:57:01 +02:00
Denys Vlasenko
0806e401d6
hush: install signal handlers with filled sigmask
...
function old new delta
install_sighandler - 39 +39
hush_main 1001 1031 +30
builtin_trap 386 392 +6
install_sighandlers 121 123 +2
switch_off_special_sigs 87 86 -1
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/1 up/down: 77/-1) Total: 76 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-12 23:06:20 +02:00
Denys Vlasenko
75e77deab1
hush: fixes and small shrink for HUSH_JOB!=y
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-12 13:12:47 +02:00
Denys Vlasenko
ebc1ee2e2a
hush: remove one sigprocmask from exit path
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-12 10:59:18 +02:00
Denys Vlasenko
0c40a731e3
hush: add forgotten {} in multi-statement if.
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-12 09:50:12 +02:00
Denys Vlasenko
f58f705c58
hush: fix login shell's signal handling; add -l option so that it's easier to test
...
function old new delta
hush_main 958 1001 +43
install_special_sighandlers 47 52 +5
packed_usage 28752 28741 -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 48/-11) Total: 37 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-12 02:10:33 +02:00
Denys Vlasenko
9d6cbafe72
hush: replace signal handling machinery
...
With new version of signal handling, read builtin should be less buggy
wrt signals.
function old new delta
install_sighandlers - 121 +121
switch_off_special_sigs - 84 +84
pick_sighandler - 58 +58
install_special_sighandlers - 47 +47
builtin_wait 284 319 +35
record_pending_signo - 21 +21
execvp_or_die 43 48 +5
file_get 290 288 -2
run_list 1004 998 -6
static.zero_timespec 8 - -8
sigprocmask_set 14 - -14
sigwaitinfo 23 - -23
record_signal 23 - -23
__GI_sigwaitinfo 23 - -23
sigtimedwait 25 - -25
builtin_trap 417 392 -25
__GI_sigtimedwait 25 - -25
hush_main 1003 965 -38
check_and_run_traps 263 217 -46
__rt_sigtimedwait 52 - -52
reset_traps_to_defaults 213 126 -87
init_sigmasks 198 - -198
builtin_read 536 197 -339
------------------------------------------------------------------------------
(add/remove: 5/10 grow/shrink: 2/7 up/down: 371/-934) Total: -563 bytes
text data bss dec hex filename
903075 936 17736 921747 e1093 busybox_old
902547 936 17736 921219 e0e83 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-11 23:56:11 +02:00
Denys Vlasenko
10c0131a8a
hush: use SA_RESTARTed signal handlers across read.
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-11 11:49:21 +02:00
Denys Vlasenko
bcf1fa80f3
hush: add tests for interrupting read
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-09 01:05:33 +02:00
Denys Vlasenko
54e9e1217c
hush: code shrink
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-09 00:52:15 +02:00
Denys Vlasenko
80542bad2f
hush: make read builtin interruptible.
...
function old new delta
builtin_read 185 471 +286
check_and_run_traps 200 262 +62
nonblock_immune_read 73 119 +46
sigismember - 44 +44
record_signal - 21 +21
sigisemptyset - 16 +16
...
------------------------------------------------------------------------------
(add/remove: 5/0 grow/shrink: 7/5 up/down: 483/-46) Total: 437 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-08 21:23:43 +02:00
Denys Vlasenko
80c5b6893d
libbb: nonblock_safe_read->nonblock_immune_read, remove unused param of xmalloc_reads
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-08 21:21:10 +02:00
Denys Vlasenko
b8709032a3
hush: fix incorrect PS2 dispaly and trap handling while reading command
...
The fix affects only !ENABLE_FEATURE_EDITING configuration
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-08 21:20:01 +02:00
Ian Wienand
89b3cbaa97
ash: clear sa_flags always
...
Signed-off-by: Ian Wienand <ianw@vmware.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-16 20:05:14 +02:00
Denys Vlasenko
e32d05b708
ash,hush: add ulimit -e -r (RLIMIT_NICE, RLIMIT_RTPRIO)
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-04 02:12:14 +02:00
Denys Vlasenko
2c4de5b045
ash,hush: optional support for $HISTFILESIZE.
...
Based on patch from Alexey Fomenko (ext-alexey.fomenko AT nokia.com)
function old new delta
size_from_HISTFILESIZE - 44 +44
hush_main 998 1025 +27
ash_main 1348 1374 +26
read_line_input 3361 3372 +11
new_line_input_t 17 24 +7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-31 13:16:52 +02:00
Denys Vlasenko
a439fa93f6
hush: remove outdated comments
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-30 19:11:46 +02:00
Denys Vlasenko
cecbc98611
hush: fix source1.tests
...
function old new delta
parse_and_run_stream 95 139 +44
static_get 22 25 +3
file_get 260 263 +3
builtin_umask 133 132 -1
parse_stream 2442 2425 -17
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 50/-18) Total: 32 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-30 18:54:52 +02:00
Denys Vlasenko
c162bcdcd1
hush: document a bug about aborting on sourced file error when non-interactive
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-24 05:38:51 +01:00
Denys Vlasenko
3eab24e64a
hush: make parse errors in sourced file non-fatal in interactive script
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-24 05:25:59 +01:00
Denys Vlasenko
68d5cb5dac
hush: fix a case where return in sourced file has no effect
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-24 02:50:03 +01:00
Denys Vlasenko
20704f0662
ash,hush: recheck LANG before every line input
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-23 17:59:27 +01:00
Denys Vlasenko
6b6af53426
ash/hush: shrink help text
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-08 10:24:17 +01:00
Denys Vlasenko
976ec23da5
remove stray empty line
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-07 13:12:01 +01:00
Denys Vlasenko
b0b834342f
ash/hush: provide help text
...
$ ./busybox ash --help
BusyBox v1.19.0.git (2011-03-07 11:25:29 CET) multi-call binary.
Usage: ash [-/+OPTCHARS] [-/+o OPTNAME]... [-c 'SCRIPT' [ARG0 [ARGS]] / SCRIPT_FILE [ARGS]]
Unix shell interpreter
$ ./busybox hush --help
BusyBox v1.19.0.git (2011-03-07 11:25:29 CET) multi-call binary.
Usage: hush [-nx] [-c 'SCRIPT' [ARG0 [ARGS]] / SCRIPT_FILE [ARGS]]
Unix shell interpreter
function old new delta
packed_usage 28163 28212 +49
setcmd 85 78 -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 49/-7) Total: 42 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-07 12:34:59 +01:00
Denys Vlasenko
aefe1c260e
ash: fix execution of shell scripts without shebang
...
We were assuming #!/bin/sh, whereas we had to simply re-enter ash.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-07 12:02:40 +01:00
Denys Vlasenko
940c7206c2
convert "do {...} while (1);" -> "while (1) {...}"
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-02 04:07:14 +01:00
Denys Vlasenko
bac0a25f72
slightly better wording in comments
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-21 03:47:50 +01:00
Denys Vlasenko
b12553faa8
ash: fix ash-signals/signal8 testcase failure
...
function old new delta
killcmd 109 224 +115
kill_main 882 910 +28
changepath 194 195 +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 144/0) Total: 144 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-21 03:22:20 +01:00
Denys Vlasenko
7c6f2468cc
hush: do not print killer signal's name for SIGPIPE
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-14 17:17:10 +01:00
Denys Vlasenko
66c5b12dbf
ash: fix TMOUT not restoring tty attributes
...
function old new delta
pgetc 420 500 +80
readtoken1 3202 3239 +37
read_line_input 3316 3337 +21
udhcpc_main 2610 2630 +20
file_get 266 272 +6
expandarg 958 963 +5
localcmd 257 259 +2
addLines 85 87 +2
read_line 94 95 +1
ed_main 2540 2541 +1
timed_out 1 - -1
lineedit_read_key 256 255 -1
alrm_sighandler 44 - -44
cmdloop 539 434 -105
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 10/2 up/down: 175/-151) Total: 24 bytes
text data bss dec hex filename
887379 936 17200 905515 dd12b busybox_old
887411 936 17192 905539 dd143 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-08 05:07:02 +01:00
Denys Vlasenko
8ee2adab21
echo: do not retry on write errors
...
function old new delta
echo_main 297 336 +39
stpcpy - 22 +22
run_pipe 1561 1566 +5
pseudo_exec_argv 187 192 +5
hush_exit 75 80 +5
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 4/0 up/down: 98/0) Total: 76 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-07 02:03:51 +01:00
Denys Vlasenko
046341e8bd
ash: optional support for $TMOUT variable
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-04 17:53:59 +01:00
Denys Vlasenko
8c52f80397
ash: cosmetic cleanups
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-04 17:36:21 +01:00
Denys Vlasenko
b7c9fb27cb
whitespace fixes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-03 00:05:48 +01:00
Denys Vlasenko
b72baeb003
hush: use FEATURE_SH_NOFORK to enable NOFORK trick
...
Also expands docs
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-02 18:38:57 +01:00
Denys Vlasenko
8d0e0cdadf
move utmp.h include to libbb.h
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-25 23:21:46 +01:00
Denys Vlasenko
a146319173
hush: improve prompt in nested {}s, remove unused in_str->promptme member
...
function old new delta
setup_string_in_str 29 38 +9
parse_and_run_stream 79 88 +9
setup_file_in_str 32 39 +7
parse_stream 2430 2422 -8
file_get 262 235 -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 25/-35) Total: -10 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-18 17:55:04 +01:00
Denys Vlasenko
98c46d10ee
hush: fix "cmd & <newline>" problem
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-18 17:30:07 +01:00
Denys Vlasenko
b9f2d9f7d9
mass removal of underscores from _BB_DIR_foo and _BB_SUID_foo
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-18 13:58:01 +01:00
Denys Vlasenko
642e71a789
hush: fix wrong prompt problem on empty interactive commants
...
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-01-07 15:16:05 +01:00
Denys Vlasenko
6088e138e1
init: simpler handling of leading dash in commands
...
function old new delta
init_exec 233 219 -14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-25 23:58:42 +01:00