Commit Graph

15910 Commits

Author SHA1 Message Date
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