Denys Vlasenko
1dd2685dcc
Bump version to 1.30.1
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 15:25:41 +01:00
Rostislav Skudnov
c199472e3a
chcon: Fix typo in ACTION_RECURSE
...
Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
d7a622b572
lineedit: fix SEGV in isk, hexedit, ed, closes 11661
...
fdisk, hexedit and ed calls read_line_edit in libbb/lineedit.c with NULL
as first argument. On line 2373 of lineedit.c of busybox version 1.29.3,
state->hist_file is referenced without checking the state->flag.
This causes segmentation fault on fdisk, hexedit and ed on ARM Cortex-A9.
It somehow works on x86_64.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Ari Sundholm
256ee62224
grep: fix -x -v with certain pattern orders
...
We found out that busybox -x -v is a bit broken:
ari@ari-thinkpad:~/busybox$ echo ' aa bb cc' | ./busybox grep -x -e 'aa.*' -e '.*bb.*'
aa bb cc
ari@ari-thinkpad:~/busybox$ echo ' aa bb cc' | ./busybox grep -x -v -e 'aa.*' -e '.*bb.*'
ari@ari-thinkpad:~/busybox$ echo ' aa bb cc' | ./busybox grep -x -e '.*aa.*' -e 'bb.*'
aa bb cc
ari@ari-thinkpad:~/busybox$ echo ' aa bb cc' | ./busybox grep -x -v -e '.*aa.*' -e 'bb.*'
aa bb cc
Last one is wrong.
This patch fixes the issue by making sure that the variable 'found'
never makes a transition from 1 to 0, as this would mean that
grep previously found a match on this input line.
Signed-off-by: Ari Sundholm <ari@tuxera.com >
Signed-off-by: Niko Vähäsarja <niko@tuxera.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
5c6b9165e7
bc: implement pass-by-reference code from upstream
...
function old new delta
zxc_program_popResultAndCopyToVar 298 493 +195
bc_vec_pushIndex - 75 +75
zxc_vm_process 859 928 +69
xc_program_dereference - 66 +66
bc_vec_npush - 65 +65
zbc_num_s 239 249 +10
zxc_program_num 1024 1032 +8
zbc_num_divmod 150 156 +6
xc_program_search 143 146 +3
zxc_program_assign 392 389 -3
zdc_program_execStr 520 517 -3
xc_program_pushVar 198 195 -3
zxc_program_exec 4101 4092 -9
zbc_program_call 318 308 -10
zbc_func_insert 120 104 -16
zbc_parse_stmt_possibly_auto 1460 1439 -21
bc_vec_push 53 12 -41
xc_parse_pushIndex 61 18 -43
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 6/9 up/down: 497/-149) Total: 348 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Bernhard Reutner-Fischer
8296334c1f
ip link: Fix vlan proto, closes 8261 and 11638
...
The proto has to be passed in network byte-order.
While at it allow for
ip link add link eth0 name eth0.2.24 type vlan proto 802.1ad id 24
ip link del link eth0 name eth0.2.24 type vlan proto 802.1ad id 24
The del was lacking a dev_str and thus errored out. Fix by using
name/dev counterpart as fallback.
The proto identifier 802.1Q was not recognized, just it's lowercase
variant, fix that too.
function old new delta
do_add_or_delete 1275 1376 +101
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 101/0) Total: 101 bytes
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
7f8f20714a
ip link: fix mismatched enums in vlan_parse_opt(), closes 11631
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Brian Foley
b65db51ac1
sed: Fix backslash parsing for 'w' command arg
...
If there's any whitespace between w and the filename, parse_file_cmd
writes to the wrong offset when trying to fix up backslashes.
This can be seen in the asan build with busybox sed -e 'w 0\\'
Signed-off-by: Brian Foley <bpfoley@google.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Mark Marshall
fa86b27e24
capability: fix string comparison in cap_name_to_number
...
The result of strcasecmp was being used incorrectly. This function
returns 0 if the strings match.
Signed-off-by: Mark Marshall <mark.marshall@omicronenergy.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
b570954363
bc: code shrink
...
function old new delta
xc_parse_pushInst_and_Index - 16 +16
zbc_parse_expr 1818 1816 -2
xc_parse_pushIndex 65 61 -4
zbc_parse_pushSTR 63 58 -5
zbc_parse_name 448 442 -6
xc_parse_pushNUM 74 67 -7
zdc_parse_expr 479 470 -9
bc_parse_pushJUMP_ZERO 21 12 -9
bc_parse_pushJUMP 21 12 -9
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/8 up/down: 16/-51) Total: -35 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
c28dc0b58b
bc: remove "empty expression" check/message, parsing fails in these cases anyway
...
function old new delta
zbc_parse_expr 1848 1818 -30
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
60fb586597
bc: zbc_parse_expr_empty_ok() is unused except by zbc_parse_expr(), fold it in
...
function old new delta
zbc_parse_expr 1865 1848 -17
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
715273a992
bc: disallow invalid syntax like "{ print 1 print 2 }"
...
statement parsing must NOT eat the terminator: caller needs to know
what it was, to correctly decide whether it is a valid one.
function old new delta
zxc_program_read - 234 +234
zdc_program_printStream - 144 +144
zbc_parse_stmt_possibly_auto 1413 1460 +47
zxc_vm_process 869 859 -10
zxc_program_exec 4116 4101 -15
zdc_program_asciify 368 - -368
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 1/2 up/down: 425/-393) Total: 32 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Martijn Dekker
a89ec68a8a
ls: make -i compatible with coreutils: don't follow symlink by default
...
Signed-off-by: Martijn Dekker <martijn@inlv.org >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
5cea086bbf
bc: shorten "limits" output
...
text data bss dec hex filename
979016 485 7296 986797 f0ead busybox_old
978959 485 7296 986740 f0e74 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
9c36a02f4d
bc: formatting changes, added a FIXME comment, no logic changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
5b35d599e8
bc: support void functions (GNU compat)
...
function old new delta
xc_program_print - 689 +689
zxc_vm_process 814 869 +55
zxc_program_exec 4098 4116 +18
zxc_program_assign 385 392 +7
bc_result_free 43 46 +3
zxc_program_binOpPrep 243 245 +2
zdc_program_execStr 518 520 +2
zxc_program_print 683 - -683
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 6/0 up/down: 776/-683) Total: 93 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
c7679c759a
dc: fit returning of string
...
function old new delta
zxc_program_exec 4087 4098 +11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
d2651fb775
dc: fix '?'
...
function old new delta
zdc_parse_expr 470 479 +9
zxc_vm_process 839 814 -25
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 9/-25) Total: -16 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
fb001145e1
bc: eliminate struct BcInstPtr::results_len_before_call, it is redundant
...
function old new delta
zbc_program_call 332 318 -14
zxc_program_exec 4147 4087 -60
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-74) Total: -74 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
ef2e6a8062
bc: add a palceholder comment for "void" return
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
f40467d369
bc: remove extra div/0 test, remove test for string function parameter
...
function old new delta
zbc_program_call 354 332 -22
zxc_program_assign 426 385 -41
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-63) Total: -63 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
56e09e93bd
bc: fix "...; return}" to work, disallow "return ()"
...
function old new delta
zbc_parse_expr 24 1865 +1841
zbc_parse_stmt_possibly_auto 1425 1413 -12
bc_parse_expr_empty_ok 1843 - -1843
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 1841/-1855) Total: -14 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
18351b4a89
bc: make error line number also size_t, like everything else
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
a8ec556458
bc: generate large bc tests on the fly, -5 mbytes in the git tree
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
7dd6ba12f7
bc: speed up string printing, fix print ""
...
function old new delta
static.esc - 9 +9
zxc_program_print 681 683 +2
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 11/0) Total: 11 bytes
text data bss dec hex filename
979144 485 7296 986925 f0f2d busybox_old
979062 485 7296 986843 f0edb busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
f23c04af2d
bc: upstream fixes
...
function old new delta
bc_parse_expr_empty_ok 1764 1843 +79
bc_error_at - 62 +62
bc_parse_inst_isLeaf - 30 +30
zbc_func_insert 100 120 +20
bc_error_bad_function_definition - 10 +10
bc_error_bad_assignment - 10 +10
zxc_lex_next 1608 1614 +6
ok_in_expr 30 - -30
zxc_vm_process 874 839 -35
------------------------------------------------------------------------------
(add/remove: 4/1 grow/shrink: 3/1 up/down: 217/-65) Total: 152 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
c3de036da9
bc: in xc_read_line(), check ^C on NUL input bytes too
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
2123ceed18
bc: remove superfluous assigment
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
8a7411fcc8
bc: support ibase up to 36 (GNU compat)
...
function old new delta
zxc_program_num 995 1018 +23
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
07c8b240d5
bc: fold xc_lex_more_input() into peek_inbuf()
...
function old new delta
peek_inbuf 69 56 -13
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2019-02-14 14:40:57 +01:00
Denys Vlasenko
ef800e5441
Bump version to 1.30.0
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-30 16:15:57 +01:00
Denys Vlasenko
2cd8c04632
bc: tidying up, no logic changes
...
function old new delta
bc_ops_prec_and_assoc - 25 +25
xc_vm_init 665 663 -2
bc_parse_ops 25 - -25
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/1 up/down: 25/-27) Total: -2 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-30 15:56:36 +01:00
Denys Vlasenko
8ab209f00e
bc: simplify representation of 0.5 in sqrt()
...
function old new delta
zxc_program_exec 4012 4149 +137
zdc_program_printStream 144 - -144
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 137/-144) Total: -7 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-29 16:23:34 +01:00
Denys Vlasenko
374d2c47ec
bc: remove special-cased assignment to ibase, it works correctly with general rules
...
function old new delta
zxc_program_print 683 681 -2
zxc_program_prep 91 89 -2
zxc_program_copyToVar 300 298 -2
zdc_program_printStream 146 144 -2
zdc_program_execStr 520 518 -2
zdc_program_asciify 370 368 -2
zxc_program_exec 4016 4012 -4
zdc_program_modexp 694 688 -6
zxc_program_num 1020 995 -25
zxc_program_binOpPrep 306 243 -63
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/10 up/down: 0/-110) Total: -110 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-29 14:52:30 +01:00
Denys Vlasenko
d5b0fa6abf
bc: more fixes for unusual input bases
...
function old new delta
zxc_program_num 990 1020 +30
zxc_lex_number 172 202 +30
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 60/0) Total: 60 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-29 03:08:12 +01:00
Denys Vlasenko
e16a5223d2
bc: fix handling of "digits" above 9
...
function old new delta
zxc_lex_next 1573 1608 +35
xc_parse_pushIndex 58 56 -2
xc_program_index 71 63 -8
zxc_program_num 1022 990 -32
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 35/-42) Total: -7 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-29 02:24:19 +01:00
Denys Vlasenko
f9b4cc114c
config: dpkg_deb should be dpkg-deb
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-28 18:24:45 +01:00
Denys Vlasenko
b86b39bfda
config: more tweaks
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-28 17:52:43 +01:00
Denys Vlasenko
cdadad58a1
bc: bc enables FEATURE_DC_BIG, for correct dc testsuite operation
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-28 15:13:23 +01:00
Denys Vlasenko
df1ff103c9
config: add size information for three more applets
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-28 13:37:44 +01:00
Denys Vlasenko
1476760600
bc: rename config options
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-28 13:32:04 +01:00
Denys Vlasenko
83e7e13628
config: add size information for udhcpc
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-28 13:03:48 +01:00
Denys Vlasenko
b097a84d62
config: update size information
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-28 03:20:17 +01:00
Denys Vlasenko
10bde14292
bc: rename functions common to bc and dc as xc_FOO()
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-27 18:23:58 +01:00
Denys Vlasenko
db8d607514
bc: G.prog.zero does not need initializing num[] vector
...
function old new delta
bc_vm_init 676 665 -11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-27 18:08:49 +01:00
Denys Vlasenko
3d27d435db
randomconfig fixes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-27 18:03:20 +01:00
Denys Vlasenko
2beb1f6faf
bc: use ALIGN1 where appropriate
...
text data bss dec hex filename
980138 485 7296 987919 f130f busybox_old
980128 485 7296 987909 f1305 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-26 21:17:12 +01:00
Denys Vlasenko
8af11087b2
bc: undo debugging change, add a small optimization
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-26 21:01:41 +01:00
Denys Vlasenko
ab9a98602f
bc: simple speedups
...
function old new delta
bc_parse_pushName 20 56 +36
bc_program_index 47 71 +24
bc_parse_pushIndex 52 58 +6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 66/0) Total: 66 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-26 20:30:47 +01:00
Denys Vlasenko
f706a18f33
bc: use '\0' insteads of 0xff (BC_PARSE_STREND) as name terminator
...
function old new delta
zdc_program_printStream - 146 +146
zbc_program_exec 4003 4016 +13
zdc_parse_expr 473 470 -3
bc_parse_pushName 31 20 -11
bc_program_name 63 34 -29
zbc_program_pushArray 147 - -147
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/3 up/down: 159/-190) Total: -31 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-26 20:02:27 +01:00
Denys Vlasenko
1c69ec1597
bc: reduce indentation, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-26 19:24:15 +01:00
Denys Vlasenko
8a56e3643f
bc: fix "bc only" build
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-26 19:09:23 +01:00
Denys Vlasenko
1e87b97da6
bc: fix "dc only" build
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-26 19:06:05 +01:00
Denys Vlasenko
2f7352b4f5
bc: comment out code which appears to be never reached
...
function old new delta
zbc_lex_next 1587 1568 -19
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-26 18:59:42 +01:00
Denys Vlasenko
b1b7996a2a
bc: remove all logic for multi-line buffering
...
function old new delta
zbc_vm_process 865 874 +9
zbc_parse_text_init 51 38 -13
bc_read_line 394 345 -49
peek_inbuf 292 69 -223
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 9/-285) Total: -276 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-26 18:46:03 +01:00
Denys Vlasenko
7d32e25bf3
bc: prepare for char-by-char input handling
...
function old new delta
peek_inbuf - 292 +292
parse_lex_by_checking_eq_sign - 26 +26
eat_inbuf - 22 +22
zbc_vm_execute_FILE 52 61 +9
bc_lex_lineComment 29 30 +1
zbc_lex_number 174 172 -2
bc_vm_run 104 99 -5
zbc_num_divmod 156 150 -6
bc_lex_file 24 - -24
bc_lex_assign 26 - -26
zbc_lex_next 1982 1587 -395
------------------------------------------------------------------------------
(add/remove: 3/2 grow/shrink: 2/4 up/down: 350/-458) Total: -108 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-26 18:32:43 +01:00
Denys Vlasenko
63ad799384
bc: fix handling of comment/string interactions while buffering input
...
function old new delta
zbc_lex_next 1965 1982 +17
zbc_num_divmod 150 156 +6
bc_read_line 411 394 -17
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 23/-17) Total: 6 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-26 12:23:05 +01:00
Denys Vlasenko
94576d2b97
bc: fix interactive handling of comments in strings and quotes in comments
...
function old new delta
zbc_lex_next 1965 1979 +14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-25 23:45:57 +01:00
Denys Vlasenko
c192b0442b
bc: simplify input pointer manipulation while lexing
...
function old new delta
bc_lex_name 70 68 -2
zbc_lex_number 177 174 -3
bc_vm_init 679 676 -3
bc_lex_whitespace 42 39 -3
zbc_parse_text_init 55 51 -4
bc_lex_lineComment 37 29 -8
bc_lex_assign 34 26 -8
zbc_lex_next 2039 1965 -74
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/8 up/down: 0/-105) Total: -105 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-25 23:15:59 +01:00
Denys Vlasenko
ecb62edd47
bc: fold struct BcLex into BcParse
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-25 22:32:41 +01:00
Denys Vlasenko
6e6182342e
bc: move BcLex::lex member to be the first in struct globals
...
function old new delta
zbc_program_exec 3967 4003 +36
zdc_program_execStr 501 520 +19
zbc_posix_error_fmt 58 62 +4
bc_vm_init 675 679 +4
bc_read_line 407 411 +4
bc_error_fmt 36 40 +4
zdc_parse_register 45 44 -1
zdc_parse_exprs_until_eof 28 27 -1
zbc_parse_text_init 56 55 -1
zbc_parse_stmt_allow_NLINE_before 55 54 -1
zbc_lex_skip_if_at_NLINE 19 18 -1
zbc_lex_number 178 177 -1
bc_parse_create 97 96 -1
bc_lex_whitespace 43 42 -1
bc_lex_name 71 70 -1
bc_lex_lineComment 38 37 -1
bc_lex_assign 35 34 -1
zdc_parse_expr 476 473 -3
bc_verror_msg 93 90 -3
bc_lex_file 27 24 -3
zbc_parse_name 453 448 -5
bc_parse_expr_empty_ok 1776 1764 -12
zbc_vm_process 878 865 -13
zbc_parse_stmt_possibly_auto 1451 1425 -26
zbc_lex_next 2075 2039 -36
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 6/19 up/down: 71/-112) Total: -41 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-25 22:20:14 +01:00
Denys Vlasenko
0b0e8d0509
bc: rename some members and macros, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-25 21:44:10 +01:00
Denys Vlasenko
3f8752c33f
bc: shorten error messages
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-25 21:28:25 +01:00
Gavin Howard
fa495ce498
bc: make it clear that the code is adapted
...
Signed-off-by: Gavin Howard <yzena.tech@gmail.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-25 20:53:15 +01:00
Denys Vlasenko
8fac1c7740
dc: add two tests
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-25 20:50:41 +01:00
Denys Vlasenko
a2e62e3e50
bc: stop passing a pointer to G.prs down the call chain
...
function old new delta
rewrite_label_to_current 19 26 +7
bc_lex_assign 28 35 +7
zbc_lex_skip_if_at_NLINE 14 19 +5
bc_parse_push 11 16 +5
bc_parse_operator 147 152 +5
bc_parse_create 92 97 +5
bc_lex_whitespace 38 43 +5
bc_lex_name 66 71 +5
bc_lex_lineComment 33 38 +5
zbc_lex_number 174 178 +4
zbc_parse_text_init 53 56 +3
zdc_parse_register 43 45 +2
zdc_parse_exprs_until_eof 26 28 +2
bc_parse_free 38 40 +2
bc_lex_file 28 27 -1
zbc_parse_pushSTR 65 63 -2
bc_parse_expr_empty_ok 1778 1776 -2
zbc_vm_execute_FILE 55 52 -3
bc_vm_init 678 675 -3
zbc_parse_stmt_allow_NLINE_before 59 55 -4
bc_parse_pushNUM 80 74 -6
bc_parse_pushJUMP_ZERO 27 21 -6
bc_parse_pushJUMP 27 21 -6
bc_vm_run 112 104 -8
bc_parse_pushName 39 31 -8
bc_parse_pushIndex 60 52 -8
zbc_parse_name 468 453 -15
zdc_program_execStr 524 501 -23
zdc_parse_mem 93 70 -23
zbc_program_exec 4003 3967 -36
zdc_parse_expr 518 476 -42
zbc_vm_process 923 878 -45
zbc_lex_next 2158 2070 -88
zbc_parse_stmt_possibly_auto 1560 1451 -109
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 14/20 up/down: 62/-438) Total: -376 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-25 20:40:55 +01:00
Denys Vlasenko
1fbe35a7d8
bc: make zbc_program_read() and zdc_program_execStr() use G.prs
...
function old new delta
zbc_program_print 656 683 +27
zbc_program_exec 3976 4003 +27
zdc_program_execStr 512 524 +12
bc_num_printNewline 45 54 +9
bc_num_printHex 61 67 +6
bc_num_printDigits 131 137 +6
dc_num_printChar 21 24 +3
bc_vm_init 675 678 +3
zbc_program_assign 424 426 +2
bc_read_line 410 407 -3
bc_verror_msg 99 93 -6
zbc_lex_next 2167 2158 -9
zbc_vm_execute_FILE 67 55 -12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 9/4 up/down: 95/-30) Total: 65 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-25 19:38:13 +01:00
Denys Vlasenko
53e569c06b
bc: fix interactive read()
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-25 19:37:23 +01:00
Denys Vlasenko
2638454464
bc: add code to detect errors like "print 1 print 2"
...
function old new delta
zbc_vm_process 831 925 +94
zbc_program_exec 3964 3976 +12
zdc_program_execStr 506 512 +6
zbc_lex_next 2161 2167 +6
zbc_program_assign 419 424 +5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 123/0) Total: 123 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-25 18:37:52 +01:00
Denys Vlasenko
5fa74b9efc
bc: allow {break} and {continue} (allow RBRACE to terminate them)
...
function old new delta
zbc_parse_stmt_possibly_auto 1599 1560 -39
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-25 17:07:51 +01:00
Denys Vlasenko
d4b721cc8b
bc: shrink parsing code a bit more, disallow "auto a b c" (without commas)
...
function old new delta
bc_parse_expr_empty_ok 1791 1785 -6
zbc_parse_stmt_possibly_auto 1675 1599 -76
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-82) Total: -82 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-25 16:39:01 +01:00
Denys Vlasenko
73b3ebc0e1
bc: simplify bc_parse_expr_empty_ok()
...
function old new delta
bc_parse_expr_empty_ok 1810 1791 -19
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-25 01:43:52 +01:00
Denys Vlasenko
d0238d83f0
bc: simplify bc_parse_expr_empty_ok()
...
function old new delta
bc_parse_expr_empty_ok 1819 1810 -9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-25 01:21:16 +01:00
Denys Vlasenko
bb116031a0
bc: simplify bc_parse_expr_empty_ok()
...
function old new delta
bc_parse_expr_empty_ok 1846 1819 -27
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-25 01:16:37 +01:00
Denys Vlasenko
d897c9aca6
bc: BC_RESULT_ONE is bc-specific
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-24 23:41:31 +01:00
Denys Vlasenko
0c45bb22a0
bc: partially deinline BC_PARSE_LEAF() macro
...
function old new delta
ok_in_expr - 30 +30
bc_parse_expr_empty_ok 1972 1846 -126
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 30/-126) Total: -96 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-24 23:22:40 +01:00
Denys Vlasenko
a17d95d0d0
bc: rename lexer variables, use smallints where appropriate
...
function old new delta
bc_parse_expr_empty_ok 1966 1972 +6
zdc_parse_expr 514 518 +4
zbc_lex_number 177 174 -3
dc_num_printChar 24 21 -3
bc_lex_whitespace 41 38 -3
bc_lex_name 69 66 -3
bc_lex_lineComment 36 33 -3
bc_lex_assign 31 28 -3
zbc_parse_name 472 468 -4
zbc_vm_process 836 831 -5
zdc_program_execStr 512 506 -6
zbc_parse_text_init 59 53 -6
bc_num_printNewline 51 45 -6
bc_num_printHex 67 61 -6
bc_num_printDigits 137 131 -6
zbc_program_assign 426 419 -7
zbc_parse_stmt_possibly_auto 1682 1675 -7
zbc_program_exec 3977 3964 -13
zbc_program_print 683 656 -27
zbc_lex_next 2233 2161 -72
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/18 up/down: 10/-183) Total: -173 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-24 22:55:54 +01:00
Denys Vlasenko
d279d809ac
bc: fix "bc -s" only warning on "define f()<newline>", not exiting
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-24 18:28:56 +01:00
Denys Vlasenko
79587cb442
bc: POSIX error/warn functions can be 'z' functions too
...
In non-interactive config, they either return 'success', or do not return.
function old new delta
zbc_posix_error_fmt 41 39 -2
bc_parse_expr_empty_ok 1751 1744 -7
zbc_parse_stmt_possibly_auto 1322 1314 -8
------------------------------------------------------------------------------
(add/remove: 5/5 grow/shrink: 0/2 up/down: 118/-135) Total: -17 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-24 18:11:41 +01:00
Denys Vlasenko
65b6fe09c4
bc: remove unnecessary NULL initializers
...
function old new delta
zbc_program_assign 442 426 -16
zbc_program_exec 4043 3977 -66
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-82) Total: -82 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-24 17:21:31 +01:00
Denys Vlasenko
a5bf53e4bb
bc: move relational LEXs before math LEXs - shorten dc_LEX_to_INST[]
...
function old new delta
dc_LEX_to_INST 48 42 -6
zdc_parse_expr 523 514 -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-15) Total: -15 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-24 17:07:20 +01:00
Denys Vlasenko
4accb6bba8
bc: offset dc_LEX_to_INST[] start
...
function old new delta
zdc_parse_expr 516 523 +7
dc_LEX_to_INST 56 48 -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 7/-8) Total: -1 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-24 15:29:33 +01:00
Denys Vlasenko
23ea0734e1
bc: rename BC_LEX_NLINE/WHITESPACE/STR/NAME/NUMBER to XC_LEX_
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-24 15:05:49 +01:00
Denys Vlasenko
9d9c97efbd
bc: separate many bc and dc LEX constants
...
function old new delta
zdc_parse_expr 510 516 +6
bc_parse_expr_empty_ok 1963 1966 +3
dc_LEX_to_INST 83 56 -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 9/-27) Total: -18 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-24 15:00:56 +01:00
Denys Vlasenko
69560f42da
bc: rename several BC_LEX_OPs to XC_LEX_OPs.
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-24 14:14:23 +01:00
Denys Vlasenko
abf6cf6765
bc: move BC_LEX_OP_INC/DEC to the end of operation LEX constants
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-24 13:20:57 +01:00
Denys Vlasenko
7d9be0bc6d
bc: rename BC_LEXs to XC_LEXs for common constants, and to DC_LEXs for dc-specific
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-24 12:25:20 +01:00
Denys Vlasenko
2097ac8d9e
bc: move functions/macros around, no code changes
...
Order now is:
enums/structures/defines,
utility/common functions,
parsing,
execution,
main loop,
main()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-24 05:00:36 +01:00
Denys Vlasenko
a7732d1120
bc: rename common INST constants to XC_, dc-specific ones to DC_
...
This will assist in disentangling dc and bc LEX constants
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-24 04:26:07 +01:00
Denys Vlasenko
81293c8af0
dc: without -x, do not parse extended regs: 's p' means: store to ' ' reg, print
...
function old new delta
zbc_lex_next 2240 2233 -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-7) Total: -7 bytes
text data bss dec hex filename
981437 485 7296 989218 f1822 busybox_old
981412 485 7296 989193 f1809 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-24 02:01:32 +01:00
Denys Vlasenko
73b2c60825
bc: fix incorrect bit in BC_PARSE_EXPRS_BITS: 'limits' is not allowed
...
Alsl, move and rename dc_lex_tokens[] to dc_char_to_LEX[]
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-24 01:04:21 +01:00
Denys Vlasenko
ad0bd381e9
bc: for "dc only" remove handling of LAST, move OBASE enums up to IBASE
...
function old new delta
dc_LEX_to_INST - 82 +82
bc_parse_pushNUM - 62 +62
zbc_program_num 981 978 -3
bc_result_free 46 43 -3
zbc_program_binOpPrep 305 300 -5
static.msg 24 12 -12
zbc_program_exec 4013 3994 -19
zdc_parse_expr 583 507 -76
dc_parse_insts 83 - -83
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 0/6 up/down: 144/-201) Total: -57 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-24 00:50:32 +01:00
Denys Vlasenko
9471bd4660
bc: fix empty lines in dc generating "bad token" message
...
function old new delta
zdc_program_asciify - 370 +370
zbc_program_pushArray - 147 +147
zbc_vm_process 824 828 +4
zbc_program_exec 4182 4046 -136
zdc_program_printStream 146 - -146
zbc_program_read 268 - -268
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 1/1 up/down: 521/-550) Total: -29 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-23 00:13:15 +01:00
Denys Vlasenko
01eb5e9da1
bc: shrink modular exponentiation code
...
function old new delta
zdc_program_modexp 721 694 -27
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-22 23:59:21 +01:00
Denys Vlasenko
1acac7f9c5
bc: do not yet allow 2^2.1
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-22 23:14:48 +01:00
Denys Vlasenko
a9f59db809
bc: avoid having to twiddle b->neg in zbc_num_p()
...
function old new delta
zbc_num_ulong_abs - 70 +70
zbc_num_p 424 413 -11
zbc_num_ulong 81 21 -60
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 70/-71) Total: -1 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-22 21:52:30 +01:00
Denys Vlasenko
2ea8ddf8c2
bc: do not disallow powers to N.0000 degree - it's even shorter code
...
function old new delta
zbc_num_p 440 424 -16
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-22 21:45:18 +01:00
Denys Vlasenko
1557b76edd
bc: shrink zbc_num_ulong()
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-22 21:37:46 +01:00
Denys Vlasenko
ec74a9c145
bc: make long-running dc drop data it does not need (when it can)
...
function old new delta
zbc_vm_process 765 824 +59
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-22 19:23:46 +01:00
Denys Vlasenko
5cf0b2d466
bc: unbreak "z function" macro machinery
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-22 18:24:19 +01:00
Denys Vlasenko
badf683b0a
dc: unbreak interactive mode - was trying to get next tokens instead of executing
...
function old new delta
zbc_program_read - 268 +268
zdc_program_printStream - 146 +146
zbc_program_exec 4046 4182 +136
zdc_program_execStr 472 512 +40
zdc_parse_exprs_until_eof - 26 +26
zbc_vm_process 740 765 +25
zbc_lex_next 2225 2240 +15
zdc_parse_expr 569 535 -34
zbc_program_pushArray 147 - -147
zdc_program_asciify 370 - -370
------------------------------------------------------------------------------
(add/remove: 3/2 grow/shrink: 4/1 up/down: 656/-551) Total: 105 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-22 18:10:50 +01:00
Denys Vlasenko
5daa1a0adf
bc: move zbc_lex_next() out of zdc_parse_string() and zdc_parse_mem()
...
function old new delta
zdc_parse_mem 99 93 -6
zdc_parse_expr 586 569 -17
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-23) Total: -23 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-22 16:41:23 +01:00
Denys Vlasenko
7c1c9dc86b
bc: shorten sanity-check code
...
function old new delta
zbc_vm_process 745 740 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-22 14:18:47 +01:00
Denys Vlasenko
88fcd5cc6c
bc: fold single-callsite functions into callers, commonalize code
...
function old new delta
zbc_vm_process 699 745 +46
zbc_parse_stmt_possibly_auto 1689 1682 -7
bc_parse_reset 113 - -113
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 46/-120) Total: -74 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-22 06:00:25 +01:00
Denys Vlasenko
514967df5e
bc: zcommon_parse_expr() has only one user, fold it in
...
function old new delta
zbc_program_exec 4021 4046 +25
zdc_parse_expr 589 586 -3
zcommon_parse_expr 28 - -28
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 25/-31) Total: -6 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-22 03:38:52 +01:00
Denys Vlasenko
f093e3df2d
bc: zcommon_parse_expr() lost its flags argument
...
function old new delta
zcommon_parse_expr - 28 +28
zdc_program_execStr 474 472 -2
zbc_program_exec 4023 4021 -2
common_parse_expr 29 - -29
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/2 up/down: 28/-33) Total: -5 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-22 02:30:18 +01:00
Denys Vlasenko
39287e0d02
bc: stop using BC_PARSE_NOCALL in dc code
...
function old new delta
zdc_program_execStr 465 474 +9
zbc_vm_process 701 699 -2
common_parse_expr 32 29 -3
zdc_parse_expr 615 586 -29
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 9/-34) Total: -25 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-22 02:23:08 +01:00
Denys Vlasenko
8c1e723596
bc: unbreak read(), remove checks for nested read()
...
function old new delta
zbc_parse_pushSTR - 65 +65
common_parse_expr - 32 +32
bc_error_nested_read_call 10 - -10
bc_parse_expr_empty_ok 1977 1963 -14
zdc_parse_expr 635 615 -20
zcommon_parse_expr 32 - -32
zbc_program_exec 4064 4023 -41
bc_parse_pushSTR 65 - -65
------------------------------------------------------------------------------
(add/remove: 2/3 grow/shrink: 0/3 up/down: 97/-182) Total: -85 bytes
text data bss dec hex filename
981661 485 7296 989442 f1902 busybox_old
981540 485 7296 989321 f1889 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-22 01:34:10 +01:00
Denys Vlasenko
1dc4de9d9b
bc: code shrink
...
function old new delta
bc_result_pop_and_push - 73 +73
zbc_program_exec 4068 4064 -4
bc_program_binOpRetire 46 32 -14
zdc_program_assignStr 146 126 -20
zdc_program_asciify 395 370 -25
bc_program_retire 35 7 -28
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/5 up/down: 73/-91) Total: -18 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-21 23:13:48 +01:00
Denys Vlasenko
24e4194635
bc: rename BcInstPtr::idx and ::len
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-21 23:01:26 +01:00
Denys Vlasenko
8287b1c869
bc: remove unnecessary initializations
...
function old new delta
zdc_program_asciify 403 395 -8
zbc_program_print 691 683 -8
zbc_program_exec 4079 4068 -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-27) Total: -27 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-21 22:43:53 +01:00
Denys Vlasenko
e8e7bda63a
bc: use non-allocated BcNum's where appropriate
...
function old new delta
zbc_num_printNum 540 543 +3
zdc_program_asciify 407 403 -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 3/-4) Total: -1 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-21 22:36:04 +01:00
Denys Vlasenko
6ed7fb0a87
bc: optimize bc_vec_push() usage
...
function old new delta
bc_parse_pushNUM 87 80 -7
zbc_parse_stmt_possibly_auto 1697 1689 -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-15) Total: -15 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-21 22:16:17 +01:00
Denys Vlasenko
19eee8ed7c
bc: fix for() to not leave data on stack
...
function old new delta
zbc_parse_stmt_possibly_auto 1665 1697 +32
zbc_vm_process 672 701 +29
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 61/0) Total: 61 bytes
text data bss dec hex filename
981656 485 7296 989437 f18fd busybox_old
981748 485 7296 989529 f1959 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-21 20:29:34 +01:00
Denys Vlasenko
5d57bc442d
bc: fix infinite state growth for "yes 1 | bc" case
...
function old new delta
zbc_vm_process 585 672 +87
bc_func_init 50 86 +36
zbc_program_num 990 1022 +32
bc_program_str 17 47 +30
bc_program_current_func - 22 +22
bc_parse_pushNUM 66 87 +21
bc_func_free 27 43 +16
zbc_num_binary 145 147 +2
bc_program_reset 64 61 -3
bc_parse_pushSTR 73 65 -8
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 7/2 up/down: 246/-11) Total: 235 bytes
text data bss dec hex filename
981393 485 7296 989174 f17f6 busybox_old
981656 485 7296 989437 f18fd busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-21 16:22:26 +01:00
Denys Vlasenko
447dc02c27
bc: fix comment
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-21 00:39:02 +01:00
Denys Vlasenko
52caa007e3
bc: for(;;) fix from upstream
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-21 00:35:22 +01:00
Denys Vlasenko
047154472a
bc: shrink bc_program_add_fn()
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-21 00:10:26 +01:00
Denys Vlasenko
44a99ca617
bc: "dc only" config does not need G.prog.fn_map
...
function old new delta
bc_program_add_fn - 43 +43
bc_vm_init 655 675 +20
bc_program_addFunc 138 118 -20
zdc_parse_expr 658 635 -23
zdc_program_asciify 447 407 -40
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/3 up/down: 63/-83) Total: -20 bytes
text data bss dec hex filename
984739 489 7312 992540 f251c busybox_old
984712 489 7312 992513 f2501 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-20 20:34:09 +01:00
Denys Vlasenko
5acd14ba5b
bc: fix keyword matching to not think "ifz" is the "if" keyword
...
function old new delta
zbc_lex_next 2224 2225 +1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-20 16:48:50 +01:00
Denys Vlasenko
503faf9d53
bc: shrink "dc only" code by dropping unused structure members
...
function old new delta
zbc_program_num 979 981 +2
zbc_program_pushArray 147 145 -2
bc_program_pushVar 198 196 -2
bc_program_func 17 15 -2
dc_num_printChar 24 21 -3
bc_program_retire 35 32 -3
bc_program_binOpRetire 46 43 -3
zdc_program_printStream 153 148 -5
zbc_program_prep 91 86 -5
zbc_program_copyToVar 300 295 -5
zdc_program_modexp 721 715 -6
zbc_program_binOpPrep 311 305 -6
bc_program_addFunc 138 132 -6
bc_num_printNewline 51 45 -6
bc_num_printHex 67 61 -6
bc_num_printDigits 137 131 -6
zdc_program_assignStr 146 137 -9
bc_program_reset 64 55 -9
bc_func_free 27 5 -22
bc_parse_free 38 8 -30
bc_parse_create 92 47 -45
bc_func_init 50 5 -45
dc_main 691 645 -46
zdc_program_execStr 496 442 -54
zbc_program_print 677 623 -54
zbc_vm_process 204 137 -67
zbc_program_exec 4132 4057 -75
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/26 up/down: 2/-522) Total: -520 bytes
text data bss dec hex filename
969767 485 7296 977548 eea8c busybox_old
969210 485 7296 976991 ee85f busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-20 16:24:18 +01:00
Denys Vlasenko
eaa3b00002
bc: shorten bc_program_addFunc()
...
function old new delta
bc_func_init - 50 +50
bc_program_addFunc 201 138 -63
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 50/-63) Total: -13 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-19 20:05:50 +01:00
Denys Vlasenko
408b7d45f6
bc: fix "dc only" and "bc only" configs
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-19 19:43:03 +01:00
Denys Vlasenko
fa21079183
bc: rename dc-specific functions, simplify zdc_program_execStr() a bit
...
function old new delta
zbc_program_execStr 496 - -496
zdc_program_execStr - 491 +491
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-19 19:38:51 +01:00
Denys Vlasenko
44dbe675dd
bc: rename zbc_parse_string->bc_parse_pushSTR, do not emit next opcode in it
...
function old new delta
bc_parse_pushSTR - 73 +73
zbc_parse_stmt_possibly_auto 1638 1640 +2
zbc_parse_string 89 - -89
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/0 up/down: 75/-89) Total: -14 bytes
text data bss dec hex filename
981377 485 7296 989158 f17e6 busybox_old
981363 485 7296 989144 f17d8 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-19 19:10:40 +01:00
Denys Vlasenko
ea5cad2a0d
bc: avoid bc_vec_item() calls in bc_vm_run()
...
function old new delta
bc_vm_run 124 112 -12
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-19 18:09:31 +01:00
Denys Vlasenko
eac0de55d6
bc: avoid bc_vec_item() calls in bc_array_copy()
...
function old new delta
zbc_program_copyToVar 311 300 -11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-19 17:59:30 +01:00
Denys Vlasenko
87888ce4d8
bc: avoid successive bc_vec_item(&func->autos, i)
...
function old new delta
zbc_func_insert 97 100 +3
zbc_program_call 353 354 +1
zbc_program_exec 4085 4078 -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 4/-7) Total: -3 bytes
text data bss dec hex filename
981403 485 7296 989184 f1800 busybox_old
981400 485 7296 989181 f17fd busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-19 17:55:23 +01:00
Denys Vlasenko
f36a0adf8b
bc: remove unnecessary union use
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-19 17:15:04 +01:00
Denys Vlasenko
dfe1dd2031
bc: "unsigned_n > 0" is shorter code than "unsigned_n >= 1"
...
function old new delta
zbc_program_print 680 677 -3
zbc_program_exec 4089 4085 -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-7) Total: -7 bytes
text data bss dec hex filename
981404 485 7296 989185 f1801 busybox_old
981397 485 7296 989178 f17fa busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-19 17:09:01 +01:00
Denys Vlasenko
65e1046abf
bc: open-code bc_parse_updateFunc() macro
...
This clearly shows one place which would need changing
for nested funcdefs to work.
function old new delta
bc_parse_reset 106 110 +4
zbc_vm_process 586 585 -1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 4/-1) Total: 3 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-19 15:13:14 +01:00
Denys Vlasenko
684d441f5c
bc: make bc_program_addFunc() return new idx, untangle &p->fidx interaction
...
In:
bc_program_addFunc(name, idx);
p->func = bc_program_func(p->fidx);
in some cases p->fidx was updated by _first_ statement - because passed idx
was pointing at it. This was very obscure.
function old new delta
zdc_parse_expr 653 658 +5
bc_program_addFunc 204 201 -3
zbc_vm_process 594 586 -8
bc_vm_init 663 655 -8
zbc_parse_name 482 472 -10
bc_parse_addFunc 25 - -25
zbc_program_asciify 473 447 -26
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/5 up/down: 5/-80) Total: -75 bytes
text data bss dec hex filename
981482 485 7296 989263 f184f busybox_old
981401 485 7296 989182 f17fe busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-19 14:59:22 +01:00
Denys Vlasenko
085b420220
bc: "reload stack only after insts" change missed a few places
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-19 14:02:59 +01:00
Denys Vlasenko
5aa54830bf
bc: rename a few functions
...
function old new delta
bc_map_find_ge - 71 +71
bc_map_find_exact - 50 +50
bc_map_index 50 - -50
bc_map_find 71 - -71
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 0/0 up/down: 121/-121) Total: 0 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-19 13:55:53 +01:00
Denys Vlasenko
e3d3d2067d
bc: remove redundant strdup+free in zbc_parse_call()
...
function old new delta
zbc_parse_name 527 482 -45
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-45) Total: -45 bytes
text data bss dec hex filename
981541 485 7296 989322 f188a busybox_old
981486 485 7296 989267 f1853 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-19 13:20:02 +01:00
Denys Vlasenko
4796a1d537
bc: delete G.prog.strmb for real
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-19 12:48:16 +01:00
Denys Vlasenko
b80d7aad1b
bc: in execution loop, reload stack only after insts which can change it
...
Only these functions affect G.prog.exestack:
zbc_program_read
zbc_program_call
zbc_program_return
zbc_program_nquit
zbc_program_execStr
function old new delta
zbc_program_exec 3995 4093 +98
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 98/0) Total: 98 bytes
text data bss dec hex filename
981364 485 7296 989145 f17d9 busybox_old
981462 485 7296 989243 f183b busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-19 12:35:27 +01:00
Denys Vlasenko
d6e24bd795
bc: simplify bc_array_expand()
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 20:10:48 +01:00
Denys Vlasenko
30a8e0c2f9
bc: code shrink
...
function old new delta
zbc_program_print 684 680 -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-4) Total: -4 bytes
text data bss dec hex filename
981368 485 7296 989149 f17dd busybox_old
981364 485 7296 989145 f17d9 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 19:20:04 +01:00
Denys Vlasenko
694d2982e5
bc: code shrink
...
function old new delta
bc_program_name 67 63 -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-4) Total: -4 bytes
text data bss dec hex filename
981372 485 7296 989153 f17e1 busybox_old
981368 485 7296 989149 f17dd busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 19:17:11 +01:00
Denys Vlasenko
7b30bc0222
bc: shrink bc_program_pushVar()
...
function old new delta
bc_program_pushVar 203 198 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 17:14:34 +01:00
Denys Vlasenko
d340143247
bc: get rid of G.prog.ob, G.prog.strmb
...
function old new delta
zbc_num_printNum 489 540 +51
zbc_program_asciify 426 473 +47
zbc_program_print 686 684 -2
zbc_program_exec 4008 3995 -13
zbc_program_assign 474 440 -34
bc_vm_init 739 663 -76
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/4 up/down: 98/-125) Total: -27 bytes
text data bss dec hex filename
981404 485 7296 989185 f1801 busybox_old
981377 485 7296 989158 f17e6 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 17:00:35 +01:00
Denys Vlasenko
09fe0aaefa
bc: do not show -i in --help, it's a NOP (for now)
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 16:32:25 +01:00
Denys Vlasenko
7f2d59c38d
bc: style edit, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 16:24:07 +01:00
Denys Vlasenko
3f940c9c70
bc: shrink bc_program_index()
...
function old new delta
bc_program_index 66 47 -19
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-19) Total: -19 bytes
text data bss dec hex filename
981418 485 7296 989199 f180f busybox_old
981399 485 7296 989180 f17fc busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 15:49:42 +01:00
Denys Vlasenko
55f3cab7e9
bc: fix "echo -n '#foo' | bc" not eating last 'o'
...
function old new delta
zdc_parse_expr 656 653 -3
bc_lex_lineComment 39 36 -3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-6) Total: -6 bytes
text data bss dec hex filename
981424 485 7296 989205 f1815 busybox_old
981418 485 7296 989199 f180f busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 14:39:33 +01:00
Denys Vlasenko
a199cc95b7
bc: shrink zdc_parse_expr()
...
function old new delta
zdc_parse_expr 656 653 -3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 14:11:35 +01:00
Denys Vlasenko
07597cd35d
bc: optimize zbc_lex_string()
...
function old new delta
zbc_lex_next 2359 2353 -6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 14:03:20 +01:00
Denys Vlasenko
ef271da33f
bc: shrink zdc_lex_string()
...
This actually fixes a rather obscure bug. This was failing to find
end of the string:
$ echo -n '[foo]' | dc
dc: string end could not be found
function old new delta
zbc_lex_next 2230 2141 -89
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-89) Total: -89 bytes
text data bss dec hex filename
981461 485 7296 989242 f183a busybox_old
981372 485 7296 989153 f17e1 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 13:48:37 +01:00
Denys Vlasenko
d4258dd321
bc: another for() loop simplified
...
function old new delta
zbc_program_print 688 686 -2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 13:22:23 +01:00
Denys Vlasenko
5c0c5abba0
bc: simplify another for() loop
...
function old new delta
zbc_num_d 563 557 -6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 13:15:55 +01:00
Denys Vlasenko
6b0fbd14fc
bc: rewrite more for() loops
...
function old new delta
bc_program_name 75 67 -8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 12:55:40 +01:00
Denys Vlasenko
71c82d1d8c
bc: rewrite another for() loop
...
function old new delta
zbc_num_d 570 563 -7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 12:43:21 +01:00
Denys Vlasenko
e2e6ffd3c5
bc: replace signed division / 10 by unsigned
...
function old new delta
zbc_num_a 443 441 -2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 12:23:16 +01:00
Denys Vlasenko
4113e1f2cd
bc: rewrite bc_num_compare() to be readable
...
function old new delta
bc_num_compare 59 51 -8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 03:30:23 +01:00
Denys Vlasenko
57734c926b
bc: fold zbc_num_stream() into its single caller
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 03:30:23 +01:00
Denys Vlasenko
f6e3f8511e
bc: get rid of BcNum BcProgram::ib,hexb
...
function old new delta
zbc_program_num 907 943 +36
zbc_program_assign 485 474 -11
bc_vm_init 757 739 -18
bc_num_ten 30 - -30
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/2 up/down: 36/-59) Total: -23 bytes
text data bss dec hex filename
981532 485 7296 989313 f1881 busybox_old
981509 485 7296 989290 f186a busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 03:30:23 +01:00
Denys Vlasenko
0f31a5c79e
bc: fixes to bugs found while testing 64-bit build
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 03:16:48 +01:00
Denys Vlasenko
f4f10720fe
bc: fixed from 64-bit compile
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-18 02:23:53 +01:00
Denys Vlasenko
6d3b4bb24d
udhcpc: check that 4-byte options are indeed 4-byte, closes 11506
...
function old new delta
udhcp_get_option32 - 27 +27
udhcp_get_option 231 248 +17
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 44/0) Total: 44 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-17 18:07:18 +01:00
Denys Vlasenko
4b72aebe80
bc: remove "error after expression parsing" check
...
It is misplaced: caller knows better what can or cannot follow the expression.
Sometimes even caller's caller: "if (1) return a+b else..." -
parser of "return" does not know that "else" after it is valid,
parser of stmt does not know it either, - only parser of
"if" knows it!
The removed code balked on e.g. "{ print 1 }" statement.
This does not break any valid programs, but starts accepting some
invalid ones, e.g. "print 1 print 2" would work.
function old new delta
zcommon_parse_expr 40 32 -8
zbc_parse_name 509 494 -15
zbc_parse_stmt_possibly_auto 1678 1638 -40
bc_parse_expr_empty_ok 2025 1977 -48
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-111) Total: -111 bytes
text data bss dec hex filename
981599 485 7296 989380 f18c4 busybox_old
981488 485 7296 989269 f1855 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-17 17:00:29 +01:00
Denys Vlasenko
b44a7f1d66
bc: tighten up input NUL handling
...
function old new delta
static.dc_lex_tokens - 90 +90
bc_error_bad_character 17 31 +14
static.dc_lex_regs - 13 +13
bc_read_line 406 410 +4
bc_program_index 64 66 +2
dc_lex_regs 13 - -13
zdc_parse_expr 671 656 -15
zbc_lex_next 2318 2230 -88
dc_lex_tokens 91 - -91
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 3/2 up/down: 123/-207) Total: -84 bytes
text data bss dec hex filename
981667 485 7296 989448 f1908 busybox_old
981599 485 7296 989380 f18c4 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-17 11:58:20 +01:00
Denys Vlasenko
e42cc19b51
bc: simplify zdc_parse_string()
...
function old new delta
bc_program_index 64 66 +2
zdc_parse_expr 671 656 -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 2/-15) Total: -13 bytes
text data bss dec hex filename
981667 485 7296 989448 f1908 busybox_old
981655 485 7296 989436 f18fc busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-17 11:02:26 +01:00
Denys Vlasenko
59d4ce935e
bc: use common strings
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-17 10:42:31 +01:00
Denys Vlasenko
ec60318f15
bc: tidy up "z-function" macro machinery
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-17 10:34:02 +01:00
Denys Vlasenko
e4ba4c4371
bc: parse file arguments piecemeal (do not read entire file)
...
function old new delta
bc_read_line 336 406 +70
zbc_vm_execute_FILE - 67 +67
zbc_lex_next 2309 2318 +9
zbc_program_exec 4002 4008 +6
bc_program_index 66 64 -2
bc_vm_run 139 124 -15
zbc_vm_file 208 32 -176
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/3 up/down: 152/-193) Total: -41 bytes
text data bss dec hex filename
981736 485 7296 989517 f194d busybox_old
981667 485 7296 989448 f1908 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-17 09:51:43 +01:00
Denys Vlasenko
c5774a3458
bc: move fflush to the _actual_ execution loop
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-17 01:22:53 +01:00
Denys Vlasenko
51b22b1bce
bc: fix typo: defone -> define
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-17 00:15:35 +01:00
Denys Vlasenko
94f72a387c
bc: factor out common code
...
function old new delta
zbc_parse_stmt_allow_NLINE_before - 59 +59
bc_parse_pushJUMP_ZERO - 27 +27
bc_parse_pushJUMP - 27 +27
rewrite_label_to_current - 19 +19
zbc_vm_process 594 599 +5
zbc_lex_next_and_skip_NLINE 22 - -22
zbc_parse_stmt_fail_if_bare_NLINE 28 - -28
zbc_parse_stmt_possibly_auto 1909 1678 -231
------------------------------------------------------------------------------
(add/remove: 4/2 grow/shrink: 1/1 up/down: 137/-281) Total: -144 bytes
text data bss dec hex filename
981879 485 7296 989660 f19dc busybox_old
981755 485 7296 989536 f1960 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-17 00:07:48 +01:00
Denys Vlasenko
5ebd2a6128
bc: remove use of "BcInstPtr ip" object from loop parsing
...
function old new delta
zbc_parse_stmt_possibly_auto 1964 1909 -55
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-55) Total: -55 bytes
text data bss dec hex filename
981934 485 7296 989715 f1a13 busybox_old
981879 485 7296 989660 f19dc busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-16 23:35:04 +01:00
Denys Vlasenko
266aa00012
bc: store only index in p->exits, it's the only thing used there
...
function old new delta
zbc_parse_stmt_possibly_auto 1967 1964 -3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-3) Total: -3 bytes
text data bss dec hex filename
981937 485 7296 989718 f1a16 busybox_old
981934 485 7296 989715 f1a13 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-16 23:24:25 +01:00
Denys Vlasenko
8e7686e457
bc: p->exits.func is never zero, do not check for that
...
function old new delta
zbc_parse_stmt_possibly_auto 1978 1967 -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-11) Total: -11 bytes
text data bss dec hex filename
981948 485 7296 989729 f1a21 busybox_old
981937 485 7296 989718 f1a16 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-16 23:18:28 +01:00
Denys Vlasenko
de24e9d366
bc: remove redundant JUMP generation when parsing 'while'
...
function old new delta
zbc_parse_stmt_possibly_auto 2065 2025 -40
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-40) Total: -40 bytes
text data bss dec hex filename
982035 485 7296 989816 f1a78 busybox_old
981995 485 7296 989776 f1a50 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-16 23:02:22 +01:00
Denys Vlasenko
06ade77002
bc: simplify use of "ip" in loop parsing functions
...
function old new delta
zbc_parse_stmt_possibly_auto 2106 2065 -41
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-41) Total: -41 bytes
text data bss dec hex filename
982076 485 7296 989857 f1aa1 busybox_old
982035 485 7296 989816 f1a78 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-16 22:44:51 +01:00
Denys Vlasenko
146a79d19c
bc: shring bc_lib[]
...
function old new delta
bc_lib 1586 1584 -2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-16 21:46:11 +01:00
Denys Vlasenko
15850832be
bc: shrink zbc_parse_if() a bit more
...
function old new delta
zbc_parse_stmt_possibly_auto 2180 2106 -74
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-74) Total: -74 bytes
text data bss dec hex filename
982152 485 7296 989933 f1aed busybox_old
982078 485 7296 989859 f1aa3 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-16 21:41:17 +01:00
Denys Vlasenko
6b5b46f817
bc: stop using p->exits when parsing if()
...
function old new delta
zbc_parse_stmt_possibly_auto 2180 2138 -42
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-16 21:29:08 +01:00
Denys Vlasenko
7415633128
bc: preparation to stop using p->exits when parsing if()
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-16 21:21:27 +01:00
Denys Vlasenko
5d18f6be90
bc: fix "print 1,2,3" parsing
...
function old new delta
zbc_parse_stmt_possibly_auto 2245 2180 -65
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-65) Total: -65 bytes
text data bss dec hex filename
982237 485 7296 990018 f1b42 busybox_old
982152 485 7296 989933 f1aed busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-16 21:08:30 +01:00
Denys Vlasenko
cb18b546f7
bc: disallow empty statement as function body
...
$ bc
define z() <cr>
<cr>
bc: no statement after 'define'
function old new delta
zbc_parse_stmt_possibly_auto 2239 2245 +6
zbc_vm_process 589 594 +5
zbc_parse_stmt_fail_if_bare_NLINE 25 28 +3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 14/0) Total: 14 bytes
text data bss dec hex filename
982216 485 7296 989997 f1b2d busybox_old
982237 485 7296 990018 f1b42 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-16 20:46:15 +01:00
Denys Vlasenko
2e8be023cb
bc: allow only one <newline> between if() and stmt
...
Attempt to have more than one causes this error message:
$ bc -q
if (1)<cr>
<cr>
bc: no statement after 'if'
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-16 20:41:32 +01:00
Denys Vlasenko
e6c40c48d9
bc: simplify bc_parse_pushName(), do not free name in it - avoids one strdup
...
function old new delta
zbc_parse_name 511 509 -2
zdc_parse_register 50 43 -7
bc_parse_pushName 61 39 -22
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-31) Total: -31 bytes
text data bss dec hex filename
982183 485 7296 989964 f1b0c busybox_old
982152 485 7296 989933 f1aed busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-16 20:32:58 +01:00
Denys Vlasenko
563d93c9a4
bc: simplify zbc_parse_break_or_continue(), logic is the same
...
function old new delta
zbc_parse_stmt_possibly_auto 2259 2224 -35
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-35) Total: -35 bytes
text data bss dec hex filename
982218 485 7296 989999 f1b2f busybox_old
982183 485 7296 989964 f1b0c busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-16 19:47:40 +01:00
Denys Vlasenko
a50576a415
bc: fold zbc_parse_else() into its only caller
...
While at it, allow newline between "else" and its body
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-16 19:21:57 +01:00
Denys Vlasenko
6d29879c67
bc: fold bc_parse_noElse() into its only caller
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-16 19:10:38 +01:00
Denys Vlasenko
9dc5d08baa
bc: delete unused (write-only) BcParse::nbraces member
...
function old new delta
zbc_lex_next 2296 2309 +13
bc_parse_expr_empty_ok 2021 2025 +4
bc_vm_init 760 757 -3
bc_num_printNewline 54 51 -3
zbc_num_divmod 156 150 -6
bc_parse_reset 113 106 -7
zbc_lex_number 200 192 -8
bc_parse_number 83 66 -17
zdc_parse_expr 707 671 -36
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/7 up/down: 17/-80) Total: -63 bytes
text data bss dec hex filename
982275 485 7296 990056 f1b68 busybox_old
982212 485 7296 989993 f1b29 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-16 18:43:51 +01:00
Denys Vlasenko
202dd1943c
bc: fixes for multi-line if/while/for
...
function old new delta
zbc_vm_process 561 589 +28
zbc_lex_next_and_skip_NLINE - 22 +22
zbc_parse_stmt_possibly_auto 2232 2253 +21
zbc_lex_skip_if_at_NLINE - 14 +14
zbc_lex_number 192 200 +8
zbc_num_divmod 150 156 +6
bc_vm_run 134 139 +5
bc_vm_init 757 760 +3
bc_num_printNewline 51 54 +3
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 7/0 up/down: 110/0) Total: 110 bytes
text data bss dec hex filename
982138 485 7296 989919 f1adf busybox_old
982275 485 7296 990056 f1b68 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-16 17:30:35 +01:00
Denys Vlasenko
e9519e44a6
bc: fix handling of 'return' not in functions, and 'define f()<newline>{...}'
...
function old new delta
zbc_vm_process 561 597 +36
zbc_parse_stmt_possibly_auto 2232 2253 +21
zbc_lex_number 192 200 +8
zbc_num_divmod 150 156 +6
bc_vm_run 134 139 +5
bc_vm_init 757 760 +3
bc_num_printNewline 51 54 +3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/0 up/down: 82/0) Total: 82 bytes
text data bss dec hex filename
982138 485 7296 989919 f1adf busybox_old
982247 485 7296 990028 f1b4c busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-16 17:06:07 +01:00
Denys Vlasenko
d1d29b4245
bc: partially rewrite parser, tests pass, ^C might be broken now
...
The entire control construct (if/while/for/funcdef) or {} block is
"eaten" by the corresponding parsing function, instead of maintaining
special "block flag stack" with magic bits in it, and returning to main
input loop after every inner statement (every input line, essentially).
This required moving line input deep into lexer - now zbc_lex_next()
triggers more reading when needed.
"block flag stack" is gone.
Correctness of ^C handling wasn't checked, might need fixing now.
if/else syntax is changed to match GNU bc: "else" can not be on
the next line (the rationale is that "if (1) 2" statement in interactive
mode should execute and print 2 instead of waiting for possible
"else ..." line).
This change fixes the following examples:
if (1) if (1) 1 else 2 else 3
if (0) 1 else if (1) 2
define w() { auto z; return 1; }
function old new delta
zbc_parse_stmt_possibly_auto - 2232 +2232
zbc_vm_process 89 561 +472
zbc_lex_next 1982 2296 +314
bc_vm_init 749 757 +8
bc_parse_expr_empty_ok 2016 2021 +5
bc_num_printNewline 54 51 -3
zbc_program_read 289 280 -9
bc_parse_free 47 38 -9
bc_parse_reset 126 113 -13
bc_parse_create 108 92 -16
bc_parse_push_block_flag 47 - -47
bc_parse_noElse 48 - -48
zbc_parse_text_init 113 59 -54
zbc_parse_body 121 - -121
zbc_parse_else 125 - -125
zbc_parse_endBody 254 - -254
bc_vm_run 421 134 -287
zbc_parse_auto 290 - -290
zcommon_parse 476 - -476
zbc_parse_stmt 1682 7 -1675
------------------------------------------------------------------------------
(add/remove: 1/7 grow/shrink: 4/8 up/down: 3031/-3427) Total: -396 bytes
text data bss dec hex filename
982586 485 7296 990367 f1c9f busybox_old
982138 485 7296 989919 f1adf busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-16 16:10:38 +01:00
Denys Vlasenko
99b3762335
bc: lexer debugging, added some failing test cases
...
function old new delta
bc_parse_push_block_flag - 47 +47
zbc_parse_body 107 121 +14
zbc_num_divmod 156 150 -6
zbc_lex_number 200 192 -8
zbc_parse_endBody 264 254 -10
bc_parse_startBody 47 - -47
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/3 up/down: 61/-71) Total: -10 bytes
text data bss dec hex filename
982596 485 7296 990377 f1ca9 busybox_old
982586 485 7296 990367 f1c9f busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-15 20:06:59 +01:00
Denys Vlasenko
fd51e0c4d2
bc: simplify BC_INST_JUMP[_ZERO] handling
...
function old new delta
zbc_program_exec 4063 4050 -13
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-15 15:07:14 +01:00
Denys Vlasenko
7db384338a
bc: rewrite "block flag stack" using simple realloc'ed byte array
...
Each access to current top flag took a function call + fetch of three data items
+ multiplication and some additions + and then following the resulting pointer.
After the change, it is: fetch pointer value + one byte access via this pointer.
function old new delta
bc_parse_startBody 45 49 +4
bc_parse_free 46 47 +1
zbc_parse_auto 188 185 -3
bc_parse_push 14 11 -3
bc_vm_run 398 394 -4
zbc_vm_process 63 58 -5
zdc_parse_expr 638 632 -6
zbc_parse_body 101 95 -6
bc_parse_addFunc 31 25 -6
bc_parse_noElse 56 48 -8
zcommon_parse 341 331 -10
zbc_parse_else 134 123 -11
bc_parse_create 124 108 -16
zbc_parse_text_init 123 104 -19
zbc_parse_endBody 292 252 -40
zbc_parse_stmt 1479 1420 -59
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/14 up/down: 5/-196) Total: -191 bytes
text data bss dec hex filename
979880 485 7296 987661 f120d busybox_old
979689 485 7296 987470 f114e busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-15 00:49:16 +01:00
Denys Vlasenko
f10f17f8d3
bc: drop zbc_parse_endBody() bool parameter, move its code to caller which uses it
...
function old new delta
zbc_parse_stmt 1456 1479 +23
zbc_parse_body 103 101 -2
zbc_parse_endBody 326 292 -34
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 23/-36) Total: -13 bytes
text data bss dec hex filename
979893 485 7296 987674 f121a busybox_old
979880 485 7296 987661 f120d busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-14 23:41:33 +01:00
Denys Vlasenko
0154d78738
bc: shorten one message, make defines more readable
...
text data bss dec hex filename
979916 485 7296 987697 f1231 busybox_old
979893 485 7296 987674 f121a busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-14 23:32:51 +01:00
Denys Vlasenko
7b1df3db97
bc: pull zbc_lex_next() call out of zbc_parse_operator() into one caller that uses it
...
function old new delta
bc_parse_operator - 144 +144
bc_parse_expr_empty_ok 1788 1792 +4
zbc_parse_operator 170 - -170
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/0 up/down: 148/-170) Total: -22 bytes
text data bss dec hex filename
979938 485 7296 987719 f1247 busybox_old
979916 485 7296 987697 f1231 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-14 23:12:48 +01:00
Denys Vlasenko
17df882a57
bx: add more debug scaffolding
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-14 23:00:24 +01:00
Denys Vlasenko
2ea53a45b7
bc: convert macro bc_parse_push() to function, add debug infrastructure
...
function old new delta
bc_parse_push - 14 +14
zbc_parse_else 132 134 +2
bc_parse_pushName 63 61 -2
zbc_parse_operator 174 170 -4
bc_parse_number 87 83 -4
zbc_parse_string 97 89 -8
bc_parse_pushIndex 68 60 -8
zbc_parse_endBody 339 326 -13
zbc_parse_name 401 387 -14
zdc_parse_mem 107 91 -16
zdc_parse_expr 680 638 -42
zbc_parse_stmt 1502 1456 -46
bc_parse_expr_empty_ok 1838 1788 -50
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/11 up/down: 16/-207) Total: -191 bytes
text data bss dec hex filename
980129 485 7296 987910 f1306 busybox_old
979938 485 7296 987719 f1247 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-14 17:51:17 +01:00
Denys Vlasenko
f86e960e7c
bc: rename zbc_parse_text() to ..._init(), reuse existing code for library parsing
...
function old new delta
zbc_parse_text_init - 123 +123
bc_vm_run 423 398 -25
zbc_parse_text 123 - -123
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/1 up/down: 123/-148) Total: -25 bytes
text data bss dec hex filename
980154 485 7296 987935 f131f busybox_old
980129 485 7296 987910 f1306 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-14 17:02:27 +01:00
Denys Vlasenko
0a23814e98
bc: compress two constant arguments of bc_lex_assign() to one
...
function old new delta
zbc_program_num 836 835 -1
bc_lex_assign 34 31 -3
zbc_lex_next 1930 1880 -50
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-54) Total: -54 bytes
text data bss dec hex filename
980208 485 7296 987989 f1355 busybox_old
980154 485 7296 987935 f131f busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-14 16:48:34 +01:00
Denys Vlasenko
8226912b2c
bc: remove stale comment, empty lines, regularize comment style
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-14 16:30:56 +01:00
Denys Vlasenko
87b49beeda
bc: tweak bc_num_parseDecimal() for readability, logic is not changed
...
function old new delta
zbc_program_num 836 835 -1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-14 16:24:01 +01:00
Denys Vlasenko
240d7ee3fc
bc: shrink s() in library again
...
function old new delta
bc_lib 1596 1586 -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-10) Total: -10 bytes
text data bss dec hex filename
980152 485 7296 987933 f131d busybox_old
980142 485 7296 987923 f1313 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-14 11:27:09 +01:00
Denys Vlasenko
fc9d26902b
bc: yet another library shrink
...
function old new delta
bc_lib 1604 1596 -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-8) Total: -8 bytes
text data bss dec hex filename
980160 485 7296 987941 f1325 busybox_old
980152 485 7296 987933 f131d busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-14 11:00:23 +01:00
Denys Vlasenko
c06537d9bb
bc: shrink internal library yet more
...
function old new delta
bc_lib 1609 1604 -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-5) Total: -5 bytes
text data bss dec hex filename
980165 485 7296 987946 f132a busybox_old
980160 485 7296 987941 f1325 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-14 10:10:37 +01:00
Denys Vlasenko
203210e253
bc: shrink internal library more
...
function old new delta
bc_lib 1618 1609 -9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-14 09:53:50 +01:00
Denys Vlasenko
3ac0c21a1f
bc: shrink internal library
...
function old new delta
bc_lib 1674 1618 -56
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-14 01:01:01 +01:00
Denys Vlasenko
57b6918b0a
bc: group ENABLE_BC code a bit better, no logic changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-14 00:12:13 +01:00
Denys Vlasenko
5f263f406c
bc: fix "dc only" bug
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-13 22:49:59 +01:00
Denys Vlasenko
e755e30402
bc: unbreak "only bc" and "only dc" configs
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-13 22:25:28 +01:00
Denys Vlasenko
89198a9e5d
bc: simplify bc_lex_whitespace()
...
function old new delta
bc_lex_whitespace 52 41 -11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-13 21:31:29 +01:00
Denys Vlasenko
bbcecc4118
bc: G.sbgn and G.send are unused, remove them
...
function old new delta
bc_program_index 66 64 -2
bc_parse_expr_empty_ok 1840 1838 -2
dc_main 176 168 -8
bc_main 73 65 -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-20) Total: -20 bytes
text data bss dec hex filename
980327 485 7296 988108 f13cc busybox_old
980307 485 7296 988088 f13b8 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-13 21:17:43 +01:00
Denys Vlasenko
0fe270e775
bc: simplify filename saving in zbc_vm_file()
...
function old new delta
bc_vm_run 433 423 -10
zbc_vm_file 187 174 -13
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-23) Total: -23 bytes
text data bss dec hex filename
980350 485 7296 988131 f13e3 busybox_old
980327 485 7296 988108 f13cc busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-13 19:58:58 +01:00
Denys Vlasenko
915c72b273
bc: do not append duplicate NUL, reduce indentation in bc_read_line()
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-13 19:29:02 +01:00
Denys Vlasenko
82ea67fbfa
bc: change bc_read_line() and zbc_vm_stdin() to avoid double buffers
...
function old new delta
bc_read_line 129 124 -5
bc_vm_run 523 433 -90
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-95) Total: -95 bytes
text data bss dec hex filename
980445 485 7296 988226 f1442 busybox_old
980350 485 7296 988131 f13e3 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-13 19:24:42 +01:00
Denys Vlasenko
b7e61e3e4a
bc: further simplification in zbc_vm_stdin()
...
function old new delta
bc_vm_run 500 523 +23
bc_vec_concat 66 - -66
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 23/-66) Total: -43 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-13 18:16:39 +01:00
Denys Vlasenko
818b602c88
bc: fix another thinko
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-13 17:56:35 +01:00
Denys Vlasenko
335b4efd2f
bc: fix a thinko: dc uses [] string delimiters, bot bc!
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-13 17:46:26 +01:00
Denys Vlasenko
766f67250f
bc: fix comment handling
...
function old new delta
bc_vm_run 514 513 -1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-13 17:43:23 +01:00
Denys Vlasenko
7dc0a51286
bc: further zbc_vm_stdin() optimizations
...
function old new delta
bc_vm_run 534 514 -20
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-13 17:36:41 +01:00
Denys Vlasenko
40534bb6e2
bc: shrink zbc_vm_stdin()
...
function old new delta
bc_vm_run 592 534 -58
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-13 17:27:00 +01:00
Denys Vlasenko
89e785af98
bc: trim config help text, add a few comments, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-13 16:35:52 +01:00
Denys Vlasenko
9811ad02bd
bc: unbreak CONFIG_FEATURE_BC_SIGNALS=y config
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-12 23:25:13 +01:00
Denys Vlasenko
c2265f526e
bc: remove lexer function pointer
...
function old new delta
zbc_lex_next 81 1930 +1849
bc_parse_create 131 124 -7
common_parse_init 31 - -31
zdc_lex_token 672 - -672
zbc_lex_token 1193 - -1193
------------------------------------------------------------------------------
(add/remove: 0/3 grow/shrink: 1/1 up/down: 1849/-1903) Total: -54 bytes
text data bss dec hex filename
980634 485 7296 988415 f14ff busybox_old
980580 485 7296 988361 f14c9 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-12 23:14:44 +01:00
Denys Vlasenko
c0ef23ca40
bc: remove parse function pointer
...
function old new delta
zbc_program_asciify - 372 +372
zcommon_parse - 341 +341
zbc_program_printStream - 141 +141
zbc_program_pushArray - 111 +111
zbc_program_nquit - 92 +92
zbc_vm_process 61 63 +2
zbc_parse_text 122 123 +1
bc_vm_run 591 592 +1
zdc_parse_mem 108 107 -1
zbc_parse_operator 175 174 -1
zbc_parse_else 133 132 -1
zbc_parse_body 104 103 -1
zbc_program_read 261 259 -2
zdc_parse_register 40 37 -3
zbc_parse_string 100 97 -3
zbc_parse_endBody 343 339 -4
zdc_parse_expr 688 680 -8
zbc_parse_auto 198 188 -10
zbc_parse_name 414 401 -13
common_parse_init 45 31 -14
zdc_parse_parse 23 - -23
bc_parse_create 158 131 -27
zbc_parse_stmt 1540 1502 -38
bc_parse_expr_empty_ok 1882 1840 -42
zbc_program_exec 3963 3837 -126
zbc_parse_parse 311 - -311
zbc_program_modexp 556 - -556
------------------------------------------------------------------------------
(add/remove: 5/3 grow/shrink: 3/16 up/down: 1061/-1184) Total: -123 bytes
text data bss dec hex filename
980757 485 7296 988538 f157a busybox_old
980634 485 7296 988415 f14ff busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-12 23:03:10 +01:00
Denys Vlasenko
19f110751d
bc: convert two more functions to "z" logic
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-12 22:48:19 +01:00
Denys Vlasenko
8a89247e0a
bc: remove BC_STATUS_EOF (again), the condition is detectable as len==0
...
function old new delta
bc_read_line 147 129 -18
bc_vm_run 618 591 -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-45) Total: -45 bytes
text data bss dec hex filename
980802 485 7296 988583 f15a7 busybox_old
980757 485 7296 988538 f157a busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-12 22:43:58 +01:00
Denys Vlasenko
d8078a79be
dc: fix EOF handling in case of last line being incomplete
...
This wasn't working correctly:
$ echo -ne '10 20+p' | dc
30
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-12 21:56:06 +01:00
Denys Vlasenko
9a23b07c4c
testsuite: add bc and dc tests
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-12 21:41:40 +01:00
Denys Vlasenko
d6ad3666dc
bc: further conversions to "z" logic
...
function old new delta
bc_program_exec 3876 - -3876
zbc_program_exec - 3963 +3963
bc_program_execStr 429 - -429
zbc_program_execStr - 427 +427
bc_vm_file 197 - -197
zbc_vm_file - 187 +187
bc_vm_process 74 - -74
zbc_vm_process - 61 +61
bc_parse_pushIndex 66 68 +2
bc_vm_run 624 618 -6
dc_main 187 176 -11
bc_program_reset 64 - -64
zbc_program_pushArray 111 - -111
------------------------------------------------------------------------------
(add/remove: 4/6 grow/shrink: 1/2 up/down: 4640/-4768) Total: -128 bytes
text data bss dec hex filename
980922 485 7296 988703 f161f busybox_old
980794 485 7296 988575 f159f busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-12 21:39:10 +01:00
Denys Vlasenko
c2da68e896
bc: optimize bc_parse_pushIndex()
...
function old new delta
bc_parse_pushIndex 80 68 -12
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-12 16:44:34 +01:00
Denys Vlasenko
26819db9a3
bc: convert even more of lexer functions to "z" convention
...
function old new delta
bc_parse_name 416 - -416
zbc_parse_name - 414 +414
bc_parse_parse 305 - -305
zbc_parse_parse - 311 +311
bc_program_read 271 - -271
zbc_program_read - 261 +261
bc_parse_text 129 - -129
zbc_parse_text - 122 +122
dc_parse_parse 26 - -26
zdc_parse_parse - 23 +23
bc_program_index 66 64 -2
bc_vm_process 92 74 -18
bc_program_execStr 460 429 -31
bc_parse_expr_empty_ok 1939 1882 -57
------------------------------------------------------------------------------
(add/remove: 5/5 grow/shrink: 0/4 up/down: 1131/-1255) Total: -124 bytes
text data bss dec hex filename
981058 485 7296 988839 f16a7 busybox_old
980934 485 7296 988715 f162b busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-12 16:09:47 +01:00
Denys Vlasenko
ae0faf91d0
bc: convert even more of lexer functions to "z" convention
...
function old new delta
bc_parse_stmt 1594 - -1594
zbc_parse_stmt - 1540 +1540
common_parse_expr 43 - -43
zcommon_parse_expr - 40 +40
bc_parse_expr 24 - -24
zbc_parse_expr - 24 +24
zbc_parse_body 108 104 -4
bc_program_read 277 271 -6
bc_program_execStr 468 460 -8
bc_parse_expr_empty_ok 1955 1939 -16
bc_parse_name 451 416 -35
bc_parse_parse 476 305 -171
------------------------------------------------------------------------------
(add/remove: 3/3 grow/shrink: 0/6 up/down: 1604/-1901) Total: -297 bytes
text data bss dec hex filename
981355 485 7296 989136 f17d0 busybox_old
981058 485 7296 988839 f16a7 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-12 15:19:54 +01:00
Denys Vlasenko
8cd468f604
bc: convert more of lexer functions to "z" convention
...
function old new delta
dc_parse_expr 748 - -748
zdc_parse_expr - 688 +688
bc_parse_endBody 338 - -338
zbc_parse_endBody - 343 +343
bc_parse_auto 201 - -201
zbc_parse_auto - 198 +198
dc_parse_mem 115 - -115
zdc_parse_mem - 108 +108
bc_parse_body 116 - -116
zbc_parse_body - 108 +108
bc_parse_string 102 - -102
zbc_parse_string - 100 +100
dc_parse_register 43 - -43
zdc_parse_register - 40 +40
common_parse_expr 40 43 +3
bc_parse_parse 321 476 +155
bc_parse_stmt 1598 1594 -4
dc_parse_parse 44 26 -18
bc_parse_reset 153 - -153
------------------------------------------------------------------------------
(add/remove: 7/8 grow/shrink: 2/2 up/down: 1743/-1838) Total: -95 bytes
text data bss dec hex filename
981450 485 7296 989231 f182f busybox_old
981355 485 7296 989136 f17d0 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-12 14:57:15 +01:00
Denys Vlasenko
9a34e89289
bc: partially convert lexer functions to "z" convention
...
function old new delta
bc_lex_token 1228 - -1228
zbc_lex_token - 1193 +1193
dc_lex_token 674 - -674
zdc_lex_token - 672 +672
bc_parse_operator 177 - -177
zbc_parse_operator - 175 +175
bc_parse_else 133 - -133
zbc_parse_else - 133 +133
bc_lex_next 91 - -91
zbc_lex_next - 81 +81
dc_parse_expr 744 748 +4
bc_parse_string 100 102 +2
bc_parse_body 114 116 +2
dc_parse_mem 116 115 -1
bc_parse_text 130 129 -1
dc_parse_register 51 43 -8
bc_parse_endBody 358 338 -20
bc_parse_name 513 451 -62
bc_parse_auto 265 201 -64
bc_parse_expr_empty_ok 2032 1955 -77
bc_parse_parse 417 321 -96
bc_parse_stmt 1753 1598 -155
------------------------------------------------------------------------------
(add/remove: 5/5 grow/shrink: 3/9 up/down: 2262/-2787) Total: -525 bytes
text data bss dec hex filename
981975 485 7296 989756 f1a3c busybox_old
981450 485 7296 989231 f182f busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-12 13:58:55 +01:00
Denys Vlasenko
251fbb57be
bc: code shrink in bc_num_cmp()
...
function old new delta
bc_num_cmp 275 231 -44
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-12 11:51:32 +01:00
Denys Vlasenko
16494f557f
bc: simplify zbc_program_logical()
...
function old new delta
bc_program_exec 3918 3876 -42
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-42) Total: -42 bytes
text data bss dec hex filename
982061 485 7296 989842 f1a92 busybox_old
982019 485 7296 989800 f1a68 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-12 00:51:53 +01:00
Denys Vlasenko
69171dc466
bc: simplify nested read() check
...
function old new delta
bc_vm_run 622 624 +2
dc_main 186 187 +1
bc_main 72 73 +1
bc_program_read 312 277 -35
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 4/-35) Total: -31 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-12 00:29:24 +01:00
Denys Vlasenko
12b9eaf787
bc: in non-interactive config, POSIX error functions never return nonzero
...
function old new delta
bc_parse_expr_empty_ok 2036 2032 -4
bc_parse_stmt 1767 1753 -14
bc_lex_token 1259 1228 -31
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-49) Total: -49 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-11 23:50:14 +01:00
Denys Vlasenko
f0f069b08f
bc: use common_parse_init() in bc_vm_init()
...
function old new delta
common_parse_init 26 45 +19
dc_parse_init 17 - -17
bc_parse_init 17 - -17
bc_vm_init 744 725 -19
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/1 up/down: 19/-53) Total: -34 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-11 23:22:52 +01:00
Denys Vlasenko
4dd3652c2f
bc: fix EOF handling in bc_program_read()
...
$ bc -q
read()
2^D^D2
^ prints the result of read()'ed expression
function old new delta
zbc_program_print 629 642 +13
bc_program_read 322 312 -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 13/-10) Total: 3 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-11 22:45:15 +01:00
Denys Vlasenko
2c6f563216
bc: tweak comment
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-11 21:21:14 +01:00
Denys Vlasenko
c008a73762
bc: convert bc_program_asciify to "z" function
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-11 20:57:53 +01:00
Denys Vlasenko
9f657e0f7d
bc: shrink bc_program_printString
...
function old new delta
zbc_program_print 665 642 -23
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-11 19:52:25 +01:00
Denys Vlasenko
259137d0f0
bc: convert zbc_program_op to "z" function, fix a thinko in prev commits
...
function old new delta
zbc_program_assign 448 447 -1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-11 19:44:14 +01:00
Denys Vlasenko
728e7c9ecb
bc: convert bc_program_logical to "z" function
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-11 19:37:00 +01:00
Denys Vlasenko
09d8df84ee
bc: do not use "(cond ? f1 : f2)(params)" idiom, it messes up static function optimizations
...
With direct calls, GCC no longer thinks that we take addresses of the functions,
and can use "more optimal" internal ABI for _all_ calls to these functions,
not only at this callsite. On i486, regparm is used, and:
function old new delta
zbc_num_inv 56 57 +1
zbc_num_k 852 851 -1
zbc_program_modexp 558 556 -2
zbc_num_d 541 539 -2
bc_num_ulong2num 59 57 -2
zbc_program_num 840 836 -4
bc_num_zero 11 7 -4
bc_num_one 28 24 -4
bc_program_exec 3928 3918 -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/8 up/down: 1/-29) Total: -28 bytes
text data bss dec hex filename
982237 485 7296 990018 f1b42 busybox_old
982209 485 7296 989990 f1b26 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-11 19:33:09 +01:00
Denys Vlasenko
7f4daa4f58
bc: convert arithmetic calc functions to "z" logic
...
In order for magic macros to work, a bit of reordering was necessary.
function old new delta
zbc_program_modexp - 558 +558
zbc_program_assign - 448 +448
zbc_program_pushArray - 111 +111
zbc_num_s 239 237 -2
zbc_num_d 543 541 -2
zbc_num_binary 145 143 -2
zbc_num_a 443 441 -2
zbc_num_rem 95 91 -4
zbc_num_divmod 150 146 -4
zbc_num_m 269 257 -12
zbc_num_r 230 208 -22
zbc_num_printNum 447 417 -30
bc_program_exec 3960 3928 -32
zbc_num_p 434 399 -35
zbc_program_num 880 840 -40
zbc_num_k 913 852 -61
zbc_program_printStream 141 - -141
bc_program_assign 455 - -455
bc_program_modexp 668 - -668
------------------------------------------------------------------------------
(add/remove: 3/3 grow/shrink: 0/13 up/down: 1117/-1512) Total: -395 bytes
text data bss dec hex filename
982632 485 7296 990413 f1ccd busybox_old
982237 485 7296 990018 f1b42 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-11 19:22:04 +01:00
Denys Vlasenko
1aeacefbb3
bc: rename arithmetic calc functions to "z" functions, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-11 19:12:13 +01:00
Denys Vlasenko
c2d15dff42
bc: move declarations around, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-11 17:56:09 +01:00
Denys Vlasenko
c355c4a7d6
bc: code shrink in zbc_lex_number()
...
function old new delta
zbc_lex_number 279 190 -89
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-11 17:36:21 +01:00
Denys Vlasenko
b402ff844c
bc: make bc_program_pushVar "z-function"
...
function old new delta
bc_program_pushVar 200 198 -2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-11 15:45:15 +01:00
Denys Vlasenko
2930123279
bc: improve "noninteractive" macro machinery so that even "return zero" code is not generated
...
Most affected functions shrink by 2 bytes on x86.
function old new delta
zbc_program_num - 880 +880
zbc_program_print - 665 +665
zbc_num_printNum - 447 +447
zbc_program_call - 323 +323
zbc_program_copyToVar - 287 +287
zbc_lex_number - 279 +279
zbc_program_binOpPrep - 269 +269
zbc_program_assignStr - 142 +142
zbc_program_printStream - 141 +141
zbc_func_insert - 93 +93
zbc_num_ulong - 88 +88
zbc_program_prep - 79 +79
zbc_num_shift - 53 +53
bc_num_shift 54 - -54
bc_program_prep 81 - -81
bc_num_ulong 90 - -90
bc_func_insert 95 - -95
bc_program_printStream 143 - -143
bc_program_assignStr 144 - -144
bc_program_binOpPrep 271 - -271
bc_lex_number 281 - -281
bc_program_copyToVar 289 - -289
bc_program_call 325 - -325
bc_num_printNum 471 - -471
bc_program_print 667 - -667
bc_program_num 880 - -880
------------------------------------------------------------------------------
(add/remove: 13/13 grow/shrink: 0/0 up/down: 3746/-3791) Total: -45 bytes
text data bss dec hex filename
982779 485 7296 990560 f1d60 busybox_old
982734 485 7296 990515 f1d33 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-11 15:29:32 +01:00
Denys Vlasenko
91cde95916
bc: it's not clear bc_vm_file() always exits on errors, remove ERRORS_ARE_FATAL
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-10 20:56:44 +01:00
Denys Vlasenko
628bf1bc63
bc: more ERRORS_ARE_FATAL annotations
...
function old new delta
bc_program_exec 3920 3969 +49
bc_program_call 329 325 -4
bc_vm_run 622 616 -6
bc_program_modexp 677 668 -9
bc_program_assign 471 455 -16
bc_program_pushArray 113 - -113
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/4 up/down: 49/-148) Total: -99 bytes
text data bss dec hex filename
982872 485 7296 990653 f1dbd busybox_old
982773 485 7296 990554 f1d5a busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-10 20:41:05 +01:00
Denys Vlasenko
88cfea6a81
bc: stop checking for name length in bc_lex_name()
...
Gigabyte-long names are not a practical concern.
function old new delta
bc_lex_name 73 69 -4
bc_lex_token 1266 1259 -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-11) Total: -11 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-10 20:26:04 +01:00
Denys Vlasenko
fa35e598ab
bc: optimize non-interactive config: we know that many functions always succeed
...
function old new delta
bc_program_assign 475 471 -4
bc_program_prep 87 81 -6
bc_parse_parse 423 417 -6
bc_num_p 440 434 -6
bc_program_printStream 153 143 -10
bc_program_execStr 478 468 -10
bc_parse_auto 275 265 -10
bc_num_k 925 913 -12
bc_program_copyToVar 307 289 -18
bc_program_binOpPrep 289 271 -18
bc_num_printNum 489 471 -18
bc_num_m 287 269 -18
bc_program_pushArray 139 113 -26
bc_program_modexp 707 677 -30
bc_program_print 704 667 -37
bc_program_exec 4010 3920 -90
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/16 up/down: 0/-319) Total: -319 bytes
text data bss dec hex filename
983202 485 7296 990983 f1f07 busybox_old
982883 485 7296 990664 f1dc8 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-10 20:17:24 +01:00
Denys Vlasenko
86e63cdeca
bc: in non-interactive config, let compiler know that error funcs do not return
...
function old new delta
bc_num_s 235 239 +4
bc_lex_next 92 91 -1
dc_parse_register 53 51 -2
dc_parse_parse 46 44 -2
bc_vm_run 624 622 -2
bc_program_assignStr 146 144 -2
bc_parse_else 135 133 -2
bc_parse_body 116 114 -2
bc_num_a 445 443 -2
bc_func_insert 97 95 -2
bc_program_pushVar 203 200 -3
bc_parse_text 133 130 -3
bc_error_bad_character 17 14 -3
bc_error 14 11 -3
bc_program_printStream 157 153 -4
bc_program_prep 91 87 -4
bc_program_copyToVar 311 307 -4
bc_num_ulong 95 90 -5
bc_num_p 445 440 -5
bc_program_print 711 704 -7
bc_parse_endBody 365 358 -7
bc_num_r 237 230 -7
bc_num_d 550 543 -7
dc_lex_token 682 674 -8
bc_program_pushArray 147 139 -8
bc_program_assign 485 475 -10
bc_program_read 333 322 -11
bc_lex_token 1278 1266 -12
bc_parse_stmt 1780 1767 -13
bc_program_modexp 723 707 -16
dc_parse_expr 762 744 -18
bc_program_execStr 496 478 -18
bc_program_call 347 329 -18
bc_vm_file 219 197 -22
bc_program_binOpPrep 311 289 -22
bc_parse_name 539 513 -26
bc_parse_parse 451 423 -28
bc_program_num 912 880 -32
bc_read_line 172 139 -33
bc_program_exec 4048 4010 -38
bc_parse_auto 313 275 -38
bc_parse_expr_empty_ok 2095 2036 -59
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/41 up/down: 4/-509) Total: -505 bytes
text data bss dec hex filename
983707 485 7296 991488 f2100 busybox_old
983202 485 7296 990983 f1f07 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-10 19:46:53 +01:00
Denys Vlasenko
3a4d5a73a8
tls: prepare for ECDH_anon ciphers
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-10 19:19:38 +01:00
Denys Vlasenko
c67ff8a1b0
tls: fix a potential (currently "disabled" by a macro) SHA1-related bug
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-10 18:49:29 +01:00
Denys Vlasenko
63bfe0e4c0
tls: if !ENABLE_FEATURE_TLS_SHA1, tls->MAC_size is always SHA256_OUTSIZE for AES-CBC
...
function old new delta
tls_xread_record 634 636 +2
xwrite_encrypted 579 580 +1
tls_handshake 2095 2085 -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 3/-10) Total: -7 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-10 16:43:53 +01:00
Denys Vlasenko
71fa5b0a4c
tls: introduce FEATURE_TLS_SHA1 to make SHA1 code optional
...
When disabled:
function old new delta
xwrite_encrypted 580 579 -1
prf_hmac_sha256 222 217 -5
hmac_begin 158 149 -9
static.ciphers 32 20 -12
tls_handshake 2115 2095 -20
hmac 87 61 -26
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/6 up/down: 0/-73) Total: -73 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-10 16:14:58 +01:00
Denys Vlasenko
dafbc2cdb8
bc: simplify bc_num_parseDecimal() further
...
function old new delta
bc_program_num 925 912 -13
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-10 15:38:52 +01:00
Denys Vlasenko
5ba55f1f35
bc: make all function pointers FAST_FUNC, on i486 this saves ~400 bytes
...
function old new delta
bc_num_rem 91 95 +4
bc_num_inv 53 56 +3
bc_num_d 569 572 +3
bc_num_printDigits 136 137 +1
bc_program_assign 486 485 -1
dc_lex_token 684 682 -2
bc_vec_pop 27 25 -2
bc_vec_npop 55 53 -2
bc_program_read 335 333 -2
bc_program_print 713 711 -2
bc_parse_parse 462 460 -2
bc_lex_token 1280 1278 -2
bc_num_printChar 27 24 -3
bc_num_binary 150 147 -3
dc_parse_parse 59 55 -4
bc_vm_run 630 626 -4
bc_num_printHex 71 67 -4
bc_num_divmod 155 150 -5
bc_vec_free 24 18 -6
bc_string_free 15 9 -6
bc_num_free 15 9 -6
bc_id_free 15 9 -6
bc_parse_free 53 46 -7
bc_program_scale 8 - -8
bc_num_r 245 237 -8
bc_func_free 35 27 -8
bc_result_free 57 46 -11
bc_num_a 454 443 -11
bc_num_sub 77 65 -12
bc_num_add 77 65 -12
bc_program_modexp 736 723 -13
bc_num_s 252 239 -13
bc_num_mul 62 49 -13
bc_num_mod 62 49 -13
bc_num_div 62 49 -13
bc_num_pow 47 31 -16
bc_program_exec 4081 4059 -22
bc_num_printNum 514 489 -25
bc_num_p 478 445 -33
bc_program_len 34 - -34
bc_program_num 963 925 -38
bc_num_k 988 944 -44
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 4/36 up/down: 11/-416) Total: -405 bytes
text data bss dec hex filename
984536 485 7296 992317 f243d busybox_old
984131 485 7296 991912 f22a8 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-10 15:37:14 +01:00
Denys Vlasenko
c665c183f1
bc: 0xffffffffffffffff may be larger than unsigned long
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-10 15:15:42 +01:00
Denys Vlasenko
8b4cf0dbb0
bc: optimize bc_vec_concat()
...
function old new delta
bc_vec_concat 71 66 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-10 15:12:58 +01:00
Denys Vlasenko
a7f1a36540
bc: simplify bc_program_len()
...
function old new delta
bc_program_len 42 34 -8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-10 12:57:01 +01:00
Denys Vlasenko
44d79d866d
bc: simplify bc_program_print()
...
function old new delta
bc_program_print 730 713 -17
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-10 12:33:40 +01:00
Denys Vlasenko
b696d9ec20
bc: simplify bc_num_ulong2num()
...
function old new delta
bc_num_ulong2num 64 59 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-10 12:22:15 +01:00
Denys Vlasenko
9311e01803
bc: move str-to-num conversion functions to their only caller, bc_num_parse()
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-10 11:54:59 +01:00
Denys Vlasenko
218ed1cf54
bc: further simplify string-to-number conversion code
...
function old new delta
bc_program_index 66 64 -2
bc_program_num 983 963 -20
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-22) Total: -22 bytes
text data bss dec hex filename
985706 477 7296 993479 f28c7 busybox_old
985684 477 7296 993457 f28b1 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-09 13:33:52 +01:00
Denys Vlasenko
4a024c7719
bc: simplify string-tonumber conversion code
...
function old new delta
bc_program_num 1108 983 -125
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-125) Total: -125 bytes
text data bss dec hex filename
985831 477 7296 993604 f2944 busybox_old
985706 477 7296 993479 f28c7 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-09 13:21:54 +01:00
Denys Vlasenko
3129f705fc
bc: no need to "set to zero" BcNum after bc_num_init(), it already is
...
function old new delta
bc_num_init 48 49 +1
bc_program_num 1115 1108 -7
bc_program_exec 4098 4081 -17
bc_vm_init 786 768 -18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 1/-42) Total: -41 bytes
text data bss dec hex filename
985872 477 7296 993645 f296d busybox_old
985831 477 7296 993604 f2944 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-09 12:04:44 +01:00
Denys Vlasenko
e20e00de34
bc: add and use bc_num_init_DEF_SIZE()
...
function old new delta
bc_num_init_DEF_SIZE - 10 +10
bc_num_binary 150 148 -2
bc_program_pushVar 208 203 -5
bc_program_modexp 741 736 -5
bc_program_copyToVar 316 311 -5
bc_program_call 352 347 -5
bc_array_expand 88 83 -5
bc_program_num 1125 1115 -10
bc_vm_init 821 786 -35
bc_program_exec 4152 4098 -54
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/9 up/down: 10/-126) Total: -116 bytes
text data bss dec hex filename
985988 477 7296 993761 f29e1 busybox_old
985872 477 7296 993645 f296d busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-09 11:44:20 +01:00
Denys Vlasenko
5ec4b49125
bc: in bc_program_execStr(), push two variables into inner scope
...
function old new delta
bc_program_execStr 502 496 -6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-09 02:54:06 +01:00
Denys Vlasenko
927a7d6853
bc: in bc_program_exec(), push two variables into inner scope
...
While at it, delete empty lines.
function old new delta
bc_program_exec 4179 4152 -27
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-09 02:24:14 +01:00
Denys Vlasenko
8fa1e8e6e7
bc: add accessors for G.prog.strs[idx], G.prog.fns[idx]
...
function old new delta
bc_program_str - 17 +17
bc_program_func - 17 +17
bc_program_addFunc 209 204 -5
bc_program_reset 70 64 -6
bc_program_printStream 163 157 -6
bc_program_print 736 730 -6
bc_vm_file 226 219 -7
bc_parse_text 143 133 -10
bc_parse_reset 163 153 -10
bc_parse_endBody 375 365 -10
bc_parse_create 168 158 -10
bc_parse_addFunc 41 31 -10
bc_program_call 364 352 -12
bc_program_read 350 335 -15
bc_program_execStr 528 502 -26
bc_program_exec 4219 4179 -40
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/14 up/down: 34/-173) Total: -139 bytes
text data bss dec hex filename
985043 485 7296 992824 f2638 busybox_old
984904 485 7296 992685 f25ad busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-09 00:03:57 +01:00
Denys Vlasenko
0f37b3286a
bc: eliminate always the same params to bc_num_printBase()
...
function old new delta
bc_program_print 739 736 -3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-08 23:48:53 +01:00
Denys Vlasenko
ebc41c9d94
bc: remove redundant error checks in bc_parse_print()
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-08 23:36:28 +01:00
Denys Vlasenko
5f1b90b91a
bc: stop propagating pointer to G.prog.nchars deep into printing functions
...
function old new delta
bc_num_printHex 62 71 +9
bc_num_printNewline 47 54 +7
bc_num_printDigits 132 136 +4
bc_num_printChar 23 27 +4
bc_program_printStream 173 163 -10
bc_program_print 754 739 -15
bc_num_printNum 538 514 -24
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/3 up/down: 24/-49) Total: -25 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-08 23:18:06 +01:00
Denys Vlasenko
2a8ad48734
bc: do not pass line width in parameters, it's in globals
...
function old new delta
bc_num_printNewline 36 47 +11
bc_num_printHex 70 62 -8
bc_num_printDigits 142 132 -10
bc_program_printStream 185 173 -12
bc_program_print 773 754 -19
bc_num_printNum 563 538 -25
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/5 up/down: 11/-74) Total: -63 bytes
text data bss dec hex filename
985122 485 7296 992903 f2687 busybox_old
985059 485 7296 992840 f2648 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-08 21:56:37 +01:00
Denys Vlasenko
ac6ed11f8d
bc: remove "ready for more input" message, GNU bc does not print that
...
function old new delta
bc_read_line 285 268 -17
bc_vm_run 684 630 -54
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-71) Total: -71 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-08 21:39:10 +01:00
Denys Vlasenko
32ec5f1705
tls: AES-GCM: in GMULT, avoid memcpy, use one less variable in bit loop
...
function old new delta
GMULT 168 159 -9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-08 21:24:38 +01:00
Denys Vlasenko
6e7c65fca0
bc: trim banner, use empty interactive prompts (GNU bc compat)
...
function old new delta
bc_vm_run 689 684 -5
bc_program_read 355 350 -5
bc_read_line 307 285 -22
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-32) Total: -32 bytes
text data bss dec hex filename
985409 485 7296 993190 f27a6 busybox_old
985265 485 7296 993046 f2716 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-08 19:34:35 +01:00
Denys Vlasenko
d0bc5fdfea
dc: fix "small dc" to have standard command line API
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-08 18:59:07 +01:00
Denys Vlasenko
23427a63fc
lineedit: fix "defined but not used" sigaction2 warning
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-08 15:45:46 +01:00
Denys Vlasenko
51283b8109
mdev: suppress aliasing warning
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-08 15:41:17 +01:00
Denys Vlasenko
b437df1157
inetd: suppress aliasing warning
...
function old new delta
sigprocmask2 - 8 +8
wait_for_child_or_signal 213 218 +5
dowait 424 429 +5
block_CHLD_HUP_ALRM 62 59 -3
sigprocmask_SIG_SETMASK 16 - -16
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 2/1 up/down: 18/-19) Total: -1 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-08 15:35:24 +01:00
Denys Vlasenko
136fe9bede
suppress gcc 8 aliasing warnings
...
function old new delta
sigprocmask_SIG_SETMASK - 16 +16
wait_for_child_or_signal 221 213 -8
dowait 432 424 -8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-08 13:49:15 +01:00
Denys Vlasenko
9f00a0fdb1
tls: make RIGHTSHIFTX() in AES-GCM faster
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-08 13:34:43 +01:00
Denys Vlasenko
f522dd9420
bc: replace G.eof with a special exit code of bc_vm_stdin()
...
function old new delta
bc_read_line 305 307 +2
bc_vm_run 701 689 -12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 2/-12) Total: -10 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-07 16:35:43 +01:00
Denys Vlasenko
2d615fee38
bc: convert two macros to functions, unwing one complex max(a,min(b,c))
...
function old new delta
BC_NUM_AREQ - 45 +45
BC_NUM_MREQ - 33 +33
bc_num_rem 104 91 -13
bc_num_divmod 168 155 -13
bc_num_d 584 569 -15
bc_num_mul 80 62 -18
bc_num_mod 80 62 -18
bc_num_div 80 62 -18
bc_num_sub 112 77 -35
bc_num_add 112 77 -35
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/8 up/down: 78/-165) Total: -87 bytes
text data bss dec hex filename
985526 485 7296 993307 f281b busybox_old
985439 485 7296 993220 f27c4 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-07 16:22:45 +01:00
Denys Vlasenko
64074a1767
bc: do not perform domr limit checks when they can't work (e.g. on 32-bit arches)
...
Also, optimize printing of messages with fixed limit strings
by including limits as strings.
function old new delta
bc_num_ulong 103 95 -8
bc_lex_number 296 281 -15
dc_lex_token 701 684 -17
bc_lex_name 90 73 -17
bc_num_shift 72 54 -18
bc_lex_token 1299 1280 -19
bc_parse_stmt 1868 1768 -100
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/7 up/down: 0/-194) Total: -194 bytes
text data bss dec hex filename
985814 485 7296 993595 f293b busybox_old
985526 485 7296 993307 f281b busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-07 15:50:14 +01:00
Denys Vlasenko
ffdcebdffe
bc: pull temporary into a register
...
function old new delta
bc_num_ulong 103 95 -8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-07 15:10:05 +01:00
Denys Vlasenko
18c6b54f82
bc: use more compact parsing data structures
...
function old new delta
dc_lex_token 697 701 +4
bc_parse_next_rel 20 - -20
bc_parse_next_read 20 - -20
bc_parse_next_print 20 - -20
bc_parse_next_param 20 - -20
bc_parse_next_for 20 - -20
bc_parse_next_expr 20 - -20
bc_parse_next_elem 20 - -20
common_parse_expr 62 40 -22
bc_parse_expr 49 24 -25
dc_lex_regs 52 13 -39
bc_parse_name 581 539 -42
bc_parse_expr_empty_ok 2157 2108 -49
dc_parse_insts 332 83 -249
dc_lex_tokens 364 91 -273
bc_parse_stmt 2261 1868 -393
------------------------------------------------------------------------------
(add/remove: 0/7 grow/shrink: 1/8 up/down: 4/-1232) Total: -1228 bytes
text data bss dec hex filename
987037 485 7296 994818 f2e02 busybox_old
985814 485 7296 993595 f293b busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-07 12:57:32 +01:00
Denys Vlasenko
b9c321d6d9
bc: use only G_interrupt as interrupt flag
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-07 12:41:42 +01:00
Denys Vlasenko
c7a7ce06b8
bc: fix exit codes for FEATURE_CLEAN_UP=y
...
$ echo 0/0 | ./busybox bc; echo $?
bc: divide by zero
1
$ echo halt | ./busybox bc; echo $?
0 <------- was 1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 23:06:57 +01:00
Denys Vlasenko
a133137174
dc: fix testsuite
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 18:46:42 +01:00
Denys Vlasenko
6d0be10aae
bc: correctly parse dc options
...
function old new delta
bc_vm_init - 821 +821
bc_vm_file - 226 +226
dc_main 41 187 +146
bc_main 41 73 +32
packed_usage 33076 33059 -17
bc_vm_run 1903 701 -1202
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/2 up/down: 1225/-1219) Total: 6 bytes
text data bss dec hex filename
987046 485 7296 994827 f2e0b busybox_old
987037 485 7296 994818 f2e02 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 18:41:59 +01:00
Denys Vlasenko
4c9455f967
dc: fix "dc does_not_exist" SEGVing
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 15:21:39 +01:00
Denys Vlasenko
52c210594c
fix make_single_applets.sh
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 14:10:10 +01:00
Denys Vlasenko
b23ac51d0c
bc: code shrink - convert two macros to functions
...
function old new delta
bc_program_printStream - 185 +185
bc_program_pushArray - 147 +147
bc_program_exec 4132 4219 +87
bc_vec_pop - 27 +27
bc_vec_top - 13 +13
bc_num_ulong 92 103 +11
bc_vm_run 1905 1903 -2
bc_vm_process 94 92 -2
bc_program_reset 72 70 -2
bc_program_prep 93 91 -2
bc_program_call 366 364 -2
bc_parse_startBody 47 45 -2
bc_parse_parse 464 462 -2
bc_parse_else 137 135 -2
bc_parse_body 118 116 -2
bc_program_num 1129 1125 -4
bc_parse_text 147 143 -4
bc_program_retire 40 35 -5
bc_program_print 778 773 -5
bc_program_modexp 746 741 -5
bc_program_pushVar 215 208 -7
bc_program_copyToVar 323 316 -7
bc_parse_operator 184 177 -7
bc_parse_noElse 65 56 -9
bc_program_binOpRetire 56 46 -10
bc_parse_stmt 2271 2261 -10
bc_program_execStr 543 528 -15
bc_program_assignStr 161 146 -15
bc_parse_expr_empty_ok 2178 2157 -21
bc_parse_endBody 420 375 -45
bc_program_asciify 464 - -464
------------------------------------------------------------------------------
(add/remove: 4/1 grow/shrink: 2/24 up/down: 470/-651) Total: -181 bytes
text data bss dec hex filename
987227 485 7296 995008 f2ec0 busybox_old
987046 485 7296 994827 f2e0b busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 13:10:56 +01:00
Denys Vlasenko
d00d2f9603
bc: make keyword POSIXness check more readable
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 12:59:40 +01:00
Denys Vlasenko
b6f60863cb
bc: move a function to reduce forward declarations
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 12:54:26 +01:00
Denys Vlasenko
e55a572600
bc: small simplification in dc_lex_token()
...
Pulling array element into a temporary, taking address of this temporary
and copying it? That's much unnecessary work.
function old new delta
dc_lex_token 701 697 -4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 12:47:17 +01:00
Denys Vlasenko
2fa11b6d35
bc: add comment about BC_NUM_DEF_SIZE
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 12:34:39 +01:00
Denys Vlasenko
1ff8862149
bc: fix for prev commit
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 12:06:16 +01:00
Denys Vlasenko
4c30406df6
bc: do not needlessly use strcat
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 12:01:17 +01:00
Denys Vlasenko
23c2e9fcf9
bc: unbreak "BC only" and "DC only" configs
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 11:43:17 +01:00
Denys Vlasenko
9ca9ef2d5b
dc: re-enable "tiny dc" implementation
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 11:31:14 +01:00
Denys Vlasenko
a68a87cd60
bc: unbreak FEATURE_CLEAN_UP build
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 11:12:38 +01:00
Denys Vlasenko
a6f84e1a35
bc: reuse common string
...
text data bss dec hex filename
987232 485 7296 995013 f2ec5 busybox_old
987205 485 7296 994986 f2eaa busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 11:10:11 +01:00
Denys Vlasenko
95f93bdc28
bc: hook up line editing with history buffer
...
function old new delta
push_input_byte - 65 +65
bc_vm_run 1875 1905 +30
bc_read_line 303 305 +2
bc_num_binary 148 150 +2
bc_num_ulong 103 92 -11
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/1 up/down: 99/-11) Total: 88 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 10:29:12 +01:00
Denys Vlasenko
ed849351d1
bc: add preparatory indent block, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 10:26:13 +01:00
Denys Vlasenko
1a6a482d19
bc: if ^C handling is not selected, there is no interactive mode
...
function old new delta
packed_usage 33023 33076 +53
bc_num_s 252 246 -6
bc_vm_run 1859 1850 -9
bc_error_fmt 36 20 -16
bc_posix_error_fmt 58 41 -17
bc_read_line 202 168 -34
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/5 up/down: 53/-82) Total: -29 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 09:20:32 +01:00
Denys Vlasenko
54214c38db
bc: fix "bc -v" printing version info twice, and not exiting
...
function old new delta
bc_args 123 130 +7
bc_num_binary 150 148 -2
static.nullptr 4 - -4
bc_vm_run 1883 1874 -9
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/2 up/down: 7/-15) Total: -8 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 09:07:06 +01:00
Denys Vlasenko
1ff1c70944
bc: make bc_vm_envArgs() NULL-terminate its argv, simplify bc_vm_envLen()
...
function old new delta
bc_num_ulong 92 103 +11
static.nullptr - 4 +4
bc_args 120 123 +3
static.bc_args_env_name 4 - -4
dc_main 49 41 -8
bc_main 49 41 -8
bc_vm_run 1917 1883 -34
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 2/3 up/down: 18/-54) Total: -36 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 00:54:12 +01:00
Denys Vlasenko
e873ff9660
bc: if FEATURE_CLEAN_UP, clean up allocations on exits
...
Will have exitcode 1 even on "quit" and "halt", is it a problem?
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-06 00:29:22 +01:00
Denys Vlasenko
050b0fe9a7
bc: do not allow "()" as a valid expression
...
function old new delta
bc_parse_expr_empty_ok - 2178 +2178
bc_parse_expr 2178 49 -2129
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 2178/-2129) Total: 49 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 22:40:44 +01:00
Denys Vlasenko
cca79a0064
bc: reorder functions, delete forward declarations, no code changes - part 2
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 21:15:46 +01:00
Denys Vlasenko
b0e3761410
bc: reorder functions, delete forward declarations, no code changes
...
Pure block moves of text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 21:03:16 +01:00
Denys Vlasenko
aad652a69a
bc: remove unused strings
...
text data bss dec hex filename
987088 485 7296 994869 f2e35 busybox_old
987079 485 7296 994860 f2e2c busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 20:33:23 +01:00
Denys Vlasenko
452df923f7
bc: trivial simplification in bc_parse_return()
...
function old new delta
bc_parse_stmt 2276 2271 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 20:28:26 +01:00
Denys Vlasenko
657d6bb262
bc: fix "warning: 's' may be used uninitialized in this function"
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 20:25:03 +01:00
Denys Vlasenko
bcb62a7f11
bc: code shrink
...
function old new delta
bc_parse_expr 2151 2178 +27
bc_parse_exprs 60 - -60
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 2/0 up/down: 27/-60) Total: -33 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 20:17:48 +01:00
Denys Vlasenko
6543758b13
bc: code shrink
...
function old new delta
bc_parse_operator 181 184 +3
bc_parse_ops 50 25 -25
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 3/-25) Total: -22 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 19:37:19 +01:00
Denys Vlasenko
f381a88234
bc: make division operation interruptible
...
function old new delta
bc_num_d 564 584 +20
bc_num_r 230 245 +15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 35/0) Total: 35 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 19:21:34 +01:00
Denys Vlasenko
b3cb90124b
bc: use unsigned division by 10 instead of signed
...
function old new delta
bc_num_k 990 988 -2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 19:05:32 +01:00
Denys Vlasenko
06fa65bd95
bc: move ^C check fro power calculation to multiplication
...
function old new delta
bc_num_k 971 990 +19
bc_num_p 507 478 -29
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 19/-29) Total: -10 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 19:00:58 +01:00
Denys Vlasenko
b692c2faf1
bc: bc_num_k(): move carry,i,j,len to inner scope
...
This might help compiler
function old new delta
bc_num_k 957 971 +14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 18:56:14 +01:00
Denys Vlasenko
0d7e46b1de
bc: tweak error messages
...
function old new delta
bc_lex_token 1285 1299 +14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 18:31:19 +01:00
Denys Vlasenko
0064679915
bc: fix inverted POSIXness test, improve messages, commonalize message strings
...
function old new delta
bc_lex_token 1251 1285 +34
bc_POSIX_does_not_allow_bool_ops_this_is_bad - 25 +25
bc_POSIX_does_not_allow_empty_X_expression_in_for - 20 +20
bc_POSIX_does_not_allow - 20 +20
bc_parse_expr 2146 2151 +5
bc_num_ulong 103 92 -11
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 2/1 up/down: 104/-11) Total: 93 bytes
text data bss dec hex filename
987210 485 7296 994991 f2eaf busybox_old
987084 485 7296 994865 f2e31 busybox_unstripped
^^^^^^^
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 18:12:27 +01:00
Denys Vlasenko
5318f81fbe
bc: print error line numbers
...
FILE:
print 1
print "
$ busybox bc -q FILE
bc: FILE:2: string end could not be found
ready for more input
>>> _
function old new delta
bc_verror_msg - 99 +99
bc_lex_file 12 28 +16
bc_lex_next 77 92 +15
dc_lex_token 687 701 +14
bc_lex_token 1237 1251 +14
bc_posix_error_fmt 90 58 -32
bc_error_fmt 70 36 -34
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/2 up/down: 158/-66) Total: 92 bytes
text data bss dec hex filename
987108 485 7296 994889 f2e49 busybox_old
987210 485 7296 994991 f2eaf busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 17:48:01 +01:00
Denys Vlasenko
08c033c406
bc: optimize pushing zero bytes to vectors
...
function old new delta
bc_vec_pushZeroByte - 10 +10
bc_vm_run 1919 1917 -2
bc_vec_string 61 59 -2
bc_vec_concat 68 66 -2
bc_parse_create 170 168 -2
bc_lex_number 298 296 -2
dc_lex_token 691 687 -4
bc_read_line 314 303 -11
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/7 up/down: 10/-25) Total: -15 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 16:55:08 +01:00
Denys Vlasenko
0409ad36a1
bc: restore printing of script name on errors
...
Examples:
On stdin, no file name is available:
$ echo 'print "' | busybox bc
bc: string end could not be found
When the same error is in file:
$ busybox bc FILE
bc 1.30.0.git
Copyright (c) 2018 Gavin D. Howard and contributors
Report bugs at: https://github.com/gavinhoward/bc
This is free software with ABSOLUTELY NO WARRANTY
FILE: string end could not be found
ready for more input
>>>
Line number printing to be added later...
function old new delta
bc_error_fmt 38 70 +32
bc_posix_error_fmt 60 90 +30
bc_vm_run 1900 1919 +19
bc_program_read 338 355 +17
bc_lex_file 15 12 -3
bc_program_stdin_name 8 - -8
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 4/1 up/down: 98/-11) Total: 87 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 16:39:22 +01:00
Denys Vlasenko
0ad36c46c7
bc: do not check for errors when parsing/running internal library
...
function old new delta
bc_lib_name 4 - -4
bc_vm_run 1921 1900 -21
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-25) Total: -25 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 16:21:43 +01:00
Denys Vlasenko
24fb2cd62f
bc: shrink error handling code by enabling tail-call optimization
...
function old new delta
bc_posix_error_fmt - 60 +60
bc_error_fmt - 38 +38
bc_error_bad_character - 17 +17
bc_parse_auto 302 313 +11
bc_num_ulong 93 103 +10
bc_error_variable_is_wrong_type - 10 +10
bc_error_stack_has_too_few_elements - 10 +10
bc_error_nested_read_call - 10 +10
bc_error_bad_token - 10 +10
bc_error_bad_expression - 10 +10
bc_num_d 561 564 +3
bc_program_assign 484 486 +2
dc_parse_parse 60 59 -1
bc_program_num 1130 1129 -1
bc_program_call 367 366 -1
bc_parse_stmt 2277 2276 -1
bc_lex_number 299 298 -1
bc_lex_name 91 90 -1
bc_func_insert 98 97 -1
bc_num_shift 74 72 -2
bc_vm_run 1924 1921 -3
bc_parse_endBody 424 420 -4
bc_lex_next 81 77 -4
bc_program_read 343 338 -5
bc_program_asciify 469 464 -5
bc_program_pushVar 221 215 -6
bc_program_print 784 778 -6
bc_program_prep 99 93 -6
bc_program_assignStr 167 161 -6
bc_parse_else 143 137 -6
bc_parse_body 124 118 -6
dc_parse_register 61 53 -8
dc_lex_token 699 691 -8
bc_program_modexp 756 746 -10
bc_parse_name 593 581 -12
dc_parse_expr 775 762 -13
bc_program_copyToVar 336 323 -13
bc_program_binOpPrep 324 311 -13
bc_program_execStr 561 543 -18
bc_program_exec 4150 4132 -18
bc_parse_parse 483 464 -19
bc_error 38 14 -24
bc_lex_token 1266 1237 -29
bc_posix_error 60 14 -46
bc_parse_expr 2194 2146 -48
------------------------------------------------------------------------------
(add/remove: 8/0 grow/shrink: 4/33 up/down: 191/-345) Total: -154 bytes
text data bss dec hex filename
987226 485 7296 995007 f2ebf busybox_old
987072 485 7296 994853 f2e25 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 16:03:46 +01:00
Denys Vlasenko
f359e004b0
bc: make 2^1000000 interruptible faster
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
68cc0a676e
bc: remove tabs from internal library
...
function old new delta
bc_lib 1877 1674 -203
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
51fb8aa5c1
bc: store library in ASCII, shrink keyword parsing code
...
Also, use ARRAY_SIZE() where appropriate
function old new delta
bc_lib 1878 1877 -1
bc_program_index 66 64 -2
bc_lex_token 1282 1266 -16
bc_lex_kws 220 160 -60
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-79) Total: -79 bytes
text data bss dec hex filename
987518 485 7296 995299 f2fe3 busybox_old
987440 485 7296 995221 f2f95 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
cb9a99f3bb
bc: drop bc_map_init() macro
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
7d62801db9
bc: create a few common functions
...
function old new delta
bc_char_vec_init - 12 +12
bc_vec_pop_all - 8 +8
bc_program_index 64 66 +2
bc_vec_string 64 61 -3
bc_vec_free 27 24 -3
bc_read_line 317 314 -3
bc_program_execStr 564 561 -3
bc_program_exec 4153 4150 -3
bc_program_copyToVar 340 336 -4
bc_parse_create 175 170 -5
dc_lex_token 705 699 -6
bc_program_reset 78 72 -6
bc_lex_number 305 299 -6
bc_program_read 353 343 -10
bc_program_addFunc 225 209 -16
bc_vm_run 1942 1924 -18
bc_parse_reset 181 163 -18
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 1/14 up/down: 22/-104) Total: -82 bytes
text data bss dec hex filename
987600 485 7296 995381 f3035 busybox_old
987518 485 7296 995299 f2fe3 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
d5f7703abb
bc: rewrite "BOOL * EXPR" idiom as if() statement
...
function old new delta
bc_program_index 66 64 -2
bc_program_num 1147 1130 -17
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-19) Total: -19 bytes
text data bss dec hex filename
987619 485 7296 995400 f3048 busybox_old
987600 485 7296 995381 f3035 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
17c5472c5a
bc: switch to SA_RESTART signal handling
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
d70d4a0235
bc: get rid of G.tty and G.flags
...
G.flags == option_mask32
function old new delta
bc_args 97 120 +23
dc_main 48 49 +1
bc_main 48 49 +1
bc_error 42 38 -4
bc_posix_error 65 60 -5
bc_read_line 325 317 -8
dc_lex_token 714 705 -9
bc_vm_run 2039 1942 -97
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/5 up/down: 25/-123) Total: -98 bytes
text data bss dec hex filename
987717 485 7296 995498 f30aa busybox_old
987619 485 7296 995400 f3048 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
9b70f197b4
bc: convert all status codes, remove bc_err_msgs[], bc_vm_error(), bc_vm_posixError()
...
function old new delta
bc_posix_error - 65 +65
bc_vm_run 1995 2039 +44
bc_err_line 7 - -7
bc_num_ulong 103 93 -10
bc_parse_parse 495 483 -12
bc_err_fmt 12 - -12
bc_warn_fmt 14 - -14
bc_parse_expr 2210 2194 -16
bc_program_reset 105 78 -27
bc_vm_process 130 94 -36
bc_parse_stmt 2313 2277 -36
bc_err_msgs 60 - -60
bc_lex_token 1367 1282 -85
bc_vm_error 143 - -143
bc_vm_posixError 189 - -189
------------------------------------------------------------------------------
(add/remove: 1/6 grow/shrink: 1/7 up/down: 109/-647) Total: -538 bytes
text data bss dec hex filename
988258 485 7296 996039 f32c7 busybox_old
987717 485 7296 995498 f30aa busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
60cf747b6c
bc: convert all non-POSIX BC_STATUS_foo codes
...
function old new delta
bc_program_asciify - 469 +469
bc_parse_parse 432 495 +63
dc_parse_expr 727 775 +48
bc_vm_run 1955 1995 +40
bc_program_num 1115 1147 +32
bc_program_binOpPrep 296 324 +28
static.msg - 24 +24
bc_parse_name 570 593 +23
bc_lex_token 1344 1367 +23
dc_lex_token 695 714 +19
bc_num_ulong 85 103 +18
bc_program_read 336 353 +17
dc_parse_parse 47 60 +13
bc_parse_stmt 2301 2313 +12
bc_parse_auto 291 302 +11
bc_program_prep 89 99 +10
bc_lex_next 71 81 +10
dc_parse_register 52 61 +9
bc_program_print 775 784 +9
bc_func_insert 89 98 +9
bc_program_assignStr 159 167 +8
bc_program_assign 476 484 +8
bc_parse_body 116 124 +8
bc_lex_name 83 91 +8
bc_program_pushVar 215 221 +6
bc_parse_text 141 147 +6
bc_num_shift 68 74 +6
bc_num_p 472 478 +6
bc_program_execStr 559 564 +5
bc_parse_else 139 143 +4
bc_lex_number 301 305 +4
bc_num_d 558 561 +3
bc_parse_endBody 422 424 +2
bc_num_r 231 230 -1
bc_program_copyToVar 343 340 -3
bc_program_call 372 367 -5
bc_parse_expr 2215 2210 -5
bc_program_modexp 763 756 -7
bc_err_msgs 164 60 -104
bc_program_pushArray 136 - -136
bc_program_exec 4453 4153 -300
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 31/7 up/down: 961/-561) Total: 400 bytes
text data bss dec hex filename
987766 485 7296 995547 f30db busybox_old
988258 485 7296 996039 f32c7 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
d38af48e0a
bc: convert BC_STATUS_EXEC_SIGNAL - its message string was never used
...
function old new delta
bc_vm_process 132 130 -2
bc_err_msgs 168 164 -4
dc_parse_parse 52 47 -5
bc_parse_reset 187 181 -6
bc_program_ready_msg 22 - -22
bc_program_exec 4478 4453 -25
bc_parse_parse 461 432 -29
bc_program_reset 159 105 -54
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/7 up/down: 0/-147) Total: -147 bytes
text data bss dec hex filename
987923 485 7296 995704 f3178 busybox_old
987766 485 7296 995547 f30db busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
abbc433d29
bc: convert BC_STATUS_PARSE_NO_AUTO
...
function old new delta
bc_parse_auto 275 291 +16
bc_err_msgs 172 168 -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 16/-4) Total: 12 bytes
text data bss dec hex filename
987911 485 7296 995692 f316c busybox_old
987923 485 7296 995704 f3178 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
04a1c763a6
bc: convert BC_STATUS_EXEC_MISMATCHED_PARAMS and BC_STATUS_EXEC_UNDEFINED_FUNC
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
a02f84472a
bc: BC_STATUS_VEC_ITEM_EXISTS is not a real error code, its message was never used
...
It was only used to indicate rusult of bc_map_insert() - did we insert, or
did we find that this key is already in the map?
function old new delta
bc_map_insert 142 145 +3
bc_program_addFunc 226 225 -1
bc_err_msgs 184 180 -4
bc_program_search 152 143 -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 3/-14) Total: -11 bytes
text data bss dec hex filename
987904 485 7296 995685 f3165 busybox_old
987873 485 7296 995654 f3146 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
bc5ce66617
bc: simplify bc_lex_comment()
...
function old new delta
bc_lex_token 1369 1344 -25
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
c1c2470f84
bc: handle BIN_FILE and LEX_BAD_CHAR errors at the site of detection
...
The most informative message can be generated at the location
where error is detected. The "error codes" are stupid:
print error meesage immediately, then just return "there was an error"
indicator.
All error codes will be converted. For now, converting these two.
For now, this and following changes will degrade error messages
quality. For example, file name and line number printouts may be lost.
This will be re-added later.
This change anlso fixes handling of invalid stdin input:
this used to cause interactive bc to exit:
....
>>> ς
bc: illegal character 0xcf
bc: illegal character 0x82
>>> _
function old new delta
bc_error - 42 +42
bc_lex_token 1333 1369 +36
dc_lex_token 675 695 +20
bc_read_line 311 325 +14
bc_num_a 456 454 -2
bc_err_msgs 188 184 -4
bc_num_ulong 95 85 -10
bc_vm_run 1984 1955 -29
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/4 up/down: 112/-45) Total: 67 bytes
text data bss dec hex filename
987828 485 7296 995609 f3119 busybox_old
987929 485 7296 995710 f317e busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
d4744adf35
bc: eliminate BC_STATUS_INPUT_EOF
...
function old new delta
fflush_and_check - 36 +36
bc_num_a 445 456 +11
bc_num_ulong 85 95 +10
bc_vm_run 1978 1984 +6
bc_num_s 246 252 +6
bc_err_msgs 192 188 -4
quit 38 32 -6
bc_vm_process 139 132 -7
bc_program_reset 172 159 -13
bc_parse_create 192 175 -17
bc_read_line 349 311 -38
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/6 up/down: 69/-85) Total: -16 bytes
text data bss dec hex filename
987844 485 7296 995625 f3129 busybox_old
987828 485 7296 995609 f3119 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
cfdc1334c3
bc: handle "limits" and "quit" immediately at parse time
...
No need to propagate a special exit code.
function old new delta
bc_parse_stmt 2197 2301 +104
quit - 38 +38
bc_read_line 344 349 +5
bc_program_reset 174 172 -2
bc_num_s 252 246 -6
bc_num_a 454 445 -9
bc_parse_parse 471 461 -10
bc_num_ulong 95 85 -10
bc_program_exec 4500 4478 -22
bc_vm_run 2006 1978 -28
bc_vm_process 291 139 -152
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/8 up/down: 147/-239) Total: -92 bytes
text data bss dec hex filename
987936 485 7296 995717 f3185 busybox_old
987844 485 7296 995625 f3129 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
01cabafd05
bc": drop unused error codes and strings
...
function old new delta
bc_err_msgs 216 192 -24
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-24) Total: -24 bytes
text data bss dec hex filename
988122 485 7296 995903 f323f busybox_old
987936 485 7296 995717 f3185 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
b8860a8892
bc: remove "error ids": serve no useful purpose, error message should be explanatory enough
...
function old new delta
bc_warn_fmt 17 14 -3
bc_err_fmt 15 12 -3
bc_vm_posixError 205 189 -16
bc_vm_error 156 138 -18
bc_errs 28 - -28
bc_err_ids 58 - -58
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 0/4 up/down: 0/-126) Total: -126 bytes
text data bss dec hex filename
988288 485 7296 996069 f32e5 busybox_old
988122 485 7296 995903 f323f busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
1f67e935ac
bc: reduce forward declarations
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
d9d66556d7
bc: use smaller datatypes for limits, match GNU bc 'limits' output
...
function old new delta
bc_vm_process 315 291 -24
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-24) Total: -24 bytes
text data bss dec hex filename
988303 485 7296 996084 f32f4 busybox_old
988273 485 7296 996054 f32d6 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
416ce76bcd
bc: better handle optional args of bc_program_pushVar()
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
9721f6c8b0
bc: tweak help text
...
-v is supported but not shown
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
a0c421c118
bc: simplify bc_vm_stdin()
...
function old new delta
bc_vm_run 2020 2006 -14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
71e1fc6b37
bc: only check for ^C in bc_program_exec() main loop
...
Checking it in individual operations such as SQRT is not necessary
since they usually do not take very long to complete. We repeatedly return
to main loop.
TODO: re-add more fine-grained ^C checks - but only with examples where it is
actually needed. E.g. I suspect simplest ops like addition or compare won't need it.
function old new delta
bc_program_index 66 64 -2
bc_num_s 258 246 -12
bc_num_cmp 294 275 -19
bc_num_compare 84 59 -25
bc_num_subArrays 74 47 -27
bc_num_a 474 445 -29
bc_program_exec 4530 4500 -30
bc_num_p 518 472 -46
bc_num_d 604 558 -46
bc_num_k 1005 957 -48
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/10 up/down: 0/-284) Total: -284 bytes
text data bss dec hex filename
988601 485 7296 996382 f341e busybox_old
988317 485 7296 996098 f3302 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
df51539ed0
bc: simpler calling convention for bc_read_file(), bc_program_search()
...
function old new delta
bc_vm_run 1854 2020 +166
bc_program_assign 482 476 -6
bc_program_pushVar 225 215 -10
bc_program_call 366 356 -10
bc_program_num 1126 1115 -11
bc_program_copyToVar 354 343 -11
bc_program_search 164 152 -12
bc_program_execStr 573 559 -14
bc_program_exec 4544 4530 -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/8 up/down: 166/-88) Total: 78 bytes
text data bss dec hex filename
988523 485 7296 996304 f33d0 busybox_old
988601 485 7296 996382 f341e busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
e3b4f23cf3
bc: bc_num_ulong2num(), bc_program_pushGlobal(), bc_program_stackLen() never fail
...
function old new delta
bc_num_ulong2num 66 62 -4
bc_num_printNum 572 563 -9
bc_program_exec 4562 4544 -18
bc_program_num 1147 1126 -21
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-52) Total: -52 bytes
text data bss dec hex filename
988575 485 7296 996356 f3404 busybox_old
988523 485 7296 996304 f33d0 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
a1d3ca2455
bc: stop passing around pointers to G.prog, they are all constant
...
function old new delta
bc_program_exec 4523 4562 +39
bc_program_assign 450 482 +32
bc_program_assignStr 131 159 +28
bc_program_print 762 775 +13
bc_program_num 1134 1147 +13
bc_program_search 154 164 +10
bc_num_ulong 85 95 +10
dc_parse_expr 719 727 +8
bc_program_retire 34 40 +6
bc_program_reset 168 174 +6
bc_program_binOpRetire 50 56 +6
bc_program_addFunc 220 226 +6
bc_program_prep 88 89 +1
dc_parse_init 18 17 -1
bc_program_copyToVar 355 354 -1
bc_parse_text 142 141 -1
bc_parse_number 88 87 -1
bc_parse_init 18 17 -1
bc_parse_endBody 423 422 -1
common_parse_init 29 26 -3
bc_parse_string 103 100 -3
bc_parse_addFunc 44 41 -3
bc_program_call 371 366 -5
bc_program_binOpPrep 301 296 -5
bc_program_read 342 336 -6
bc_parse_create 198 192 -6
bc_program_pushArray 143 136 -7
bc_parse_reset 194 187 -7
bc_vm_process 323 315 -8
bc_program_pushVar 236 225 -11
bc_vm_run 1872 1854 -18
bc_parse_name 590 570 -20
bc_program_execStr 594 573 -21
bc_program_modexp 793 763 -30
bc_program_printStream 172 - -172
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 13/21 up/down: 178/-331) Total: -153 bytes
text data bss dec hex filename
988728 485 7296 996509 f349d busybox_old
988575 485 7296 996356 f3404 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
f6c1da5ff3
bc: select parse_init() and parse_expr() using IS_BC, not function pointers
...
function old new delta
common_parse_expr - 62 +62
common_parse_init - 29 +29
dc_parse_parse 53 52 -1
dc_parse_expr 723 719 -4
bc_program_execStr 606 594 -12
dc_parse_init 33 18 -15
bc_parse_init 33 18 -15
bc_parse_expression 39 - -39
bc_vm_run 1923 1872 -51
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 0/6 up/down: 91/-137) Total: -46 bytes
text data bss dec hex filename
988774 485 7296 996555 f34cb busybox_old
988728 485 7296 996509 f349d busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
785e4b3057
bc: propagate fixed arguments into callees
...
Looks like there is only one "BcProgram" object, &G.prog.
function old new delta
bc_program_exec 4401 4523 +122
bc_program_execStr 579 606 +27
bc_program_read 323 342 +19
bc_args 83 97 +14
bc_vm_process 327 323 -4
bc_num_ulong 95 85 -10
dc_main 62 48 -14
bc_main 62 48 -14
bc_vm_run 2317 1923 -394
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/5 up/down: 182/-436) Total: -254 bytes
text data bss dec hex filename
989028 485 7296 996809 f35c9 busybox_old
988774 485 7296 996555 f34cb busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
ab3c568fd8
bc: simplify ^C handling
...
It's still buggy: if SIGINT would interrupt e.g. output write(),
the result would not be as intended:
>>> while ( 1 ) print 1
...
11111111111111111111111111111111111111111111111111111111111111111111\
11111111111111111111111111111111111111111111111111111111111111111111\
^Cready for more input
interrupt (type "quit" to exit)
>>> bc: output error
function old new delta
dc_parse_parse 58 53 -5
bc_parse_parse 476 471 -5
bc_num_d 609 604 -5
bc_num_cmp 299 294 -5
bc_num_compare 90 84 -6
bc_parse_expr 2222 2215 -7
bc_num_subArrays 82 74 -8
dc_main 72 62 -10
bc_main 72 62 -10
bc_program_exec 4413 4401 -12
bc_num_a 491 474 -17
bc_read_line 364 344 -20
bc_num_p 540 518 -22
bc_program_reset 192 168 -24
bc_num_k 1031 1005 -26
bc_vm_run 2382 2317 -65
bc_vm_sig 97 - -97
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/16 up/down: 0/-344) Total: -344 bytes
text data bss dec hex filename
989372 485 7296 997153 f3721 busybox_old
989028 485 7296 996809 f35c9 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
6d9146ab56
bc: convert to "G trick" - this returns bc to zero bss increase
...
function old new delta
bc_num_p 518 540 +22
bc_num_k 1010 1031 +21
bc_vm_process 312 327 +15
bc_program_exec 4401 4413 +12
bc_vm_posixError 194 205 +11
bc_num_a 480 491 +11
bc_program_reset 182 192 +10
bc_vm_sig 88 97 +9
bc_vm_error 148 156 +8
bc_parse_expr 2215 2222 +7
bc_num_compare 84 90 +6
dc_parse_parse 53 58 +5
dc_lex_token 670 675 +5
bc_read_line 359 364 +5
bc_parse_parse 471 476 +5
bc_num_cmp 294 299 +5
bc_num_subArrays 84 82 -2
bc_num_d 614 609 -5
dc_main 80 72 -8
bc_main 80 72 -8
bcg 40 - -40
bc_vm_run 2569 2382 -187
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 16/5 up/down: 157/-250) Total: -93 bytes
text data bss dec hex filename
989425 485 7336 997246 f377e busybox_old
989372 485 7296 997153 f3721 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
5a9fef5b59
bc: simplify, and restore ^C, fix ^D handling
...
^D used to enter infinite loop
function old new delta
bc_read_line 342 359 +17
bc_args_opt 8 - -8
dc_sig_msg 31 - -31
bc_sig_msg 34 - -34
bc_vm_run 2608 2569 -39
bc_args 123 83 -40
bc_args_lopt 81 - -81
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 1/2 up/down: 17/-233) Total: -216 bytes
text data bss dec hex filename
989491 485 7336 997312 f37c0 busybox_old
989425 485 7336 997246 f377e busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:43:35 +01:00
Denys Vlasenko
00d7779a35
bc: simplify, stop testing for IO errors on every output
...
function old new delta
bc_read_line 297 342 +45
bc_vm_run 2601 2608 +7
bc_program_reset 178 182 +4
bc_args 125 123 -2
dc_name 3 - -3
bc_name 3 - -3
bc_program_printStream 176 172 -4
bcg 48 40 -8
dc_main 97 80 -17
bc_main 97 80 -17
bc_vm_fflush 21 - -21
bc_vm_puts 23 - -23
bc_vm_printf 36 - -36
bc_vm_putchar 46 - -46
bc_vm_exit 46 - -46
bc_vm_process 361 312 -49
bc_vm_info 76 19 -57
bc_copyright 155 - -155
------------------------------------------------------------------------------
(add/remove: 0/8 grow/shrink: 3/7 up/down: 56/-487) Total: -431 bytes
text data bss dec hex filename
989722 485 7344 997551 f38af busybox_old
989491 485 7336 997312 f37c0 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:42:52 +01:00
Denys Vlasenko
ef869ec728
bc: fix warnings, initial cleanups
...
function old new delta
bc_program_exec - 4401 +4401
bc_vm_run - 2601 +2601
bc_parse_expr - 2215 +2215
bc_parse_stmt - 2197 +2197
bc_lib - 1878 +1878
bc_lex_token - 1333 +1333
bc_program_num - 1134 +1134
bc_num_k - 1010 +1010
bc_program_modexp - 793 +793
bc_program_print - 762 +762
dc_parse_expr - 723 +723
dc_lex_token - 670 +670
bc_num_d - 614 +614
bc_parse_name - 590 +590
bc_program_execStr - 579 +579
bc_num_printNum - 572 +572
bc_num_p - 518 +518
bc_num_a - 480 +480
bc_parse_parse - 471 +471
bc_program_assign - 450 +450
bc_parse_endBody - 423 +423
bc_program_call - 371 +371
dc_lex_tokens - 364 +364
bc_vm_process - 361 +361
bc_program_copyToVar - 355 +355
dc_parse_insts - 332 +332
bc_program_read - 323 +323
bc_program_binOpPrep - 301 +301
bc_lex_number - 301 +301
bc_read_line - 297 +297
bc_num_cmp - 294 +294
bc_num_m - 287 +287
bc_parse_auto - 275 +275
bc_num_s - 258 +258
bc_program_pushVar - 236 +236
bc_num_r - 231 +231
bc_program_addFunc - 220 +220
bc_lex_kws - 220 +220
bc_err_msgs - 216 +216
bc_parse_create - 198 +198
bc_vm_posixError - 194 +194
bc_parse_reset - 194 +194
bc_parse_operator - 181 +181
bc_program_reset - 178 +178
bc_program_printStream - 176 +176
bc_num_divmod - 168 +168
bc_copyright - 155 +155
bc_program_search - 154 +154
bc_num_binary - 150 +150
bc_vm_error - 148 +148
bc_program_pushArray - 143 +143
bc_parse_text - 142 +142
bc_num_printDigits - 142 +142
bc_map_insert - 142 +142
bc_parse_else - 139 +139
bc_program_assignStr - 131 +131
bc_args - 125 +125
dc_parse_mem - 116 +116
bc_parse_body - 116 +116
bc_num_split - 113 +113
bc_num_sub - 112 +112
bc_num_add - 112 +112
packed_usage 32958 33066 +108
bc_num_rem - 104 +104
bc_parse_string - 103 +103
bc_main - 97 +97
bc_num_ulong - 95 +95
bc_func_insert - 89 +89
bc_vm_sig - 88 +88
bc_program_prep - 88 +88
bc_parse_number - 88 +88
bc_array_expand - 88 +88
bc_num_subArrays - 84 +84
bc_num_compare - 84 +84
bc_lex_name - 83 +83
bc_args_lopt - 81 +81
bc_parse_pushIndex - 80 +80
bc_num_mul - 80 +80
bc_num_mod - 80 +80
bc_num_div - 80 +80
bc_vm_info - 76 +76
bc_program_name - 75 +75
bc_map_find - 71 +71
bc_lex_next - 71 +71
bc_num_printHex - 70 +70
bc_vec_concat - 68 +68
bc_num_shift - 68 +68
bc_num_extend - 68 +68
bc_program_index - 66 +66
bc_num_ulong2num - 66 +66
bc_num_retireMul - 66 +66
bc_parse_noElse - 65 +65
bc_vec_string - 64 +64
bc_parse_pushName - 63 +63
bc_parse_exprs - 60 +60
bc_err_ids - 58 +58
bc_result_free - 57 +57
bc_vec_npop - 55 +55
dc_parse_parse - 53 +53
bc_vec_push - 53 +53
bc_parse_free - 53 +53
bc_num_inv - 53 +53
dc_parse_register - 52 +52
dc_lex_regs - 52 +52
bc_lex_whitespace - 52 +52
bc_num_copy - 51 +51
bc_program_binOpRetire - 50 +50
bc_parse_ops - 50 +50
bc_map_index - 50 +50
bcg - 48 +48
bc_num_init - 48 +48
bc_parse_startBody - 47 +47
bc_num_pow - 47 +47
bc_vm_putchar - 46 +46
bc_vm_exit - 46 +46
bc_num_clean - 45 +45
bc_parse_addFunc - 44 +44
bc_vec_grow - 42 +42
bc_program_len - 42 +42
bc_num_truncate - 42 +42
bc_array_init - 42 +42
bc_parse_expression - 39 +39
bc_lex_lineComment - 39 +39
bc_num_expand - 38 +38
bc_vec_init - 37 +37
bc_vm_printf - 36 +36
bc_num_printNewline - 36 +36
bc_func_free - 35 +35
bc_sig_msg - 34 +34
bc_program_retire - 34 +34
bc_lex_assign - 34 +34
dc_parse_init - 33 +33
bc_parse_init - 33 +33
dc_sig_msg - 31 +31
bc_vec_expand - 30 +30
bc_num_ten - 30 +30
bc_num_one - 28 +28
bc_errs - 28 +28
bc_vec_free - 27 +27
bc_program_ops - 24 +24
bc_vm_puts - 23 +23
bc_num_printChar - 23 +23
bc_program_ready_msg - 22 +22
bc_vm_fflush - 21 +21
dc_main 77 97 +20
bc_parse_next_rel - 20 +20
bc_parse_next_read - 20 +20
bc_parse_next_print - 20 +20
bc_parse_next_param - 20 +20
bc_parse_next_for - 20 +20
bc_parse_next_expr - 20 +20
bc_parse_next_elem - 20 +20
bc_warn_fmt - 17 +17
bc_vec_pushByte - 15 +15
bc_string_free - 15 +15
bc_num_setToZero - 15 +15
bc_num_free - 15 +15
bc_lex_file - 15 +15
bc_id_free - 15 +15
bc_err_fmt - 15 +15
bc_vec_item_rev - 14 +14
bc_id_cmp - 12 +12
bc_num_zero - 11 +11
bc_vec_item - 9 +9
bc_program_stdin_name - 8 +8
bc_program_scale - 8 +8
bc_args_opt - 8 +8
bc_func_read - 7 +7
bc_func_main - 7 +7
bc_err_line - 7 +7
bc_lib_name - 4 +4
bc_args_env_name - 4 +4
applet_main 1604 1608 +4
dc_name - 3 +3
bc_name - 3 +3
applet_names 2781 2784 +3
static.bases 5 - -5
check_under 20 - -20
pop 24 - -24
print_no_pop 32 - -32
sub 34 - -34
divide 34 - -34
mul 37 - -37
add 37 - -37
push 38 - -38
print_stack_no_pop 40 - -40
not 72 - -72
set_output_base 95 - -95
or 103 - -103
eor 103 - -103
and 103 - -103
mod 105 - -105
stack_machine 116 - -116
operators 144 - -144
print_base 230 - -230
------------------------------------------------------------------------------
(add/remove: 173/20 grow/shrink: 4/0 up/down: 38089/-1372) Total: 36717 bytes
text data bss dec hex filename
950181 485 7296 957962 e9e0a busybox_old
989722 485 7344 997551 f38af busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:42:48 +01:00
Gavin Howard
01055ba89a
bc: new applet, throws warning
...
Signed-off-by: Gavin Howard <yzena.tech@gmail.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-05 15:40:38 +01:00
Ron Yorston
d08206dce1
vi: correctly detect when a deletion empties the buffer
...
Michał Berger has reported two issues:
- Repeatedly deleting and undoing the deletion of the last line
results in characters being lost from the end of the line.
- Deleting the bottom line twice then attempting to undo each of
these deletions results in a segfault.
The problem seems to be an incorrect test for whether the text buffer
is empty.
Reported-by: Michał Berger <michallinuxstuff@gmail.com >
Signed-off-by: Ron Yorston <rmy@pobox.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-12-03 10:07:58 +01:00
Denys Vlasenko
b733046069
vi: code shrink
...
function old new delta
char_search 241 247 +6
get_one_address 275 272 -3
colon 2878 2875 -3
do_cmd 4726 4720 -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 6/-12) Total: -6 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-29 14:39:52 +01:00
Denys Vlasenko
836d0a7ee4
vi: fix FEATURE_VI_REGEX_SEARCH to respect LIMITED (one-line) search
...
If busybox is compiled with FEATURE_VI_REGEX_SEARCH enabled, command
":s/x/y/" searches not only in the current line, but continues search
after it. This makes range searches (":1,3s/x/y/") work incorrect. For
example file "./test":
1
2
3
$ vi ./test
:1,2s/3/e/
gives us:
1
2
e
function old new delta
char_search 213 241 +28
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-29 14:19:57 +01:00
Denys Vlasenko
9a2b6dcc2d
libbb: do not misinterpret 0x10-0x19 chars in "\xNNN" too
...
function old new delta
bb_process_escape_sequence 141 151 +10
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-29 13:16:15 +01:00
Denys Vlasenko
480c7e5dfb
libbb: @ in "\x3@" is not a valid hex digit
...
function old new delta
bb_process_escape_sequence 134 141 +7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-29 12:34:50 +01:00
Denys Vlasenko
c100535571
cat,nl: fix handling of open errors
...
$ cat -n does_not_exist; echo $?
cat: does_not_exist: No such file or directory
1
function old new delta
print_numbered_lines 118 129 +11
nl_main 196 201 +5
cat_main 421 425 +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 20/0) Total: 20 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-29 11:44:10 +01:00
Denys Vlasenko
75a1c87357
awk: abort if NF set to negative value
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-28 12:16:29 +01:00
Chen Qi
572dfb8e78
testsuite: check CONFIG_DESKTOP before using 'od -t'
...
The '-t' option for od is enabled by CONFIG_DESKTOP. So
check this config before using 'od -t' in test cases.
Signed-off-by: Chen Qi <Qi.Chen@windriver.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-27 16:57:36 +01:00
Ron Yorston
71df2d3589
hush: allow hush to run embedded scripts
...
Embedded scripts require a shell to be present in the BusyBox
binary. Allow either ash or hush to be used for this purpose.
If both are enabled ash takes precedence.
The size of the binary is unchanged in the default configuration:
both ash and hush are present but support for embedded scripts
isn't compiled into hush.
Signed-off-by: Ron Yorston <rmy@pobox.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-27 16:13:07 +01:00
Denys Vlasenko
f4709d78cb
free: ensure there is a least one space between numbers
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-27 15:43:10 +01:00
Ron Yorston
31a04d91c2
docs: add embedded-scripts.txt
...
Signed-off-by: Ron Yorston <rmy@pobox.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-27 12:33:28 +01:00
Denys Vlasenko
403d2574be
tar: skip 'V' headers (GNU volume label), closes 11526
...
function old new delta
get_header_tar 1696 1690 -6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-27 12:09:01 +01:00
Denys Vlasenko
e80d04b574
unlzma: fix too-eager corruption check
...
function old new delta
unpack_lzma_stream 2686 2674 -12
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-27 11:52:14 +01:00
Denys Vlasenko
f4fc303e36
tar: fix too eager autodetection, closes 11531
...
function old new delta
is_suffixed_with - 54 +54
tar_main 1006 1026 +20
open_transformer 92 79 -13
config_file_action 478 458 -20
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/2 up/down: 74/-33) Total: 41 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-27 11:26:48 +01:00
Ron Yorston
2d217799e8
build system: prevent duplicate applet names
...
The embedded script feature makes it easier to create applets with
duplicate names. Currently in such cases the build succeeds but
the resulting executable doesn't work as the developer intended.
Catch duplicate names when the applet tables are being generated
and make the build fail.
Signed-off-by: Ron Yorston <rmy@pobox.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-27 10:47:06 +01:00
Ron Yorston
7b42f8fc76
Tweaks to build process for embedded scripts
...
- Force a rebuild if a script in applets_sh is changed.
- Move the dummy usage messages for custom applets to usage.h and
change the name from 'dummy' to 'scripted'.
- Hide an error from gen_build_files.sh if an embed directory exists
but is empty.
- Tidy up embedded_scripts script.
v2: Remove a couple of unnecessary tests in embedded_scripts, as
pointed out by Xabier Oneca.
Drop the stripping of comments.
Signed-off-by: Ron Yorston <rmy@pobox.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-27 10:38:10 +01:00
Denys Vlasenko
dffc8ff6a6
tls: add ECDHE_PSK and remove ARIA cipher ids
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-27 10:35:10 +01:00
Denys Vlasenko
8a46c74f8d
tls: add _anon_ cipher definitions
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-26 17:33:17 +01:00
Denys Vlasenko
2eb04290f9
tls: enable TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 cipher
...
function old new delta
static.ciphers 30 32 +2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-26 16:39:35 +01:00
Denys Vlasenko
60f784027e
tls: cipher 009D is not yet supported, don't test for it
...
function old new delta
tls_handshake 2116 2108 -8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-26 16:30:22 +01:00
Denys Vlasenko
d9f6c3b091
tls: speed up prf_hmac_sha256()
...
function old new delta
hmac_sha_precomputed - 58 +58
prf_hmac_sha256 181 222 +41
hmac_sha256 68 - -68
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/0 up/down: 99/-68) Total: 31 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-26 15:55:41 +01:00
Denys Vlasenko
f69f207490
libbb: add comment on sha384
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-26 13:00:28 +01:00
Denys Vlasenko
d4681c7293
tls: simplify hmac_begin()
...
function old new delta
hmac_begin 196 158 -38
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-26 10:33:23 +01:00
Denys Vlasenko
ca7cdd4b03
tls: add support for 8 more cipher ids - all tested to work
...
function old new delta
tls_handshake 2059 2116 +57
static.ciphers - 30 +30
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 87/0) Total: 87 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-26 00:17:10 +01:00
Denys Vlasenko
838b88c044
tls: fix comments
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-25 18:52:47 +01:00
Denys Vlasenko
330d7f53f7
tls: add a comment on expanding list of supported ciphers
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-25 17:27:48 +01:00
Denys Vlasenko
a6192f347f
tls: do not leak RSA key
...
function old new delta
tls_handshake 1957 2059 +102
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-25 16:17:26 +01:00
Denys Vlasenko
eb53d01be5
tls: code shrink
...
function old new delta
xwrite_and_update_handshake_hash 81 80 -1
tls_handshake 1987 1957 -30
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-25 14:45:55 +01:00
Denys Vlasenko
a33b008240
tls: code shrink
...
function old new delta
tls_handshake 1993 1987 -6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-25 14:28:32 +01:00
Denys Vlasenko
be5ca42e8d
tls: code shrink
...
function old new delta
aesgcm_GHASH 223 196 -27
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-25 14:03:59 +01:00
Denys Vlasenko
23d0d8caf4
tls: on x86, use xorbuf_aligned_AES_BLOCK_SIZE() even with non-aligned source
...
function old new delta
aesgcm_GHASH 228 223 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-25 12:02:45 +01:00
Denys Vlasenko
ab3c5e4c44
tls: actually fill in CIPHER_ID3 value in hello message
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-25 00:53:19 +01:00
Denys Vlasenko
0d18e5cab2
ntpd: do not SEGV on "-p keyno:192.168.1.1", show --help instead
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-25 00:42:56 +01:00
Denys Vlasenko
5084bae61a
wget: code shrink
...
function old new delta
base64enc 53 46 -7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-24 21:56:21 +01:00
Denys Vlasenko
d2923b3d23
tls: fix is.gd again, fix AES-CBC using decrypt key instead of encrypt
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-24 21:26:20 +01:00
Denys Vlasenko
03569bc50f
tls: speed up xor'ing of aligned 16-byte buffers
...
function old new delta
xorbuf_aligned_AES_BLOCK_SIZE - 23 +23
xwrite_encrypted 585 580 -5
aesgcm_GHASH 233 228 -5
GMULT 192 187 -5
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/3 up/down: 23/-15) Total: 8 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-24 14:08:29 +01:00
Denys Vlasenko
941440cf16
tls: in AES-GCM decoding, avoid memmove
...
function old new delta
xorbuf3 - 36 +36
xorbuf 24 12 -12
tls_xread_record 656 634 -22
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 36/-34) Total: 2 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-24 13:51:46 +01:00
Denys Vlasenko
985702c892
tls: fix a thinko in GHASH optimization
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-24 13:47:44 +01:00
Denys Vlasenko
624066f0cc
tls: make tls_get_random() FAST_FUNC
...
function old new delta
tls_handshake 1977 1985 +8
tls_get_random 32 28 -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 8/-4) Total: 4 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-23 19:24:57 +01:00
Denys Vlasenko
26602b85a3
wget: print the final newline only for non-tty output
...
$ busybox wget URL 2>&1 | cat
Connecting to ....
install.iso 0% | | 2629k 0:02:05 ETA
install.iso 7% |** | 25.7M 0:00:23 ETA
install.iso 16% |***** | 54.1M 0:00:14 ETA
install.iso 20% |****** | 67.4M 0:00:15 ETA
install.iso 25% |******** | 81.0M 0:00:14 ETA
install.iso 30% |********* | 97.3M 0:00:13 ETA
install.iso 36% |*********** | 117M 0:00:12 ETA
install.iso 41% |************* | 134M 0:00:11 ETA
install.iso 47% |*************** | 152M 0:00:10 ETA
install.iso 54% |***************** | 176M 0:00:08 ETA
install.iso 61% |******************* | 200M 0:00:06 ETA
install.iso 66% |********************* | 215M 0:00:06 ETA
install.iso 71% |********************** | 231M 0:00:05 ETA
install.iso 75% |************************ | 244M 0:00:04 ETA
install.iso 79% |************************* | 257M 0:00:03 ETA
install.iso 84% |*************************** | 275M 0:00:02 ETA
install.iso 91% |***************************** | 297M 0:00:01 ETA
install.iso 99% |******************************* | 321M 0:00:00 ETA
install.iso 100% |********************************| 323M 0:00:00 ETA
<-- no empty line here
$
function old new delta
bb_progress_update 622 632 +10
progress_meter 152 158 +6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 16/0) Total: 16 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-23 19:14:52 +01:00
Denys Vlasenko
fbf5e6363b
tls: code shrink
...
function old new delta
aesgcm_GHASH 262 233 -29
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-23 19:07:05 +01:00
Denys Vlasenko
d496b4002a
tls: typo fix in comment
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-23 19:00:12 +01:00
Denys Vlasenko
25569c3ca9
tls: make local buffers in aesgcm_GHASH() explicitly 32-bit aligned
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-23 18:55:15 +01:00
Denys Vlasenko
219c9d4b5d
tls: code shrink
...
function old new delta
xwrite_encrypted 599 585 -14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-23 18:48:20 +01:00
Denys Vlasenko
ecc9090cfc
tls: simplify aesgcm_GHASH()
...
function old new delta
xwrite_encrypted 604 599 -5
FlattenSzInBits 52 - -52
aesgcm_GHASH 395 262 -133
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/2 up/down: 0/-190) Total: -190 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-23 18:31:26 +01:00
Denys Vlasenko
5e4236d226
tls: in AES-CBC code, do not set key for every record - do it once
...
function old new delta
aes_setkey 16 212 +196
tls_handshake 1941 1977 +36
aes_encrypt_1 382 396 +14
xwrite_encrypted 605 604 -1
tls_xread_record 659 656 -3
aes_encrypt_one_block 65 59 -6
aes_cbc_encrypt 172 121 -51
aesgcm_setkey 58 - -58
aes_cbc_decrypt 958 881 -77
KeyExpansion 188 - -188
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 3/5 up/down: 246/-384) Total: -138 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-23 18:02:44 +01:00
Denys Vlasenko
83e5c627e1
tls: add support for TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 cipher
...
function old new delta
xwrite_encrypted 209 605 +396
GHASH - 395 +395
aes_encrypt_1 - 382 +382
GMULT - 192 +192
tls_xread_record 489 659 +170
aes_encrypt_one_block - 65 +65
aesgcm_setkey - 58 +58
FlattenSzInBits - 52 +52
tls_handshake 1890 1941 +51
xwrite_and_update_handshake_hash 46 81 +35
xorbuf - 24 +24
aes_setkey - 16 +16
psRsaEncryptPub 413 421 +8
stty_main 1221 1227 +6
ssl_client_main 138 143 +5
next_token 841 845 +4
spawn_ssl_client 218 219 +1
volume_id_probe_hfs_hfsplus 564 563 -1
read_package_field 232 230 -2
i2cdetect_main 674 672 -2
fail_hunk 139 136 -3
parse_expr 891 883 -8
curve25519 802 793 -9
aes_cbc_decrypt 971 958 -13
xwrite_handshake_record 43 - -43
aes_cbc_encrypt 644 172 -472
------------------------------------------------------------------------------
(add/remove: 9/1 grow/shrink: 9/8 up/down: 1860/-553) Total: 1307 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-23 17:48:07 +01:00
Christoph Schulz
03ad7ae081
ash: reset tokpushback before prompting while parsing heredoc
...
The parser reads from an already freed memory location, thereby causing
unpredictable results, in the following situation:
- ENABLE_ASH_EXPAND_PRMT is enabled
- heredoc is being parsed
- command substitution is used within heredoc
Examples where this bug crops up are (PS2 is set to "> "):
$ cat <<EOF
> `echo abc`
> EOF
-sh: O: not found
$ cat <<EOF
> $(echo abc)
> EOF
-sh: {garbage}: not found
The presumable reason is that setprompt_if() causes a nested expansion when
ENABLE_ASH_EXPAND_PRMT is enabled, therefore leaving "wordtext" in an unusable
state. However, when parseheredoc() is called, "tokpushback" is non-zero, which
causes the next call to xxreadtoken() to return TWORD, causing the caller to
use the invalid "wordtoken" instead of reading the next valid token.
The call chain is:
list()
-> peektoken() [sets tokpushback to 1]
-> parseheredoc()
-> setprompt_if()
-> pushstackmark()
-> expandstr()
-> readtoken1()
[sets lasttoken to TWORD, wordtoken points to expanded prompt]
-> popstackmark() [invalidates wordtoken, leaves lasttoken as is]
-> readtoken1()
-> ...parsebackq
-> list()
-> andor()
-> pipeline()
-> readtoken()
-> xxreadtoken()
[tokpushback non-zero, reuse lasttoken and wordtext]
Note that in almost all other contexts, each call to setprompt_if() is preceded
by setting "tokpushback" to zero. One exception is "oldstyle" backquote parsing
in readtoken1(), but there "tokpushback" is reset afterwards. The other
exception is nlprompt(), but this function is only used within readtoken1()
(but in contexts where no nested calls to xxreadtoken() occur) and xxreadtoken()
(where "tokpushback" is guaranteed to be zero).
function old new delta
parseheredoc 124 131 +7
Signed-off-by: Christoph Schulz <develop@kristov.de >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-20 17:45:52 +01:00
Denys Vlasenko
32511da87d
scripts/trylink: be more clever when deciding that "lib elimination" has finished:
...
Before:
Trying libraries: crypt m resolv
Library crypt is not needed, excluding it
Library m is needed, can't exclude it (yet)
Library resolv is needed, can't exclude it (yet)
Library m is needed, can't exclude it (yet)
Library resolv is needed, can't exclude it (yet)
Final link with: m resolv
After:
Trying libraries: crypt m resolv
Library crypt is not needed, excluding it
Library m is needed, can't exclude it (yet)
Library resolv is needed, can't exclude it (yet)
Final link with: m resolv
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-19 20:36:16 +01:00
Denys Vlasenko
4e46b98a45
tls: add comment, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-18 19:50:24 +01:00
Ron Yorston
af694a4b29
Ensure build works when KBUILD_OUTPUT is set, closes 11511
...
The build process for embedded scripts didn't have consistent
support for saving output to a different directory.
Signed-off-by: Ron Yorston <rmy@pobox.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-18 19:34:39 +01:00
Ron Yorston
d1b2ae2d04
busybox: add '--show SCRIPT' option to display scripts
...
Add an option to allow the content of embedded scripts to be
displayed. This includes applet scripts, custom scripts and the
.profile script.
function old new delta
busybox_main 624 701 +77
find_script_by_name - 24 +24
scripted_main 41 35 -6
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 101/-6) Total: 95 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-18 19:19:29 +01:00
Ron Yorston
3778898f97
Treat custom and applet scripts as applets
...
BusyBox has support for embedded shell scripts. Two types can be
distinguished: custom scripts and scripts implementing applets.
Custom scripts should be placed in the 'embed' directory at build
time. They are given a default applet configuration and appear
as applets to the user but no further configuration is possible.
Applet scripts are integrated with the BusyBox build system and
are intended to be used to ship standard applets that just happen
to be implemented as scripts. They can be configured at build time
and appear just like native applets.
Such scripts should be placed in the 'applets_sh' directory. A stub
C program should be written to provide the usual applet configuration
details and placed in a suitable subsystem directory. It may be
helpful to have a configuration option to enable any dependencies the
script requires: see the 'nologin' applet for an example.
function old new delta
scripted_main - 41 +41
applet_names 2773 2781 +8
applet_main 1600 1604 +4
i2cdetect_main 672 674 +2
applet_suid 100 101 +1
applet_install_loc 200 201 +1
applet_flags 100 101 +1
packed_usage 33180 33179 -1
tryexec 159 152 -7
evalcommand 1661 1653 -8
script_names 9 - -9
packed_scripts 123 114 -9
complete_cmd_dir_file 826 811 -15
shellexec 271 254 -17
find_command 1007 990 -17
busybox_main 642 624 -18
run_applet_and_exit 100 78 -22
find_script_by_name 51 - -51
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 6/9 up/down: 58/-174) Total: -116 bytes
text data bss dec hex filename
950034 477 7296 957807 e9d6f busybox_old
949918 477 7296 957691 e9cfb busybox_unstripped
Signed-off-by: Ron Yorston <rmy@pobox.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-17 21:16:33 +01:00
Ron Yorston
e6a63bf683
ash: ensure variables are fully initialised when unset
...
When a variable is unset by calling setvar(name, NULL, 0) the code
to initialise the new, empty variable fails to initialise the last
character of the string.
Attempts to read the contents of the unset variable will result
in the uninitialised character at the end of the string being
accessed.
For example, running BusyBox under Valgrind and unsetting PATH:
$ valgrind ./busybox_unstripped sh
==21249== Memcheck, a memory error detector
==21249== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==21249== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==21249== Command: ./busybox_unstripped sh
==21249==
/data2/git/build_fix_8721 $ unset PATH
/data2/git/build_fix_8721 $ 0
==21249== Conditional jump or move depends on uninitialised value(s)
==21249== at 0x451371: path_advance (ash.c:2555)
==21249== by 0x456E22: find_command (ash.c:13407)
==21249== by 0x458425: evalcommand (ash.c:10139)
==21249== by 0x454CBC: evaltree (ash.c:9131)
==21249== by 0x456C80: cmdloop (ash.c:13164)
Closes https://bugs.busybox.net/show_bug.cgi?id=8721
v2: On the dash mailing list Harald van Dijk was kind enough to point
out a flaw in my reasoning and provide an alternative patch. Sadly
his patch adds 2 bytes of bloat. Using xzalloc to zero the whole
string gives a bloat of -3 bytes.
function old new delta
setvar 172 169 -3
Signed-off-by: Ron Yorston <rmy@pobox.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-16 17:28:01 +01:00
Ron Yorston
060f0a050a
hush: correct description for HUSH_TICK config option
...
The HUSH_TICK configuration option enables command substitution,
not process substitution.
Signed-off-by: Ron Yorston <rmy@pobox.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-14 11:35:58 +01:00
Denys Vlasenko
fe836d8455
tls: code shrink
...
function old new delta
spawn_ssl_client 219 218 -1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-14 11:35:36 +01:00
Denys Vlasenko
dbe95682b4
wget: print "TLS certificate validation not implemented" only once on redirects
...
function old new delta
spawn_ssl_client 209 219 +10
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-13 12:00:19 +01:00
Denys Vlasenko
d5a0405a6f
tls: code shrink
...
function old new delta
tls_get_zeroed_outbuf - 28 +28
static.empty_client_cert 7 - -7
tls_handshake 1930 1890 -40
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/1 up/down: 28/-47) Total: -19 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-13 11:58:53 +01:00
Denys Vlasenko
de7b5bb59a
tls: tidy up recently added ECDSA code
...
function old new delta
tls_handshake 1935 1930 -5
static.OID_ECDSA_KEY_ALG 21 11 -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-15) Total: -15 bytes
text data bss dec hex filename
950036 477 7296 957809 e9d71 busybox_old
950048 477 7296 957821 e9d7d busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-13 11:44:32 +01:00
Denys Vlasenko
375fc78d51
tls: code shrink
...
function old new delta
static.f25519_one 32 - -32
curve25519 835 802 -33
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-65) Total: -65 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-13 03:15:15 +01:00
Denys Vlasenko
bddb6545a9
tls: add support for ECDHE-ECDSA-AES-128-CBC-SHA and x25519 curve
...
function old new delta
curve25519 - 835 +835
tls_handshake 1619 1935 +316
xc_diffadd - 230 +230
fe_mul__distinct - 149 +149
lm_sub - 103 +103
lm_add - 82 +82
fe_mul_c - 74 +74
fe_select - 45 +45
static.f25519_one - 32 +32
static.basepoint9 - 32 +32
static.OID_ECDSA_KEY_ALG - 21 +21
static.OID_RSA_KEY_ALG - 13 +13
static.supported_groups - 8 +8
static.empty_client_cert - 7 +7
der_binary_to_pstm 40 42 +2
static.expected 13 - -13
------------------------------------------------------------------------------
(add/remove: 14/1 grow/shrink: 2/0 up/down: 1949/-13) Total: 1936 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-13 02:17:54 +01:00
Ron Yorston
8767c12774
ash: minor fixes
...
Ensure that login_sh is initialised in procargs even when running
an embedded script.
The argc argument to ash_main isn't unused when embedded scripts
are present.
Signed-off-by: Ron Yorston <rmy@pobox.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-06 08:49:11 +01:00
Denys Vlasenko
084bac472b
tls: code shrink
...
function old new delta
tls_handshake 1643 1619 -24
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-05 00:19:15 +01:00
Denys Vlasenko
5df3b12241
tls: reorder a few more cipher ids
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-04 21:25:41 +01:00
Denys Vlasenko
b29d045581
tls: move TLS_AES_128_GCM_SHA256 definition up
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-04 21:18:29 +01:00
Denys Vlasenko
9b0ce4d608
tls: add more cipher ids, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-04 20:53:54 +01:00
Denys Vlasenko
9d05ad087e
udhcpc: code shrink
...
function old new delta
perform_release 112 172 +60
send_release 81 - -81
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 60/-81) Total: -21 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-03 23:34:35 +01:00
Denys Vlasenko
97c2a6d082
remove FAST_FUNC on a static function
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-02 14:20:54 +01:00
Denys Vlasenko
43794ff45d
scripts/embedded_scripts: do not add superfluous NUL to script_names[]
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-02 14:18:36 +01:00
Ron Yorston
c339c7f7b3
libarchive: add a function to unpack embedded data
...
Similar code to unpack embedded data is used to decompress usage
messages, embedded scripts and the config file (in the non-default
bbconfig applet).
Moving this code to a common function reduces the size of the default
build and hides more of the internals of libarchive.
function old new delta
unpack_bz2_data - 135 +135
bb_show_usage 137 157 +20
get_script_content 32 47 +15
unpack_scripts 119 - -119
unpack_usage_messages 124 - -124
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 2/0 up/down: 170/-243) Total: -73 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-02 14:14:51 +01:00
Denys Vlasenko
0df289f427
svlogd: fix pattern matching when using timestamps
...
function old new delta
svlogd_main 1488 1496 +8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-01 14:53:04 +01:00
Denys Vlasenko
0575c9932d
busybox: show embedded scripts in applet list
...
function old new delta
busybox_main 624 642 +18
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-01 13:58:16 +01:00
Ron Yorston
c9e161277e
lineedit: autocompletion for embedded scripts
...
function old new delta
complete_cmd_dir_file 811 826 +15
Signed-off-by: Ron Yorston <rmy@pobox.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-01 12:51:10 +01:00
Denys Vlasenko
b0df5af0fa
ash: fix thinko in last commit
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-01 12:50:33 +01:00
Ron Yorston
ca82b5354f
ash: in tryexec(), ensure we don't try to run embedded scripts as applets
...
Signed-off-by: Ron Yorston <rmy@pobox.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-01 11:48:21 +01:00
Ron Yorston
151de441e7
ash: recognize embedded scripts in SH_STANDALONE mode
...
function old new delta
find_script_by_name - 51 +51
shellexec 254 271 +17
find_command 990 1007 +17
evalcommand 1653 1661 +8
doCommands 2233 2222 -11
run_applet_and_exit 128 100 -28
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 6/4 up/down: 104/-52) Total: 52 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-01 11:07:26 +01:00
Denys Vlasenko
aa2959c90d
claenups for previous commit
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-01 10:28:04 +01:00
Denys Vlasenko
4f2ef4a836
ash: allow shell scripts to be embedded in the binary
...
To assist in the deployment of shell scripts it may be convenient
to embed them in the BusyBox binary.
'Embed scripts in the binary' takes any files in the directory
'embed', concatenates them with null separators, compresses them
and embeds them in the binary.
When scripts are embedded in the binary, scripts can be run as
'busybox SCRIPT [ARGS]' or by usual (sym)link mechanism.
embed/nologin is provided as an example.
function old new delta
packed_scripts - 123 +123
unpack_scripts - 87 +87
ash_main 1103 1171 +68
run_applet_and_exit 78 128 +50
get_script_content - 32 +32
script_names - 10 +10
expmeta 663 659 -4
------------------------------------------------------------------------------
(add/remove: 4/0 grow/shrink: 2/1 up/down: 370/-4) Total: 366 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-11-01 10:15:13 +01:00
Ron Yorston
552796791f
vi: remove duplicated code
...
At worst show_status_line() might be called needlessly when the
user presses ^L/^R, but I don't think we'll get many complaints
about that.
function old new delta
do_cmd 4592 4558 -34
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-34) Total: -34 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-10-31 12:51:51 +01:00
Rasmus Villemoes
656ca7bdd9
libbb/u_signal_names.c: don't check errno after bb_strtou
...
Since we're comparing the return value to a smallish integer anyway, we
might as well use that bb_strtou() returns UINT_MAX for malformed
input. Referencing errno is kinda bloaty on glibc.
While NSIG is not in POSIX, we do already rely on it being defined,
compile-time const and smallish, since arrays in struct globals_misc are
defined in terms of it.
function old new delta
get_signum 312 286 -26
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-10-31 11:28:37 +01:00
Rasmus Villemoes
571e525a14
libbb: optionally honour libc provided SIGRTMIN/SIGRTMAX in get_signum()
...
When an application documents that it responds such and such to
SIGRTMIN+n, that almost always means with respect to the libc-provided
SIGRTMIN. Hence I disagree with the "more correct" in commit
7b276fc175 . In any case, this is rather unfortunate:
36
34
(the first shell is bash). We probably can't change default behaviour
after 7 years, but at least we can provide a config option.
We avoid a little code generation (repeated calls to
__libc_current_sigrtmin) by stashing SIGRTMIN/SIGRTMAX in local
variables, but it does cost ~50 bytes. The next patch serves as penance
for that.
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-10-31 11:13:55 +01:00
Denys Vlasenko
93ef5dd640
printf: fix printf "%u\n" +18446744073709551614
...
function old new delta
conv_strtoll 19 32 +13
conv_strtoull 49 61 +12
bb_strtoll 89 84 -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 25/-5) Total: 20 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-10-30 23:24:18 +01:00
Denys Vlasenko
63d053d8c3
ntpd: default to FEATURE_NTP_AUTH=y
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-10-30 23:07:26 +01:00
Denys Vlasenko
9ab5a8d560
dd: do not have 'ocount' variable if ibs/obs support is not enabled
...
function old new delta
packed_usage 32964 32961 -3
dd_main 1033 1021 -12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-15) Total: -15 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-10-30 17:04:52 +01:00
Rostislav Skudnov
3f6a978a0d
dd: add 'oflag=seek_bytes'
...
Allow specifying position in the output file in bytes instead of
obs-sized blocks, improve compatibility with GNU dd.
function old new delta
dd_main 1632 1693 +61
packed_usage 33130 33150 +20
static.oflag_words - 12 +12
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/0 up/down: 93/0) Total: 93 bytes
Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-10-30 16:55:09 +01:00
Denys Vlasenko
f3e2838fc4
xargs: fix exit code if command exits nonzero, closes 11381
...
No code size change on x86.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-10-30 14:40:17 +01:00
Guillermo Rodriguez
c8e3922ad8
free: add 'available' memory if provided by the kernel
...
Show estimated available memory if this is provided by the
kernel. See [1] for the full story.
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773
function old new delta
free_main 537 633 +96
parse_cached_kb 85 - -85
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 96/-85) Total: 11 bytes
Signed-off-by: Guillermo Rodriguez <guille.rodriguez@gmail.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-10-30 13:49:51 +01:00
Jiří Prchal
47839ae679
examples/udhcp/simple.script: add possibility to use modern "ip"
...
Script uses "ifconfig" only, not up-to-date so much.
This patch adds "ip" in condition if exists.
Signed-off-by: Jiří Prchal <jiri.prchal@aksignal.cz >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-10-30 12:05:03 +01:00
Denys Vlasenko
c05aa6a776
udhcpc: ensure at least one unicast renew attempt
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-10-30 11:56:18 +01:00
Brandon P. Enochs
a541314b1f
ntpd: add support for MD5/SHA1 message authentication
...
Add support for MD5 message authentication as described in RFC 5905.
This patch also supports SHA1 authentication.
The key file format is the same file format as used by ntpd.
The configuration file format follows standard Unix conventions
(# comments) with lines consist of the following fields separated by whitespace:
<key identifier, [1,65535]> <SHA1|MD5> <an ASCII string of up to 20 characters|an octet string [a-zA-F0-9] of up to 40 characters>.
https://www.ietf.org/rfc/rfc5905.txt
function old new delta
ntp_init 473 987 +514
hash - 125 +125
recv_and_process_peer_pkt 889 961 +72
packed_usage 33066 33130 +64
ntpd_main 1226 1277 +51
find_key_entry - 29 +29
add_peers 195 207 +12
recv_and_process_client_pkt 509 514 +5
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 6/0 up/down: 872/0) Total: 872 bytes
Signed-off-by: Brandon P. Enochs <enochs.brandon@gmail.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-10-27 18:57:37 +02:00
Denys Vlasenko
4329116b6d
nbd-client: support newstyle protocol, -b, -d, -p, -N
...
Recognize the "newstyle" protocol and switch to it automatically.
Add options for setting blocksize (-b) and for disconnecting
a nbd device (-d).
function old new delta
nbdclient_main 492 1179 +687
static.long_options - 80 +80
print_direc 438 457 +19
brctl_main 1169 1183 +14
bb_strtoll 84 89 +5
packed_usage 33082 33066 -16
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/1 up/down: 805/-16) Total: 789 bytes
Signed-off-by: Elvira Khabirova <lineprinter@altlinux.org >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-10-24 15:52:04 +02:00
Bernhard Reutner-Fischer
3db4e7f84c
printf: fix printing +-prefixed numbers
...
Thanks to Cristian Ionescu-Idbohrn for noticing.
Also fix "%d" ' 42' to skip leading whitespace.
function old new delta
print_direc 435 454 +19
bb_strtoll 99 103 +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 23/0) Total: 23 bytes
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com >
2018-10-19 15:27:42 +02:00
Bernhard Reutner-Fischer
7effa31cd4
brctl: use a single buffer for brname and ifname
...
function old new delta
brctl_main 1681 1675 -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-6) Total: -6 bytes
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com >
2018-10-01 22:45:36 +02:00
Denys Vlasenko
349d72c19c
unzip: use printable_string() for printing filenames
...
function old new delta
unzip_main 2726 2792 +66
printable_string2 - 57 +57
identify 4329 4336 +7
expmeta 659 663 +4
add_interface 99 103 +4
beep_main 286 289 +3
changepath 192 194 +2
builtin_type 115 117 +2
devmem_main 469 470 +1
input_tab 1076 1074 -2
create_J 1821 1819 -2
poplocalvars 314 311 -3
doCommands 2222 2214 -8
do_load 918 902 -16
printable_string 57 9 -48
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 8/6 up/down: 146/-79) Total: 67 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-09-30 16:56:56 +02:00
Brandon Maier
14454b3071
ifupdown: support "source-directory" stanza
...
Support the "source-directory" stanza from ifupdown[1]. source-directory
will include all files in the named directory. Similar to the Busybox
version of the "source" stanza, this version of source-directory does
not currently support shell wildcards.
We only check that the stanza starts with "source-dir" as ifupdown does[2].
[1] https://manpages.debian.org/stretch/ifupdown/interfaces.5.en.html#INCLUDING_OTHER_FILES
[2] https://salsa.debian.org/debian/ifupdown/blob/0.8.33/config.c#L498
function old new delta
read_interfaces 1150 1241 +91
Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-09-30 13:23:05 +02:00
Denys Vlasenko
abfa3ec059
move storage helpers to libbb.h
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-09-28 15:13:04 +02:00
Denys Vlasenko
aae428f0bf
udhcpc: give SIGUSR1-induced renew one chance of unicast renew
...
The caps were inconsistent: timeout to renew was capped at 20 seconds,
and any renews with timeout <= 60 seconds were forced to broadcast.
function old new delta
udhcpc_main 2683 2680 -3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-09-28 14:44:09 +02:00
Martin Kaiser
702d865fe6
.gitignore: add ctags output files
...
Exuberant ctags creates an output file called "tags" by default or
"TAGS" when it's run in emacs mode. Add those two files to .gitignore so
they won't be removed by git clean -df.
Signed-off-by: Martin Kaiser <martin@kaiser.cx >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-09-26 10:05:27 +02:00
Martin Kaiser
d1cd3da1e5
mdev.txt: explain the meaning of a leading "-"
...
If a line in mdev.conf starts with "-", parsing will continue even if
a match is found in that line.
Signed-off-by: Martin Kaiser <martin@kaiser.cx >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-09-25 13:20:17 +02:00
Denys Vlasenko
706a9a03bb
sed: fix double-free in FEATURE_CLEAN_UP code
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-09-25 12:50:54 +02:00
Denys Vlasenko
76832ff5c4
date: do not allow "month #20 " and such, closes 11356
...
function old new delta
parse_datestr 906 961 +55
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-09-23 20:27:32 +02:00
Thomas De Schampheleire
6608879d34
head: convert existing tests to new-style
...
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-09-22 19:40:35 +02:00
Thomas De Schampheleire
e0f617699f
head: add test case for negative -n invocation
...
Commit 2da9724b56 broke 'head -n -1' and was
later reverted with 0d598ab9f0 .
This commit adds a test case to avoid future breakage.
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-09-22 19:40:35 +02:00
Denys Vlasenko
426aff88a0
init: hopefully fix "rebooting" in containers
...
function old new delta
pause_and_low_level_reboot 48 57 +9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-09-22 19:30:40 +02:00
Denys Vlasenko
1303962957
ntpd: more verbose message for "root distance too high" case
...
Managed to make ntpd on one of my machines to be stuck getting
"root distance too high" all the time, but log is not giving me
more informatin what exactly is happening...
function old new delta
select_and_cluster 1045 1095 +50
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-09-13 12:15:36 +02:00
Chen Yu
05b18065ab
remove_file: don't call rmdir if remove_file return failure
...
When deleting a directory, the directory should not be removed if the
file in the subdirectory fails to be deleted.
Background information:
When I tested the kernel using LTP (linux-test-project).I found the
mv command have some issue. The LTP test case use the mv command to
move the directory t1 in the cgroup file system to the /tmp directory.
becase files in the cgroup file system are not allowed to be removed.
so the mv reported "Permission denied", but I used the ls command to
view the results and found that the directory t1 had been removed
from the cgroup file system. For the same test case, I used the mv
tool in the GNU coreutils, and the directory t1 will not be removed.
the following testcase use busybox mv:
/ # mount -t cgroup -o cpu cgroup /cpu
/ # cd /cpu
/cpu # mkdir -p t1
/cpu # ls
cgroup.clone_children cpu.cfs_period_us cpu.stat t1
cgroup.procs cpu.cfs_quota_us notify_on_release tasks
cgroup.sane_behavior cpu.shares release_agent
/cpu # mv t1 /tmp
mv: can't remove 't1/cgroup.procs': Operation not permitted
mv: can't remove 't1/cpu.cfs_period_us': Operation not permitted
mv: can't remove 't1/cpu.stat': Operation not permitted
mv: can't remove 't1/cpu.shares': Operation not permitted
mv: can't remove 't1/cpu.cfs_quota_us': Operation not permitted
mv: can't remove 't1/tasks': Operation not permitted
mv: can't remove 't1/notify_on_release': Operation not permitted
mv: can't remove 't1/cgroup.clone_children': Operation not permitted
/cpu # ls
cgroup.clone_children cpu.cfs_period_us cpu.stat cgroup.procs
cpu.cfs_quota_us notify_on_release tasks cgroup.sane_behavior
cpu.shares release_agent
/cpu #
This patch fixed it, don't call rmdir if remove_file return failure,
and under certain file systems, the mv could work normally.
Signed-off-by: Chen Yu <yu.chen3@zte.com.cn >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-09-09 20:16:04 +02:00
Denys Vlasenko
3d6f95ede6
whois: fix a possible out-of-bounds stack access
...
If fgets() returns incomplete string, we replace NUL with
'\n', and then trim() runs on a non-NUL-terminated buffer.
Prevent that.
While at it, bump buffer from 1k to 2k.
function old new delta
query 519 524 +5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-09-04 14:48:00 +02:00
sagivd
8f1ae25634
chcon: fix issues with recurse and retval for retained files
...
- recurse is not acting as expected (looks like broken old code)
- when not using verbose output, return value for retained files is 1,
which is not expected.
Signed-off-by: sagivd <sagivdev@gmail.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-09-03 16:02:26 +02:00
Denys Vlasenko
28d91d754e
libbb: fix potential NULL pointer use
...
function old new delta
unicode_conv_to_printable2 193 216 +23
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-09-03 10:36:51 +02:00
Denys Vlasenko
3060992ec9
libbb: fix use-after-free in copy_file
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-09-03 10:25:29 +02:00
Denys Vlasenko
22a9951620
libbb: in xmalloc_fgets(), use size_t for bb_get_chunk_from_file()
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-09-02 18:48:09 +02:00
Denys Vlasenko
0d598ab9f0
Revert "libbb: remove unnecessary variable in xmalloc_fgets"
...
The variable is in fact necessary.
commit 2da9724b56
Author: Quentin Rameau <quinq@fifth.space >
Date: Sun Apr 1 17:05:35 2018 +0200
libbb: remove unnecessary variable in xmalloc_fgets
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-09-02 18:35:29 +02:00
Denys Vlasenko
270becc240
smemcap: keep outputting by ignoring transient processes, take two
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-30 11:49:51 +02:00
Andre Goddard Rosa
9a2621a3b9
smemcap: keep outputting by ignoring transient processes
...
function old new delta
archivefile 167 176 +9
Signed-off-by: Andre Goddard Rosa <andre.rosa@lge.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-26 17:37:30 +02:00
Peter Korsgaard
9d539f9fbd
sysklogd: add timestamp option to ignore message timestamps
...
Some syslog producers provide inconsistent timestamps, so provide an option
to ignore the message timestamps and always locally timestamp. In order to
implement this, invert the valid-timestamp check, but only use the timestamp
if this option is not enabled.
This is in line with what what other syslogd implementations do:
From sysklogd syslogd.c:
* Sun Nov 7 12:28:47 CET 2004: Martin Schulze <joey@infodrom.org >
* Discard any timestamp information found in received syslog
* messages. This will affect local messages sent from a
* different timezone.
rsyslog's imuxsock module similary has an (enabled by default)
IgnoreTimestamp option:
https://www.rsyslog.com/doc/v8-stable/configuration/modules/imuxsock.html
function old new delta
packed_usage 32877 32912 +35
timestamp_and_log 363 376 +13
syslogd_main 1638 1641 +3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 51/0) Total: 51 bytes
Signed-off-by: Peter Korsgaard <peter@korsgaard.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-26 17:31:21 +02:00
Denys Vlasenko
6791140123
fix !CONFIG_FLOAT_DURATION build
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-26 16:32:16 +02:00
Denys Vlasenko
78a5ef9d2c
ping: use setitimer() instead of ualarm()
...
function old new delta
sendping_tail 218 265 +47
ualarm 79 - -79
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/0 up/down: 47/-79) Total: -32 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-25 19:36:06 +02:00
Denys Vlasenko
3759516672
ip: tweak --help text
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-14 11:19:09 +02:00
Denys Vlasenko
c97df2939e
hush: tweak comment, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-14 11:04:58 +02:00
Denys Vlasenko
4bf0854248
hush: add a comment on how globbing (should) work
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-11 18:44:11 +02:00
Denys Vlasenko
eb54ca8be0
ash: expand: Do not quote backslashes in unquoted parameter expansion
...
Upstream commit:
Date: Wed, 28 Mar 2018 18:37:51 +0800
expand: Do not quote backslashes in unquoted parameter expansion
Here is a better example:
a="/*/\nullx" b="/*/\null"; printf "%s\n" $a $b
dash currently prints
/*/\nullx
/*/\null
bash prints
/*/\nullx
/dev/null
You may argue the bash behaviour is inconsistent but it actually
makes sense. What happens is that quote removal only applies to
the original token as seen by the shell. It is never applied to
the result of parameter expansion.
Now you may ask why on earth does the second line say "/dev/null"
instead of "/dev/\null". Well that's because it is not the quote
removal step that removed the backslash, but the pathname expansion.
The fact that the /de\v does not become /dev even though it exists
is just the result of the optimisation to avoid unnecessarily
calling stat(2). I have checked POSIX and I don't see anything
that forbids this behaviour.
So going back to dash yes I think we should adopt the bash behaviour
for pathname expansion and keep the existing case semantics.
This patch does exactly that. Note that this patch does not work
unless you have already applied
https://patchwork.kernel.org/patch/10306507/
because otherwise the optimisation mentioned above does not get
detected correctly and we will end up doing quote removal twice.
This patch also updates expmeta to handle naked backslashes at
the end of the pattern which is now possible.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
function old new delta
expmeta 618 653 +35
memtodest 146 147 +1
Tested to work with both ASH_INTERNAL_GLOB on and off.
hush does not handle this correctly.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-07 18:58:02 +02:00
Denys Vlasenko
77c18491b8
hush: adopt ash's quote_in_varexp1.tests
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-05 20:03:04 +02:00
Denys Vlasenko
2596f412cd
ash: exec: Return 126 on most errors in shellexec
...
Upstream commit:
Date: Sat, 19 May 2018 02:39:37 +0800
exec: Return 126 on most errors in shellexec
Currently when shellexec fails on most errors the shell will exit
with exit status 2. This patch changes it to 126 in order to avoid
ambiguities with the exit status from a successful exec.
The errors that result in 127 has also been expanded to include
ENOTDIR, ENAMETOOLONG and ELOOP.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
function old new delta
shellexec 245 254 +9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-05 18:11:15 +02:00
Denys Vlasenko
1c5eb88cd8
ash: eval: Restore input files in evalcommand
...
Upstream commit:
Date: Tue, 27 Mar 2018 00:39:35 +0800
eval: Restore input files in evalcommand
When evalcommand invokes a command that modifies parsefile and
then bails out without popping the file, we need to ensure the
input file is restored so that the shell can continue to execute.
Reported-by: Martijn Dekker <martijn@inlv.org >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
function old new delta
unwindfiles - 20 +20
evalcommand 1635 1653 +18
getoptscmd 584 595 +11
popallfiles 20 10 -10
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/1 up/down: 49/-10) Total: 39 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-05 18:11:15 +02:00
Denys Vlasenko
58eb805c2c
ash: parser: Fix parsing of ${}
...
Upstream commit:
Date: Tue, 3 Apr 2018 00:40:25 +0800
parser: Fix parsing of ${}
dash -c 'echo ${}' should print "Bad subtitution" but instead
fails with "Syntax error: Missing '}'". This is caused by us
reading an extra character beyond the right brace. This patch
fixes it so that this construct only fails during expansion rather
than during parsing.
Fixes: 3df3edd13389 ("[PARSER] Report substition errors at...")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
function old new delta
readtoken1 2907 2916 +9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-05 18:11:15 +02:00
Denys Vlasenko
19358cc313
ash,hush: fold shell_builtin_read() way-too-many params into a struct param
...
function old new delta
getoptscmd 587 584 -3
readcmd 240 224 -16
shell_builtin_read 1426 1399 -27
builtin_read 210 182 -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-74) Total: -74 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-05 18:11:15 +02:00
Denys Vlasenko
fd6f295a98
hush: set IFS to default on startup
...
function old new delta
hush_main 1095 1110 +15
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-05 18:11:15 +02:00
Denys Vlasenko
e9dccab9f4
hush: fix fallout from FILE->HFILE conversion
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-05 18:11:15 +02:00
Denys Vlasenko
440da97ed7
ash: expand: Fix ghost fields with unquoted $@/$*
...
Upstream commit:
Date: Fri, 23 Mar 2018 18:58:47 +0800
expand: Fix ghost fields with unquoted $@/$*
You're right. The proper fix to this is to ensure that nulonly
is not set in varvalue for $*. It should only be set for $@ when
it's inside double quotes.
In fact there is another bug while we're playing with $@/$*.
When IFS is set to a non-whitespace character such as :, $*
outside quotes won't remove empty fields as it should.
This patch fixes both problems.
Reported-by: Martijn Dekker <martijn@inlv.org >
Suggested-by: Harald van Dijk <harald@gigawatt.nl >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
function old new delta
argstr 1111 1113 +2
evalvar 571 569 -2
varvalue 579 576 -3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 2/-5) Total: -3 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-05 14:29:58 +02:00
Denys Vlasenko
67dae152f4
ash: var: Set IFS to fixed value at start time
...
Upstream commit:
Date: Sat, 19 May 2018 02:39:43 +0800
var: Set IFS to fixed value at start time
This patch forces the IFS variable to always be set to its default
value, regardless of the environment.
It also removes the long unused IFS_BROKEN code.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-05 13:59:35 +02:00
Denys Vlasenko
9abf53beb4
ash: eval: Variable assignments on functions are no longer persistent
...
Upstream commit:
Date: Wed, 4 Apr 2018 17:54:01 +0800
eval: Variable assignments on functions are no longer persistent
Dirk Fieldhouse <fieldhouse@gmx.net > wrote:
> In POSIX.1-2017 ("simultaneously IEEE Std 1003.1™-2017 and The Open
> Group Technical Standard Base Specifications, Issue 7")
> <http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09 >,
> we read under '2.9.1 Simple Commands'
>
> "Variable assignments shall be performed as follows:
> ...
> - If the command name is a standard utility implemented as a function
> (see XBD Utility), the effect of variable assignments shall be as if the
> utility was not implemented as a function.
> ...
> - If the command name is a function that is not a standard utility
> implemented as a function, variable assignments shall affect the current
> execution environment during the execution of the function. It is
> unspecified:
>
> * Whether or not the variable assignments persist after the
> completion of the function
>
> * Whether or not the variables gain the export attribute during
> the execution of the function
>
> * Whether or not export attributes gained as a result of the
> variable assignments persist after the completion of the function (if
> variable assignments persist after the completion of the function)"
POSIX used to require the current dash behaviour. However, you're
right that this is no longer the case.
This patch will remove the persistence of the variable assignment.
I have considered the exporting the variables during the function
execution but have decided against it because:
1) It makes the code bigger.
2) dash has never done this in the past.
3) You cannot use this portably anyway.
Reported-by: Dirk Fieldhouse <fieldhouse@gmx.net >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
function old new delta
evalcommand 1606 1635 +29
evalcase 313 317 +4
evalfun 280 268 -12
pushlocalvars 48 - -48
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 2/1 up/down: 33/-60) Total: -27 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-05 11:14:11 +02:00
Denys Vlasenko
c2aa218f23
ash,hush: properly handle ${v//pattern/repl} if pattern starts with /
...
Closes 2695
function old new delta
parse_dollar 762 790 +28
subevalvar 1258 1267 +9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 37/0) Total: 37 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-04 22:25:28 +02:00
Denys Vlasenko
2005d3ff36
tar: fix a thinko in prev commit - we need to copy to _unused_ fd
...
function old new delta
vfork_compressor 257 246 -11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-04 21:06:02 +02:00
Denys Vlasenko
037759bb4f
tar: handle the case when opened created tarball happens to have fd#0
...
Reproducer:
exec 0>&-
exec 1>&-
tar czf z.tar.gz FILE
function old new delta
vfork_compressor 229 257 +28
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-04 18:15:19 +02:00
Denys Vlasenko
45d68c3749
tar: make source code a bit more terse, no logic changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-04 17:48:59 +02:00
Denys Vlasenko
3f2e963768
uptime: add -s support
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-03 19:53:49 +02:00
Denys Vlasenko
277e00ed12
Complie libbb/duration.c if ping[6] is selected
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-03 18:51:46 +02:00
Denys Vlasenko
36d198ec6d
ping: implement -i SEC
...
function old new delta
common_ping_main 1862 1968 +106
ualarm - 79 +79
packed_usage 32858 32897 +39
sendping_tail 204 218 +14
------------------------------------------------------------------------------
(add/remove: 5/0 grow/shrink: 3/0 up/down: 320/0) Total: 320 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-03 18:50:50 +02:00
Denys Vlasenko
c9720a761e
timeout: fix arguments to match coreutils
...
Was: timeout [-t SECS] [-s SIG] PROG ARGS
Is: timeout [-s SIG] SECS PROG ARGS
function old new delta
timeout_main 312 319 +7
packed_usage 32882 32858 -24
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 7/-24) Total: -17 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-03 18:28:17 +02:00
Denys Vlasenko
4c20d9f2b0
extend fractional duration support to "top -d N.N" and "timeout"
...
function old new delta
parse_duration_str - 168 +168
sleep_for_duration - 157 +157
top_main 885 928 +43
timeout_main 269 312 +43
handle_input 571 614 +43
duration_suffixes - 40 +40
sfx 40 - -40
sleep_main 364 79 -285
------------------------------------------------------------------------------
(add/remove: 4/1 grow/shrink: 3/1 up/down: 494/-325) Total: 169 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-03 18:17:12 +02:00
Denys Vlasenko
9b1c8bf89b
ntpd: show real, unclamped delays on low-latency networks
...
On fast network, I've seen "delay:0.002000" shown for all packets,
thus completely losing information on what real delays are.
The new code is careful to not reject packets with tiny delays
if the delay "grows a lot" but is still tiny:
0.000009 is "much larger" than 0.000001 (nine times larger),
but is still very good small delay.
function old new delta
recv_and_process_peer_pkt 863 889 +26
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-03 11:14:22 +02:00
Lauri Kasanen
a380aacca6
ls: When -h is passed, the total should also be in human units
...
Signed-off-by: Lauri Kasanen <cand@gmx.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-01 19:47:15 +02:00
Denys Vlasenko
9408978a43
nslookup: add support for search domains, closes 11161
...
function old new delta
parse_resolvconf - 311 +311
add_query_with_search - 105 +105
nslookup_main 873 757 -116
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/1 up/down: 416/-116) Total: 300 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-01 19:42:46 +02:00
Denys Vlasenko
d01c9aa7ca
cp: placate gcc8
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-01 18:29:41 +02:00
Jon Kolb
4e30c67fa0
Add chroot support to chpasswd
...
function old new delta
.rodata 170689 170724 +35
packed_usage 32850 32876 +26
chpasswd_main 411 436 +25
chpasswd_longopts 34 41 +7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 93/0) Total: 93 bytes
Signed-off-by: Jon Kolb <kolbyjack@gmail.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-01 15:33:41 +02:00
Denys Vlasenko
02cf149ed7
udhcpc: add a cooment about sanitizing DHCP_DOMAIN_NAME, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-01 13:36:36 +02:00
Denys Vlasenko
48ec979ed1
udhcpc: do in fact not allow hostname components which start with dash
...
function old new delta
xmalloc_optname_optval 879 893 +14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-08-01 13:16:05 +02:00
Denys Vlasenko
3550bc494d
sendmail: use on-stack buffer for AUTH PLAIN
...
function old new delta
sendmail_main 1335 1307 -28
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-31 18:07:20 +02:00
Denys Vlasenko
884ea1c172
sendmail: code shrink 2
...
function old new delta
sendmail_main 1366 1335 -31
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-31 17:36:31 +02:00
Denys Vlasenko
8d634a08c4
sendfile: code shrink
...
function old new delta
printstr_base64 - 22 +22
printbuf_base64 - 11 +11
printfile_base64 - 9 +9
makemime_main 305 294 -11
encode_n_base64 236 223 -13
sendmail_main 1380 1366 -14
encode_base64 36 - -36
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 0/3 up/down: 42/-74) Total: -32 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-31 17:30:08 +02:00
Raffaello D. Di Napoli
f28b8857a9
sendmail: support AUTH PLAIN in addition to AUTH LOGIN
...
Implement the -am argument to allow choosing an AUTH method.
For now only PLAIN and LOGIN are supported, but others can be added
easily in the future.
AUTH PLAIN required adding a new variant of encode_base64() capable of
handling NUL characters in the input string; the old function is now a
wrapper for the newer one.
function old new delta
encode_n_base64 - 236 +236
sendmail_main 1199 1380 +181
packed_usage 32873 32877 +4
encode_base64 242 36 -206
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/1 up/down: 421/-206) Total: 215 bytes
Signed-off-by: Raffaello D. Di Napoli <rafdev@dinapo.li >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-31 17:17:40 +02:00
Denys Vlasenko
c16ae469ef
klogd: code shrink
...
function old new delta
klogd_main 511 486 -25
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-31 16:50:26 +02:00
Baruch Siach
3d07446cef
install.sh: don't clobber dangling symlinks
...
Symlinks in a subdirectory that is to become target rootfs are sometimes
dangling because they link to canonical file names that are not present
on the host, but are present relative to the target rootfs root. Don't
copy over dangling symlinks when noclobber is enabled
The -e test treats dangling symlinks as non-existent files. Add -h test
that returns true for all symlinks.
Cc: Yann E. MORIN <yann.morin.1998@free.fr >
Signed-off-by: Baruch Siach <baruch@tkos.co.il >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-31 15:49:19 +02:00
Denys Vlasenko
e8073519d8
klogd: better help text
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-31 15:25:00 +02:00
Denys Vlasenko
54fdabda3b
hush: speed up ${var:+ARG} for literal ARGs
...
function old new delta
first_special_char_in_vararg - 52 +52
expand_one_var 2248 2296 +48
encode_then_expand_vararg 357 336 -21
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 100/-21) Total: 79 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-31 10:36:29 +02:00
Denys Vlasenko
a5db1d7354
hush: fix another case where empty "for" wasn't setting exitcode to 0
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-28 12:42:08 +02:00
Denys Vlasenko
a8e7441176
hush: disable debug_indent increment/decrement for HUSH_DEBUG < 2 builds
...
function old new delta
run_list 1063 1046 -17
parse_stream 2296 2249 -47
run_pipe 1890 1840 -50
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-114) Total: -114 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-28 12:16:30 +02:00
Denys Vlasenko
aa449c927d
hush: make "set -x" output don't redirectable when fd#2 redirected
...
function old new delta
x_mode_print_optionally_squoted - 120 +120
x_mode_flush - 68 +68
save_fd_on_redirect 208 243 +35
x_mode_prefix - 27 +27
x_mode_addblock - 23 +23
x_mode_addchr - 17 +17
dump_cmd_in_x_mode 110 85 -25
run_pipe 1919 1890 -29
print_optionally_squoted 145 - -145
------------------------------------------------------------------------------
(add/remove: 5/1 grow/shrink: 1/2 up/down: 290/-199) Total: 91 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-28 12:13:58 +02:00
Denys Vlasenko
4b70c926bc
hush: make "set -x" output closer to bash
...
function old new delta
print_optionally_squoted - 145 +145
run_pipe 1902 1919 +17
dump_cmd_in_x_mode 142 110 -32
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 162/-32) Total: 130 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-27 17:43:39 +02:00
Denys Vlasenko
9dda9270df
hush: fix "set -x" output prefix overlapping for v="..cmd.." case
...
Was printing initial "+" prefix for the assignment, that printing
"+ cmd"
then printing the expanded " v=VAL" string.
Delay printing of "+" prefix for the assignment to after expansion.
function old new delta
run_pipe 1883 1902 +19
builtin_eval 127 133 +6
expand_vars_to_list 1103 1106 +3
dump_cmd_in_x_mode 144 142 -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 28/-2) Total: 26 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-27 14:12:05 +02:00
Denys Vlasenko
186cf49767
hush: in some cases, expand_on_ifs() relied of uninitialized memory
...
The n > 0 check to prevent access to the last byte of non-existing argv[-1]
wasn't enough. Switched to making sure there are initialized (zero) bytes there.
A predictable testcase is rather hard to construct, unfortunately,
contents of memory depends on allocator behavior and whatnot.
function old new delta
o_save_ptr_helper 119 137 +18
expand_on_ifs 345 339 -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 18/-6) Total: 12 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-27 12:14:39 +02:00
Denys Vlasenko
7c5f18a3ba
hush: improve set -x: make "+++" indent level increase in cmd and eval.
...
function old new delta
dump_cmd_in_x_mode 126 144 +18
run_pipe 1873 1883 +10
builtin_eval 119 127 +8
expand_vars_to_list 1100 1103 +3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 39/0) Total: 39 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-26 15:21:50 +02:00
Denys Vlasenko
871bd2abac
examples/var_service: add /var/run flag file to ntp.script
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-26 13:45:33 +02:00
Denys Vlasenko
79153cb6bc
htpd: increase MIN_FREQHOLD by 3
...
This means we'll start correcting frequency ~5 minutes after start,
not ~3.5 ones.
With previos settings I still often see largish ~0.7s initial offsets
only about 1/2 corrected before frequency correction kicks in,
resulting in ~200ppm "correction" which is then slowly undone.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-25 14:58:49 +02:00
Denys Vlasenko
1ab3899d49
fdisk: code shrink
...
function old new delta
get_nonexisting_partition 119 104 -15
fdisk_main 2640 2622 -18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-33) Total: -33 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-25 14:42:53 +02:00
Denys Vlasenko
c104549b48
fdisk: sync up with some util-linux 2.31 behavior
...
= display default is no longer in cylinders
= +sizeC is no longer supported
= add +sizeT suffix - terabytes are here
= K,M,G,T and k,m,g,t suffixes all are binary, not decimal
= +sizeM results in last sector +(size * 1Mbyte - 1), not +(size * 1Mbyte)
= fix comparison to "YES" answer for sgi/sun
function old new delta
read_int 492 519 +27
fdisk_main 2644 2640 -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 27/-4) Total: 23 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-25 13:52:30 +02:00
Denys Vlasenko
163e637ffb
fdisk: use strtoul[l] instead of atoi, closes 11176
...
Couldn't create partitions bigger than 1TB (when using 512 bytes sectors,
on 32 bits architectures).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-25 12:08:26 +02:00
Denys Vlasenko
81de30de05
gzip: unbreak FEATURE_GZIP_LEVELS, closes 11171
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-24 21:12:58 +02:00
Denys Vlasenko
945e9b05c9
hush: fix/explain corner cases of redirection colliding with script fd
...
function old new delta
save_fd_on_redirect 200 208 +8
run_pipe 1870 1873 +3
setup_redirects 321 322 +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 12/0) Total: 12 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-24 18:01:22 +02:00
Denys Vlasenko
63c42afaa4
hush: add "heredoc.tests" from ash, tweak ash "is a function" message
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-24 17:10:18 +02:00
Denys Vlasenko
41ef41b3e0
hush: fix nested redirects colliding with script fds
...
This necessitates switch from libc FILE api to a simple
homegrown replacement.
The change which fixes the bug here is the deleting of
restore_redirected_FILEs();
line. It was prematurely moving (restoring) script fd#3.
The fix is: we don't even _want_ to restore scrit fds,
we are perfectly fine with them being moved.
The only reason we tried to restore them is that FILE api
did not allow moving of FILE->fd.
function old new delta
refill_HFILE_and_getc - 93 +93
hfopen - 90 +90
hfclose - 66 +66
pseudo_exec_argv 591 597 +6
hush_main 1089 1095 +6
builtin_source 209 214 +5
save_fd_on_redirect 197 200 +3
setup_redirects 320 321 +1
fgetc_interactive 235 236 +1
i_peek_and_eat_bkslash_nl 99 97 -2
expand_vars_to_list 1103 1100 -3
restore_redirects 99 52 -47
fclose_and_forget 57 - -57
remember_FILE 63 - -63
------------------------------------------------------------------------------
(add/remove: 3/2 grow/shrink: 6/3 up/down: 271/-172) Total: 99 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-24 16:54:41 +02:00
Denys Vlasenko
dfc7394763
hush: handle backslash-newline in heredoc terminators
...
function old new delta
fetch_heredocs 479 527 +48
(ash fails this test)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-24 14:03:18 +02:00
Denys Vlasenko
474cb20555
hush: fix handling of heredocs not enclosed in groups where they are "declared"
...
function old new delta
fetch_heredocs - 479 +479
parse_and_run_stream 146 148 +2
parse_stream 2787 2296 -491
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 481/-491) Total: -10 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-24 13:03:03 +02:00
Denys Vlasenko
3675c37b9b
hush: fix heredoc handling in the "cmd <<EOF ;<newline>" case
...
function old new delta
parse_stream 2759 2787 +28
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-23 16:31:21 +02:00
Denys Vlasenko
d73cdbf84c
hush: fix handling of heredocs starting with empty lines
...
function old new delta
parse_stream 2748 2759 +11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-23 15:43:57 +02:00
Denys Vlasenko
ca2f831ead
hexedit: fixes for redraw and down movement causing SEGV on attempt to access
...
"Go to:" command was not updating row position, making next "down" movements
for one screenful print empty lines instead of showing the contents.
If the file is whole pages long, "down" movement at EOF was advancing position
+16 bytes, mapping the next portion (entirely past the end of the file),
then finding out that the new position is beyond the EOF, rolling it back
-16 bytes... ending up with this postion pointing *before* the mapped portion.
Any next access (e.g. "move right" key) SEGVs.
function old new delta
hexedit_main 1170 1184 +14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-23 14:26:55 +02:00
Denys Vlasenko
f36caa4071
hush: never glob result of dquoted "${v:+/bin/c*}"
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-20 19:29:41 +02:00
Denys Vlasenko
4c3c8a1a61
hush: tidy up code after previous commits
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-20 19:11:09 +02:00
Denys Vlasenko
1856740ec0
hush: better names for o_free_unsafe() / o_free(), no logic changes
...
o_free() made o_string NULL-initialized,
o_free_unsafe() did not bother reinitializing (expected caller to not need it).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-20 17:51:31 +02:00
Denys Vlasenko
83e434d5b5
hush: fix handling of '' in ${var:+ARG}
...
This wasn't an ash bug in dollar_altvalue9, it was hush bug (and bash!)
function old new delta
expand_one_var 2236 2254 +18
expand_vars_to_list 1097 1103 +6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 24/0) Total: 24 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-20 17:36:06 +02:00
Denys Vlasenko
294eb4612c
hush: fix word splitting in ${v:+ARG} - dollar_altvalue1 test
...
ash might be a bit buggy, need to investigate dollar_altvalue9 test
function old new delta
expand_one_var 1639 2236 +597
expand_variables 112 128 +16
expand_vars_to_list 1117 1097 -20
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 613/-20) Total: 593 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-20 16:29:43 +02:00
Denys Vlasenko
57235beb69
hush: expand_vars_to_list() should not assume it starts new word
...
function old new delta
expand_variables 112 115 +3
expand_vars_to_list 1117 1108 -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 3/-9) Total: -6 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-20 16:27:26 +02:00
Denys Vlasenko
18e8b61292
hush: remove pointless "next" var, simplify expand_vars_to_list()
...
function old new delta
o_addstr - 26 +26
expand_vars_to_list 1112 1117 +5
encode_then_expand_vararg 398 382 -16
parse_dollar 779 762 -17
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/2 up/down: 31/-33) Total: -2 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-20 16:27:26 +02:00
Denys Vlasenko
168579a34c
hush: store "ended_in_ifs" flag in o_string
...
This simplifies function parameter passing.
function old new delta
expand_one_var 1643 1639 -4
append_str_maybe_ifs_split 64 52 -12
expand_vars_to_list 1125 1112 -13
expand_on_ifs 361 345 -16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-45) Total: -45 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-20 16:27:26 +02:00
Denys Vlasenko
8a6a461504
hush: propagate (output,n) parameters into expand_one_var()
...
This is necessary since expand_one_var() for ${var:+ARG} must create more than one
output word, and thus can't simply return a char*.
function old new delta
expand_one_var 1610 1643 +33
expand_vars_to_list 1139 1125 -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 33/-14) Total: 19 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-20 16:27:26 +02:00
Denys Vlasenko
116b50a5c1
hush: make expand_vars_to_list() a bit more sane
...
function old new delta
append_str_maybe_ifs_split - 64 +64
expand_vars_to_list 1167 1139 -28
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 64/-28) Total: 36 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-20 16:27:26 +02:00
Denys Vlasenko
e36a5894bd
hush: reduce indentation, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-18 16:12:23 +02:00
Denys Vlasenko
2e71101e31
hush: fix 'x=; echo ${x:-"$@"}' producing 'BUG in varexp2' message
...
function old new delta
expand_string_to_string 126 128 +2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-18 16:02:25 +02:00
Denys Vlasenko
8b08d5a502
hush: smaller code to set o_string to ""
...
function old new delta
encode_then_expand_vararg 399 398 -1
parse_stream 2753 2748 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-18 15:50:04 +02:00
Denys Vlasenko
4c201c00a3
whitespace fixes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-17 15:04:17 +02:00
Denys Vlasenko
0d2e0de42b
hush: faster/smaller code to check for presense of multiple chars in string
...
Go over the string only once.
function old new delta
encode_then_expand_string 126 105 -21
encode_then_expand_vararg 443 399 -44
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-65) Total: -65 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-17 14:33:19 +02:00
Denys Vlasenko
b762c784ca
hush: improve ${var#...}, ${var:+...} and ${var/.../...} - handle quoting
...
dollar_altvalue1 test partially fails: word splitting of unquoted ${var:+...}
is not correct
function old new delta
encode_then_expand_vararg - 443 +443
expand_one_var 1599 1610 +11
parse_stream 2756 2753 -3
encode_string 250 242 -8
setup_heredoc 308 298 -10
expand_and_evaluate_arith 106 96 -10
encode_then_expand_string 142 126 -16
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/5 up/down: 454/-47) Total: 407 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-17 14:21:38 +02:00
Denys Vlasenko
1fbb73fc4c
cp: add missing quote in config snippet
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-17 00:16:16 +02:00
Denys Vlasenko
b0441a7189
hush: shrink code in builtin_eval
...
function old new delta
builtin_eval 126 119 -7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-15 18:03:56 +02:00
Denys Vlasenko
8717b14f37
grep: accept and ignore --color[=anything]
...
function old new delta
grep_main 827 834 +7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-13 20:40:40 +02:00
Denys Vlasenko
79fb6ac7a5
cp: optional --reflink support
...
function old new delta
cp_main 428 512 +84
copy_file 1676 1742 +66
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-13 20:30:02 +02:00
Denys Vlasenko
253f555f01
usage: do not print trailing space for commands which have no arguments
...
function old new delta
bb_show_usage 120 130 +10
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-09 18:23:33 +02:00
Denys Vlasenko
cbe8c65e59
sort: add -V "sort version"
...
function old new delta
packed_usage 32855 32858 +3
get_key 500 503 +3
sort_opt_str 36 37 +1
sort_main 1037 1036 -1
compare_keys 795 783 -12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 7/-13) Total: -6 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-08 01:37:54 +02:00
Denys Vlasenko
008e73b572
find: implement -executable
...
function old new delta
func_executable - 19 +19
parse_params 1505 1519 +14
static.params 216 228 +12
packed_usage 32847 32855 +8
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/0 up/down: 53/0) Total: 53 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-06 21:04:41 +02:00
Denys Vlasenko
9be4d4fe44
cpio: if longopts are enabled, accept --null (synonym for -0)
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-06 20:50:30 +02:00
Denys Vlasenko
4d0e2d5b6d
tweak help texts
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-06 20:49:08 +02:00
Denys Vlasenko
abe22cd17b
find: implement -quit
...
function old new delta
packed_usage 32816 32846 +30
find_main 446 464 +18
func_quit - 13 +13
parse_params 1495 1505 +10
static.params 210 216 +6
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/0 up/down: 77/0) Total: 77 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-06 20:35:35 +02:00
haroon maqsood
4a85d56c4c
nproc: implement --all --ignore=N
...
function old new delta
nproc_main 98 242 +144
packed_usage 32799 32816 +17
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 161/0) Total: 161 bytes
Signed-off-by: haroon maqsood <maqsood3525@live.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-06 16:19:04 +02:00
Raffaello D. Di Napoli
6f09785b7e
sendmail: fix parsing of addresses in angle brackets
...
Pointer e needs to be wound back in order to overwrite '>' with '\0'.
Regression introduced in 20077c1429
Signed-off-by: Raffaello D. Di Napoli <rafdev@dinapo.li >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-04 16:18:35 +02:00
Denys Vlasenko
2cd81698ee
udhcp: add decimal option values in comments, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-04 16:05:48 +02:00
Denys Vlasenko
6d26744a2c
udhcp: tweak comment indentation, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-04 15:44:22 +02:00
Jeremy Kerr
fc267214f0
udhcp: add option 211, "reboot time"
...
As defined in RFC 5071.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-04 15:38:19 +02:00
Denys Vlasenko
14339191af
examples/var_service/: use standard logger script, viewer and pager scripts
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-03 23:23:09 +02:00
Denys Vlasenko
aa75a7da7f
examples/var_service/: use "svc" for service commands, other tweaks
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-03 17:02:50 +02:00
Denys Vlasenko
e5d5f5b9a7
hexdump: fix short file of zero butes treated as dup
...
function old new delta
bb_dump_dump 1466 1491 +25
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-03 16:29:06 +02:00
Denys Vlasenko
9634e8a7d5
wget: fix fetching of https URLs without http proxy
...
The "fix fetching of https URLs with http proxy" commit
broke the usual http-to-https redirect:
$ wget http://busybox.net/downloads/busybox-1.29.0.tar.bz2
Connecting to busybox.net (140.211.167.122:80)
Connecting to busybox.net (140.211.167.122:443)
wget: server returned error: HTTP/1.1 400 Bad Request
Fixing...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-02 18:31:02 +02:00
Denys Vlasenko
029bd187bd
ntpd: increase minimum G.FREQHOLD_cnt from 8 to 10
...
With ~0.9 initiall offsets, using 8 results in a bit too eager
frequency correction.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-02 16:18:34 +02:00
Denys Vlasenko
0dbcb46af5
Start 1.30.0 development cycle
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-01 17:18:47 +02:00
Denys Vlasenko
10a3817440
Bump version to 1.29.0
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-07-01 16:38:52 +02:00
Denys Vlasenko
335766602b
testsuite/mount.tests: fix false positive
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-28 14:10:00 +02:00
Denys Vlasenko
8825cb6660
vi: placate "warning: variable orig_buf set but not used"
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-27 15:11:36 +02:00
Denys Vlasenko
4c58f246d4
testsuite/pidof.tests: fix false positive take 2
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-27 14:50:00 +02:00
Denys Vlasenko
39043ad25e
vi: placate "warning: statement with no effect"
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-27 14:46:08 +02:00
Denys Vlasenko
2f7738e474
nslookup: placate "warning: unused variable i"
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-27 14:44:35 +02:00
Denys Vlasenko
332a191e7f
testsuite/tar.tests: fix false positive
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-27 14:35:56 +02:00
Denys Vlasenko
33eae28710
testsuite/pidof.tests: fix false positive
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-27 14:26:21 +02:00
Denys Vlasenko
94593799f7
testsuite/bzcat.tests: fix false positive take 2
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-27 13:15:10 +02:00
Denys Vlasenko
d8799b90f3
testsuite/unexpand/unexpand-works-like-GNU: fix false positive
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-27 12:54:57 +02:00
Denys Vlasenko
a429d5d0f3
testsuite/bzcat.tests: fix false positive
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-27 10:35:45 +02:00
Denys Vlasenko
5738823dff
testsuite/tar.tests: fix false positive
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-27 10:01:49 +02:00
Denys Vlasenko
751005020d
testsuite/cat.tests: fix false positive
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-27 09:57:30 +02:00
Denys Vlasenko
57dbe4d5ac
libbb: crypt() in newer glibc requires include <crypt.h>
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-27 09:45:20 +02:00
Denys Vlasenko
35a017c0c5
hush: unset_local_var_len is only used by unset_local_var
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-26 18:27:54 +02:00
Denys Vlasenko
b2b14cbd4c
hush: fix compile problem found by randomconfig
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-26 18:09:22 +02:00
Denys Vlasenko
762440b20e
scripts/randomtest: disable CONFIG_NSLOOKUP for uclibc
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-26 17:22:35 +02:00
Denys Vlasenko
185326613d
scripts/randomtest: disable CONFIG_FEATURE_INETD_RPC for glibc
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-26 16:08:22 +02:00
Denys Vlasenko
5f5119be97
scripts/randomtest: disable CONFIG_FEATURE_MOUNT_NFS for glibc
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-26 16:03:24 +02:00
Denys Vlasenko
d1a83234c0
hush: fix dup_CLOEXEC() call without "avoid_fd" parameter
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-26 15:50:33 +02:00
Denys Vlasenko
8ef9effaa5
fdisk: placate warning of strncpy not copying NUL byte
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-26 15:44:58 +02:00
Denys Vlasenko
c96bb2c5ab
hush: fix for !ENABLE_HUSH_MODE_X configuration
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-26 15:43:56 +02:00
Denys Vlasenko
99496dc716
hush: variable nesting code is used also if HUSH_FUNCTIONS is not enabled
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-26 15:36:58 +02:00
Denys Vlasenko
817a20296f
randomconfig fixes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-26 15:35:17 +02:00
Ivan Abrea
5cb4f9081f
tls: fix to handle X.509 v1 certificates correctly
...
The syntax of public key certificates can be found in RFC 5280 section
4.1. The relevant part of the syntax is the following:
TBSCertificate ::= SEQUENCE {
version [0] EXPLICIT Version DEFAULT v1,
serialNumber CertificateSerialNumber,
... remaining fields omitted ...
}
The version field has a default value of v1. RFC 5280 section 4.1.2.1
says the following:
If only basic fields are present, the version SHOULD be 1 (the value
is omitted from the certificate as the default value); however, the
version MAY be 2 or 3.
To help detect if the version field is present or not, the type of the
version field has an explicit tag of [0]. Due to this tag, if the
version field is present, its encoding will have an identifier octet
that is distinct from that of the serialNumber field.
ITU-T X.690 specifies how a value of such a type should be encoded with
DER. There is a PDF of X.690 freely available from ITU-T. X.690 section
8.1.2 specifies the format of identifier octets which is the first
component of every encoded value. Identifier octets encode the tag of a
type. Bits 8 and 7 encode the tag class. Bit 6 will be 0 if the encoding
is primitive and 1 if the encoding is constructed. Bits 5 to 1 encode
the tag number.
X.690 section 8.14 specifies what the identifier octet should be for
explicitly tagged types. Section 8.14.3 says if implicit tagging is not
used, then the encoding shall be constructed. The version field uses
explicit tagging and not implicit tagging, so its encoding will be
constructed. This means bit 6 of the identifier octet should be 1.
X.690 section 8.14 and Annex A provide examples. Note from their
examples that the notation for tags could look like [APPLICATION 2]
where both the tag class and tag number are given. For this example, the
tag class is 1 (application) and the tag number is 2. For notation like
[0] where the tag class is omitted and only the tag number is given, the
tag class will be context-specific.
Putting this all together, the identifier octet for the DER encoding of
the version field should have a tag class of 2 (context-specific), bit 6
as 1 (constructed), and a tag number of 0.
Signed-off-by: Ivan Abrea <ivan@algosolutions.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-24 20:05:24 +02:00
Codarren Velvindron
7c43d43117
ntpd: deprecate IPTOS_LOWDELAY in favor of IPTOS_DSCP_AF21
...
Update QoS markers.
Use DSCP AF21 for interactive traffic. DSCP is defined in RFC2474.
Many modern equipment no longer support IPTOS.
Signed-off-by: Codarren Velvindron <codarren@hackers.mu >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-24 20:03:55 +02:00
Denys Vlasenko
e56e091d65
examples: update /var/service/getty for Unicode ttys
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-23 13:55:13 +02:00
Denys Vlasenko
34254f9dde
install: fix "-D -t DIR1/DIR2/DIR3" creating only DIR1/DIR2, closes 11106
...
function old new delta
install_main 758 767 +9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-22 18:59:10 +02:00
Denys Vlasenko
148788eb0e
udhcpc: remove code which requires server ID to be on local network
...
This reverts "udhcpc: paranoia when using kernel UDP mode
for sending renew: server ID may be bogus".
Users complain that they do have servers behind routers
(with DHCP relays).
function old new delta
send_packet 168 166 -2
bcast_or_ucast 25 23 -2
udhcp_send_kernel_packet 301 295 -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-10) Total: -10 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-21 17:38:14 +02:00
Eli Schwartz
6fb8bd795c
Update release script to generate detached signatures and checksum files
...
This is more usable for programmatically checking the validity of a
release.
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-09 21:19:35 +02:00
Kartik Agaram
43b17b1cd0
restore documentation on the build config language
...
Kconfig-language.txt was deleted in commit 4fa499a17b back in 2006.
Move to docs/ as suggested by Xabier Oneca:
http://lists.busybox.net/pipermail/busybox/2014-May/080914.html
Also update references to it everywhere.
Signed-off-by: Kartik Agaram <akkartik@gmail.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-06-06 15:16:48 +02:00
Denys Vlasenko
0972c7f7a5
wget: emit a message that certificate verification is not implemented
...
function old new delta
spawn_ssl_client 185 209 +24
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-05-28 14:36:26 +02:00
Denys Vlasenko
8bc418f07e
fdisk: remove "Partition N does not end on cylinder boundary" message
...
fdisk from util-linux 2.31 (maybe earlier) does not print this.
function old new delta
check_consistency 449 399 -50
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-05-26 18:51:18 +02:00
Denys Vlasenko
bf7f103ffb
whitespace fix
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-05-26 17:42:00 +02:00
Denys Vlasenko
a36986bb80
unlzma: close another SEGV possibility
...
function old new delta
unpack_lzma_stream 2669 2686 +17
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-05-25 17:03:46 +02:00
David Decotigny
8f48fc01e9
udhcpc6: carry along length of packet when parsing it.
...
This is to avoid parsing garbage past packet's actual end.
Also const-ize params to a few functions.
function old new delta
d6_run_script_no_option - 12 +12
option_to_env 791 798 +7
d6_run_script 253 255 +2
perform_d6_release 95 93 -2
udhcpc6_main 2596 2592 -4
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/2 up/down: 21/-6) Total: 15 bytes
Signed-off-by: David Decotigny <ddecotig@gmail.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-05-24 18:34:56 +02:00
David Decotigny
a174c791ec
udhcpc6: ignore invalid OPTION_IAADDR
...
Signed-off-by: David Decotigny <ddecotig@gmail.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-05-24 18:26:01 +02:00
Denys Vlasenko
747162109f
realpath,readlink -f: coreutils compat, closes 11021
...
function old new delta
xmalloc_realpath_coreutils - 121 +121
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-05-24 17:31:00 +02:00
Denys Vlasenko
3f91e662f2
nc: fix the !NC_SERVER configuration
...
The symptom is the "nc: NO OPT l!" message.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-05-24 16:38:40 +02:00
Denys Vlasenko
ccb8e4bc4f
fsck: fix incorrect handling of child exit
...
In commit
c4fb8c6a - fsck: do not use statics
not only statics were changed but also a couple of
statics-unrelated changes were made.
This included the handling of the child termination status
as follows:
- if (WIFEXITED(status))
- status = WEXITSTATUS(status);
- else if (WIFSIGNALED(status)) {
+ status = WEXITSTATUS(status);
+ if (WIFSIGNALED(status)) {
This is wrong, should have used a different variable to hold exit code.
Reported by Niklas Hambüchen <mail@nh2.me >.
function old new delta
wait_one 294 282 -12
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-05-24 15:29:15 +02:00
Harald van Dijk
8c24af9dcf
tar: fix interaction of delayed symlink and hardlink creation
...
function old new delta
create_or_remember_link - 106 +106
create_links_from_list - 93 +93
find_applet_by_name 124 128 +4
unzip_main 2724 2726 +2
data_extract_all 891 873 -18
create_symlinks_from_list 64 - -64
create_or_remember_symlink 94 - -94
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 2/1 up/down: 205/-176) Total: 29 bytes
Signed-off-by: Harald van Dijk <harald@gigawatt.nl >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-05-22 17:34:31 +02:00
Denys Vlasenko
a40a661d97
tweak /var/service example
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-05-20 22:43:42 +02:00
Denys Vlasenko
2ccd352281
popmaildir: placate gcc8 "warning: 'strncpy' output truncated"
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-05-14 11:14:58 +02:00
Denys Vlasenko
6027597fd1
udhcpc6: set -x options in request
...
Last foru commits:
function old new delta
option_to_env 621 791 +170
.rodata 168351 168505 +154
attach_option 431 506 +75
add_d6_client_options 112 167 +55
d6_option_strings 30 84 +54
udhcp_str2optset 644 660 +16
d6_optflags 12 20 +8
udhcpc6_main 2590 2596 +6
udhcpc_main 2648 2651 +3
read_optset 15 18 +3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 10/0 up/down: 544/0) Total: 544 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-05-14 11:11:08 +02:00
Samuel Mendoza-Jonas
30f4d52ed1
udhcpc6: add PXELINUX options
...
Add support for the PXELINUX options 209 ("ConfigFile") and 210
("PathPrefix") in the DHCPv6 client.
See also: RFC5071, "Dynamic Host Configuration Protocol Options Used by
PXELINUX".
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-05-14 10:46:00 +02:00
Samuel Mendoza-Jonas
23cbd7d5bb
udhcpc6: add DHCPv6 boot options
...
Add support for 'bootfile-url' and 'bootfile-params' as defined by
RFC5970 "DHCPv6 Options for Network Boot".
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-05-14 10:46:00 +02:00
Samuel Mendoza-Jonas
bcdec1a8b8
udhcpc6: add DHCPv6 env helper
...
Add string_option_to_env() to easily generate environment variables for
known simple options.
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-05-14 10:46:00 +02:00
Samuel Mendoza-Jonas
43b9235f66
udhcp: fix use of trim() in udhcp_str2optset()
...
trim() modifies the string in place if needed and returns a pointer to
the end of the resulting string. Update udhcp_str2optset() so it no
longer sets the value of 'val' to the return value of trim().
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-05-14 10:46:00 +02:00
Euan Harris
254e47372f
nsenter: fix parsing of -t, -S and -G options
...
-t, -S and -G each take mandatory integer arguments. getopt32long()'s
option string syntax for this type of argument is 'c:+', however nsenter's
opt_str uses 'c+', which specifies two options 'c' and '+' which do not
take arguments. This means that giving a target PID causes nsenter to
exit and print the usage string:
# nsenter -t1 sh
nsenter: unrecognized option: 1
BusyBox v1.27.2 (2017-12-12 10:41:50 GMT) multi-call binary.
...
The long form options are also broken:
# nsenter --setuid=1000 --setgid=1000 sh
BusyBox v1.29.0.git (2018-05-04 13:56:49 UTC) multi-call binary.
...
`nsenter --target=<pid> sh` parses correctly and appears to work, but
<pid> is ignored and set to 0. This doesn't raise an error unless one
of the namespace arguments is also given:
# ./busybox_unstripped nsenter --target=42 sh
# exit
# ./busybox_unstripped nsenter -n --target=42 sh
BusyBox v1.29.0.git (2018-05-04 13:56:49 UTC) multi-call binary.
...
This has caused problems in a couple of places:
https://github.com/linuxkit/linuxkit/issues/567
https://github.com/gliderlabs/docker-alpine/issues/359
https://github.com/kontena/pharos-cluster/pull/81
Signed-off-by: Euan Harris <euan.harris@docker.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-05-13 20:14:07 +02:00
Euan Harris
40394cb1c9
nsenter: Rename --network option to --net
...
In nsenter from util-linux, the long version of the -n option is
--net=<path>. BusyBox's version expects --network=<path>, so scripts
and examples written for util-linux's version cause BusyBox's version
to exit with the usage message.
Confusingly, until commit 036585a911 , the usage message erroneously
claimed that the long option was indeed called --net; after that commit
long options are not listed at all.
Signed-off-by: Euan Harris <euan.harris@docker.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-05-13 18:58:23 +02:00
Denys Vlasenko
d80eecb868
cat: fix cat -e and cat -v erroneously numbering 1st line
...
function old new delta
cat_main 418 421 +3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-29 14:05:43 +02:00
Denys Vlasenko
bc2e70b4a2
ifplugd: close signal race
...
function old new delta
ifplugd_main 1109 1117 +8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-29 13:46:49 +02:00
Denys Vlasenko
77bf05dfe3
unlzma: do emit the error message on bad input, when we exit with 1
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-24 13:49:12 +02:00
Denys Vlasenko
df45eb49ac
wget: handle URLs with @ or hash differently
...
If server replied with 302 and
Location: ?foo
we used to underflow the allocated space while trying to form the "@foo"
filename. Switch to forming "foo" filename.
function old new delta
packed_usage 32795 32799 +4
parse_url 387 352 -35
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 4/-35) Total: -31 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-24 13:35:32 +02:00
Denys Vlasenko
f4eaccbfae
free: improve --help for type option
...
Patch by Fred Friedrich.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-24 10:13:45 +02:00
Denys Vlasenko
2454e678cb
awk: do not allow $(-1)
...
function old new delta
EMSG_NEGATIVE_FIELD - 25 +25
evaluate 3390 3403 +13
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 38/0) Total: 38 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-23 10:53:18 +02:00
Denys Vlasenko
c21dfaf836
examples/shutdown-1.0: an example of reboot which does not signal init
...
For one, my inits know nothing about the concept of "shutting down the system".
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-20 15:12:52 +02:00
Denys Vlasenko
e09c426456
unlzma: fix another SEGV case
...
function old new delta
unpack_lzma_stream 1705 1717 +12
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-19 19:30:51 +02:00
Denys Vlasenko
2aeb201c97
libbb: new option FEATURE_ETC_SERVICES: if off, /etc/services reads often avoided
...
In practice, "wget http://host.com/ " always uses port 80.
People explicitly set non-standard ports via options or parameters
("telnet 1.2.3.4 567" or "telnet 1.2.3.4 ftp") instead of modifying
/etc/services.
function old new delta
telnet_main 1466 1464 -2
rdate_main 215 198 -17
fakeidentd_main 269 252 -17
parse_url 459 392 -67
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-103) Total: -103 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-17 12:43:54 +02:00
Denys Vlasenko
816d8d7a66
setlogcons: open /dev/ttyN for "setlogcons N", not /dev/tty1
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-16 21:48:32 +02:00
Denys Vlasenko
fa87abe807
build system: FEATURE_NSLOOKUP_BIG needs -lresolv
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-16 11:04:03 +02:00
Denys Vlasenko
058a153b69
less: fix fallout from "use common routine to set raw termios"
...
Testcase: (sleep 10; ls) | busybox less
[...]
~ LICENSE
~ Makefile
~ Makefile.custom
~ Makefile.flags
[...]
less did not want this part:
+ /* dont convert NL to CR+NL on output */
+ newterm->c_oflag &= ~(ONLCR);
function old new delta
get_termios_and_make_raw 108 115 +7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-16 10:24:48 +02:00
Denys Vlasenko
c72499584a
nslookup: simplify make_ptr
...
function old new delta
nslookup_main 2644 2611 -33
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-15 20:04:57 +02:00
Denys Vlasenko
71e4b3f482
nslookup: get rid of query::rlen field
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-15 19:51:42 +02:00
Denys Vlasenko
b74e490629
ar: stop using static data
...
function old new delta
static.ar_long_names 4 - -4
static.ar_long_name_size 4 - -4
get_header_ar 546 532 -14
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 0/1 up/down: 0/-22) Total: -22 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-15 14:18:16 +02:00
Denys Vlasenko
58e43a4c40
nslookup: move array of queries to "globals"
...
function old new delta
add_query 95 89 -6
nslookup_main 2692 2641 -51
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-57) Total: -57 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-15 14:10:45 +02:00
Denys Vlasenko
50aea2786b
less: remove unnecessary message
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-15 13:14:51 +02:00
Aaro Koskinen
36941503bd
less: implement -F
...
Implement -F option: Exit if entire file fits on first screen.
function old new delta
buffer_print 622 633 +11
less_main 2446 2449 +3
buffer_fill_and_print 169 172 +3
packed_usage 32258 32236 -22
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 17/-22) Total: -5 bytes
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-15 13:13:34 +02:00
Denys Vlasenko
4b6091f92c
nslookup: accept lowercase -type=soa, document query types
...
Usage: nslookup [-type=QUERY_TYPE] [-debug] HOST [DNS_SERVER]
Query DNS about HOST
QUERY_TYPE: soa,ns,a,aaaa,cname,mx,txt,ptr,any
function old new delta
packed_usage 32189 32258 +69
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-15 12:58:15 +02:00
Denys Vlasenko
6cdc3195a6
nslookup: change -stats to -debug (it's a bug in bind that it accepts -s)
...
function old new delta
packed_usage 32211 32189 -22
nslookup_main 2754 2692 -62
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-84) Total: -84 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-15 12:50:28 +02:00
Yann E. MORIN
296381ff4f
applets/install: don't try to install nothing
...
Commit 952d5a6024 (applets/install: accept more than one install
option) changed the way we handle install options: before that commit, a
missing install type would mean to install nothing; after, we would
iterate over options, so we would never notice there was a mising
option.
Fix that by introducing an explicit --none option to specify to install
nothing.
Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi >
Cc: Aaro Koskinen <aaro.koskinen@iki.fi >
Cc: Denys Vlasenko <vda.linux@googlemail.com >
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-15 12:07:22 +02:00
Denys Vlasenko
d4461ef9fb
nslookup: rework option parsing
...
function old new delta
nslookup_main 2715 2754 +39
packed_usage 32179 32211 +32
add_ns 65 66 +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 72/0) Total: 72 bytes
text data bss dec hex filename
926262 555 5740 932557 e3acd busybox_old
926239 555 5740 932534 e3ab6 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-15 12:01:46 +02:00
Denys Vlasenko
a980109c6a
nslookup: smaller qtypes[] array
...
function old new delta
nslookup_main 2708 2715 +7
qtypes 80 72 -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 7/-8) Total: -1 bytes
text data bss dec hex filename
926277 555 5740 932572 e3adc busybox_old
926262 555 5740 932557 e3acd busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-15 10:52:11 +02:00
Denys Vlasenko
2cf75b3c81
nslookup: process replies immediately, do not store them
...
function old new delta
nslookup_main 1837 2708 +871
parse_reply 852 - -852
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 871/-852) Total: 19 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-15 10:46:44 +02:00
Denys Vlasenko
4e73c0f659
nslookup: fix output corruption for "nslookup 1.2.3.4"
...
function old new delta
nslookup_main 1832 1837 +5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-14 23:18:34 +02:00
Denys Vlasenko
cf950cd3ea
nslookup: more closely resemble output format of bind-utils-9.11.3
...
function old new delta
nslookup_main 1880 1832 -48
parse_reply 1022 852 -170
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-218) Total: -218 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-14 23:08:23 +02:00
Denys Vlasenko
71e016d806
nslookup: shrink send_queries()
...
function old new delta
rcodes 68 64 -4
nslookup_main 2007 1880 -127
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-131) Total: -131 bytes
text data bss dec hex filename
926735 555 5740 933030 e3ca6 busybox_old
926525 555 5740 932820 e3bd4 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-14 22:53:39 +02:00
Denys Vlasenko
db93b21ec9
nslookup: use xmalloc_sockaddr2dotted() instead of homegrown function
...
function old new delta
nslookup_main 2091 2007 -84
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-14 18:11:35 +02:00
Denys Vlasenko
55bc8e8826
nslookup: usee bbox network functions instead of opne-coded mess
...
function old new delta
nslookup_main 2363 2091 -272
add_ns 663 65 -598
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-870) Total: -870 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-14 17:55:54 +02:00
Denys Vlasenko
75568354f6
patch: implement --dry-run
...
function old new delta
static.patch_longopts - 137 +137
patch_main 2053 2135 +82
fail_hunk 132 139 +7
finish_oldfile 119 124 +5
packed_usage 32807 32787 -20
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/1 up/down: 231/-20) Total: 211 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-14 16:05:26 +02:00
Denys Vlasenko
d5f5045b43
ash: expand: Fix buffer overflow in expandmeta
...
Upstream commit:
Date: Sun, 25 Mar 2018 16:38:00 +0800
expand: Fix buffer overflow in expandmeta
The native version of expandmeta allocates a buffer that may be
overrun for two reasons. First of all the size is 1 byte too small
but this is normally hidden because the minimum size is rounded
up to 2048 bytes. Secondly, if the directory level is deep enough,
any buffer can be overrun.
This patch fixes both problems by calling realloc when necessary.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
function old new delta
expmeta 517 635 +118
expandarg 990 996 +6
mklocal 288 290 +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 126/0) Total: 126 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-14 14:50:47 +02:00
Denys Vlasenko
0dd3be8c09
nslookup: add openwrt / lede version
...
Needs work on size reduction
function old new delta
nslookup_main 114 2363 +2249
parse_reply - 1022 +1022
add_ns - 663 +663
ns_parserr - 486 +486
ns_initparse - 184 +184
ns_skiprr - 117 +117
add_query - 95 +95
qtypes - 80 +80
rcodes - 68 +68
dn_skipname - 58 +58
ns_name_uncompress - 56 +56
ns_get16 - 13 +13
v4_mapped - 12 +12
ns_get32 - 9 +9
res_init 3 - -3
__res_state 6 - -6
xmalloc_sockaddr2hostonly_noport 10 - -10
gai_strerror 47 - -47
set_default_dns 95 - -95
print_host 199 - -199
static.res 512 - -512
------------------------------------------------------------------------------
(add/remove: 15/10 grow/shrink: 1/0 up/down: 5112/-872) Total: 4240 bytes
text data bss dec hex filename
921944 555 6252 928751 e2bef busybox_old
927375 555 5740 933670 e3f26 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-14 14:05:45 +02:00
Michael Olbrich
43dd006222
build system: fix parallel building issue
...
The files generated by the include/config/MARKER target are in the
dependency list for applets/applet_tables.
If applets/applet_tables is created first during applets_dir then it will
be created again later as part of $(busybox-dirs).
As a result include/applet_tables.h is created again. This time while other
build commands may need it.
Let applets_dir depend on include/config/MARKER to avoid this particular
race condition and create the header files atomically to ensure that the
compiler never sees incomplete files.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-14 01:55:51 +02:00
Denys Vlasenko
c783cf78af
tart_stop_daemon: another fix to disabled OLDER_VERSION_OF_X code
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-14 01:29:01 +02:00
Denys Vlasenko
837913fc54
start_stop_daemon: fix normally disabled OLDER_VERSION_OF_X code
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-14 01:27:05 +02:00
Denys Vlasenko
dd56921e2d
dpkg: fix symlink creation, closes 10941
...
function old new delta
get_header_ar 434 442 +8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-13 13:27:52 +02:00
Denys Vlasenko
266f6f1973
udhcp: support string user options, closes 10946
...
function old new delta
udhcp_str2optset 536 628 +92
packed_usage 32757 32760 +3
udhcpc_main 2708 2692 -16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 95/-16) Total: 79 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-13 13:27:52 +02:00
Denys Vlasenko
46158dc833
shell: add 6856 $IFS tests to testsuites
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-11 20:24:58 +02:00
Denys Vlasenko
f693b606b7
hush: fix recent breakage from parse_stream() changes
...
function old new delta
parse_stream 3808 3821 +13
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-11 20:00:43 +02:00
Denys Vlasenko
44257ad5d0
hush: fix IFS handling in read
...
$ echo "X:Y:" | (IFS=": " read x y; echo "|$x|$y|")
|X|Y|
$ echo "X:Y : " | (IFS=": " read x y; echo "|$x|$y|")
|X|Y|
function old new delta
shell_builtin_read 1320 1426 +106
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-11 17:18:34 +02:00
Denys Vlasenko
9678636911
hush: IFS fixes
...
$ IFS=": "; x=" "; set x $x; for v; do echo "|$v|"; done
|x|
$ IFS=": "; x=":"; set x $x; for v; do echo "|$v|"; done
|x|
||
function old new delta
run_pipe 1789 1870 +81
expand_on_ifs 310 361 +51
pseudo_exec_argv 588 591 +3
builtin_local 50 53 +3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 138/0) Total: 138 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-11 16:02:58 +02:00
Denys Vlasenko
34179956f9
hush: fix "$v" expansion in case patterns when v='[a]'
...
function old new delta
run_list 1053 1063 +10
setup_redirects 311 320 +9
encode_then_expand_string 135 142 +7
run_pipe 1784 1789 +5
expand_assignments 81 86 +5
expand_string_to_string 124 125 +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 6/0 up/down: 37/0) Total: 37 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-11 13:47:59 +02:00
Denys Vlasenko
680c3016a2
ash: parser: Allow newlines within parameter substitution
...
Upstream commit:
Date: Thu, 22 Mar 2018 21:41:24 +0800
parser: Allow newlines within parameter substitution
On Fri, Mar 16, 2018 at 11:27:22AM +0800, Herbert Xu wrote:
> On Thu, Mar 15, 2018 at 10:49:15PM +0100, Harald van Dijk wrote:
> >
> > Okay, it can be trivially modified to something that does work in other
> > shells (even if it were actually executed), but gets rejected at parse time
> > by dash:
> >
> > if false; then
> > : ${$+
> > }
> > fi
>
> That's just a bug in dash's parser with ${} in general, because
> it bombs out without the if clause too:
>
> : ${$+
> }
This patch fixes the parsing of newlines with parameter substitution.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-11 12:39:18 +02:00
Denys Vlasenko
0403bedccc
hush: optimize parse_stream()
...
Since we check for '\' anyway when we determine whether we can look ahead,
we can just check for *and handle* it there.
function old new delta
parse_stream 2751 2740 -11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-11 01:34:46 +02:00
Denys Vlasenko
89e9d5534d
hush: do not drop backslash from eval 'echo ok\'
...
newer bash does not drop it, most other shells too
function old new delta
unbackslash 39 57 +18
parse_stream 2753 2751 -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 18/-2) Total: 16 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-11 01:15:33 +02:00
Denys Vlasenko
3632cb15f1
shell: add comments about [[, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-10 15:25:41 +02:00
Denys Vlasenko
4709df0f15
hush: fix handling of \<eof> in double-quoted strings
...
function old new delta
encode_string 268 250 -18
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-10 14:49:01 +02:00
Denys Vlasenko
bcf56114fa
hush: fix eval 'echo ok\'
...
function old new delta
parse_stream 2762 2753 -9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-10 14:40:23 +02:00
Denys Vlasenko
92a930b4e8
hush: simplify \<newline> code, part 3
...
function old new delta
parse_stream 2780 2762 -18
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-10 14:27:08 +02:00
Denys Vlasenko
e8b1bc0481
hush: simplify \<newline> code, part 2
...
function old new delta
parse_stream 2787 2780 -7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-10 14:23:49 +02:00
Denys Vlasenko
1c57269b5d
hush: simplify \<newline> code, part 1
...
function old new delta
parse_stream 2919 2787 -132
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-10 14:23:49 +02:00
Denys Vlasenko
09b7a7ec0e
hush: put "current word" structure into parsing context
...
function old new delta
done_word 790 767 -23
parse_stream 3018 2919 -99
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-122) Total: -122 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-10 03:22:10 +02:00
Denys Vlasenko
e93031e6dc
ash: if "[[" bashism is not supported, do not handle it anywhere
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-10 01:23:19 +02:00
Denys Vlasenko
57b7efb0d5
ash: trivial code shrink
...
function old new delta
parse_command 1677 1674 -3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-10 01:20:26 +02:00
Ron Yorston
1f27fa9838
testsuite: allow tests to work in paths containing spaces
...
Tweak some tests so they work when the path to the test directory or
$HOME contains spaces.
Signed-off-by: Ron Yorston <rmy@pobox.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-09 20:35:48 +02:00
Denys Vlasenko
9db344a0f4
hush: fix var_leaks.tests and var_preserved.tests on NOMMU
...
function old new delta
remove_nested_vars - 77 +77
run_pipe 1756 1786 +30
pseudo_exec_argv 376 379 +3
leave_var_nest_level 98 32 -66
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/1 up/down: 110/-66) Total: 44 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-09 19:05:11 +02:00
Denys Vlasenko
eb0de05d68
hush: fix func_return2.tests on NOMMU
...
function old new delta
hush_main 1714 1718 +4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-09 17:54:07 +02:00
Denys Vlasenko
a1870f4807
unlzma: fix segfault on bad archive
...
function old new delta
unpack_lzma_stream 2647 2653 +6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-08 20:45:16 +02:00
Denys Vlasenko
38ccd6af8a
bzip2: fix two crashes on corrupted archives
...
As it turns out, longjmp'ing into freed stack is not healthy...
function old new delta
unpack_usage_messages - 97 +97
unpack_bz2_stream 369 409 +40
get_next_block 1667 1677 +10
get_bits 156 155 -1
start_bunzip 212 183 -29
bb_show_usage 181 120 -61
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/3 up/down: 147/-91) Total: 56 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-08 20:05:04 +02:00
Denys Vlasenko
8e2174e9bd
wget: check chunk length for overflowing off_t
...
function old new delta
retrieve_file_data 428 465 +37
wget_main 2386 2389 +3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 40/0) Total: 40 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-08 18:06:24 +02:00
Denys Vlasenko
7bcde5f00d
libbb.h: always include sys/resource.h
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-08 17:23:27 +02:00
Denys Vlasenko
87a08e476b
lzop: remove method checks which are always true/false
...
function old new delta
do_lzo_compress 232 224 -8
lzo_compress 531 488 -43
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-51) Total: -51 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-08 16:44:45 +02:00
Denys Vlasenko
3d4f688a19
lzop: buffer several 32-bit writes when we start a new compressed block
...
function old new delta
lzo_compress 483 531 +48
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-08 16:31:02 +02:00
Denys Vlasenko
24ef5c6375
lzop: reuse strings
...
function old new delta
lzo_compress 470 483 +13
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 13/0) Total: 13 bytes
text data bss dec hex filename
940011 477 7284 947772 e763c busybox_old
939976 477 7284 947737 e7619 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-08 14:00:03 +02:00
Denys Vlasenko
15684bf545
lzop: checksum reads do not need to be checksummed
...
function old new delta
do_lzo_decompress 404 427 +23
f_read32 22 - -22
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-08 13:45:04 +02:00
Denys Vlasenko
3a7d16d488
lzop: don't support ancient versions < 0.94 (15 Oct 1997)
...
0.94 came only 2 months after initial 0.90:
0.90 (10 Aug 1997): First public release of lzop
...
0.94 (15 Oct 1997): Header format change
function old new delta
do_lzo_decompress 411 404 -7
f_read8 24 - -24
f_read16 31 - -31
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 0/1 up/down: 0/-62) Total: -62 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-08 13:35:28 +02:00
Denys Vlasenko
434f95960a
lzop: code shrink by using header_t matching on-disk layout
...
function old new delta
add_bytes_to_chksum 37 47 +10
lzo_decompress 524 532 +8
init_chksum 14 21 +7
chksum_getresult 13 17 +4
f_read 33 28 -5
f_write8 20 - -20
f_write32 22 - -22
f_write16 25 - -25
f_write 36 - -36
do_lzo_compress 328 232 -96
do_lzo_decompress 526 411 -115
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 4/3 up/down: 29/-319) Total: -290 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-08 13:33:43 +02:00
Denys Vlasenko
7924b69f99
tar: trim help text
...
Usage: tar c|x|t [-ZzJjahmvokO] [-f TARFILE] [-C DIR] [-T FILE] [-X FILE] [--exclude PATTERN]... [FILE]...
Create, extract, or list files from a tar file
Operation: <============== DELETED
c Create
x Extract
t List
-f FILE Name of TARFILE ('-' for stdin/out)
-C DIR Change to DIR before operation
-v Verbose
-O Extract to stdout
-m Don't restore mtime
-o Don't restore user:group
-k Don't replace existing files
-Z (De)compress using compress
-z (De)compress using gzip
-J (De)compress using xz
-j (De)compress using bzip2
-a (De)compress using lzma
-h Follow symlinks
-T FILE File with names to include
-X FILE File with glob patterns to exclude
--exclude PATTERN Glob pattern to exclude
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-07 21:04:39 +02:00
Denys Vlasenko
8d6eab3225
hush: fix prompt in multi-line $(())
...
Now shows PS2 in this case:
/path/to/dir $ a=b; echo $((
> _
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-07 17:01:31 +02:00
Denys Vlasenko
17058a06c4
libbb: switch bb_ask_noecho() to "mallocing" string return API
...
function old new delta
bb_ask_noecho 313 330 +17
get_cred_or_die 125 115 -10
passwd_main 995 958 -37
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 17/-47) Total: -30 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-07 15:50:30 +02:00
Denys Vlasenko
bae8fc4436
xargs: use bb_ask_y_confirmation_FILE() instead of homegrown copy
...
function old new delta
bb_ask_y_confirmation_FILE - 83 +83
inetd_main 2033 2043 +10
udhcp_send_kernel_packet 295 301 +6
rmescapes 306 310 +4
send_tree 353 355 +2
i2cdetect_main 674 672 -2
confirm_or_abort 43 38 -5
get_terminal_width_height 242 234 -8
bb_ask_y_confirmation 76 10 -66
xargs_main 823 755 -68
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/5 up/down: 105/-149) Total: -44 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-07 15:23:10 +02:00
Denys Vlasenko
77cb6b99a4
libbb: rename bb_ask -> bb_ask_noecho, bb_ask_confirmation -> bb_ask_y_confirmation
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-07 15:08:12 +02:00
Denys Vlasenko
2f094ae821
telnet: move winsize detection closer to I/O loop, delete non-functioning debug code
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-07 15:02:20 +02:00
Denys Vlasenko
e0afe0a9fd
ftpd: allow -A if !FTPD_AUTHENTICATION as well
...
Users will be able to use "ftpd -A" in scripts regardless of build config
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-07 14:18:42 +02:00
Denys Vlasenko
8edaaced16
ftpd: added -A option to disable all authentication, closes 10921
...
function old new delta
packed_usage 32745 32777 +32
ftpd_main 2162 2156 -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 32/-6) Total: 26 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-07 14:02:21 +02:00
Denys Vlasenko
32c3e3a44c
wget,ftpd: shorten and reuse strings
...
function old new delta
wget_main 2382 2386 +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 4/0) Total: 4 bytes
text data bss dec hex filename
934228 477 7296 942001 e5fb1 busybox_old
934202 477 7296 941975 e5f97 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-07 13:22:52 +02:00
Denys Vlasenko
9fe8bd8d61
httpd: do not default to Content-type: application/octet-stream
...
Instead, simply don't send this header.
On Mon, Apr 2, 2018 at 8:17 PM, xisd <xisd-dev@riseup.net > wrote:
> I had some trouble using busybox httpd to serve a static website and I
> thought the issue might be of interest.
>
> My problem is related to something that seem quite common for static
> site generator : the use of html files without the '.html' extension
> (it is called 'clean url'...)
>
> Most web server guess that these files are html and display them like
> any other .html files.
>
> From what I understood, the MIME type for files without extension in
> busybox htttp default settings is 'application/octet-stream', and
> because of that 'clean url' pages are not displayed.
>
> It is only trouble because I wanted to deploy my website on freshly
> installed linux without editing any configuration.
>
> The default MIME setting make sense to me as it is, I just thought that
> might be worth mentioning since the use of 'clean url' seem to be a
> common practice for static sites generators (the one I use is callled
> 'yellow' (https://github.com/datenstrom/yellow ))
>
> Here is a link for the related issue on github :
> https://github.com/datenstrom/yellow/issues/317
function old new delta
send_headers 702 718 +16
send_headers_and_exit 23 20 -3
handle_incoming_and_exit 2794 2791 -3
send_file_and_exit 772 756 -16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 16/-22) Total: -6 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-07 01:13:30 +02:00
Denys Vlasenko
6b6a3d9339
scripts/kconfig/mconf.c: survive is SIGWINCH is not defined
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-06 19:05:53 +02:00
Denys Vlasenko
2c99702810
i386: make stack size optimization selectable, and allow i486 insns (bswap)
...
It's hard to imagine someone still using non-bswap equipped CPU
function old new delta
xmalloc_optname_optval 888 879 -9
write_leases 214 205 -9
write32 36 27 -9
update_status 612 603 -9
udhcpd_main 1468 1459 -9
udhcpc_main 2708 2699 -9
udhcp_run_script 804 795 -9
sha256_process_block64 423 414 -9
sha1_process_block64 337 328 -9
sha1_end 80 71 -9
send_ACK 161 152 -9
select_lease_time 64 55 -9
rpm_getint 118 109 -9
readprofile_main 1719 1710 -9
read32 33 24 -9
rdate_main 236 227 -9
machtime 39 30 -9
inet_addr_match 103 94 -9
get_prefix 344 335 -9
f_write32 31 22 -9
f_read32 31 22 -9
dumpleases_main 620 611 -9
KeyExpansion 197 188 -9
udhcp_str2optset 536 518 -18
read_config 222 204 -18
lfp_to_d 55 37 -18
ipaddr_modify 1226 1208 -18
dnsd_main 1278 1260 -18
des_crypt 1344 1326 -18
d_to_lfp 106 88 -18
bb_bswap_64 29 11 -18
INET_setroute 827 809 -18
read_leases 330 309 -21
zcip_main 1256 1229 -27
send_offer 476 449 -27
ipcalc_main 534 507 -27
handle_incoming_and_exit 2821 2794 -27
fmt_time_bernstein_25 131 104 -27
common_traceroute_main 3804 3768 -36
rpm_gettags 451 397 -54
parse_args 1412 1358 -54
volume_id_probe_hfs_hfsplus 627 564 -63
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/42 up/down: 0/-732) Total: -732 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-06 19:01:51 +02:00
Denys Vlasenko
2ab994f707
placate gcc-8.0.1 warnings
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-06 18:26:33 +02:00
Denys Vlasenko
f5018dac21
hush: fix "unset PS1/PS2", and put them into initial variable set
...
"unset PS1/PS2" causes prompts to be empty strings
function old new delta
hush_main 1031 1089 +58
goto_new_line 27 33 +6
fgetc_interactive 244 245 +1
unset_local_var 155 149 -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 65/-6) Total: 59 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-06 17:58:21 +02:00
Denys Vlasenko
d1d6d9c5d8
sort: smaller and more agressive FEATURE_SORT_OPTIMIZE_MEMORY
...
function old new delta
sort_main 1098 1037 -61
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-06 16:44:50 +02:00
Denys Vlasenko
00bd76728d
hush: if we did match "LINENO" or "OPTIND", stop further comparisons
...
function old new delta
handle_changed_special_names 99 101 +2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-06 14:57:53 +02:00
Denys Vlasenko
cf079ffe1c
hush: consolidate handling of setting/unsetting of PSn, LINENO, OPTIND
...
function old new delta
handle_changed_special_names - 99 +99
unset_local_var 256 155 -101
set_local_var 557 437 -120
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 99/-221) Total: -122 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-06 14:50:12 +02:00
Denys Vlasenko
de02625985
hush: update to correctly handle changed var_bash[346].tests
...
function old new delta
expand_one_var 1612 1604 -8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-05 17:04:53 +02:00
Denys Vlasenko
f2ed39b930
hush: implement "hush -s"
...
function old new delta
hush_main 1015 1031 +16
packed_usage 32757 32745 -12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 16/-12) Total: 4 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-05 16:46:49 +02:00
Denys Vlasenko
d878ccca9c
placate gcc 8.0.1 sprintf overflow warnings in config tools
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-05 15:21:34 +02:00
Denys Vlasenko
21b7f1b6b6
hush: fix a few more corner cases with empty-expanding cmds
...
See added testcases
function old new delta
run_pipe 1723 1784 +61
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-05 15:15:53 +02:00
Denys Vlasenko
41d8f10813
hush: fix corner cases with exec in empty expansions
...
Cases like these:
var=val exec >redir
var=val `` >redir
function old new delta
run_pipe 1701 1723 +22
redirect_and_varexp_helper 56 55 -1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 22/-1) Total: 21 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-05 14:41:21 +02:00
Denys Vlasenko
929a41d577
hush: less mind-bending set_vars_and_save_old()
...
function old new delta
run_pipe 1651 1701 +50
set_local_var 510 557 +47
pseudo_exec_argv 544 581 +37
redirect_and_varexp_helper 64 56 -8
set_vars_and_save_old 164 149 -15
unset_local_var 274 256 -18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/3 up/down: 134/-41) Total: 93 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-05 14:09:14 +02:00
Denys Vlasenko
4e1dc539e9
hush: "no logic changes" in last commit was not true, fix it up
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-05 13:10:34 +02:00
Denys Vlasenko
34f6b12330
hush: make run_pipe code simpler to understand, no logic changes
...
function old new delta
run_pipe 1641 1651 +10
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-05 11:30:17 +02:00
Denys Vlasenko
d358b0b65d
hush: fix a bug where we don't properly handle f() { a=A; b=B; }; a= f
...
function old new delta
unset_local_var 20 274 +254
leave_var_nest_level - 98 +98
set_vars_and_save_old 128 164 +36
enter_var_nest_level - 32 +32
builtin_local 46 50 +4
pseudo_exec_argv 554 544 -10
redirect_and_varexp_helper 77 64 -13
run_pipe 1890 1641 -249
unset_local_var_len 267 - -267
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 3/3 up/down: 424/-539) Total: -115 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-05 00:51:55 +02:00
Denys Vlasenko
332e4115c9
hush: make var nesting code independent of "local" support
...
Also, add code to abort at ~65000 function recursion depth.
SEGVing is not as nice as exiting with a message (and restoring termios!):
$ f() { echo -n .; f; }; f
....<many dots later>....hush: fatal recursion (depth 65281)
function old new delta
run_pipe 1826 1890 +64
pseudo_exec_argv 544 554 +10
parse_and_run_file 71 80 +9
i_getch 104 107 +3
done_command 99 102 +3
set_local_var 508 510 +2
helper_export_local 214 215 +1
builtin_local 49 46 -3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/1 up/down: 92/-3) Total: 89 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-04 22:35:13 +02:00
Denys Vlasenko
61407807ab
hush: fix for readonly vars in "ro=A ro=B cmd" case
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-04 21:14:28 +02:00
Denys Vlasenko
759ca8a4cb
sort: move misplaced comment
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-04 17:07:21 +02:00
Denys Vlasenko
c29c2e60d8
sort: FEATURE_SORT_OPTIMIZE_MEMORY
...
On sorting all kernel/linux/arch/ *.[ch] files,
this reduces memory usage by 6%.
yes | head -99999999 | sort
goes down from 1900Mb to 380 Mb.
function old new delta
sort_main 862 1098 +236
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-04 17:03:41 +02:00
Denys Vlasenko
ee1fd1246e
ash: unbreak PS1 parsing after "ash: parser: Add syntax stack..." commit
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-04 13:59:53 +02:00
Denys Vlasenko
fbf44854a3
hush: support "f() (cmd)" functions
...
Many other shells support this construct
function old new delta
parse_stream 2950 3018 +68
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-03 14:56:52 +02:00
Denys Vlasenko
49015a60cb
hush: fix mishandling of "true | f() { echo QWE; }"
...
function old new delta
run_pipe 1820 1826 +6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-03 13:02:43 +02:00
Denys Vlasenko
5fa0505f8a
hush: fix "set -e; false || x=1; echo OK"
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-03 11:21:13 +02:00
Denys Vlasenko
11752d46d1
hush: one-word, no-globbing handling of local/export/readonly args
...
function old new delta
done_word 738 790 +52
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-03 08:20:58 +02:00
Denys Vlasenko
f50e14632f
ash: parser: Fix parameter expansion inside inner double quotes
...
Upstream email:
parser: Fix parameter expansion inside inner double quotes
The parsing of parameter expansion inside inner double quotes
breaks because we never look for ENDVAR while innerdq is true.
echo "${x#"${x+''}"''}
This patch fixes it by pushing the syntax stack if innerdq is
true and we enter a new parameter expansion.
This patch also fixes a corner case where a bad substitution error
occurs within arithmetic expansion.
Reported-by: Denys Vlasenko <vda.linux@googlemail.com >
Fixes: ab1cecb40478 (" parser: Add syntax stack for recursive...")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
function old new delta
readtoken1 2880 2898 +18
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-02 21:00:59 +02:00
Denys Vlasenko
abf755615e
hush: fix a backslash-removal bug in case
...
function old new delta
run_list 1270 1053 -217
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-02 17:25:18 +02:00
Denys Vlasenko
9a95df9046
ash: expand: Fix bugs with words connected to the right of $@
...
Upstream email:
This is actually composed of two bugs. First of all our tracking
of quotemark is wrong so anything after "$@" becomes quoted. Once
we fix that then the problem is that the first space character
after "$@" is not recognised as an IFS.
This patch fixes both.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-02 14:27:50 +02:00
Denys Vlasenko
355ec353be
ash: redir: Fix typo in noclobber code
...
Upstream commit "redir: Fix typo in noclobber code"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-02 13:34:57 +02:00
Denys Vlasenko
c4c2012284
ash: parser: Fix single-quoted patterns in here-documents
...
Upstream commit:
From: Herbert Xu <herbert@gondor.apana.org.au >
Date: Fri, 9 Mar 2018 23:07:53 +0800
parser: Fix single-quoted patterns in here-documents
The script
x=*
cat <<- EOF
${x#'*'}
EOF
prints * instead of nothing as it should. The problem is that
when we're in sqsyntax context in a here-document, we won't add
CTLESC as we should. This patch fixes it:
Reported-by: Harald van Dijk <harald@gigawatt.nl >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-02 13:29:20 +02:00
Denys Vlasenko
8b536eb40d
hush: remove stray debugging printout
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-02 13:26:16 +02:00
Denys Vlasenko
216913c290
ash: parser: Add syntax stack for recursive parsing
...
This closes 10821.
Upstream patch:
From: Herbert Xu <herbert@gondor.apana.org.au >
Date: Fri, 9 Mar 2018 00:14:02 +0800
parser: Add syntax stack for recursive parsing
Without a stack of syntaxes we cannot correctly these two cases
together:
"${a#'$$'}"
"${a#"${b-'$$'}"}"
A recursive parser also helps in some other corner cases such
as nested arithmetic expansion with paratheses.
This patch adds a syntax stack allocated from the stack using
alloca. As a side-effect this allows us to remove the naked
backslashes for patterns within double-quotes, which means that
EXP_QPAT also has to go.
This patch also fixes removes any backslashes that precede right
braces when they are present within a parameter expansion context,
and backslashes that precede double quotes within inner double
quotes inside a parameter expansion in a here-document context.
The idea of a recursive parser is based on a patch by Harald van
Dijk.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
var_bash3, var_bash4 and var_bash6 tests are updated
with the output given by bash-4.3.43
With this patch, the following tests now pass for ash:
dollar_repl_slash_bash2.tests
squote_in_varexp2.tests
squote_in_varexp.tests
var_bash4.tests
function old new delta
readtoken1 2615 2874 +259
synstack_push - 54 +54
evalvar 574 571 -3
rmescapes 330 310 -20
subevalvar 1279 1258 -21
argstr 1146 1107 -39
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/4 up/down: 313/-83) Total: 230 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-02 13:15:37 +02:00
Denys Vlasenko
e84212f834
hush: update information comment about heredoc discrepancy
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-01 20:11:23 +02:00
Denys Vlasenko
899ae5337a
libbb: new function bb_die_memory_exhausted
...
function old new delta
bb_die_memory_exhausted - 10 +10
xstrdup 28 23 -5
xsetenv 27 22 -5
xrealloc 32 27 -5
xputenv 22 17 -5
xmalloc 30 25 -5
xfdopen_helper 40 35 -5
xasprintf 44 39 -5
wget_main 2387 2382 -5
open_socket 54 49 -5
glob_brace 419 414 -5
bb_get_chunk_from_file 146 141 -5
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/11 up/down: 10/-55) Total: -45 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-01 19:59:37 +02:00
Quentin Rameau
e2afae6303
sed: prevent overflow of length from bb_get_chunk_from_file
...
This fragment did not work right:
temp = bb_get_chunk_from_file(fp, &len);
if (temp) {
/* len > 0 here, it's ok to do temp[len-1] */
char c = temp[len-1];
With "int len" _sign-extending_, temp[len-1] can refer to a wrong location
if len > 0x7fffffff.
Signed-off-by: Quentin Rameau <quinq@fifth.space >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-01 19:51:14 +02:00
Quentin Rameau
2da9724b56
libbb: remove unnecessary variable in xmalloc_fgets
...
Signed-off-by: Quentin Rameau <quinq@fifth.space >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-01 19:45:36 +02:00
Denys Vlasenko
bb6f573ad2
hush: add a comment where we differ from bash wrt heredoc EOF mark handling
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-01 18:55:00 +02:00
Denys Vlasenko
41fddb4372
parser: Fix backquote support in here-document EOF mark
...
Upstream commit:
Author: Herbert Xu <herbert@gondor.apana.org.au >
Date: Thu Mar 15 18:27:30 2018 +0800
parser: Fix backquote support in here-document EOF mark
Currently using backquotes in a here-document EOF mark is broken
because dash tries to do command substitution on it. This patch
fixes it by checking whether we're looking for an EOF mark during
tokenisation.
Reported-by: Harald van Dijk <harald@gigawatt.nl >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
With added fix for quoted-ness of the EOF mark.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-01 16:38:32 +02:00
Denys Vlasenko
1e5111b0f8
ash,hush: handle a few more bkslash-newline cases
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-04-01 03:04:55 +02:00
Denys Vlasenko
32e183e63e
shells: fix var_LINENO1.tests false positive, add it to ash tests too
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-31 20:31:13 +02:00
Denys Vlasenko
a94eeb0b42
hush: fix heredoc_bkslash_newline1.tests failure
...
function old new delta
parse_stream 2787 2827 +40
builtin_type 117 115 -2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-31 20:16:31 +02:00
Denys Vlasenko
220be537a0
ash: use pgetc_eatbnl() in more places
...
Part of upstream commit:
Date: Thu Mar 8 08:37:11 2018 +0100
Author: Harald van Dijk <harald@gigawatt.nl >
parser: use pgetc_eatbnl() in more places
dash has a pgetc_eatbnl function in parser.c which skips any
backslash-newline combinations. It's not used everywhere it could be.
There is also some duplicated backslash-newline handling elsewhere in
parser.c. Replace most of the calls to pgetc() with calls to
pgetc_eatbnl() and remove the duplicated backslash-newline handling.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
Not adding "readtoken1(pgetc_eatbnl(), DQSYNTAX..." changes, since
readtoken1() handles the "starts with backslash + newline" case itself.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-31 19:40:56 +02:00
Martijn Dekker
ad4e961352
ash: 'nolog' and 'debug' options cause "$-" to wreak havoc
...
Upstream commit:
Date: Tue Mar 6 17:40:37 2018 +0000
expand: 'nolog' and 'debug' options cause "$-" to wreak havoc
Op 29-03-17 om 20:02 schreef Martijn Dekker:
> Bug: if either the 'nolog' or the 'debug' option is set, trying to
> expand "$-" silently aborts parsing of an entire argument.
>
> $ dash -o nolog -c 'set -fuC; echo "|$- are the options|"; set +o nolog; echo "|$- are the options|"'
> |
> |uCf are the options|
> $ dash -o debug -c 'set -fuC; echo "|$- are the options|"; set +o debug; echo "|$- are the options|"'
> |
> |uCf are the options|
This turned out to be easy to fix. The routine producing the "$-"
expansion failed to skip options for which there is no option letter,
but only a long-form name. In dash, 'nolog' and 'debug' are currently
the only two such options. Patch below.
- Martijn
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
In bbox ash, pipefail is the option which exhibited this.
Signed-off-by: Martijn Dekker <martijn@inlv.org >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-31 18:30:27 +02:00
Denys Vlasenko
7bf304f371
stat: fix a typo: s/romfs/ramfs/, closes 10876
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-31 02:45:22 +02:00
Denys Vlasenko
6ffaa00338
hush: fix a signedness bug
...
Testcase:
set -- a ""; space=" "; printf "<%s>\n" "$@"$space
Before:
<a >
After:
<a>
<>
It usually does not bite since bbox forces -funsigned-char build.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-31 00:48:18 +02:00
Denys Vlasenko
73523079a2
ash,hush: new test dollar_repl_slash_bash2.tests
...
This fails for ash. hush works.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-30 23:25:24 +02:00
Denys Vlasenko
ac61f44704
ash: fix "char == CTLfoo" comparison signedness bug
...
It usually does not bite since bbox forces -funsigned-char build.
But for some reason void linux people disabled that.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-30 23:04:39 +02:00
Denys Vlasenko
60fb98e51d
ash: use F_DUPFD_CLOEXEC and O_CLOEXEC
...
function old new delta
setjobctl 371 367 -4
setinputfile 226 220 -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-10) Total: -10 bytes
Based on patch by Mark Marshall <mark.marshall@omicronenergy.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-30 22:15:14 +02:00
Denys Vlasenko
df65dc89b4
examples/var_service: new example: dnsmasq service
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-30 20:49:16 +02:00
Natanael Copa
d9503224c8
cpio: extract "unsafe" symlinks the same way tar/unzip does
...
function old new delta
cpio_main 588 596 +8
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-30 20:18:12 +02:00
Denys Vlasenko
0d79d7709d
svok: new applet (daemontools compat)
...
function old new delta
svok_main - 127 +127
packed_usage 32705 32757 +52
applet_names 2756 2761 +5
applet_main 1588 1592 +4
bb_banner 46 47 +1
sv 1286 1284 -2
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/1 up/down: 189/-2) Total: 187 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-30 20:02:33 +02:00
Denys Vlasenko
d892f7137f
ifplugd service example: always run up/down script on startup
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-30 11:14:46 +02:00
Stefan Agner
2adaa90534
ifplugd: if SIOCSIFFLAGS fails with EADDRNOTAVAIL, don't die
...
When using ifplugd on a RNDIS interface with monitor mode, using
SIOCSIFFLAGS seems to fail with EADDRNOTAVAIL. Treat it the same
as if iface disappeared again.
This has been observed on a Tegra TK1 using Linux 4.14. There seem
to be a race when the kernel is creating the device:
ifplugd(usb0): started: BusyBox v1.24.1 (2018-03-27 09:47:48 CEST)
ifplugd(usb0): interface doesn't exist, waiting
ifplugd(usb0): interface appeared
ifplugd(usb0): upping interface
ifplugd(usb0): setting interface flags failed: Cannot assign requested address
<exit>
With this patch ifplugd is successful in upping the device the second
time around:
ifplugd(usb0): upping interface
ifplugd(usb0): using SIOCETHTOOL detection mode
ifplugd(usb0): interface appeared
ifplugd(usb0): upping interface
ifplugd(usb0): setting interface flags failed: Cannot assign requested address
ifplugd(usb0): interface appeared
ifplugd(usb0): upping interface
ifplugd(usb0): using SIOCETHTOOL detection mode
ifplugd(usb0): link is up
ifplugd(usb0): executing '/etc/ifplugd/ifplugd.usb.action usb0 up'
ifplugd up
ifplugd(usb0): exit code: 0
function old new delta
up_iface 120 127 +7
Signed-off-by: Stefan Agner <stefan@agner.ch >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-29 18:45:11 +02:00
Peter Korsgaard
a82fe671f5
fbsplash: support configurable image position
...
For some setups (E.G. for supporting different screen resolutions),
positioning the image somewhere else than the top left corner may be
interesting.
Add support for IMG_LEFT/IMG_TOP settings to specify the image location,
similar to how it is done for the progress bar.
function old new delta
fbsplash_main 994 1038 +44
static.param_names 57 74 +17
packed_usage 32631 32647 +16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 77/0) Total: 77 bytes
Signed-off-by: Peter Korsgaard <peter@korsgaard.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-29 18:42:11 +02:00
Denys Vlasenko
03fd7e06f8
grep: fix echo "aa" | busybox grep -F -w "a" (should not match)
...
function old new delta
grep_file 1461 1470 +9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-29 18:03:50 +02:00
Denys Vlasenko
3be4b9b0de
fstrim: do not check that specified file is on a block device
...
Kernel will surely inform us in FITRIM does not make sense on a given file.
function old new delta
fstrim_main 241 221 -20
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-29 16:05:10 +02:00
Denys Vlasenko
d1b845706d
hush: add a FIXME comment
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-28 18:42:54 +02:00
Denys Vlasenko
9acd63c92c
ash,hush: fix "saved" redirected fds still visible in children
...
Based on a patch by Mark Marshall <mark.marshall@omicronenergy.com >
function old new delta
dup_CLOEXEC - 49 +49
fcntl_F_DUPFD 46 - -46
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-28 18:35:07 +02:00
Denys Vlasenko
e4defe826b
libbb: use BUILD_BUG_ON in utoa_to_buf()
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-28 17:12:56 +02:00
Kaarle Ritvanen
123fdda0a4
ifupdown: do not fail if interface disappears during ifdown
...
Interface may not exist because it got deleted by an ifdown hook script
earlier. This may happen when a virtual interface, such as VLAN, has multiple
iface blocks defined.
function old new delta
static_down6 14 40 +26
static_down 54 70 +16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 42/0) Total: 42 bytes
Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-28 00:02:52 +02:00
Denys Vlasenko
46ba2468a3
ioctl(SIOCGIFINDEX) does not require clearing of entire ifr
...
function old new delta
INET6_setroute 492 472 -20
do_iplink 1357 1330 -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-47) Total: -47 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-27 23:55:43 +02:00
Mark Marshall
98592db323
netstat: produce numeric-ip output for non-resolved names
...
If we don't ask for numerical output, and the symbolic look-up failed
we used to get "(null)", but the numeric output would be better.
function old new delta
ip_port_str 109 121 +12
Signed-off-by: Mark Marshall <mark.marshall@omicronenergy.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-27 23:28:53 +02:00
Ron Yorston
b5820d9fd8
ssl_client: fix option parsing
...
The wrong character was used to indicate options taking an integer
parameter.
Signed-off-by: Ron Yorston <rmy@pobox.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-20 11:41:51 +01:00
Denys Vlasenko
b3e98b1ccc
top: fix "warning: unused variable new_mask"
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-19 20:00:10 +01:00
Denys Vlasenko
3c08437db7
tar: add -o and -k to short --help too
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-16 04:02:23 +01:00
Denys Vlasenko
1ee222e1bf
tar: add -k and -o to --help
...
-o Don't restore user:group
-k Don't replace existing files
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-16 03:55:14 +01:00
Denys Vlasenko
bbe47d9b9a
tcpsvd: fix fallout from opt_complementary removal
...
text data bss dec hex filename
933035 473 6836 940344 e5938 busybox_old
933051 473 6836 940360 e5948 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-11 23:02:50 +01:00
Denys Vlasenko
0e09ded2f1
readprofile: code shrink
...
function old new delta
defaultpro 14 - -14
defaultmap 17 - -17
readprofile_main 1762 1719 -43
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 0/1 up/down: 0/-74) Total: -74 bytes
text data bss dec hex filename
933081 473 6836 940390 e5966 busybox_old
933035 473 6836 940344 e5938 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-11 19:35:58 +01:00
Denys Vlasenko
448fdcc17d
ntpd: choose initial FREQHOLD_cnt dynamically
...
function old new delta
update_local_clock 834 858 +24
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-11 17:08:02 +01:00
Denys Vlasenko
3d306bffc5
udhcpd: clamp down huge auto_times to ~2M seconds, better EINTR poll handling
...
EINTR _should_ only happen on two signals we trap, and safe_poll
_should_ work here just fine, but there were kernel bugs where spurious EINTRs
happen (e.g. on ptrace attach). Be safe.
function old new delta
udhcpd_main 1437 1468 +31
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-11 11:39:05 +01:00
Denys Vlasenko
39dfb4de38
ntpd: suppress in-kernel frequency correction in first 8 adjtimex calls
...
In other words: try to correct initially existing clock offset first,
before assuming that our clock drifts.
function old new delta
update_local_clock 826 834 +8
ntp_init 550 557 +7
filter_datapoints 179 173 -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 15/-6) Total: 9 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-10 21:25:53 +01:00
Denys Vlasenko
3293bc1469
udhcpd: fix "not dying on SIGTERM"
...
Fixes:
commit 52a515d187
"udhcp: use poll() instead of select()"
Feb 16 2017
udhcp_sp_read() is meant to check whether signal pipe indeed has some data to read.
In the above commit, it was changed as follows:
- if (!FD_ISSET(signal_pipe.rd, rfds))
+ if (!pfds[0].revents)
return 0;
The problem is, the check was working for select() purely by accident.
Caught signal interrupts select()/poll() syscalls, they return with EINTR
(regardless of SA_RESTART flag in sigaction). _Then_ signal handler is invoked.
IOW: they can't see any changes to fd state caused by signal haldler
(in our case, signal handler makes signal pipe ready to be read).
For select(), it means that rfds[] bit array is unmodified, bit of signal
pipe's read fd is still set, and the above check "works": it thinks select()
says there is data to read.
This accident does not work for poll(): .revents stays clear, and we do not
try reading signal pipe as we should. In udhcpd, we fall through and block
in socket read. Further SIGTERM signals simply cause socket read to be
interrupted and then restarted (since SIGTERM handler has SA_RESTART=1).
Fixing this as follows: remove the check altogether. Set signal pipe read fd
to nonblocking mode. Always read it in udhcp_sp_read().
If read fails, assume it's EAGAIN and return 0 ("no signal seen").
udhcpd avoids reading signal pipe on every recvd packet by looping if EINTR
(using safe_poll()) - thus ensuring we have correct .revents for all fds -
and calling udhcp_sp_read() only if pfds[0].revents!=0.
udhcpc performs much fewer reads (typically it sleeps >99.999% of the time),
there is no need to optimize it: can call udhcp_sp_read() after each poll
unconditionally.
To robustify socket reads, unconditionally set pfds[1].revents=0
in udhcp_sp_fd_set() (which is before poll), and check it before reading
network socket in udhcpd.
TODO:
This might still fail: if pfds[1].revents=POLLIN, socket read may still block.
There are rare cases when select/poll indicates that data can be read,
but then actual read still blocks (one such case is UDP packets with
wrong checksum). General advise is, if you use a poll/select loop,
keep all your fds nonblocking.
Maybe we should also do that to our network sockets?
function old new delta
udhcp_sp_setup 55 65 +10
udhcp_sp_fd_set 54 60 +6
udhcp_sp_read 46 36 -10
udhcpd_main 1451 1437 -14
udhcpc_main 2723 2708 -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/3 up/down: 16/-39) Total: -23 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-10 19:34:39 +01:00
Denys Vlasenko
3936222a0a
remove stray newline in "iplink --help"
...
function old new delta
packed_usage 32547 32550 +3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-08 16:06:18 +01:00
Denys Vlasenko
db169f2538
ip: fix "ip -oneline a"
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-08 15:55:07 +01:00
Denys Vlasenko
7798282db2
ipcs: further code shrink
...
function old new delta
packed_usage 32543 32547 +4
ipcs_main 1014 980 -34
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 4/-34) Total: -30 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-08 13:23:06 +01:00
Denys Vlasenko
f7fa8001b7
ipcs: code shrink
...
function old new delta
packed_usage 32539 32543 +4
format 1 - -1
do_shm 883 880 -3
do_sem 636 633 -3
do_msg 782 779 -3
ipcs_main 1049 1014 -35
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/4 up/down: 4/-45) Total: -41 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-08 13:10:23 +01:00
Denys Vlasenko
694bc06345
md5sum: use config help text similar to other "sum" tools
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-08 12:49:39 +01:00
Denys Vlasenko
a2cae937d0
top: much faster cursor key navigation by avoiding process rescan
...
function old new delta
handle_input 549 560 +11
top_main 889 891 +2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-07 04:47:52 +01:00
Denys Vlasenko
75e56a3db9
top: do unsigned rather than signed division in do_stats()
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-07 04:20:22 +01:00
Denys Vlasenko
86107d6dc7
top: handle much larger VSZ values
...
function old new delta
display_process_list 1018 999 -19
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-07 03:59:52 +01:00
Denys Vlasenko
e1b1b79269
use gmtime_r() instead of gmtime()
...
This avoids pulling in gmtime's static buffer:
function old new delta
svlogd_main 1401 1412 +11
send_headers 668 678 +10
gmtime 21 - -21
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 2/0 up/down: 21/-21) Total: 0 bytes
text data bss dec hex filename
920221 555 5804 926580 e2374 busybox_old
920221 555 5740 926516 e2334 busybox_unstripped
^^^^
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-06 18:11:47 +01:00
Denys Vlasenko
33f7c8f200
hush: code shrink
...
function old new delta
run_pipe 1589 1591 +2
pseudo_exec_argv 374 375 +1
builtin_type 114 115 +1
find_function 8 - -8
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 3/0 up/down: 4/-8) Total: -4 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-06 17:21:57 +01:00
Denys Vlasenko
d51ba0b5ab
networking/interface.c: get rid of global data
...
These were data/bss:
static.proc_read 1 - -1
int_list 4 - -4
int_last 4 - -4
We never call display_interfaces() twice, thus code to not scan /proc twice
never triggers.
function old new delta
do_if_print - 1998 +1998
display_interfaces 145 249 +104
static.proc_read 1 - -1
add_interface 104 103 -1
int_list 4 - -4
int_last 4 - -4
if_readlist_proc 560 542 -18
if_readconf 141 - -141
do_if_fetch 643 - -643
ife_print 1296 - -1296
------------------------------------------------------------------------------
(add/remove: 1/6 grow/shrink: 1/2 up/down: 2102/-2108) Total: -6 bytes
text data bss dec hex filename
933084 473 6844 940401 e5971 busybox_old
933087 473 6836 940396 e596c busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-05 18:30:33 +01:00
Denys Vlasenko
82ec89480d
networking/interface.c: get rid of global "smallint interface_opt_a"
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-05 17:46:17 +01:00
Denys Vlasenko
8a5299fcfd
networking/interface.c: code shrink
...
function old new delta
ife_print 1293 1296 +3
display_interfaces 145 146 +1
if_readconf 162 141 -21
if_readlist_proc 631 560 -71
do_if_fetch 753 643 -110
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/3 up/down: 4/-202) Total: -198 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-05 16:56:16 +01:00
Peter Lloyd
804ce5a6fe
wget: fix fetching of https URLs with http proxy
...
When fetching a https:// URL with HTTP proxy configured
(e.g. with environment variable http_proxy=http://your-proxy:3128 )
busybox was making a https connection to the proxy.
This was because the protocol scheme for the target URL was used to determine whether to connect to the proxy over SSL or not.
When the proxy is in use, the decision on whether to connect to the proxy over https
should based on the proxy URL not on the target URL.
function old new delta
wget_main 2381 2387 +6
Signed-off-by: Peter Lloyd <l-busybox@pgl22.co.uk >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-05 00:19:33 +01:00
Sean MacLennan
d9aabfe578
make busybox more portable
...
Move some distro specific include files into the appropriate #ifdef
blocks to make the code more portable.
Signed-off-by: Sean MacLennan <seanm@seanm.ca >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-04 23:15:59 +01:00
Denys Vlasenko
d4802c6243
hush: fix a='a\\'; echo "${a%\\\\}"
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-02 20:48:36 +01:00
Denys Vlasenko
55f8133a4f
shell: tweak bkslash_in_varexp.tests, add bkslash_in_varexp1.tests
...
It turns out bkslash_in_varexp.tests was a bash bug :]
ash and hush fail "corrected" bkslash_in_varexp.tests as well,
just not as badly as I thought (hush gets half of the cases right).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-02 18:12:12 +01:00
Denys Vlasenko
744a20d8f9
shell: two new tests, both fail for ash and hush
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-03-02 17:13:22 +01:00
Andy Shevchenko
cc222747ae
libbb: Use return value from is_prefixed_with()
...
add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-5 (-5)
Function old new delta
skip_dev_pfx 30 25 -5
Total: Before=779966, After=779961, chg -0.00%
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-27 13:35:40 +01:00
Denys Vlasenko
d82ea2ba8f
tcpudp: shrink per-host rate-limiting code
...
function old new delta
tcpudpsvd_main 1775 1780 +5
ipsvd_perhost_add 108 107 -1
cclen 4 - -4
cc 4 - -4
ipsvd_perhost_init 30 25 -5
ipsvd_perhost_remove 80 44 -36
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/3 up/down: 5/-50) Total: -45 bytes
text data bss dec hex filename
933358 473 6852 940683 e5a8b busybox_old
933326 473 6844 940643 e5a63 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-27 13:03:44 +01:00
Denys Vlasenko
0e0209ac53
less: accept -R option. Closes 10816
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-27 11:47:51 +01:00
Ron Yorston
23286900da
lineedit: allow window size tracking to be disabled
...
function old new delta
lineedit_read_key 269 261 -8
win_changed 47 - -47
read_line_input 3884 3821 -63
cmdedit_setwidth 63 - -63
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 0/2 up/down: 0/-181) Total: -181 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-25 20:09:54 +01:00
Denys Vlasenko
e20a703fd3
df: do "rootfs" check sooner
...
function old new delta
df_main 1065 1064 -1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-23 17:08:32 +01:00
Denys Vlasenko
58cd6e1ade
df: 4TB+ support on 32 bits arch
...
Reported for Pascal Bellard.
function old new delta
df_main 1054 1065 +11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-23 17:00:23 +01:00
Denys Vlasenko
bf39d97e9d
Fix install with hardlinks and a custom PREFIX. Closes 10801
...
Trying to install busybox with hardlinks and a custom PREFIX will fail
for applets not in the /bin directory, because relative pathnames are
used. applets/install.sh is *supposed to* use the absolute pathname
for hardlinks but it fails to do so because the wrong check is used
in the if statement.
While fixing it, shore up other sloppy coding in applets/install.sh
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-23 16:29:26 +01:00
Denys Vlasenko
3177626033
od: move address_fmt[] from data to globals. 8 less bytes in data section
...
function old new delta
od_main 2164 2179 +15
address_fmt 8 - -8
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 15/-8) Total: 7 bytes
text data bss dec hex filename
930954 481 6852 938287 e512f busybox_old
930977 473 6852 938302 e513e busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-22 12:14:55 +01:00
Denys Vlasenko
2709acbbda
sort: fix potentially buggy use of OPT_STR
...
This also makes OPT_STR reused:
text data bss dec hex filename
930979 481 6852 938312 e5148 busybox_old
930954 481 6852 938287 e512f busybox_unstripped
^^^^^^
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-22 11:03:23 +01:00
Denys Vlasenko
427ae18348
sort: in -s handling, return 1/-1, not 1/0 compare result
...
function old new delta
compare_keys 794 795 +1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-22 10:54:55 +01:00
Denys Vlasenko
2af5e3fac3
libbb: compile capability code only if FEATURE_SETPRIV_CAPABILITIES or RUN_INIT
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-21 20:13:39 +01:00
Denys Vlasenko
7d285c78a3
sort: fix -s. Closes 10671
...
function old new delta
sort_main 786 862 +76
compare_keys 720 794 +74
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 150/0) Total: 150 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-21 20:08:54 +01:00
Jan Luebbe
e789c3bea1
iplink: implement support for selecting a master interface
...
Attaching an interface to a VRF is done by setting the interface's
master. Besides VRF, this can also be used for bridges.
function old new delta
set_master - 142 +142
do_iplink 1262 1357 +95
packed_usage 32546 32539 -7
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 237/-7) Total: 230 bytes
Signed-off-by: Jan Luebbe <jluebbe@debian.org >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-20 19:43:32 +01:00
Jan Luebbe
79cda9522a
ip link: support "add TYPE vrf", improve --help
...
VRF interfaces have a mandatory table parameter, which needs to be
specified using a RTNL attribute.
function old new delta
do_add_or_delete 1150 1254 +104
packed_usage 32444 32546 +102
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 206/0) Total: 206 bytes
Signed-off-by: Jan Luebbe <jluebbe@debian.org >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-20 19:29:05 +01:00
Denys Vlasenko
b083e8cc53
umount: fix "umount -t FSTYPE MNTPOINT" acting as if -a is specified
...
While at it, add -t to --help, and fix comments which say that -t is ignored
function old new delta
packed_usage 32427 32444 +17
umount_main 558 552 -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 17/-6) Total: 11 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-20 17:58:19 +01:00
Denys Vlasenko
a84db18fc7
tar,unzip: postpone creation of symlinks with "suspicious" targets
...
This mostly reverts commit bc9bbeb2b8
"libarchive: do not extract unsafe symlinks unless $EXTRACT_UNSAFE_SYMLINKS=1"
Users report that it is somewhat too restrictive. See
https://bugs.busybox.net/show_bug.cgi?id=8411
In particular, this interferes with unpacking of busybox-based
filesystems with links like "sbin/applet" -> "../bin/busybox".
The change is made smaller by deleting ARCHIVE_EXTRACT_QUIET flag -
it is unused since 2010, and removing conditionals on it
allows commonalizing some error message codes.
function old new delta
create_or_remember_symlink - 94 +94
create_symlinks_from_list - 64 +64
tar_main 1002 1006 +4
unzip_main 2732 2724 -8
data_extract_all 984 891 -93
unsafe_symlink_target 147 - -147
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 1/2 up/down: 162/-248) Total: -86 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-20 16:06:53 +01:00
Denys Vlasenko
95121d98e6
poweroff: add a config option for people needing VERY early poweroff
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-19 15:52:35 +01:00
Denys Vlasenko
7398892ac0
mkfs_ext2, mkfs_vfat: fix warnings in STORE_LE on big-endian platforms
...
"warning: large integer implicitly truncated to unsigned type [-Woverflow]"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-15 13:46:34 +01:00
Denys Vlasenko
a48eadbc22
tls: remove redundant floor prevention
...
function old new delta
tls_xread_record 499 489 -10
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-14 17:37:41 +01:00
Denys Vlasenko
256adb0f99
ping: don't call monotonic_us twice per sending the ping
...
function old new delta
sendping6 80 85 +5
sendping4 106 111 +5
sendping_tail 209 204 -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 10/-5) Total: 5 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-13 23:53:24 +01:00
Denys Vlasenko
7189af847f
ping: implement -A "adaptive ping"
...
function old new delta
common_ping_main 1757 1862 +105
packed_usage 32367 32427 +60
sendping_tail 236 209 -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 165/-27) Total: 138 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-13 23:21:33 +01:00
Denys Vlasenko
4892f3a4c7
inetd,mount: add comment with example of flags to build with libtirpc
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-13 18:20:28 +01:00
Denys Vlasenko
edccc982e5
progress meter: add disabled code for a more stable ETA
...
Compiles to ~25 bytes if enabled.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-13 16:48:52 +01:00
Denys Vlasenko
aa617ac097
hush: simplify process_command_subs()
...
Incidentally, this fixes LINENO bug here:
echo "1:${LINENO}"
echo "2:`echo; echo`" # was counting lines in the `cmd` output as LINENO++
echo "3:${LINENO}"
function old new delta
parse_and_run_file 53 71 +18
expand_vars_to_list 1187 1164 -23
setup_file_in_str 25 - -25
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 18/-48) Total: -30 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-13 15:31:19 +01:00
Denys Vlasenko
8de5b9f88b
ash : fix double-quoted "\z" handling
...
function old new delta
readtoken1 2602 2608 +6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-13 14:44:11 +01:00
Denys Vlasenko
3459024bf4
wget: more thorough sanitization of other side's data
...
function old new delta
get_sanitized_hdr - 156 +156
fgets_trim_sanitize - 128 +128
ftpcmd 129 133 +4
parse_url 461 454 -7
sanitize_string 14 - -14
wget_main 2431 2381 -50
fgets_and_trim 119 - -119
gethdr 163 - -163
------------------------------------------------------------------------------
(add/remove: 2/3 grow/shrink: 1/2 up/down: 288/-353) Total: -65 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-12 16:46:13 +01:00
Ron Yorston
ecaec1dbec
testsuite: update busybox and bzcat tests
...
Test scripts that use CONFIG_* variables need to source .config.
Since this wasn't being done for busybox many tests were skipped.
As a result new failures due to changes in help output were missed.
Also remove some unnecessary echos in the bzcat script.
Signed-off-by: Ron Yorston <rmy@pobox.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-12 15:32:02 +01:00
Denys Vlasenko
7f441403cb
cp: fix option handling in non-longopt config
...
the patch getopt32: remove opt_complementary 22542eca18
introduced a regressed in the cp command since it removed all aliases of arguments
if long_opts is not configured.
Patch by Sebastian Gottschall <s.gottschall@dd-wrt.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-11 21:25:23 +01:00
Denys Vlasenko
b5257a6701
arping: code shrink
...
function old new delta
catcher 310 309 -1
arping_main 1668 1641 -27
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-11 21:16:24 +01:00
Denys Vlasenko
ba3b9dbf06
libbb: introduce and use bb_getsockname()
...
function old new delta
bb_getsockname - 18 +18
xrtnl_open 88 83 -5
do_iplink 1216 1209 -7
arping_main 1686 1668 -18
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/3 up/down: 18/-30) Total: -12 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-11 14:55:46 +01:00
Denys Vlasenko
d3162773d5
arping: move packet buffer, sigset and struct ifreq to malloced "globals"
...
This way, we can zero them all in one go.
We do malloc() anyway, thus nothing is lost by mallocing "globals"
function old new delta
arping_main 1683 1686 +3
finish 100 86 -14
catcher 350 310 -40
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 3/-54) Total: -51 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-11 14:35:46 +01:00
Denys Vlasenko
e015d0659f
arping: fix the case when inherited signal mask masks out ALRM
...
function old new delta
arping_main 1629 1635 +6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-11 13:48:52 +01:00
Denys Vlasenko
a3ec3bd0f8
arping: change a few message strings to be closer to iputils arping
...
ARPING 192.168.1.1 from 192.168.1.172 wlan0
Unicast reply from 192.168.1.1 [F4:F2:6D:52:A8:DE] 1.672ms
Sent 1 probes (1 broadcast(s))
Received 1 response(s)
ARPING 192.168.1.1 from 192.168.1.172 wlan0
Unicast reply from 192.168.1.1 [f4:f2:6d:52:a8:de] 1.152ms
Sent 1 probe(s) (1 broadcast(s))
Received 1 response(s) (0 request(s), 0 broadcast(s))
function old new delta
finish 120 100 -20
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-11 13:37:07 +01:00
Denys Vlasenko
f5d50fbd2f
arping: code shrink
...
Do not clear extra bits on option_mask32, it's not necessary.
Move DAD bit to 2, this makes exit logic simpler.
function old new delta
arping_main 1655 1629 -26
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-11 13:27:54 +01:00
Denys Vlasenko
3f52d13647
svlogd: improve --help text
...
function old new delta
packed_usage 32278 32367 +89
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-09 20:21:01 +01:00
Denys Vlasenko
f786901c4b
hush: probably fixing a bug in last LINENO fix
...
I don't have an example of mishandled script, but the logic looked wrong:
it could sometimes treat newlines as if they are spaces.
function old new delta
parse_stream 2788 2787 -1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-08 19:39:42 +01:00
Denys Vlasenko
5807e18f0c
hush: LINENO fix
...
Script triggering the bug:
t=0
echo "at line ${LINENO}"
while [ ${t} -lt 10 ]; do
echo "at line ${LINENO}" # LINENO was 3 instead of 4 here
t=$((t+1))
done
function old new delta
parse_stream 2754 2788 +34
done_word 711 738 +27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 61/0) Total: 61 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-08 19:19:04 +01:00
Denys Vlasenko
68ae54243c
ip: fix crash in "ip neigh show"
...
parse_rtattr() was using tb[] array without initializing it.
Based on patch by Balaji Punnuru <balaji_punnuru@cable.comcast.com >
function old new delta
parse_rtattr 85 107 +22
print_route 1630 1617 -13
print_linkinfo 807 794 -13
iproute_get 835 822 -13
print_rule 680 665 -15
ll_remember_index 263 248 -15
print_addrinfo 1223 1197 -26
ipaddr_list_or_flush 1253 1223 -30
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/7 up/down: 22/-125) Total: -103 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-08 08:42:37 +01:00
Denys Vlasenko
237a900bc5
wget: do not ask for TLS-encrypted downloads on plain ftp:// URLs
...
function old new delta
wget_main 2422 2431 +9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-08 00:28:30 +01:00
Denys Vlasenko
47529d3f16
libbb: shrink wget/tftp progress indicator code a bit more
...
This makes size display 5-char wide instead of 6-char, but now it's smarter
(can show sizes in "12.3M" format).
function old new delta
bb_progress_update 654 622 -32
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-07 23:48:34 +01:00
Denys Vlasenko
ab843e3244
libbb: shrink wget/tftp progress indicator code for 32-bit
...
function old new delta
bb_progress_update 756 654 -102
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-07 17:47:39 +01:00
Denys Vlasenko
2bd5b4e9a0
udhcp: do not setlinebuf(stdout), we don't print to stdout anymore
...
Since bb_info_msg() was eliminated type of buffering on stdout is not important
function old new delta
udhcpd_main 1463 1451 -12
udhcpc_main 2735 2723 -12
setlinebuf 19 - -19
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 0/2 up/down: 0/-43) Total: -43 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-07 16:32:30 +01:00
Denys Vlasenko
4cae044b43
bzip2: expose tuning knob for faster/smaller code
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-07 01:33:25 +01:00
Denys Vlasenko
2b7515722b
wget: attempt to negotiate encrypted data ftps stream ("PROT P")
...
function old new delta
wget_main 2382 2422 +40
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-06 20:49:27 +01:00
Denys Vlasenko
1267770a9d
fix compile failure in previous commit
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-06 18:01:39 +01:00
Denys Vlasenko
5cdd120f0c
unzip: do not set directory mode to 0777
...
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=882177
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-06 17:59:32 +01:00
Denys Vlasenko
0a90960f44
ar: hopefully fix out-of-bounds read in get_header_ar()
...
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=882175
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-06 17:39:45 +01:00
Denys Vlasenko
8d943175ce
fix a thinko in parse_pasv_epsv.c
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-06 17:11:15 +01:00
Denys Vlasenko
1783ffa990
wget: add EPSV support
...
function old new delta
parse_pasv_epsv - 151 +151
wget_main 2440 2382 -58
xconnect_ftpdata 223 94 -129
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/2 up/down: 151/-187) Total: -36 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-06 15:48:12 +01:00
Denys Vlasenko
403f2999f9
wget: initial support for ftps://
...
function old new delta
spawn_ssl_client - 185 +185
parse_url 409 461 +52
packed_usage 32259 32278 +19
tls_run_copy_loop 293 306 +13
ssl_client_main 128 138 +10
showmode 330 338 +8
P_FTPS - 5 +5
filter_datapoints 177 179 +2
deflate 907 905 -2
decode_one_format 723 716 -7
wget_main 2591 2440 -151
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 6/3 up/down: 294/-160) Total: 134 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-06 15:15:08 +01:00
Denys Vlasenko
e999657f6d
wget: preparations for ftps:// support (block move, no code changes)
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-06 15:02:16 +01:00
Denys Vlasenko
98066662aa
tls: fix hash calculations if client cert is requested and sent
...
Symptoms: connecting to
openssl s_server -cert vsftpd.pem -port 990 -debug -cipher AES128-SHA
works, but with "-verify 1" option added it does not.
function old new delta
tls_xread_record 474 499 +25
tls_handshake 1582 1607 +25
bad_record_die 98 110 +12
tls_run_copy_loop 282 293 +11
tls_xread_handshake_block 58 51 -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/1 up/down: 73/-7) Total: 66 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-06 13:33:00 +01:00
Denys Vlasenko
5740e15de5
ftpd: handle restarts past 2147483647 bytes. closes 10741
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-05 19:06:40 +01:00
Denys Vlasenko
c2a51b0cf1
bzip2: work around bad compiler optimization
...
gc-6.1.1 x86_64:
function old new delta
generateMTFValues 380 367 -13
gcc-4.3.1 386:
function old new delta
inner_loop - 41 +41
generateMTFValues 357 294 -63
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 41/-63) Total: -22 bytes
gcc-6.3.0 386:
function old new delta
inner_loop - 36 +36
generateMTFValues 363 250 -113
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 36/-113) Total: -77 bytes
The last case, gcc-6.3.0, runs almost 3 times faster after this change.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-05 00:34:08 +01:00
Denys Vlasenko
f75a7c0439
ftpd: fix aliasing warning from gcc-6.1.1
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-04 23:55:14 +01:00
Denys Vlasenko
05b84d4e92
ftpgetput: add EPSV support (PASV-like thing for IPv6)
...
Based on a patch by Kev Kitchens.
function old new delta
xconnect_ftpdata 149 223 +74
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-04 19:08:34 +01:00
Denys Vlasenko
daa643205f
ftpgetput: preparations for ESPV support, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-04 18:49:31 +01:00
Denys Vlasenko
565af23222
ftpd: switch to mallced "globals"
...
function old new delta
cmdio_write_ok 45 49 +4
cmdio_write_error 45 49 +4
handle_dir_common 360 363 +3
handle_cwd 40 43 +3
port_or_pasv_was_seen 37 39 +2
pasv_active 13 15 +2
cmdio_write_raw 34 36 +2
cmdio_write 78 80 +2
get_remote_transfer_fd 94 93 -1
port_pasv_cleanup 50 45 -5
bind_for_passive_mode 124 119 -5
cmdio_get_cmd_and_arg 237 230 -7
timeout_handler 104 93 -11
ftpd_main 2222 2152 -70
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 8/6 up/down: 22/-99) Total: -77 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-04 18:32:21 +01:00
Denys Vlasenko
2598915d43
gunzip: fix from gzip-1.3.12 for gzip file with all zero length codes
...
Corresponding changelog from gzip-1.3.12 reads:
"""
2006-12-20 Paul Eggert <eggert@cs.ucla.edu >
* inflate.c (huft_build): Fix regression that caused gzip to
refuse to uncompress null input (all zero length codes). Problem
reported by Yiorgos Adamopoulos. This regression was caused by
the security patch installed 2006-11-20, which in turn came from
Debian, which in turn apparently came from Thomas Biege of SuSe.
"""
function old new delta
huft_build 1176 1216 +40
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-04 00:15:29 +01:00
Denys Vlasenko
0e60a36c92
bzip2: move runningOrder[] back to stack - 256 bytes is not much
...
function old new delta
mainSort 1119 1108 -11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 22:52:55 +01:00
Denys Vlasenko
86be6d5ba9
bzip2: move ->origPtr out of struct EState, make a few members smaller
...
function old new delta
BZ2_compressBlock 223 228 +5
BZ2_blockSort 85 88 +3
generateMTFValues 356 357 +1
handle_compress 355 349 -6
compressStream 538 531 -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 9/-13) Total: -4 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 20:51:12 +01:00
Denys Vlasenko
c9ae8d770b
bzip2: pass sorting params through EState* pointer
...
function old new delta
mainGtU 499 515 +16
sendMTFValues 2085 2094 +9
mainSort 1116 1119 +3
generateMTFValues 357 356 -1
fallbackSort 1719 1705 -14
mainQSort3 1163 1141 -22
BZ2_blockSort 118 85 -33
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/4 up/down: 28/-70) Total: -42 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 20:19:51 +01:00
Denys Vlasenko
10f516500e
gzip2: small simplification in mainSimpleSort()
...
function old new delta
mainQSort3 1165 1163 -2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 19:11:00 +01:00
Denys Vlasenko
0599a137ba
bzip2: a few more locals converted to generic types
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 18:47:34 +01:00
Denys Vlasenko
8e31412231
bzip2: eliminate one parameter to mainQSort3()
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 18:28:10 +01:00
Denys Vlasenko
9431bdd189
bzip2: small simplification in mainSort()
...
function old new delta
mainSort 1127 1118 -9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 18:11:08 +01:00
Denys Vlasenko
fe1bab4d35
bzip2: convert some locals to unsigned's
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 18:03:33 +01:00
Denys Vlasenko
c364d32ccc
bzip2: runningOrder[] values are always 0..255, make it uint8
...
function old new delta
mainSort 1171 1124 -47
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 17:44:00 +01:00
Denys Vlasenko
df23f55e39
bzip2: remove redundant clearing of an alredy unset bit
...
function old new delta
mainSort 1178 1171 -7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 17:38:23 +01:00
Denys Vlasenko
524fa29a93
bzip2: eliminate write-only local numQSorted
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 17:30:16 +01:00
Denys Vlasenko
2109fce410
bzip2: make locals in mainSort() saner, convert one of them from uint16 to unsigned
...
function old new delta
mainSort 1192 1178 -14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 17:22:06 +01:00
Denys Vlasenko
aaa3818a75
bzip2: remove redundant loop termination check in mainSort()
...
function old new delta
mainSort 1202 1192 -10
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 16:43:33 +01:00
Denys Vlasenko
e59e5ff96e
bzip2: reduce indentation, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 15:59:46 +01:00
Denys Vlasenko
9e5662ea74
bzip2: reuse zPend processing code
...
function old new delta
generateMTFValues 378 357 -21
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 15:53:17 +01:00
Denys Vlasenko
2cfe10a558
bzip2: shrink makeMaps_e()
...
function old new delta
generateMTFValues 378 368 -10
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 15:31:54 +01:00
Denys Vlasenko
1cbcb02316
bzip2: optimize zPend variable code
...
function old new delta
generateMTFValues 433 378 -55
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 15:26:00 +01:00
Denys Vlasenko
fc228b48c9
bzip2: have two separate "store bit 0" and "store bit 1" functions
...
function old new delta
sendMTFValues 2051 2085 +34
bsW1_0 - 33 +33
BZ2_compressBlock 225 223 -2
bsW1 52 - -52
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/1 up/down: 67/-54) Total: 13 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 14:56:43 +01:00
Denys Vlasenko
feafb3423e
bzip2: ~1% speedup by special-casing "store 1 bit" function
...
function old new delta
bsW1 - 52 +52
BZ2_compressBlock 230 225 -5
BZ2_blockSort 125 118 -7
sendMTFValues 2070 2051 -19
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/3 up/down: 52/-31) Total: 21 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 04:43:46 +01:00
Denys Vlasenko
982c44d030
bzip2: rewrite bit of code which depends on integer overflow
...
function old new delta
sendMTFValues 2093 2070 -23
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 03:34:40 +01:00
Denys Vlasenko
83dd4ff696
bzip2: delete write-only fave[] array
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 03:17:48 +01:00
Denys Vlasenko
3a2c97bd12
bgip2: fewer specifically-sized [u]int32_t's locals in sendMTFValues
...
Generic ints/unsigneds are usually fine. Yes, really.
function old new delta
sendMTFValues 2100 2093 -7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 03:14:07 +01:00
Denys Vlasenko
359230da8e
bzip2: code shrink
...
function old new delta
sendMTFValues 2111 2100 -11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 02:03:42 +01:00
Denys Vlasenko
e594fb2171
bzip2: code shrink
...
function old new delta
BZ2_compressBlock 225 230 +5
handle_compress 356 355 -1
bsW16 59 56 -3
bsW 64 61 -3
bsFinishWrite 37 32 -5
prepare_new_block 48 34 -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/5 up/down: 5/-26) Total: -21 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-03 01:30:12 +01:00
Denys Vlasenko
125c3ff4b1
bzip2: code shrink
...
function old new delta
bsW16 - 59 +59
sendMTFValues 2116 2111 -5
bsPutU16 36 - -36
bsPutU32 76 31 -45
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/2 up/down: 59/-86) Total: -27 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-02 20:59:28 +01:00
Denys Vlasenko
da49e7057a
cksum: code shrink
...
function old new delta
cksum_main 281 262 -19
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-01 11:44:52 +01:00
Denys Vlasenko
ddacb03e87
libbb: commonalize a bit of little-endian CRC32 table generation code
...
function old new delta
global_crc32_new_table_le - 11 +11
crc32_new_table_le - 9 +9
inflate_unzip_internal 560 556 -4
flash_eraseall_main 823 819 -4
unpack_xz_stream 2403 2394 -9
lzop_main 121 112 -9
gzip_main 187 178 -9
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/5 up/down: 20/-35) Total: -15 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-01 10:56:19 +01:00
Denys Vlasenko
06076494da
udhcpd: use ptr_to_globals for its lone global data (g_leases)
...
function old new delta
udhcpd_main 1461 1463 +2
add_lease 320 318 -2
g_leases 4 - -4
write_leases 223 214 -9
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/2 up/down: 2/-15) Total: -13 bytes
text data bss dec hex filename
933232 481 6856 940569 e5a19 busybox_old
933223 481 6852 940556 e5a0c busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-01 10:41:14 +01:00
Aaro Koskinen
d15d7a0a4b
cp: implement -T
...
Implement "cp -T". Some Linux kernel Makefiles started using this recently,
so allow also building on systems using busybox cp.
function old new delta
cp_main 360 428 +68
copy_file 1678 1676 -2
packed_usage 32290 32259 -31
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 76/-39) Total: 35 bytes
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-01 09:30:59 +01:00
Denys Vlasenko
d6f0f03b68
libarchive: move bbunpack constants to bb_archive.h
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-01 09:13:14 +01:00
Denys Vlasenko
99ac1759dd
lzop: code shrink
...
function old new delta
lzo_decompress 526 524 -2
lzo_compress 473 470 -3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-01 01:41:31 +01:00
Denys Vlasenko
97058d0585
unlzop: fix --help: it has -U instead of -k
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-01 01:03:50 +01:00
Denys Vlasenko
1b8ac93a20
bzip2: code shrink, stop using global data variable
...
function old new delta
compressStream 523 538 +15
level 1 - -1
bzip2_main 110 73 -37
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 15/-38) Total: -23 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-02-01 01:00:58 +01:00
Denys Vlasenko
54a174eb01
gzip: "compressed_len" is unused, stop wasting code and time calculating it
...
function old new delta
flush_block 595 523 -72
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-31 23:26:11 +01:00
Denys Vlasenko
a142926029
gzip: remove unnecessary forward declarations, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-31 18:16:34 +01:00
Denys Vlasenko
919bc9d43c
gzip: flush output buffer after stored blocks only if necessary
...
function old new delta
flush_block 671 680 +9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-31 17:37:32 +01:00
Denys Vlasenko
f21ebeece5
gzip: flush output buffer after stored blocks, they are not 32-bit aligned
...
function old new delta
flush_block 665 671 +6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-31 17:19:59 +01:00
Denys Vlasenko
ba63d70e2d
gzip: make debugging of bits_sent less ugly, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-31 17:00:41 +01:00
Denys Vlasenko
26eea71c87
gzip: code shrink
...
function old new delta
flush_block 668 665 -3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-31 16:36:17 +01:00
Denys Vlasenko
05251986c7
gzip: code shrink
...
Use one memset to clear part of G1, and all of G2.
function old new delta
pack_gzip 838 828 -10
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-31 16:11:56 +01:00
Denys Vlasenko
8fd35a1fa6
gzip: code shrink
...
function old new delta
pack_gzip 861 838 -23
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-31 15:42:45 +01:00
Denys Vlasenko
468731a86b
gzip: code shrink and speedup
...
function old new delta
pack_gzip 908 861 -47
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-31 15:32:32 +01:00
Denys Vlasenko
631c16855a
gzip: optionally faster put_32bit()
...
function old new delta
put_32bit 22 55 +33
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-31 00:42:29 +01:00
Denys Vlasenko
b7dfbbcdaa
gzip: speed up send_bits()
...
Replace one RMW op with store. This speeds up gzip of a png file by ~2%.
function old new delta
send_bits 62 66 +4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-31 00:01:06 +01:00
Denys Vlasenko
d7500f856d
gzip: use "unsigned" type for bit fields and bit counts
...
This does not change any logic, those values should always be positive.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-30 23:53:38 +01:00
Denys Vlasenko
6ba6a6f28e
gzip: use wider (32-bit, not 16) bi_buf
...
function old new delta
bi_windup 76 74 -2
send_bits 70 62 -8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-30 23:47:45 +01:00
Denys Vlasenko
e4c4e6ddc3
gzip: code shrink
...
function old new delta
send_bits 92 70 -22
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-30 22:37:06 +01:00
Denys Vlasenko
9c499a5af4
gzip: code shrink
...
function old new delta
fill_window_if_needed - 238 +238
deflate 924 907 -17
pack_gzip 809 790 -19
fill_window 216 - -216
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/2 up/down: 238/-252) Total: -14 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-30 18:15:39 +01:00
Denys Vlasenko
c6d2a26fac
gzip: code shrink (consolidate zeroing on reinit)
...
function old new delta
deflate - 938 +938
pack_gzip 1903 923 -980
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-30 17:39:57 +01:00
Denys Vlasenko
749575d3c5
hush: protect against self-modifying trap code
...
function old new delta
check_and_run_traps 211 236 +25
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-30 04:29:03 +01:00
Denys Vlasenko
6f9442ff30
ash: make it possible to disable "const global ptr" optimization
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-28 20:41:23 +01:00
Denys Vlasenko
f19e3c1c6c
shell: handle $((NUM++...) like bash does. Closes 10706
...
function old new delta
evaluate_string 680 729 +49
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-28 20:13:33 +01:00
Denys Vlasenko
675d24aeaf
ash: add LINENO support
...
This patch is a backport from dash of the combination of:
[SHELL] Add preliminary LINENO support
[VAR] Fix varinit ordering that broke fc
[SHELL] Improve LINENO support
function old new delta
parse_command 1604 1677 +73
calcsize 156 223 +67
copynode 196 258 +62
evalcommand 1546 1606 +60
ash_main 1046 1103 +57
lookupvar 51 106 +55
evalcase 269 317 +48
evaltree 501 547 +46
evalfor 156 200 +44
evalsubshell 156 195 +39
raise_error_syntax 11 29 +18
varinit_data 120 132 +12
evalfun 270 280 +10
funcline - 4 +4
cmdtxt 569 572 +3
trapcmd 306 304 -2
ash_vmsg 153 150 -3
startlinno 4 - -4
funcnest 4 - -4
xxreadtoken 263 250 -13
readtoken1 2645 2602 -43
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 14/4 up/down: 598/-69) Total: 529 bytes
text data bss dec hex filename
932834 481 6864 940179 e5893 busybox_old
933375 481 6856 940712 e5aa8 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-27 22:02:05 +01:00
Denys Vlasenko
54c2111781
hush: add HUSH_BASH_SOURCE_CURDIR config option, to be on par with ash
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-27 20:46:45 +01:00
Denys Vlasenko
f7e0feaf97
hush: fix dot builtin to not search current directory
...
function old new delta
builtin_source 182 209 +27
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-27 19:05:59 +01:00
Denys Vlasenko
bb373dbc32
tar: accomodate non-terminated tar.chksum fields as seen from github.com
...
function old new delta
get_header_tar 1783 1696 -87
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-27 19:04:08 +01:00
Denys Vlasenko
01f7b9e182
ash: introduce a config option to search current directory for sourced files
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-26 15:15:43 +01:00
Denys Vlasenko
e503962981
gzip: fix debug code. Closes 10681
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-26 00:21:25 +01:00
Nicholas Clark
77a6678c42
dd: add 'fullblock' iflag
...
Adds a fullblock iflag for improved compatibility with GNU dd.
The new iflag can be used to ensure that dd calls retrieve the
expected amount of data when reading from pipes or unusual
filesystems.
function old new delta
packed_usage 32249 32334 +85
dd_main 1582 1632 +50
static.iflag_words 12 22 +10
------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 145/0) Total: 145 bytes
Signed-off-by: Nicholas Clark <nicholas.clark@gmail.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-25 19:00:19 +01:00
Denys Vlasenko
043be55691
ash testsuite: add two hush tests from last commit
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-25 14:09:06 +01:00
Denys Vlasenko
cba79a87f8
hush: fix two corner cases in ${v/pattern/repl}. Closes 10686
...
function old new delta
expand_one_var 1592 1618 +26
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-25 14:07:40 +01:00
Denys Vlasenko
0ca3198f93
hush: fix handling of $_ (so far it's an ordinary variable, no special meaning)
...
function old new delta
parse_dollar 820 779 -41
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-25 13:20:50 +01:00
Denys Vlasenko
a497231f53
chrt: code shrink
...
function old new delta
show_min_max 60 59 -1
policies 96 72 -24
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-25 09:34:23 +01:00
William Pitcock
d8fd88a091
ash: add support for command_not_found_handle hook function (bashism)
...
This implements support for the command_not_found_handle hook function, which is
useful for allowing package managers to suggest packages which could provide the
command.
Unlike bash, however, we ignore exit codes from the hook function and always return
the correct POSIX error code (EX_NOTFOUND).
function old new delta
find_command 911 990 +79
Signed-off-by: William Pitcock <nenolod@dereferenced.org >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-24 18:33:18 +01:00
Denys Vlasenko
14bc965ea9
less: fix help text conditional for -R
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-24 16:47:08 +01:00
Denys Vlasenko
30b290f996
udhcpc6: additional fix for ppp interface type
...
Invent a fictitious MAC only once
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-23 16:46:31 +01:00
Denys Vlasenko
66ad9be603
chrt: use correct min/max priorities
...
function old new delta
chrt_main 369 432 +63
policies 48 96 +48
packed_usage 32239 32249 +10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 121/0) Total: 121 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-23 16:04:48 +01:00
Povilas Kanapickas
0f6e4350b3
chrt: add support for SCHED_IDLE
...
Signed-off-by: Povilas Kanapickas <povilas@radix.lt >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-23 16:04:48 +01:00
Povilas Kanapickas
1616fb8aca
chrt: add support for SCHED_BATCH
...
Signed-off-by: Povilas Kanapickas <povilas@radix.lt >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-23 16:04:48 +01:00
Denys Vlasenko
2b9a45b9e8
od_bloaty: fix debug code
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-23 14:49:12 +01:00
Denys Vlasenko
8528d3d4f8
less: optional support of -R
...
Based on patches by Lubomir Rintel <lkundrak@v3.sk >
function old new delta
read_lines 653 722 +69
less_main 2464 2531 +67
packed_usage 32202 32239 +37
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 173/0) Total: 173 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-22 14:38:51 +01:00
Sven-Göran Bergh
e411cd071a
volume_id: add LittleFS detection
...
Add support for LittleFS to blkid. Not included if FEATURE_BLKID_TYPE
is not selected (neither UUID nor label).
LittleFS is a small fail-safe filesystem designed for embedded
systems. It has strong copy-on-write guarantees and storage on disk
is always kept in a valid state. It also provides a form of dynamic
wear levelling for systems that can not fit a full flash translation
layer. (https://github.com/geky/littlefs )
ARM has introduced it in its Mbed OS 5.7, so it starts to gain focus.
(https://os.mbed.com/blog/entry/littlefs-high-integrity-embedded-fs/ )
function old new delta
volume_id_probe_lfs - 62 +62
fs1 20 24 +4
Signed-off-by: Sven-Göran Bergh <sgb@systemaxion.se >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-19 20:37:13 +01:00
Denys Vlasenko
f6dd9e0215
udhcpc6: fix for ppp interface type
...
function old new delta
d6_read_interface 454 600 +146
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-19 18:44:19 +01:00
Denys Vlasenko
46f839c3f7
hush: fix a case where EXIT trap may modify its code mid-flight
...
function old new delta
hush_exit 93 99 +6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-19 16:58:44 +01:00
Denys Vlasenko
b8d076b00b
hush: fix build if !BASH_LINENO_VAR
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-19 16:00:57 +01:00
Denys Vlasenko
6aad1ddcc9
hush: implement $LINENO bashism
...
function old new delta
run_pipe 1697 1774 +77
unset_local_var_len 258 301 +43
hush_main 1009 1051 +42
set_local_var 516 554 +38
parse_and_run_file 42 75 +33
i_getch 96 116 +20
.rodata 18858 18876 +18
done_command 106 122 +16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 8/0 up/down: 287/0) Total: 287 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-19 15:52:36 +01:00
Denys Vlasenko
7c44b600f9
udhcpc[6]: remove overzealous timeout clamping code
...
function old new delta
udhcpc_main 2840 2826 -14
udhcpc6_main 2699 2670 -29
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-17 13:55:51 +01:00
Denys Vlasenko
64211ce6fa
udhcpc6: --help fixes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-16 22:23:38 +01:00
Denys Vlasenko
438c72ece4
udhcpc6: show only short opts in --help text
...
function old new delta
packed_usage 26028 25966 -62
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-16 22:10:12 +01:00
Denys Vlasenko
6e9e6d8fbe
udhcpc6: fix lease time staying very small because -d was not specified
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-16 21:52:23 +01:00
Denys Vlasenko
14f13205ef
udhcpc6: code shrink
...
function old new delta
udhcpc6_main 2723 2727 +4
.rodata 128695 128561 -134
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-16 21:47:10 +01:00
Denys Vlasenko
ef5207f093
udhcpc6: add support of prefix delegation
...
Based on patch by DannyAAM <danny@saru.moe >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-16 21:39:14 +01:00
Denys Vlasenko
1e8d79ba12
udhcpc6: preparatory patch, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-16 21:35:39 +01:00
Denys Vlasenko
688cb3bc19
udhcpc6: fix ipv6prefix[_lease] envvar value in script invocation
...
Based on a patch by DannyAAM <danny@saru.moe >.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-16 16:00:13 +01:00
Denys Vlasenko
1750d3afc1
ash: a bit of NOFORK code should only be active if FEATURE_SH_STANDALONE=y
...
function old new delta
evalcommand 1546 1420 -126
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-15 00:41:04 +01:00
Denys Vlasenko
cefdd4be1f
popmaildir: tweak help text
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-14 20:48:14 +01:00
Denys Vlasenko
c4144ca3a5
renice: add comment about getpwnam/NOFORK interaction
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-14 19:40:00 +01:00
Denys Vlasenko
9967978551
renice: use BUILD_BUG_ON()
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-14 19:05:02 +01:00
Denys Vlasenko
6f1c942a31
NOFORK_NOEXEC.sh: a script to find "interesting" applets
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-14 14:44:30 +01:00
Denys Vlasenko
88663e481f
mv: make it NOEXEC
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-14 14:41:52 +01:00
Denys Vlasenko
cbdc37cae0
cal: make it NOEXEC
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-14 14:32:11 +01:00
Denys Vlasenko
586f1ee7cf
nandwrite: cope with old headers which have no MTD_FILE_MODE_RAW
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-14 13:43:31 +01:00
Denys Vlasenko
36495af81f
size_single_applets.sh: fix a bug which mishandles e.g. "udhcpc6" name
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-14 12:13:16 +01:00
Denys Vlasenko
38da4c4420
config: add size estimations for a few applets
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-14 12:03:33 +01:00
Denys Vlasenko
12714ffa27
tc: fix single-applet build
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-13 21:37:20 +01:00
Denys Vlasenko
aea52e7b2d
shell: echo ${?:0} was fixed sometime ago, enable it in tests
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-13 19:28:19 +01:00
Denys Vlasenko
9809a82b59
hush: fix raw ^C handlisg in single-quoted strings
...
function old new delta
parse_stream 2719 2754 +35
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-13 19:14:27 +01:00
Denys Vlasenko
6606c519ef
hush: add command2.tests from ash tests
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-12 17:58:20 +01:00
Denys Vlasenko
afb73a25ea
hush: tweak command -vV printing code, no logic changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-12 16:17:59 +01:00
Denys Vlasenko
5700029c65
hush: implement "command -v -V"
...
function old new delta
pseudo_exec_argv 231 374 +143
if_command_vV_print_and_exit - 127 +127
builtin_set 267 273 +6
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/0 up/down: 276/0) Total: 276 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-12 14:41:45 +01:00
Denys Vlasenko
cca7c611f2
which: fix TODO with NOFORK+malloc_failure misbehaving
...
function old new delta
find_executable 86 104 +18
which_main 202 194 -8
executable_exists 66 51 -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 18/-23) Total: -5 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-12 13:21:33 +01:00
Denys Vlasenko
3bb3e1d0a1
hush: implement "command" builtin (no options are supported yet)
...
function old new delta
pseudo_exec_argv 194 231 +37
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-11 18:05:05 +01:00
Denys Vlasenko
1f1911239c
hush: fix handling of ^C in eval
...
function old new delta
run_list 1044 1259 +215
builtin_eval 45 126 +81
expand_strvec_to_string 91 - -91
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 2/0 up/down: 296/-91) Total: 205 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-11 13:17:30 +01:00
Denys Vlasenko
932b9971d0
hush: fix handling of raw ^C in scripts: "echo ^C"
...
function old new delta
expand_vars_to_list 1133 1187 +54
parse_stream 2690 2719 +29
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-11 12:39:48 +01:00
Denys Vlasenko
aaf7a2e24d
hush: remove dead code
...
function old new delta
done_word 761 711 -50
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-11 11:19:00 +01:00
Denys Vlasenko
03c36e0be1
ash: ALWAYS_INLINE grabstackblock()
...
function old new delta
grabstackblock 5 - -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-10 15:18:35 +01:00
Denys Vlasenko
f2539c78d2
init: stop using static data
...
function old new delta
init_action_list 4 - -4
new_init_action 148 142 -6
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-10) Total: -10 bytes
text data bss dec hex filename
927839 481 6832 935152 e44f0 busybox_old
927833 481 6824 935138 e44e2 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-10 13:32:20 +01:00
Denys Vlasenko
baa41c7855
ash: make ${v:N:M} more robust for very large M by clamping to MIN/MAX_INT
...
Before this patch, "${v:2:0x100000001}" = "${v:2:1}",
and similarly, constructs like "${v:2:9999999999}" may give wrong result
due to int overflows.
function old new delta
substr_atoi - 43 +43
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-10 13:22:25 +01:00
Denys Vlasenko
2c876774a9
dd: fixed partial count logic
...
$ busybox dd if=/dev/zero of=/dev/loop0 bs=100M count=8; echo $?
8+0 records in
7+0 records out <=========== FIXED, was 7+1
805220352 bytes (767.9MB) copied, 0.464010 seconds, 1.6GB/s
1
function old new delta
write_and_stats 97 99 +2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-10 11:04:09 +01:00
Denys Vlasenko
5afd63a631
dd: exit with 1 if last write was incomplete
...
$ busybox dd if=/dev/zero of=/dev/loop0 bs=100M count=8; echo $?
8+0 records in
7+1 records out
805220352 bytes (767.9MB) copied, 0.464010 seconds, 1.6GB/s
1 <=========== FIXED
function old new delta
write_and_stats 96 97 +1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-10 10:58:55 +01:00
Denys Vlasenko
d1df1a709f
ash: add comment explaining last change
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-09 17:25:58 +01:00
Denys Vlasenko
740058b42b
ash: fix var_bash5.tests - ${VAR/pattern/repl} construct
...
function old new delta
subevalvar 1198 1279 +81
rmescapes 308 330 +22
preglob 8 10 +2
parsefname 152 154 +2
expandarg 973 975 +2
argstr 1144 1146 +2
mklocal 290 288 -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 6/1 up/down: 111/-2) Total: 109 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-09 17:07:06 +01:00
Shawn Landden
4261341281
umount: ignore -c
...
"-c, --no-canonicalize: Do not canonicalize paths."
As busybox doesn't canonicalize paths in the first place it is safe to ignore
this option.
See https://github.com/systemd/systemd/issues/7786
Signed-off-by: Shawn Landden <slandden@gmail.com >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-08 13:31:58 +01:00
Denys Vlasenko
2f55404bbc
mknod: better --help, much clearer code
...
function old new delta
packed_usage 32066 32091 +25
mknod_main 173 174 +1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-08 11:22:37 +01:00
Denys Vlasenko
83c99ab446
less: code shrink
...
function old new delta
less_main 2471 2464 -7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-08 10:27:23 +01:00
Denys Vlasenko
562f63e9a4
dhcprelay: code shrink
...
function old new delta
dhcprelay_main 961 958 -3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-08 10:14:17 +01:00
Denys Vlasenko
c9807d787d
nice: code shrink
...
function old new delta
nice_main 157 152 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-08 10:13:11 +01:00
Denys Vlasenko
cb9c3894e5
*: make "argc UNUSED_PARAM" consistent
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-08 09:43:51 +01:00
Denys Vlasenko
844a6c5abd
awk: code shrink
...
function old new delta
awk_main 955 948 -7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-07 14:39:34 +01:00
Ingo van Lil
9c8e94bc0a
ash: fail if 'shift' operand is out of range
...
If the numeric argument passed to ash's 'shift' built-in is greater than
'$#' the command performs no operation and exits successfully. It should
return a non-zero exit code instead:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#shift
This is consistent with bash and hush.
function old new delta
shiftcmd 122 120 -2
Signed-off-by: Ingo van Lil <inguin@gmx.de >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-07 14:22:38 +01:00
Denys Vlasenko
6f4a785bd1
awk: fix 'delete array[var--]' decrementing var twice
...
function old new delta
evaluate 3395 3390 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-07 01:19:08 +01:00
Denys Vlasenko
7367a949a6
libbb: compile obscure() only if FEATURE_PASSWD_WEAK_CHECK=y
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-04 15:21:25 +01:00
Yann E. MORIN
a47375de8c
build system: add rule to install without cloberring existing utilities
...
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-04 14:43:46 +01:00
Yann E. MORIN
952d5a6024
applets/install: accept more than one install option
...
Currently, it is impossible to pass more than one option to the isntall
script, so it totally prevents using --noclobber.
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-04 14:43:46 +01:00
Yann E. MORIN
84be5ce0d8
applets/install: respect noclobber for script wrappers too
...
Simplify the handling of --noclobber so that it applies to all types of
installation types, even to script wrappers.
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr >
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-04 14:36:17 +01:00
Denys Vlasenko
a034cab095
tc: enables this applet
...
function old new delta
tc_main - 946 +946
cbq_print_opt - 517 +517
print_qdisc - 475 +475
print_class - 359 +359
llproto_names - 264 +264
packed_usage 31853 32066 +213
ll_proto_a2n - 112 +112
llproto_ids - 86 +86
print_tc_classid - 82 +82
static.objects - 20 +20
static._q_ - 16 +16
applet_main 1564 1568 +4
print_filter - 3 +3
applet_names 2708 2711 +3
------------------------------------------------------------------------------
(add/remove: 13/0 grow/shrink: 3/0 up/down: 3100/0) Total: 3100 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-04 10:27:51 +01:00
Denys Vlasenko
d75f9081d4
Start 1.29.0 development cycle
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com >
2018-01-02 06:11:19 +01:00