Commit Graph

663 Commits

Author SHA1 Message Date
Denys Vlasenko
2301d127a2 unicode: check $LC_CTYPE too to detect Unicode mode
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-05 22:00:57 +02:00
Denys Vlasenko
3e7ecb179b unicode: check $LC_ALL to detect Unicode mode, not only $LANG
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-02 17:30:23 +02:00
Flemming Madsen
d96ffda62e ash,hush: history builtin
function                                             old     new   delta
show_history                                           -      39     +39
builtin_history                                        -      16     +16
historycmd                                             -      13     +13
bltins1                                              312     324     +12
builtintab                                           336     344      +8
popstring                                            134     140      +6
hush_main                                           1048    1046      -2
ash_main                                            1398    1396      -2
size_from_HISTFILESIZE                                44      40      -4
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 3/3 up/down: 94/-8)              Total: 86 bytes

Signed-off-by: Flemming Madsen <busybox@themadsens.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-04-07 18:47:24 +02:00
Denys Vlasenko
091f831424 ash: add comment about failures in source builtin. No code changes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-17 14:25:22 +01:00
Stefan Hellermann
4ef1439c59 ash: read $HOME/.profile instead of $(pwd)/.profile
ash --login should read ~/.profile instead of .profile in the current
directory. I noticed it while trying to figure out why /root/.profile
is only read sometimes.

function                                             old     new   delta
ash_main                                            1374    1398     +24

Signed-off-by: Stefan Hellermann <stefan@the2masters.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-15 02:45:50 +01:00
Stefan Hellermann
aeb717aa5e ash: move code to allow setting $HOME in /etc/profile
move HISTFILE=$HOME/.ash_history below reading /etc/profile,
so that /etc/profile can set $HOME. HOME can be unset when
directly invoking ash --login from init without going through
getty.

Signed-off-by: Stefan Hellermann <stefan@the2masters.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-15 02:37:51 +01:00
Denys Vlasenko
1961aea305 move endofname() to libbb
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-26 00:36:53 +01:00
Denys Vlasenko
7c4b13e019 ash: revert wrong "fix" for an apparent memory leak. Closes 5822
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-17 13:02:27 +01:00
Denys Vlasenko
60cb48ca50 whitespace cleanup. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14 15:57:44 +01:00
Jon Tollefson
4ba6c5d3ba ash: fix a memory leak
The script which triggers the leak:

while true
  do
    while true
      do
        break;
    done</dev/null
done

Signed-off-by: Jon Tollefson <kniht@linux.vnet.ibm.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-11-13 19:26:53 +01:00
Denys Vlasenko
d527588882 ash: implement export -n
function                                             old     new   delta
exportcmd                                            129     175     +46

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-10-01 13:41:17 +02:00
Denys Vlasenko
0b4980c252 ash: trivial fixes for compile failures
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-25 12:49:29 +02:00
Denys Vlasenko
9e71e3cea5 ash: fix "read -s" + ^C. Closes 5504
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-06 13:28:10 +02:00
Denys Vlasenko
566a313a7f ash: add a comment about VEXPORT
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-07-07 21:40:35 +02:00
Denys Vlasenko
f451b2cfe0 ash: fix a bug in >${varexp} handling. Closes 5282
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-09 02:06:57 +02:00
Denys Vlasenko
83f103b30e ash: in standalone mode, search in $PATH if /proc/self/exe doesn't exist
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-20 06:10:35 +01:00
Denys Vlasenko
cda6ea905d ash: document bash's exit code too. No code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-16 00:44:36 +01:00
Denys Vlasenko
2bef526331 ash: add comment about bash's ENOEXEC handling. No code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-16 00:25:17 +01:00
Denys Vlasenko
bede215cf1 lineedit: add support for history saving on exit
Based on the patch by Dennis Groenen <tj.groenen@gmail.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-04 16:12:33 +02:00
Denys Vlasenko
4840ae8a06 lineedit: fix atomic replace of history file; hush: fix $HISTFILE handling
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-04 15:28:03 +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
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
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
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
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
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
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
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
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
Denys Vlasenko
26777aa1c6 fixes for bugs discovered by randomconfig builds and tests
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-22 23:49:10 +01:00
Denys Vlasenko
e4dcba1c10 *: whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-28 18:57:19 +02:00
Denys Vlasenko
cacb2cd281 *: whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-05 00:13:02 +02:00
Denys Vlasenko
b563f62bbb ash: fix signal and "set -e" interaction
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-09-25 17:15:13 +02:00
Denys Vlasenko
bed7c81ea2 shell/math: deconvolute and explain ?: handling. Give better error message
function                                             old     new   delta
arith_apply                                         1271    1283     +12

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-16 11:50:46 +02:00
Denys Vlasenko
063847d6bd shell/math: return string error indicator, not integer
function                                             old     new   delta
expand_and_evaluate_arith                             87     106     +19
expand_one_var                                      1563    1570      +7
arith                                                 12      18      +6
evaluate_string                                      678     680      +2
arith_apply                                         1269    1271      +2
builtin_umask                                        133     132      -1
ash_arith                                            118      75     -43
expand_vars_to_list                                 1094    1038     -56
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/3 up/down: 36/-100)           Total: -64 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-15 13:33:02 +02:00
Denys Vlasenko
06d44d7dfb shell/math.c: rename arith_eval_hooks to arith_state, put error code into it
function                                             old     new   delta
expand_and_evaluate_arith                             79      89     +10
arith                                                675     674      -1
arith_lookup_val                                     151     142      -9
ash_arith                                            135     122     -13
arith_apply                                         1304    1269     -35
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/4 up/down: 10/-58)            Total: -48 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-13 12:49:03 +02:00
Denys Vlasenko
958581a8d9 ash: shrink by folding an if check into setprompt; unindent big block
function                                             old     new   delta
setprompt_if                                           -      66     +66
parseheredoc                                         126     124      -2
parsecmd                                              68      66      -2
redirect                                            1254    1249      -5
xxreadtoken                                          351     343      -8
readtoken1                                          3219    3204     -15
setprompt                                             62       -     -62
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/5 up/down: 66/-94)            Total: -28 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12 15:04:27 +02:00
Denys Vlasenko
6040fe88f4 ash: add missing casts to match CTLfoo; add TODO comments
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12 15:03:16 +02:00
Dan Fandrich
77d4872691 Avoid side effects in putc(), which may be implemented as a macro
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-09 11:48:02 +02:00
Denys Vlasenko
8b2f13d84d shell: unify endofname() in hush and ash
function                                             old     new   delta
builtin_umask                                        132     133      +1
changepath                                           195     194      -1
expand_and_evaluate_arith                             77      69      -8
ash_arith                                            143     135      -8
expand_one_var                                      1551    1515     -36
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/4 up/down: 1/-53)             Total: -52 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-07 12:19:33 +02:00
Denys Vlasenko
d383b49aef hush: remove disabled CMD_SINGLEWORD_NOGLOB_COND, rename o_glob->perform_glob
+ other small tweaks to comments and such

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 10:22:13 +02:00
Denys Vlasenko
8d3e225a2d libbb: add xfstat function
function                                             old     new   delta
xfstat                                                 -      25     +25
mkfs_ext2_main                                      2421    2423      +2
mkfs_reiser_main                                    1197    1194      -3
next                                                 312     307      -5
ar_main                                              533     522     -11
mkfs_minix_main                                     2938    2924     -14
mkfs_vfat_main                                      1511    1495     -16
writeTarFile                                         272     255     -17
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/6 up/down: 27/-66)            Total: -39 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-08-31 12:42:06 +02:00
Denys Vlasenko
0ff78a0166 ash: small code shrink (-21 bytes)
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-08-30 15:20:07 +02:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 20:14:46 +02:00
Denys Vlasenko
33bbb27e45 ash: fix another bit of var_bash4 bug
But it _still_ doesn't pass! quoted case is a tough nut to crack

function                                             old     new   delta
redirect                                            1281    1286      +5
subevalvar                                          1141    1142      +1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-07 22:24:36 +02:00
Denys Vlasenko
09dd6ec732 ash: cosmetic fixes, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-07 02:44:33 +02:00
Denys Vlasenko
1614900522 ash: fix another bug detected by var_bash4.tests
... but var_bash4.tests still does not pass!

function                                             old     new   delta
expandarg                                            959     962      +3
localcmd                                             259     257      -2
readtoken1                                          3275    3260     -15
subevalvar                                          1178    1141     -37
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 3/-54)             Total: -51 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-06 22:06:21 +02:00
Denys Vlasenko
f02c82f38c ash: fix dequoting error detected by var_bash4 test
But the test still fails (one more bug to fix)

function                                             old     new   delta
changepath                                           195     192      -3
readtoken1                                          3247    3240      -7
subevalvar                                          1204    1184     -20
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-30)             Total: -30 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-06 19:14:47 +02:00
Denys Vlasenko
b0fbe4b540 ash: add a testcase for bug 2281 (currently fails). Small code cleanups.
function                                             old     new   delta
changepath                                           195     192      -3
subevalvar                                          1204    1200      -4
readtoken1                                          3247    3240      -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-14)             Total: -14 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-05 17:19:27 +02:00
Denys Vlasenko
f3ea792bad *: mass cosmetic removal of extra empty lines. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-26 01:06:14 +02:00
Alexander Shishkin
ccb9771861 ash: fix $! value when traps are set
Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-25 13:07:39 +02:00
Denys Vlasenko
51ca7761a3 cttyhack: move build system bits into cttyhack.c, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-16 17:16:40 +02:00
Denys Vlasenko
771f1995a9 ash: move config stuff into ash.c, no code chages
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-16 14:31:34 +02:00
Denys Vlasenko
fd33e17a2b ash: fix obscure case of replacing + globbing + backslashes
function                                             old     new   delta
subevalvar                                          1152    1178     +26
readtoken1                                          3267    3275      +8
redirect                                            1284    1286      +2
expandarg                                            957     958      +1
expdir                                                 4       -      -4
evalcommand                                         1219    1209     -10
expmeta                                              481     469     -12
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 4/2 up/down: 37/-26)             Total: 11 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-26 22:55:44 +02:00
Denys Vlasenko
1fcbff2fac build system: do not rebuild ash and hush on any change to any .c file
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-26 02:40:08 +02:00
Andreas Bühmann
da75f44844 ash: <> redir should not truncate
Signed-off-by: Andreas Bühmann <buehmann@users.berlios.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-24 04:32:37 +02:00
Denys Vlasenko
8cd9f343e7 ash: times builtin: use unsigned type; take free-of-charge modulo
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-18 15:36:48 +02:00
Denys Vlasenko
b87c17cd16 *: stop defining _GNU_SOURCE in source files, it's in CFLAGS anyway
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-18 15:15:24 +02:00
Denys Vlasenko
7df28bbb8f ash: fix unset in standalone mode
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-18 14:23:47 +02:00
Denys Vlasenko
1ed2fb40c9 ash: cosmetics, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-18 14:09:48 +02:00
Denys Vlasenko
161bb8fa12 fix a few goofs uncovered by "make allnoconfig" testing
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-06 05:07:11 +02:00
Denys Vlasenko
79b3d42e13 ash: rename parsefile->fd to ->pf_fd
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-03 04:29:08 +02:00
Denys Vlasenko
08d8b3cee1 ash: fix redirection of fd 0 in scripts are sourced from interactive ash
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-03 04:28:28 +02:00
Denys Vlasenko
ea8b252cb3 *: better string sharing
text   data    bss    dec    hex filename
 849427    441   7556 857424  d1550 busybox_old
 849355    441   7556 857352  d1508 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-02 12:57:26 +02:00
Denys Vlasenko
8837c5dec4 ash: remove one redundant function, improve string sharing, better field names
function                                             old     new   delta
var_end                                                -      15     +15
changepath                                           194     192      -2
setvareq                                             222     218      -4
lookupvar                                             57      51      -6
bltinlookup                                           57      51      -6
evalfun                                              452     443      -9
varequal                                              14       -     -14
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/5 up/down: 15/-41)            Total: -26 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-02 12:56:18 +02:00
Denys Vlasenko
599ae1eb9f shell: consolidate builtin_foo.? into shell_common.?; delete obsolete shells
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-23 17:49:50 +02:00
Denys Vlasenko
a0ec4f500c ash: eliminate 16 bytes in bss
text   data    bss    dec    hexfilename
 841423    441   7572 849436  cf61cbusybox_old
 841430    441   7556 849427  cf613busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-20 12:50:42 +02:00
Denys Vlasenko
42c4b2e3b5 ash: fix var_leak.tests so that it actually catches the NOFORK bug
+ document the bug better

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-18 16:13:56 +02:00
Denys Vlasenko
c7f95d23f6 typo fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-18 15:52:23 +02:00
Denys Vlasenko
238bf187ba ash: fix bug which causes signal6.tests to fail
function                                             old     new   delta
trapcmd                                              271     277      +6
localcmd                                             277     275      -2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-18 15:49:07 +02:00
Denys Vlasenko
e66cf821cf ash,hush: make bare "." set exitcode to 2
function                                             old     new   delta
dotcmd                                               300     305      +5
builtin_source                                       176     171      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-18 09:12:53 +02:00
Denys Vlasenko
82731b4b7a ash,hush: make "source" a synonym for . if bash compat is on
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-17 17:49:52 +02:00
Denys Vlasenko
cd10dc40e4 ash: fix ". empty_file" exitcode. +5 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-17 17:10:46 +02:00
Denys Vlasenko
82dd14a510 ash: use CONFIG_FEATURE_EDITING_MAX_LEN
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-17 10:10:01 +02:00
Denys Vlasenko
7c1ed9fbde ash: fix signal5.tests
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-17 04:42:40 +02:00
Colin Watson
3963d943f8 ash: refresh stack pointers after makestrspace in rmescapes
Without this, rmescapes sometimes returns random garbage while
performing parameter expansions such as ${foo#bar}, in the event that
the allocation of r happens to need to reallocate the stack and hence
invalidate str and p.  I'd love to provide a test case but unfortunately
it's dependent on exact stack layout, so I don't have anything simpler
than the situation described in
https://bugs.launchpad.net/ubuntu/+source/partman-base/+bug/527401/comments/23
which involved a sequence of foo="${foo#*, }" expansions on a long
string inside our RAID configuration tool.

The same fix has been in dash since 2007-09-26, contributed by Roy
Marples <uberlord@gentoo.org>.  I actually came up with it independently
almost to the character, but then synced it up with the variable naming
used in dash when I noticed that change afterwards.

Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-26 14:21:27 +02:00
Denys Vlasenko
023a08f229 ash: line up builtin table. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-26 15:53:33 +01:00
Denys Vlasenko
496d5bf4c6 ash: trap with bad signal name should not abort
function                                             old     new   delta
trapcmd                                              236     271     +35

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-26 15:52:24 +01:00
Denys Vlasenko
1497484839 ash,hush: make it possible to build them individually
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-23 01:08:26 +01:00
Denys Vlasenko
b76356b28e ash: fix quadratic matching slowdown is ${v/*foo*/repl} (really bad one)
It is especially bad with patterns starting with "*".

With ASH_OPTIMIZE_FOR_SIZE=y, only those are optimized, +few bytes:
   text    data     bss     dec     hex filename
 836337     441    7564  844342   ce236 busybox_old
 836341     441    7564  844346   ce23a busybox_unstripped

With ASH_OPTIMIZE_FOR_SIZE off, we also optimize patterns _ending_ with "*",
which costs about 80 bytes:
   text    data     bss     dec     hex filename
 836656     441    7564  844661   ce375 busybox_old
 836732     441    7564  844737   ce3c1 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-13 16:19:04 +01:00
Denys Vlasenko
f3c742f925 hush: use ash's ulimit builtin; make it more more bash0like while at it
Based on a patch by Tobias Klauser <tklauser@distanz.ch>

function                                             old     new   delta
shell_builtin_ulimit                                   -     498    +498
limits_tbl                                            33      88     +55
ulimit_opt_string                                      -      38     +38
bltins1                                              288     300     +12
limits_name                                          127       -    -127
ulimitcmd                                            415       7    -408
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 2/1 up/down: 603/-535)           Total: 68 bytes
   text    data     bss     dec     hex filename
 839229     453    6828  846510   ceaae busybox_old
 839423     453    6828  846704   ceb70 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-06 20:12:00 +01:00
Denys Vlasenko
4b1100edd8 *: use NULL for null pointers
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-05 14:10:54 +01:00
Denys Vlasenko
153fcaa6c1 Replace __uClinux__ define with !BB_MMU
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-21 05:17:41 +01:00
Denys Vlasenko
7426920461 fix bug 1087. Fix by Leonid (lly.dev AT gmail.com)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-21 01:26:42 +01:00
Denys Vlasenko
25d9b91d94 shell/read: check that variable names are sane
function                                             old     new   delta
shell_builtin_read                                  1000    1055     +55
parse_command                                       1460    1463      +3
builtin_umask                                        121     123      +2
is_well_formed_var_name                               73      66      -7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-13 18:22:35 +01:00
Denys Vlasenko
03dad22f8a hush: use ash's read builtin
function                                             old     new   delta
shell_builtin_read                                     -    1000   +1000
set_local_var_from_halves                              -      24     +24
setvar2                                                -       7      +7
...
popstring                                            140     134      -6
ash_main                                            1375    1368      -7
setvar                                               184     174     -10
arith_set_local_var                                   36       -     -36
builtin_read                                        1096     185    -911
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 5/23 up/down: 1038/-1007)        Total: 31 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-12 23:29:57 +01:00
Denys Vlasenko
7306727d1b shell: split read builtin from ash
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-12 22:11:24 +01:00
Denys Vlasenko
f2c8aa6676 libbb: introduce and use monotonic_ms
function                                             old     new   delta
monotonic_ms                                           -      60     +60
process_stdin                                        433     443     +10
display_speed                                         85      90      +5
nmeter_main                                          672     674      +2
builtin_type                                         114     116      +2
bb__parsespent                                       117     119      +2
ifplugd_main                                        1110    1109      -1
acpid_main                                           441     440      -1
chat_main                                           1361    1359      -2
doCommands                                          2458    2449      -9
arpping                                              466     450     -16
run_command                                          268     234     -34
readcmd                                             1072    1034     -38
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/7 up/down: 81/-101)           Total: -20 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-12 12:52:30 +01:00
Denys Vlasenko
8cd04d1cb6 ash: fix for read $IFS splitting. Closes bug 235
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-08 15:44:07 +01:00
Chris Metcalf
c3c1fb676b ash: fix mishandling of bash-style redirects
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-08 13:18:06 +01:00
Denys Vlasenko
46a1477107 ash: trivial optimization -6 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-10 21:27:13 +01:00
Denys Vlasenko
e9ac32a067 ash: fix double comma in initializer
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-05 02:01:25 +01:00
Michael Abbott
359da5e3be ash: implement set -o pipefail (conditional on bash compat). +39 bytes
Signed-off-by: Michael Abbott <michael@araneidae.co.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-04 23:03:29 +01:00
Denys Vlasenko
285ad155c4 ash: preparatory work for pipefail and code shrink. -44 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-04 23:02:27 +01:00
Denys Vlasenko
7a7b034482 ash: re-enable SIGHUP on entry. Closes bug 771.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-04 04:18:31 +01:00
Denys Vlasenko
8eda4a9005 ash: straighten up a bit of code in varvalue()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-30 12:16:17 +01:00
Denys Vlasenko
2ce42e98d7 ash: more cosmetics and cleanups
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-29 02:18:13 +01:00
Denys Vlasenko
068d386a6c ash: cosmetics, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-29 01:41:11 +01:00
Denys Vlasenko
76bc2d6deb ash: remove last "signed char"; make SIT() clearer. -12 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-29 01:37:46 +01:00
Denys Vlasenko
0337e038a9 ash: randmconfig fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-29 00:12:30 +01:00
Denys Vlasenko
cd71683ae6 ash: remake strange signed char machinery to be unsigned. -57 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-28 22:14:02 +01:00
Denys Vlasenko
8131eea3dc *: introduce and use ffulsh_all()
function                                             old     new   delta
buffer_fill_and_print                                179     196     +17
fflush_all                                             -       9      +9
spawn                                                 87      92      +5
rtcwake_main                                         455     453      -2
...
alarm_intr                                            93      84      -9
readcmd                                             1072    1062     -10
bb_ask                                               345     333     -12
more_main                                            845     832     -13
flush_stdout_stderr                                   42      23     -19
xfflush_stdout                                        27       -     -27
flush_stderr                                          30       -     -30
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 2/50 up/down: 31/-397)         Total: -366 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-02 14:19:51 +01:00
Denys Vlasenko
36df04837a randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-19 16:07:28 +02:00
Denys Vlasenko
76ace254e1 ash,hush: fix $RANDOM in children being repeated
function                                             old     new   delta
next_random                                           46      68     +22
forkshell                                            248     263     +15
expand_vars_to_list                                 2118    2131     +13
run_pipe                                            1775    1782      +7
popstring                                            134     140      +6
builtin_umask                                        123     121      -2
ash_main                                            1356    1336     -20
get_local_var_value                                  125     104     -21
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/3 up/down: 63/-43)             Total: 20 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-12 15:25:01 +02:00
Denys Vlasenko
e7670ff81d ash: use bbox wrappers for malloc etc instead of homegrown ones
function                                             old     new   delta
popstring                                            134     140      +6
ckmalloc                                               9       -      -9
ckstrdup                                              22       -     -22
ckrealloc                                             24       -     -24
ckzalloc                                              28       -     -28
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 1/0 up/down: 6/-83)             Total: -77 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-11 00:45:25 +02:00
Denys Vlasenko
0e5e4eaf7b ash: trivial shrink by using smaller int
function                                             old     new   delta
copynode                                             197     196      -1
calcsize                                             127     126      -1
nodesize                                              54      27     -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-29)             Total: -29 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-11 00:36:20 +02:00
Denys Vlasenko
3ea2e82dc7 ash: factor out $RANDOM support
function                                             old     new   delta
next_random                                            -      46     +46
ash_main                                            1361    1356      -5
change_random                                        132      97     -35
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 46/-40)              Total: 6 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-09 20:59:04 +02:00
Denys Vlasenko
adf922ec28 *: a few more NOINLINEs
function                                             old     new   delta
print_linkinfo                                         -     815    +815
do_msg                                                 -     783    +783
INET_setroute                                          -     757    +757
varvalue                                               -     746    +746
do_sem                                                 -     637    +637
inflate_codes                                          -     617    +617
INET6_setroute                                         -     491    +491
edir                                                   -     370    +370
sync_cursor                                            -     298    +298
update_utmp                                            -     246    +246
searchLines                                            -     165    +165
setup_alarm                                            -     144    +144
may_wakeup                                             -     101    +101
getNum                                               566     371    -195
refresh                                             1166     848    -318
rtcwake_main                                         809     479    -330
getty_main                                          2396    1921    -475
chpst_main                                          1373     746    -627
inflate_unzip_internal                              1335     567    -768
evalvar                                             1384     612    -772
ipaddr_list_or_flush                                2160    1246    -914
route_main                                          1585     245   -1340
ipcs_main                                           2523    1049   -1474
------------------------------------------------------------------------------
(add/remove: 13/0 grow/shrink: 0/10 up/down: 6170/-7213)    Total: -1043 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-08 14:35:37 +02:00
Denys Vlasenko
57ce977a97 ash: compile breakage fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-08 04:19:14 +02:00
Denys Vlasenko
7bb346f23c *: use {i,u}toa() where appropriate
function                                             old     new   delta
startservice                                         377     363     -14
setari_u                                              54      40     -14
ash_main                                            1375    1361     -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-42)             Total: -42 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-06 22:09:50 +02:00
Cristian Ionescu-Idbohrn
301f5ecb8d ash: error out on ${#1#}, ${#$11}, ${#11#}
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-05 02:07:23 +02:00
Denys Vlasenko
4d8873f997 ash: document where we accept invalid syntax. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-04 03:14:41 +02:00
Denys Vlasenko
76622dbd16 ash: code shrink
function                                             old     new   delta
ulimitcmd                                            489     415     -74

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-04 01:14:19 +02:00
Denys Vlasenko
c34c033c42 ash,hush: share string
function                                             old     new   delta
optschanged                                          133     139      +6
hush_main                                            997     982     -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 6/-15)              Total: -9 bytes
   text   data    bss    dec    hexfilename
 823160    445   7668 831273  caf29busybox_old
 823102    445   7668 831215  caeefbusybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-29 12:25:30 +02:00
Denys Vlasenko
db9c57eed1 libbb/lineedit: fix the case when we configured history to have 0 lines
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-27 02:48:53 +02:00
Denys Vlasenko
e74aaf9385 ash,hush: make trap output short signal names, without SIG prefix
function                                             old     new   delta
evalvar                                             1373    1371      -2
builtin_trap                                         457     441     -16
trapcmd                                              260     236     -24

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-27 02:05:45 +02:00
Denys Vlasenko
8f88d85e34 ash: better comment. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-25 12:12:53 +02:00
Denys Vlasenko
726e1a04f7 ash: even smaller trap code
function                                             old     new   delta
evalvar                                             1371    1373      +2
trapcmd                                              347     260     -87

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-25 02:58:20 +02:00
Denys Vlasenko
e305c28285 ash: slightly better (more correct) code for "trap hack"
function                                             old     new   delta
changepath                                           194     195      +1
evalvar                                             1373    1371      -2
forkchild                                            602     590     -12

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-25 02:12:27 +02:00
Denys Vlasenko
21d87d495a ash: better handling of EXIT trap in trap hack
function                                             old     new   delta
forkchild                                              -     602    +602
trapcmd                                              255     347     +92
ash_main                                            1362    1375     +13
evalvar                                             1371    1373      +2
popstring                                            140     134      -6
forkshell                                            835     248    -587
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/2 up/down: 709/-593)          Total: 116 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-25 00:06:51 +02:00
Denys Vlasenko
0800e3af75 ash: do not let EXIT trap to fire in trap
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-24 03:09:26 +02:00
Denys Vlasenko
2f7894b1bb ash,hush: fix trap reporting: s/SIGEXIT/EXIT/
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-24 01:43:21 +02:00
Denys Vlasenko
606291beab *: more portability fixes by Dan Fandrich
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-23 23:15:43 +02:00
Denys Vlasenko
1f27ab0d4b *: optimize code size in strtoul calls
function                                             old     new   delta
bb_parse_mode                                        433     431      -2
rtnl_rtntype_a2n                                     202     198      -4
ParseField                                           511     498     -13
bb_init_module_24                                   4730    4675     -55
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-74)             Total: -74 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-23 17:17:53 +02:00
Denys Vlasenko
844f990926 ash: fix trap
function                                             old     new   delta
forkshell                                            738     810     +72
popstring                                            134     140      +6
parse_command                                       1460    1463      +3
evalvar                                             1373    1371      -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 81/-2)              Total: 79 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-23 03:25:52 +02:00
Denys Vlasenko
1166d7b136 ash: fix bug 585 (>"$VAR_WITH_UNICODE_CHARS" problem)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-16 16:20:31 +02:00
Denys Vlasenko
b0d63383dd ash: preparatory cleanup. The only real changes are (unsigned char) casts
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-16 16:18:32 +02:00
Denys Vlasenko
6db4784d27 hush: export PWD
function                                             old     new   delta
set_pwd_var                                            -      36     +36
hush_main                                            941     951     +10
evalvar                                             1365    1363      -2
ash_main                                            1364    1362      -2
builtin_cd                                            75      72      -3
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/3 up/down: 46/-7)              Total: 39 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-05 20:15:17 +02:00
Denys Vlasenko
a00329ca8e ash: better comment. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-30 20:05:10 +02:00
Denys Vlasenko
7218af9f83 ash: revent one place where number() doesn't work
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-30 17:07:30 +02:00
Denys Vlasenko
ecc2a2e015 ash: deal with some TODOs (mostly trivial)
function                                             old     new   delta
msg_illnum                                             -      19     +19
evalvar                                             1365    1364      -1
illnum                                                19       -     -19
subevalvar                                          1182    1158     -24
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/2 up/down: 19/-44)            Total: -25 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-29 22:53:41 +02:00
Denys Vlasenko
c8334a40c9 ash: fix handling of Unicode chars in redirects. Fixes bug 585
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-29 20:24:12 +02:00
Denys Vlasenko
b6c8434896 ash: trivial simplifications and optimizations
function                                             old     new   delta
rmescapes                                              -     256    +256
memtodest                                             94     103      +9
evalvar                                             1363    1365      +2
_rmescapes                                           256       -    -256
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 2/0 up/down: 267/-256)           Total: 11 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-29 20:23:20 +02:00
Denys Vlasenko
a12af2d9f3 ash: make "jobs -l" more similar to bash. By Earl Chew. Fixes bug 481
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-23 22:10:04 +02:00
Denys Vlasenko
ffc39202aa ash: fix bug 571 (jobs %string misbehaving)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-17 02:12:20 +02:00
Denys Vlasenko
7cee00e8ae ash: further fixes to debug machinery (closes bug 485)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-24 01:08:03 +02:00
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
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
2634bf366b randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-09 18:40:07 +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
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
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
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
135cecbbce ash: fix warning in debug build 2009-04-12 00:00:57 +00:00
Denis Vlasenko
34d4d89b2d hush: fix NOMMU hangs in pseudo_exec_argv. Add forgotted setting
of signal mask. Reuse same help string in all shells.

function                                             old     new   delta
builtin_exit                                          49      47      -2
pseudo_exec_argv                                     149     145      -4
builtin_help                                          74      63     -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-17)             Total: -17 bytes
   text    data     bss     dec     hex filename
 825379     476    7616  833471   cb7bf busybox_old
 825341     476    7616  833433   cb799 busybox_unstripped
2009-04-04 20:24:37 +00:00
Denis Vlasenko
b29eb6ed25 shells: do not need to have math state global
function                                             old     new   delta                           
ash_arith                                              -     143    +143                           
expand_variables                                    2102    2124     +22                           
popstring                                            134     140      +6                           
parse_command                                       1460    1463      +3                           
trapcmd                                              236     238      +2                           
changepath                                           197     196      -1                           
raise_interrupt                                       86      83      -3                           
hush_main                                           1012     991     -21                           
ash_main                                            1388    1364     -24                           
arith_set_local_var                                   73      34     -39                           
dash_arith                                           117       -    -117                           
------------------------------------------------------------------------------                     
(add/remove: 1/1 grow/shrink: 4/5 up/down: 176/-205)          Total: -29 bytes
2009-04-02 13:46:27 +00:00
Denis Vlasenko
0dfe1d26a9 fix ash-alias/alias.tests failure 2009-04-02 12:57:38 +00:00
Mike Frysinger
98c52645c0 split math code out of ash and into a standalone library so we can use it in any shell (like hush!) 2009-04-02 10:02:37 +00:00
Denis Vlasenko
551ffdccea more of pointless whitespace fixes 2009-04-01 19:48:05 +00:00
Denis Vlasenko
f6fbd62760 ash: add/improve comments, no code changes 2009-03-31 19:36:58 +00:00
Denis Vlasenko
46aeab9a34 ash: fix $IFS handling in read. closes bug 235 2009-03-31 19:18:17 +00:00
Denis Vlasenko
5368ad53e9 ash: expand comment 2009-03-20 10:20:08 +00:00
Denis Vlasenko
1bb3d7e450 ash: add missing comma in debug scaffolding 2009-03-20 07:45:36 +00:00
Denis Vlasenko
b9e70ddf2d ash: fix a case where we close wrong descriptor; add debug hack for that 2009-03-20 01:24:08 +00:00
Denis Vlasenko
f173395c4a ash: DEBUG should be 0 :) 2009-03-19 23:21:55 +00:00
Denis Vlasenko
b21f379639 ash: fix TRACE commands 2009-03-19 23:09:58 +00:00
Denis Vlasenko
653d8e79b2 ash: make evaltree save/restore int suppression depth.
Hopefully this fixes bug 189. Not confirmed by users yet.

function                                             old     new   delta
evaltree                                             809     842     +33
evalvar                                             1374    1376      +2
2009-03-19 21:59:35 +00:00
Denis Vlasenko
4b875708c1 ash: in dotrap(), do not clear gotsig[] for SIGINT if there is no handler
for it, otherwise raise interrupt gets confused later.
 The rest are readability fixes.

function                                             old     new   delta                                                                                                       
evaltreenr                                           817     818      +1                                                                                                       
evaltree                                             817     818      +1                                                                                                       
evalstring                                            88      89      +1                                                                                                       
cmdloop                                              420     419      -1                                                                                                       
evalskip                                               4       1      -3                                                                                                       
breakcmd                                              84      81      -3                                                                                                       
ash_main                                            1382    1379      -3                                                                                                       
evalloop                                             183     177      -6                                                                                                       
evalfor                                              231     225      -6                                                                                                       
------------------------------------------------------------------------------                                                                                                 
(add/remove: 0/0 grow/shrink: 3/6 up/down: 3/-22)             Total: -19 bytes
2009-03-19 13:30:04 +00:00
Denis Vlasenko
7f88e34e1a ash: tentatively fix bug 189. 2009-03-19 03:36:18 +00:00
Denis Vlasenko
5c2b81470d ash: fix "ash -c 'exec 1>&0'" complaining that fd 0 is busy 2009-03-19 01:59:59 +00:00
Denis Vlasenko
9604e1b8fc modprobe: emit "can't open 'modules.dep': (errno)" instead of "module not found"
*: s/can't open %s/can't open '%s'/, it's better to use same string.

function                                             old     new   delta
do_modprobe                                          588     601     +13
config_file_action                                   339     345      +6
modprobe_main                                        565     570      +5
unable_to_open                                        14      16      +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 26/0)               Total: 26 bytes
   text    data     bss     dec     hex filename
 816800     476    7892  825168   c9750 busybox_old
 816812     476    7892  825180   c975c busybox_unstripped
2009-03-03 18:47:56 +00:00
Denis Vlasenko
8ad78e1ec7 ash: make dot command search current directory first, as bash does. 2009-02-15 12:40:30 +00:00
Denis Vlasenko
4e12b1a2a9 libbb: introduce and use xmalloc_ttyname (-32 in bss).
ash: small code shrink

   text    data     bss     dec     hex filename
 793669     504    7524  801697   c3ba1 busybox_old
 793659     504    7492  801655   c3b77 busybox_unstripped
2008-12-23 23:36:47 +00:00
Denis Vlasenko
68819d1232 ash: fix CONFIG_ASH_OPTIMIZE_FOR_SIZE off + high-bit chars case
(do we even need CONFIG_ASH_OPTIMIZE_FOR_SIZE conditional?)
2008-12-15 11:26:36 +00:00
Denis Vlasenko
81c3a1d0b2 ash: remove TODO which seems to actually work now.
no code changes
2008-12-03 11:59:12 +00:00
Denis Vlasenko
f8535ccd65 ash: finally installed it as /bin/sh on my machine.
some breakage noticed, the most dire is mishandled ^C.
 fixing it.

function                                             old     new   delta
blocking_wait_with_raise_on_sig                        -      40     +40
waitforjob                                            85     100     +15
setsignal                                            280     278      -2
evalvar                                             1376    1374      -2
waitcmd                                              186     182      -4
dowait                                               350     316     -34
redirect                                            1231    1185     -46
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/5 up/down: 55/-88)            Total: -33 bytes
2008-12-03 10:36:26 +00:00
Denis Vlasenko
e27dafd338 ash: add FIXME 2008-11-28 04:01:03 +00:00
Denis Vlasenko
7b2294edff ash: "ash: syntax error: XXX unexpected" -> "ash: syntax error: unexpected XXX" 2008-11-28 03:50:46 +00:00
Denis Vlasenko
41eb300ff6 ash: shrink on top of previous change
function                                             old     new   delta
readtoken1                                          3201    3221     +20
xxreadtoken                                          306     313      +7
pungetc                                               13      12      -1
ash_main                                            1380    1379      -1
setinputfile                                         196     192      -4
plinno                                                 4       -      -4
parsenleft                                             4       -      -4
parsenextc                                             4       -      -4
parselleft                                             4       -      -4
setinputstring                                        67      62      -5
pushstring                                           123     114      -9
pgetc                                                455     438     -17
pushfile                                              69      31     -38
popfile                                              114      76     -38
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 2/8 up/down: 27/-129)          Total: -102 bytes
   text    data     bss     dec     hex filename
 798750     564    7756  807070   c509e busybox_old
 798664     560    7748  806972   c503c busybox_unstripped
2008-11-28 03:42:31 +00:00
Denis Vlasenko
727752d2d2 ash: better fix for ash -c 'echo 5&' and ash -c 'sleep 5&'
with testcase
2008-11-28 03:41:47 +00:00
Denis Vlasenko
61befda93b ash,hush: add TODO for rare build failure
*: remove some redundant includes
2008-11-25 01:36:03 +00:00
Denis Vlasenko
1689840672 ash: fix bad interaction between ash -c '....&' and bash compat 2008-11-25 01:34:52 +00:00
Denis Vlasenko
cc5feabeba ash: NTO2 needs #if ENABLE_ASH_BASH_COMPAT 2008-11-22 01:32:40 +00:00
Denis Vlasenko
340299a8bc ash: fix miscalculation of memory needed for eval tree
found by Timo Teras (timo.teras AT iki.fi)
2008-11-21 10:36:36 +00:00
Denis Vlasenko
be54d6bc60 ash: fix "while kill -0 $child; do true; done" looping forever. 2008-10-27 14:25:52 +00:00
Denis Vlasenko
b730474bda ash: fix NOEXEC mode - we were forgetting to pass environment!
env: promote to NOEXEC
hd: promote to NOEXEC, as hexdump is NOEXEC already
2008-10-20 08:15:51 +00:00
Denis Vlasenko
834dee785d ash: support &> redirection (bashism). ~90 bytes of code 2008-10-07 09:18:30 +00:00
Denis Vlasenko
176d49d4f7 ash: some beautification work, no code changes 2008-10-06 09:51:47 +00:00
Denis Vlasenko
559691a3bf ash: implement ">&file" bashism. ~100 bytes. 2008-10-05 18:39:31 +00:00
Denis Vlasenko
d6855d1b50 style fixes, no code changes 2008-09-27 14:03:25 +00:00
Denis Vlasenko
34c73c499b ash: fix "(cat < file)" hang introduced by rev 22944. 2008-08-16 11:48:02 +00:00
Denis Vlasenko
c90e1be01b ash: bash compat: "shift $BIGNUM" is equivalent to "shift 1" 2008-07-30 15:35:05 +00:00
Denis Vlasenko
87d5fd984e ash: fix typo 2008-07-26 13:48:35 +00:00
Denis Vlasenko
4e19a9c81a ash: hopefully close bug 4324. With testcase.
function                                             old     new   delta
evaltree                                             621     869    +248
popstring                                            134     140      +6
2008-07-26 13:45:57 +00:00
Denis Vlasenko
6a0ad25061 ash: dont allow e.g. exec <&10 to attach to stript's fd!
function                                             old     new   delta
is_hidden_fd                                           -      61     +61
redirect                                            1135    1164     +29
popstring                                            134     140      +6
printf_main                                          635     637      +2
evalvar                                             1374    1376      +2
echo_main                                            294     296      +2
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/0 up/down: 102/0)             Total: 102 bytes
2008-07-25 13:34:05 +00:00
Denis Vlasenko
22f7414843 ash: prevent exec NN>&- from closing fd used for script reading 2008-07-24 22:34:43 +00:00
Denis Vlasenko
5a867317bb ash: fix a bug where redirection fds were not closed afterwards.
optimize close+fcntl(DUPFD) into dup2. add testsuites.

function                                             old     new   delta
copyfd                                                47      68     +21
argstr                                              1311    1298     -13
popredir                                             148     131     -17
redirect                                            1139    1107     -32
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 21/-62)            Total: -41 bytes
2008-07-24 19:46:38 +00:00