Denys Vlasenko [Thu, 14 Sep 2017 09:20:36 +0000 (11:20 +0200)]
hexedit: code shrink
function old new delta
hexedit_main 1176 1169 -7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 14 Sep 2017 09:01:37 +0000 (11:01 +0200)]
hexdump: code shrink
function old new delta
remap 173 178 +5
move_mapping_lower 107 109 +2
move_mapping_further 141 143 +2
hexedit_main 1191 1176 -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 9/-15) Total: -6 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 14 Sep 2017 08:51:12 +0000 (10:51 +0200)]
hexedit: implement "[enter] goto offset" key
This is a must if you need to edit sector
123456789999 on your /dev/disk.
text data bss dec hex filename
922745 481 6832 930058 e310a busybox_old
923023 481 6832 930336 e3220 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 14 Sep 2017 07:42:40 +0000 (09:42 +0200)]
hexedit: restore screen on exit
function old new delta
hexedit_main 998 1082 +84
restore_term - 29 +29
remap 168 173 +5
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/0 up/down: 118/0) Total: 118 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 13 Sep 2017 22:04:16 +0000 (00:04 +0200)]
hexedit: optimize output buffering
function old new delta
hexedit_main 970 998 +28
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 13 Sep 2017 21:02:51 +0000 (23:02 +0200)]
hexedit: implement page up/down
function old new delta
hexedit_main 924 970 +46
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 13 Sep 2017 20:48:30 +0000 (22:48 +0200)]
*: use ESC define instead of "\033"; use ESC[m instead of ESC[0m
text data bss dec hex filename
922535 481 6832 929848 e3038 busybox_old
922534 481 6832 929847 e3037 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 13 Sep 2017 19:38:55 +0000 (21:38 +0200)]
hexedit: smarter redraw
function old new delta
format_line 197 209 +12
hexedit_main 930 924 -6
redraw_cur_line 104 94 -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 12/-16) Total: -4 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 13 Sep 2017 17:20:27 +0000 (19:20 +0200)]
hexedit: new applet
function old new delta
hexedit_main - 930 +930
format_line - 197 +197
remap - 168 +168
move_mapping_further - 141 +141
move_mapping_lower - 107 +107
redraw_cur_line - 104 +104
packed_usage 31802 31812 +10
applet_names 2688 2696 +8
applet_main 1552 1556 +4
applet_suid 97 98 +1
applet_install_loc 194 195 +1
------------------------------------------------------------------------------
(add/remove: 7/0 grow/shrink: 5/0 up/down: 1671/0) Total: 1671 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 12 Sep 2017 15:54:28 +0000 (17:54 +0200)]
networking/interface.c: remove superfluous "& 0377"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 8 Sep 2017 18:55:59 +0000 (20:55 +0200)]
setfattr: new applet
function old new delta
setfattr_main - 189 +189
packed_usage 31516 31588 +72
setxattr - 53 +53
lsetxattr - 53 +53
removexattr - 37 +37
lremovexattr - 37 +37
applet_names 2649 2658 +9
find_applet_by_name 124 128 +4
applet_main 1532 1536 +4
------------------------------------------------------------------------------
(add/remove: 7/0 grow/shrink: 4/0 up/down: 458/0) Total: 458 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 7 Sep 2017 12:50:00 +0000 (14:50 +0200)]
build system: fix a compiler warning
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 7 Sep 2017 12:40:28 +0000 (14:40 +0200)]
build system: fix "allnoconfig" to clear all options. Closes 10296
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 5 Sep 2017 17:16:40 +0000 (19:16 +0200)]
chat: do not die when HANGUP param is missing. Closes 10016
function old new delta
chat_main 1356 1379 +23
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 1 Sep 2017 15:06:12 +0000 (17:06 +0200)]
httpd: skip "Status: " from CGI, including space. Closes 10291
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 1 Sep 2017 10:48:15 +0000 (12:48 +0200)]
klibc-utils: add ipconfig.c work-in-progress
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 30 Aug 2017 11:44:27 +0000 (13:44 +0200)]
xargs: fix a thinko in last commit
IF_FEATURE_XARGS_SUPPORT_PARALLEL(char *opt_a = NULL;)
is replaced with
IF_FEATURE_XARGS_SUPPORT_ARGS_FILE
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Johannes Schindelin [Fri, 25 Aug 2017 20:42:05 +0000 (22:42 +0200)]
xargs: support -a FILE
The GNU-specific option -a lets xargs read the arguments from a file
rather than from stdin.
This is particularly convenient when debugging in gdb interactively,
and it might be of more general use.
function old new delta
xargs_main 788 823 +35
packed_usage 31683 31671 -12
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 29 Aug 2017 17:44:45 +0000 (19:44 +0200)]
klibc-utils: remove accidental "or later" licensing wording.
I (slightly) prefer my code to be under "GPLv2 only" license.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 29 Aug 2017 14:51:17 +0000 (16:51 +0200)]
udhcpc: show only short opts in --help text
function old new delta
packed_usage 31615 31501 -114
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 29 Aug 2017 13:44:01 +0000 (15:44 +0200)]
i2c_tools: tweak --help text
function old new delta
packed_usage 31624 31615 -9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 29 Aug 2017 13:34:38 +0000 (15:34 +0200)]
setpriv: placete "declaration of 'index' shadows a global declaration" warning
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 29 Aug 2017 12:35:58 +0000 (14:35 +0200)]
hush: fix false positive in unset.tests
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 29 Aug 2017 12:32:17 +0000 (14:32 +0200)]
hush: GETOPT_RESET() _after_ getopts too.
NOEXEC'ed applets which use getopt() need this.
function old new delta
builtin_getopts 403 413 +10
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 29 Aug 2017 11:48:49 +0000 (13:48 +0200)]
hush: reuse "OPTIND=..." string
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 29 Aug 2017 11:38:30 +0000 (13:38 +0200)]
hush: fix "getopts" builtin to not be upset by other builtins calling getopt()
function old new delta
builtin_getopts 363 403 +40
unset_local_var_len 185 215 +30
set_local_var 440 466 +26
reset_traps_to_defaults 151 157 +6
pseudo_exec_argv 320 326 +6
install_special_sighandlers 52 58 +6
pick_sighandler 62 65 +3
execvp_or_die 85 88 +3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 8/0 up/down: 120/0) Total: 120 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Bartosz Golaszewski [Tue, 29 Aug 2017 10:31:22 +0000 (12:31 +0200)]
i2c-tools: don't include linux/i2c-dev.h
Installing headers from upstream i2c-tools makes it impossible to
build the busybox version due to redefined symbols. This is caused by
the fact that linux/i2c-dev.h from i2c-tools overwrites the one from
linux uapi and defines symbols already defined by linux' linux/i2c.h.
Drop this include and simply re-implement the relevant defines from
linux/i2c-dev.h in miscutils/i2c-tools.c.
Tested by building on systems with and without i2c-tools headers.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Bartosz Golaszewski [Mon, 28 Aug 2017 09:49:24 +0000 (11:49 +0200)]
i2c-tools: remove unneeded include
We no longer use common_bufsiz1 in i2c-tools.
Don't include common_bufsiz.h.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Sun, 27 Aug 2017 07:25:18 +0000 (08:25 +0100)]
kill: add '--' option to separate options from arguments
Using a negative pid to send TERM to a process group results in an
obscure error:
$ ./busybox kill -12345
kill: bad signal name '12345'
This is intended. Manpage says:
ARGUMENTS
pid Each pid can be one of four things:
...
-n where n is larger than 1. All processes in process group
n are signaled. When an argument of the form '-n' is
given, and it is meant to denote a process group, either
a signal must be specified first, or the argument must be
preceded by a '--' option, otherwise it will be taken as
the signal to send.
However, we did not support "--". Add this capability to BusyBox.
function old new delta
kill_main 993 999 +6
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 24 Aug 2017 11:23:54 +0000 (13:23 +0200)]
xargs: optional support for -P NUM. Closes 9511
Based on patch by Johannes Schindelin <johannes.schindelin@gmx.de>
function old new delta
xargs_exec - 294 +294
packed_usage 31757 31772 +15
xargs_main 787 719 -68
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 309/-68) Total: 241 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 24 Aug 2017 09:21:27 +0000 (11:21 +0200)]
xargs: code shrink
function old new delta
xargs_main 827 787 -40
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 23 Aug 2017 15:56:03 +0000 (17:56 +0200)]
sed: in '/regexp/cmd1;//cmd2', cmd2 should use the same regexp as cmd1
function old new delta
get_address 165 211 +46
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 23 Aug 2017 13:08:25 +0000 (15:08 +0200)]
*: fix fallout from opt_complementary conversion
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 23 Aug 2017 12:52:56 +0000 (14:52 +0200)]
ash: more s/error/perror/ for better error reporting
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Johannes Schindelin [Tue, 22 Aug 2017 20:03:22 +0000 (22:03 +0200)]
ash: when cd fails, say why
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Johannes Schindelin [Tue, 22 Aug 2017 20:03:17 +0000 (22:03 +0200)]
ash: report reason when a script file could not be opened
It is always nicer to give the user some sort of indication why an
operation failed.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Tue, 22 Aug 2017 15:33:06 +0000 (16:33 +0100)]
tar: fix handling of first argument without '-'
The following no longer works as expected:
$ ./busybox tar xfz test.tgz
tar: can't open 'z': No such file or directory
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 22 Aug 2017 13:53:16 +0000 (15:53 +0200)]
sendmail: fix segfault if "To: email1,email2" is used
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Tue, 22 Aug 2017 10:34:03 +0000 (11:34 +0100)]
libarchive: fix build failure on NOMMU systems
In the old code fd was an argument, now we need to get the file descriptor
from the xstate structure.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Tue, 22 Aug 2017 10:21:56 +0000 (11:21 +0100)]
ps: fix build failure if FEATURE_PS_TIME is disabled
The global seconds_since_boot is only defined if FEATURE_PS_TIME
is enabled.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 22 Aug 2017 13:33:04 +0000 (15:33 +0200)]
rpm,rpm2cpio: do not compile not-configurred parts of rpm.c
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 22 Aug 2017 09:40:27 +0000 (11:40 +0200)]
run-init: if doing dry run, do not require pid==1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Kang-Che Sung [Sat, 19 Aug 2017 06:18:27 +0000 (14:18 +0800)]
ps: allow ps config options if minips is enabled
Follow-up of commit
ab77e81a8527fa11a4f9392d97c2da037d6f4f98
"klibc-utils: new applets: resume, nuke, minips"
Also put FEATURE_PS_UNUSUAL_SYSTEMS to under FEATURE_PS_TIME in the
menu.
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 22 Aug 2017 08:37:30 +0000 (10:37 +0200)]
run-init: implement -n "dry run"
function old new delta
switch_root_main 637 706 +69
packed_usage 31743 31757 +14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 83/0) Total: 83 bytes
text data bss dec hex filename
915247 563 5844 921654 e1036 busybox_old
915303 563 5844 921710 e106e busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 21 Aug 2017 17:30:01 +0000 (19:30 +0200)]
run-init: new applet
function old new delta
switch_root_main 354 637 +283
drop_usermodehelper - 157 +157
cap_name_to_number - 77 +77
packed_usage 31707 31743 +36
applet_names 2665 2674 +9
applet_main 1544 1548 +4
applet_install_loc 193 194 +1
setpriv_main 933 928 -5
getcaps 131 122 -9
parse_cap 117 29 -88
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 5/3 up/down: 567/-102) Total: 465 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 21 Aug 2017 00:14:19 +0000 (02:14 +0200)]
libbb: move capability names code to libbb
function old new delta
cap_name_to_number - 77 +77
parse_cap 117 29 -88
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/1 up/down: 77/-88) Total: -11 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 20 Aug 2017 18:21:31 +0000 (20:21 +0200)]
setpriv: code shrink
function old new delta
parse_cap 125 117 -8
setpriv_main 949 933 -16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-24) Total: -24 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 18 Aug 2017 17:23:51 +0000 (19:23 +0200)]
nuke: shorten help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 18 Aug 2017 17:15:29 +0000 (19:15 +0200)]
klibc-utils: new applets: resume, nuke, minips
minips is a pure alias to ps, just in case someone needs 100% klibc-utils compat.
nuke is a primitive version of "rm -rf" without options and error checks. ~30 bytes.
resume is a tool for initramfs which resumes from a given block device.
function old new delta
resume_main - 582 +582
packed_usage 31640 31712 +72
nuke_main - 28 +28
xstrtoull - 24 +24
applet_names 2646 2665 +19
applet_main 1532 1544 +12
applet_suid 96 97 +1
applet_install_loc 192 193 +1
applet_flags 96 97 +1
------------------------------------------------------------------------------
(add/remove: 5/0 grow/shrink: 6/0 up/down: 740/0) Total: 740 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 18 Aug 2017 17:11:57 +0000 (19:11 +0200)]
setpriv: accept any case in capability names
This should work: setpriv --inh-caps -SyS_ReSOuRCE sh
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 17 Aug 2017 14:43:33 +0000 (16:43 +0200)]
ash: stage backported LINENO support as a separate patch
Looks biggish and not particularly useful, but may be easier to just eat
the impact if future backports from dash would be otherwise increasingly
difficult.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 17 Aug 2017 11:37:51 +0000 (13:37 +0200)]
telnet: "-a" + "-l USER" should respect USER
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 17 Aug 2017 10:36:39 +0000 (12:36 +0200)]
hush: trivial code shrink in builtin_getopts
function old new delta
builtin_getopts 368 363 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 16 Aug 2017 17:07:53 +0000 (19:07 +0200)]
awk: stop on first non-option, closes 9861
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 16 Aug 2017 15:45:32 +0000 (17:45 +0200)]
*: stop using atexit in non-debug build: saves ~260 in bss with musl
"builtin" below is atexit's 32-element global array of functions to call.
function old new delta
top_main 879 889 +10
launch_helper 185 193 +8
powertop_main 1555 1559 +4
sed_main 651 650 -1
slot 4 - -4
call 4 - -4
atexit 23 - -23
kill_helper 31 - -31
__funcs_on_exit 120 - -120
__cxa_atexit 168 - -168
builtin 260 - -260
------------------------------------------------------------------------------
(add/remove: 0/8 grow/shrink: 3/1 up/down: 22/-611) Total: -589 bytes
text data bss dec hex filename
912364 563 6132 919059 e0613 busybox_old
912035 563 5844 918442 e03aa busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 16 Aug 2017 13:05:36 +0000 (15:05 +0200)]
syslogd,logger: code shrink for musl
function old new delta
syslogd_main 1252 1910 +658
logger_main 277 393 +116
timestamp_and_log 434 542 +108
static.__compound_literal - 104 +104
parse_fac_prio_20 137 - -137
pencode 167 - -167
parse_syslogdcfg 715 - -715
------------------------------------------------------------------------------
(add/remove: 1/3 grow/shrink: 3/0 up/down: 986/-1019) Total: -33 bytes
text data bss dec hex filename
912506 563 6132 919201 e06a1 busybox_old
912364 563 6132 919059 e0613 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 16 Aug 2017 09:53:48 +0000 (11:53 +0200)]
fsck_minix,mkfs_minix: fix "strict-aliasing" warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 16 Aug 2017 09:45:09 +0000 (11:45 +0200)]
uevent: placate gcc
How sizeof() can be an aliasing problem?
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 16 Aug 2017 09:40:10 +0000 (11:40 +0200)]
top: switch to malloced "globals".
This seems to be more efficient:
function old new delta
clearmems - 28 +28
display_process_list 1001 1018 +17
read_cpu_jiffy 171 177 +6
do_stats 194 198 +4
reset_term 20 23 +3
topmem_sort 63 65 +2
mult_lvl_cmp 44 45 +1
get_jiffy_counts 247 248 +1
display_topmem_process_list 549 546 -3
top_main 912 879 -33
handle_input 630 549 -81
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 7/3 up/down: 62/-117) Total: -55 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 15 Aug 2017 13:44:41 +0000 (15:44 +0200)]
ash: unset OPTARG if getopts exits 1, support OPTERR=0 behavior
function old new delta
getoptscmd 522 547 +25
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 15 Aug 2017 13:27:41 +0000 (15:27 +0200)]
ash,hush: comment and debug tweaks, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 14 Aug 2017 17:46:56 +0000 (19:46 +0200)]
ash: one "current line = 1" might be missing, fix that
I'm not sure this is necessary, but dash has this init here.
Just in case, do it too.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 14 Aug 2017 13:01:32 +0000 (15:01 +0200)]
ash: update testsuite (we now error out on ${#=})
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 14 Aug 2017 12:23:45 +0000 (14:23 +0200)]
ash: [PARSER] Catch variable length expansions on non-existant specials
Upstream commit:
Date: Thu, 30 Oct 2014 11:53:35 +0800
[PARSER] Catch variable length expansions on non-existant specials
Currently we only check special variable names that follow directly
after $ or ${. So errors such as ${#&} are not caught. This patch
fixes that by moving the is_special check to just before we print out
the special variable name.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
function old new delta
readtoken1 2630 2635 +5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 14 Aug 2017 10:25:55 +0000 (12:25 +0200)]
build system: remove unused CONFIG_FEATURE_HAVE_RPC
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 13 Aug 2017 00:59:00 +0000 (02:59 +0200)]
shell: tweak getopts tests, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 11 Aug 2017 15:21:14 +0000 (17:21 +0200)]
hush: implement "silent" optstrings of ":opts"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 11 Aug 2017 15:00:39 +0000 (17:00 +0200)]
hush: add a test which fails due to uclibc bug in getopt()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 11 Aug 2017 13:41:39 +0000 (15:41 +0200)]
hush: fix redirect code (was using uninitialized variables)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 11 Aug 2017 00:37:48 +0000 (02:37 +0200)]
shell: add OPTARG poisoning to getopt_optarg.tests
ash fails this!
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 11 Aug 2017 00:05:21 +0000 (02:05 +0200)]
hush: teach getopts to set/unset OPTARG
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 10 Aug 2017 23:32:46 +0000 (01:32 +0200)]
hush: getopts builtin
function old new delta
builtin_getopts - 271 +271
bltins1 372 384 +12
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 283/0) Total: 283 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 10 Aug 2017 22:59:36 +0000 (00:59 +0200)]
ash: fix "unset OPTIND" throwing an error message
Added test was failing quite severely. Now only one subtest fails
(OPTERR=0 has no effect).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 10 Aug 2017 14:34:03 +0000 (16:34 +0200)]
hush: optional times builtin
function old new delta
builtin_times - 108 +108
bltins1 360 372 +12
static.times_tbl - 9 +9
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 1/0 up/down: 129/0) Total: 129 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 10 Aug 2017 13:12:11 +0000 (15:12 +0200)]
fdisk: typo fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 10 Aug 2017 13:01:43 +0000 (15:01 +0200)]
ps: improve TIME column for large times: showing "14453:50" is not good
function old new delta
format_time - 110 +110
func_time 59 50 -9
func_etime 67 53 -14
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 110/-23) Total: 87 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 10 Aug 2017 12:15:52 +0000 (14:15 +0200)]
ps: make it NOEXEC
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 10 Aug 2017 12:10:56 +0000 (14:10 +0200)]
ps: stop using AT_CLKTCK, there are more standard ways
function old new delta
ps_main 537 558 +21
func_time 66 59 -7
get_kernel_HZ 102 - -102
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 21/-109) Total: -88 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 10 Aug 2017 11:22:01 +0000 (13:22 +0200)]
rpm,rpm2cpio: INIT_G() was missing (it is a nop here so far)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 10 Aug 2017 10:40:48 +0000 (12:40 +0200)]
Hopefully fix "will break strict-aliasing rules" warning for get_le32
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 10 Aug 2017 09:52:42 +0000 (11:52 +0200)]
libarchive: do not extract unsafe symlinks unless $EXTRACT_UNSAFE_SYMLINKS=1
function old new delta
unsafe_symlink_target - 147 +147
unzip_main 2711 2732 +21
copy_file 1657 1678 +21
tar_main 999 971 -28
data_extract_all 1038 984 -54
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/2 up/down: 189/-82) Total: 107 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 10 Aug 2017 08:35:08 +0000 (10:35 +0200)]
rpm2cpio: handle LZMA compressed rpms. closes 10166
function old new delta
rpm2cpio_main 78 120 +42
setup_lzma_on_fd - 29 +29
fork_transformer_and_free - 28 +28
...
setup_unzip_on_fd 56 32 -24
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 3/5 up/down: 104/-67) Total: 37 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 10 Aug 2017 07:56:49 +0000 (09:56 +0200)]
rpm2cpio: use rpm_gettags
function old new delta
rpm_gettags - 451 +451
rpm2cpio_main 140 78 -62
skip_header 92 - -92
rpm_main 1477 1049 -428
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/2 up/down: 451/-582) Total: -131 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 10 Aug 2017 07:41:57 +0000 (09:41 +0200)]
rpm: prepare rpm_gettags for reuse in rpm2cpio
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 10 Aug 2017 07:30:38 +0000 (09:30 +0200)]
rpm,rpm2cpio: put both sources into one file, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 9 Aug 2017 17:51:17 +0000 (19:51 +0200)]
Update NOFORK_NOEXEC.lst
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 9 Aug 2017 17:27:01 +0000 (19:27 +0200)]
ipcs: tweak output orer to match util-linux 2.28
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 9 Aug 2017 17:24:19 +0000 (19:24 +0200)]
ipcrm,ipcs: make them NOEXEC
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 9 Aug 2017 17:20:08 +0000 (19:20 +0200)]
ipcrm: code shrink
function old new delta
ipcrm_main 698 663 -35
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 9 Aug 2017 16:52:19 +0000 (18:52 +0200)]
vconfig: make it NOEXEC
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 9 Aug 2017 16:20:01 +0000 (18:20 +0200)]
rpm: code shrink
function old new delta
rpm_getstr0 - 7 +7
rpm_getstr 112 110 -2
rpm_getint 120 118 -2
bsearch_rpmtag 15 13 -2
shell_builtin_read 1334 1320 -14
rpm_main 1548 1474 -74
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/5 up/down: 7/-94) Total: -87 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 9 Aug 2017 12:04:07 +0000 (14:04 +0200)]
shell: more efficient check for EOL in read
function old new delta
shell_builtin_read 1334 1320 -14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 9 Aug 2017 11:52:36 +0000 (13:52 +0200)]
hush: implement -d DELIM option for 'read'
The POSIX standard only requires the 'read' builtin to handle '-r':
http://pubs.opengroup.org/onlinepubs/
9699919799/utilities/read.html
However, Bash introduced the option '-d <DELIM>' to override IFS for
just one invocation, and it is quite useful.
We already support this in ash, let's add it to hush, too.
function old new delta
builtin_read 263 284 +21
.rodata 163587 163589 +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 23/0) Total: 23 bytes
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Johannes Schindelin [Tue, 8 Aug 2017 14:46:39 +0000 (16:46 +0200)]
ash: implement -d DELIM option for read
The POSIX standard only requires the read builtin to handle -r:
http://pubs.opengroup.org/onlinepubs/
9699919799/utilities/read.html
However, Bash introduced the option -d <DELIM> to override IFS for
just one invocation, and it is quite useful.
It is also super easy to implement in BusyBox' ash, so let's do that.
The motivation: This option is used by Git's test suite.
function old new delta
.rodata 163505 163587 +82
shell_builtin_read 1244 1289 +45
readcmd 233 259 +26
builtin_read 258 263 +5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 158/0) Total: 158 bytes
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Xabier Oneca [Wed, 9 Aug 2017 10:18:36 +0000 (12:18 +0200)]
chcon: show '--reference' in help text only if LONG_OPTS=y
Signed-off-by: Xabier Oneca <xoneca@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 8 Aug 2017 21:18:05 +0000 (23:18 +0200)]
start-stop-daemon: show only short options in --help text
function old new delta
packed_usage 31675 31607 -68
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 8 Aug 2017 20:33:02 +0000 (22:33 +0200)]
ftpgetput: show only short options in --help text
function old new delta
packed_usage 31687 31675 -12
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 8 Aug 2017 19:55:02 +0000 (21:55 +0200)]
getopt32: remove opt_complementary
function old new delta
vgetopt32 1318 1392 +74
runsvdir_main 703 713 +10
bb_make_directory 423 425 +2
collect_cpu 546 545 -1
opt_chars 3 - -3
opt_complementary 4 - -4
tftpd_main 567 562 -5
ntp_init 476 471 -5
zcip_main 1266 1256 -10
xxd_main 428 418 -10
whois_main 140 130 -10
who_main 463 453 -10
which_main 212 202 -10
wget_main 2535 2525 -10
watchdog_main 291 281 -10
watch_main 222 212 -10
vlock_main 399 389 -10
uuencode_main 332 322 -10
uudecode_main 316 306 -10
unlink_main 45 35 -10
udhcpd_main 1482 1472 -10
udhcpc_main 2762 2752 -10
tune2fs_main 290 280 -10
tunctl_main 366 356 -10
truncate_main 218 208 -10
tr_main 518 508 -10
time_main 1134 1124 -10
tftp_main 286 276 -10
telnetd_main 1873 1863 -10
tcpudpsvd_main 1785 1775 -10
taskset_main 521 511 -10
tar_main 1009 999 -10
tail_main 1644 1634 -10
syslogd_main 1967 1957 -10
switch_root_main 368 358 -10
svlogd_main 1454 1444 -10
sv 1296 1286 -10
stat_main 104 94 -10
start_stop_daemon_main 1028 1018 -10
split_main 542 532 -10
sort_main 796 786 -10
slattach_main 624 614 -10
shuf_main 504 494 -10
setsid_main 96 86 -10
setserial_main 1132 1122 -10
setfont_main 388 378 -10
setconsole_main 78 68 -10
sendmail_main 1209 1199 -10
sed_main 677 667 -10
script_main 1077 1067 -10
run_parts_main 325 315 -10
rtcwake_main 454 444 -10
rm_main 175 165 -10
reformime_main 119 109 -10
readlink_main 123 113 -10
rdate_main 246 236 -10
pwdx_main 189 179 -10
pstree_main 317 307 -10
pscan_main 663 653 -10
popmaildir_main 818 808 -10
pmap_main 80 70 -10
nc_main 1042 1032 -10
mv_main 558 548 -10
mountpoint_main 477 467 -10
mount_main 1264 1254 -10
modprobe_main 768 758 -10
modinfo_main 333 323 -10
mktemp_main 200 190 -10
mkswap_main 324 314 -10
mkfs_vfat_main 1489 1479 -10
microcom_main 715 705 -10
md5_sha1_sum_main 521 511 -10
man_main 867 857 -10
makedevs_main 1052 1042 -10
ls_main 563 553 -10
losetup_main 432 422 -10
loadfont_main 89 79 -10
ln_main 524 514 -10
link_main 75 65 -10
ipcalc_main 544 534 -10
iostat_main 2397 2387 -10
install_main 768 758 -10
id_main 480 470 -10
i2cset_main 1239 1229 -10
i2cget_main 380 370 -10
i2cdump_main 1482 1472 -10
i2cdetect_main 682 672 -10
hwclock_main 406 396 -10
httpd_main 741 731 -10
grep_main 837 827 -10
getty_main 1559 1549 -10
fuser_main 297 287 -10
ftpgetput_main 345 335 -10
ftpd_main 2232 2222 -10
fstrim_main 251 241 -10
fsfreeze_main 77 67 -10
fsck_minix_main 2921 2911 -10
flock_main 314 304 -10
flashcp_main 740 730 -10
flash_eraseall_main 833 823 -10
fdformat_main 532 522 -10
expand_main 680 670 -10
eject_main 335 325 -10
dumpleases_main 630 620 -10
du_main 314 304 -10
dos2unix_main 441 431 -10
diff_main 1350 1340 -10
df_main 1064 1054 -10
date_main 1095 1085 -10
cut_main 961 951 -10
cryptpw_main 228 218 -10
crontab_main 575 565 -10
crond_main 1149 1139 -10
cp_main 370 360 -10
common_traceroute_main 3834 3824 -10
common_ping_main 1767 1757 -10
comm_main 239 229 -10
cmp_main 655 645 -10
chrt_main 379 369 -10
chpst_main 704 694 -10
chpasswd_main 308 298 -10
chown_main 171 161 -10
chmod_main 158 148 -10
cat_main 428 418 -10
bzip2_main 120 110 -10
blkdiscard_main 264 254 -10
base64_main 221 211 -10
arping_main 1665 1655 -10
ar_main 556 546 -10
adjtimex_main 406 396 -10
adduser_main 882 872 -10
addgroup_main 411 401 -10
acpid_main 1198 1188 -10
optstring 11 - -11
opt_string 18 - -18
OPT_STR 25 - -25
ubi_tools_main 1288 1258 -30
ls_options 31 - -31
------------------------------------------------------------------------------
(add/remove: 0/6 grow/shrink: 3/129 up/down: 86/-1383) Total: -1297 bytes
text data bss dec hex filename
915428 485 6876 922789 e14a5 busybox_old
914629 485 6872 921986 e1182 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 8 Aug 2017 14:38:18 +0000 (16:38 +0200)]
getopt32: remove applet_long_options
FEATURE_GETOPT_LONG made dependent on LONG_OPTS.
The folloving options are removed, now LONG_OPTS enables long options
for affected applets:
FEATURE_ENV_LONG_OPTIONS FEATURE_EXPAND_LONG_OPTIONS
FEATURE_UNEXPAND_LONG_OPTIONS FEATURE_MKDIR_LONG_OPTIONS
FEATURE_MV_LONG_OPTIONS FEATURE_RMDIR_LONG_OPTIONS
FEATURE_ADDGROUP_LONG_OPTIONS FEATURE_ADDUSER_LONG_OPTIONS
FEATURE_HWCLOCK_LONG_OPTIONS FEATURE_NSENTER_LONG_OPTS
FEATURE_CHCON_LONG_OPTIONS FEATURE_RUNCON_LONG_OPTIONS
They either had a small number of long options, or their long options are
essential.
Example: upstream addgroup and adduser have ONLY longopts,
we should probably go further and get rid
of non-standard short options.
To this end, make addgroup and adduser "select LONG_OPTS".
We had this breakage caused by us even in our own package!
#if ENABLE_LONG_OPTS || !ENABLE_ADDGROUP
/* We try to use --gid, not -g, because "standard" addgroup
* has no short option -g, it has only long --gid.
*/
argv[1] = (char*)"--gid";
#else
/* Breaks if system in fact does NOT use busybox addgroup */
argv[1] = (char*)"-g";
#endif
xargs: its lone longopt no longer depends on DESKTOP, only on LONG_OPTS.
hwclock TODO: get rid of incompatible -t, -l aliases to --systz, --localtime
Shorten help texts by omitting long option when short opt alternative exists.
Reduction of size comes from the fact that store of an immediate
(an address of longopts) to a fixed address (global variable)
is a longer insn than pushing that immediate or passing it in a register.
This effect is CPU-agnostic.
function old new delta
getopt32 1350 22 -1328
vgetopt32 - 1318 +1318
getopt32long - 24 +24
tftpd_main 562 567 +5
scan_recursive 376 380 +4
collect_cpu 545 546 +1
date_main 1096 1095 -1
hostname_main 262 259 -3
uname_main 259 255 -4
setpriv_main 362 358 -4
rmdir_main 191 187 -4
mv_main 562 558 -4
ipcalc_main 548 544 -4
ifenslave_main 641 637 -4
gzip_main 192 188 -4
gunzip_main 77 73 -4
fsfreeze_main 81 77 -4
flock_main 318 314 -4
deluser_main 337 333 -4
cp_main 374 370 -4
chown_main 175 171 -4
applet_long_options 4 - -4
xargs_main 894 889 -5
wget_main 2540 2535 -5
udhcpc_main 2767 2762 -5
touch_main 436 431 -5
tar_main 1014 1009 -5
start_stop_daemon_main 1033 1028 -5
sed_main 682 677 -5
script_main 1082 1077 -5
run_parts_main 330 325 -5
rtcwake_main 459 454 -5
od_main 2169 2164 -5
nl_main 201 196 -5
modprobe_main 773 768 -5
mkdir_main 160 155 -5
ls_main 568 563 -5
install_main 773 768 -5
hwclock_main 411 406 -5
getopt_main 622 617 -5
fstrim_main 256 251 -5
env_main 198 193 -5
dumpleases_main 635 630 -5
dpkg_main 3991 3986 -5
diff_main 1355 1350 -5
cryptpw_main 233 228 -5
cpio_main 593 588 -5
conspy_main 1135 1130 -5
chpasswd_main 313 308 -5
adduser_main 887 882 -5
addgroup_main 416 411 -5
ftpgetput_main 351 345 -6
get_terminal_width_height 242 234 -8
expand_main 690 680 -10
static.expand_longopts 18 - -18
static.unexpand_longopts 27 - -27
mkdir_longopts 28 - -28
env_longopts 30 - -30
static.ifenslave_longopts 34 - -34
mv_longopts 46 - -46
static.rmdir_longopts 48 - -48
packed_usage 31739 31687 -52
------------------------------------------------------------------------------
(add/remove: 2/8 grow/shrink: 3/49 up/down: 1352/-1840) Total: -488 bytes
text data bss dec hex filename
915681 485 6880 923046 e15a6 busybox_old
915428 485 6876 922789 e14a5 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 8 Aug 2017 12:59:35 +0000 (14:59 +0200)]
*: fix up use of "getopt_longopts" for longopts not in getopt applet
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>