Commit Graph

15399 Commits

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