James Clarke [Sat, 7 Oct 2017 17:53:23 +0000 (18:53 +0100)]
udp_io, traceroute: Standardise IPv6 PKTINFO handling to be portable
The current standard (RFC 3542) is for IPV6_RECVPKTINFO to be given to
setsockopt, and IPV6_PKTINFO to be used as the packet type. Previously,
RFC 2292 required IPV6_PKTINFO to be used for both, but RFC 3542
re-purposed IPV6_PKTINFO when given to setsockopt. The special
Linux-specific IPV6_2292PKTINFO has the same semantics as IPV6_PKTINFO
in RFC 2292, but was introduced at the same time as IPV6_RECVPKTINFO.
Therefore, if we have IPV6_RECVPKTINFO available, we can use the RFC
3542 style, and if not, we assume that only the RFC 2292 API is
available, using IPV6_PKTINFO for both.
Signed-off-by: James Clarke <jrtc27@jrtc27.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
James Clarke [Sat, 7 Oct 2017 17:53:20 +0000 (18:53 +0100)]
df: Use statvfs instead of non-standard statfs
Platforms differ on what their implementations of statfs include.
Importantly, FreeBSD's does not include a f_frsize member inside struct
statfs. However, statvfs is specified by POSIX and includes everything
we need, so we can just use that instead.
Signed-off-by: James Clarke <jrtc27@jrtc27.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
James Clarke [Mon, 30 Oct 2017 14:18:32 +0000 (15:18 +0100)]
xfuncs: Handle missing non-POSIX termios constants
Signed-off-by: James Clarke <jrtc27@jrtc27.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
James Clarke [Sat, 7 Oct 2017 17:53:19 +0000 (18:53 +0100)]
blkdiscard: Only build on Linux
Signed-off-by: James Clarke <jrtc27@jrtc27.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
James Clarke [Sat, 7 Oct 2017 17:53:21 +0000 (18:53 +0100)]
networking: Fall back on IPPROTO_RAW when SOL_RAW is not defined
Signed-off-by: James Clarke <jrtc27@jrtc27.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sat, 28 Oct 2017 15:54:24 +0000 (17:54 +0200)]
ntpd: perform DNS resolution out of send/receive loop - closes 10466
Bad case: send request to server1good.com; then try to resolve server2bad.com -
this fails, and failure takes ~5 secs; then receive server1's
response 5 seconds later. We'll never sync up in this case...
function old new delta
ntpd_main 1079 1106 +27
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Eugene Rudoy [Wed, 18 Oct 2017 22:05:11 +0000 (00:05 +0200)]
iproute/iprule: support toolchains without RTA_TABLE routing attribute
iproute.c: In function 'print_route':
iproute.c:85:9: error: 'RTA_TABLE' undeclared (first use in this function)
iproute.c:85:9: note: each undeclared identifier is reported only once for each function it appears in
iproute.c: In function 'iproute_modify':
iproute.c:467:36: error: 'RTA_TABLE' undeclared (first use in this function)
Fix it by partially #ifdef'ing the code added in
b42107f21538e39d9a344376372f8261aed589b2
Signed-off-by: Eugene Rudoy <gene.devel@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 27 Oct 2017 17:05:00 +0000 (19:05 +0200)]
time: fix build for toolchains without O_CLOEXEC
Based on patch by Eugene Rudoy <gene.devel@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 27 Oct 2017 13:37:03 +0000 (15:37 +0200)]
unlzma: fix SEGV, closes 10436
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 22 Oct 2017 16:23:23 +0000 (18:23 +0200)]
bunzip2: fix runCnt overflow from bug 10431
This particular corrupted file can be dealth with by using "unsigned".
If there will be cases where it genuinely overflows, there is a disabled
code to deal with that too.
function old new delta
get_next_block 1678 1667 -11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 22 Oct 2017 13:55:48 +0000 (15:55 +0200)]
hush: fix comment parsing in `cmd`, closes 10421
function old new delta
parse_stream 2692 2690 -2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Markus Gothe [Sat, 21 Oct 2017 19:34:22 +0000 (21:34 +0200)]
lsscsi: fix xchdir("..") from symlink in /sys/bus/scsi/devices
Signed-off-by: Markus Gothe <nietzsche@lysator.liu.se>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 12 Oct 2017 17:40:47 +0000 (19:40 +0200)]
whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 12 Oct 2017 17:35:42 +0000 (19:35 +0200)]
typo fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 12 Oct 2017 17:20:13 +0000 (19:20 +0200)]
ash: survive failures in $PS1 expansion. Closes 10371
function old new delta
expandstr 120 209 +89
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Avi Halachmi [Thu, 12 Oct 2017 14:38:35 +0000 (16:38 +0200)]
lineedit: improve multiline PS1 - redraw using last PS1 line. Closes 10381
This patch only affects prompts with newlines.
We redraw the prompt [+ input] occasionally, e.g. during tab completion,
history browsing or search, etc, and we expect it to align with prior
redraws, such that the visible effect is that only the input changes.
With multi-line PS1, redraw always printed the prompt some lines below
the old one, which resulted in terminal scroll during every redraw.
Now we only redraw the last PS1 line, so vertical alignment is easier to
manage (we already calculated it using only the last line, but re-drew
all lines - that was the culprit), which fixes those extra scrolls.
Notes:
- We now use the full prompt for the initial draw, after clear-screen (^L),
and after tab-completion choices are displayed. Everything else now
redraws using the last/sole prompt line.
- During terminal resize we now only redraw the last[/sole] prompt line,
which is arguably better because it's hard to do right (and we never did).
- Good side effect for reverse-i-search: its prompt now replaces only the
last line of the original prompt - like other shells do.
function old new delta
put_prompt_custom - 66 +66
draw_custom - 66 +66
parse_and_put_prompt 766 806 +40
read_line_input 3867 3884 +17
input_tab 1069 1076 +7
cmdedit_setwidth 61 63 +2
redraw 59 47 -12
put_prompt 46 - -46
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 4/1 up/down: 198/-58) Total: 140 bytes
Signed-off-by: Avi Halachmi <avihpit@yahoo.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 5 Oct 2017 15:18:23 +0000 (17:18 +0200)]
sendmail allow "=" symbol in recipient, closes 10241
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 5 Oct 2017 13:33:28 +0000 (15:33 +0200)]
whitespace and comment format fixes, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 5 Oct 2017 13:19:25 +0000 (15:19 +0200)]
whitespace and comment format fixes, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 5 Oct 2017 12:41:36 +0000 (14:41 +0200)]
do not include <sys/stat.h> just before "libbb.h", it's there already
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 5 Oct 2017 12:40:24 +0000 (14:40 +0200)]
whitespace and comment format fixes, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 5 Oct 2017 12:16:09 +0000 (14:16 +0200)]
free: no longer include common_bufsiz.h
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 5 Oct 2017 12:06:49 +0000 (14:06 +0200)]
free: make it NOFORK
function old new delta
parse_cached_kb - 85 +85
free_main 580 537 -43
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 85/-43) Total: 42 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 5 Oct 2017 10:53:25 +0000 (12:53 +0200)]
date: maybe_set_utc only once
It's not clear at all why we do it twice. git archaeology did not help.
function old new delta
date_main 836 839 +3
maybe_set_utc 16 - -16
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Avi Fishman [Thu, 5 Oct 2017 09:25:16 +0000 (11:25 +0200)]
i2cset: fix 'i' & 's' modes (3 extra bytes were sent)
When 'i' or 's' modes are selected block array is filled from offset 3
(blen = 3) but copied to data.block buffer from offset 0 so first 3 bytes
contains garbage from stack.
The buffer that is sent is also 3 bytes too long due to those extra 3
bytes.
Signed-off-by: Avi Fishman <AviFishman70@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 29 Sep 2017 16:17:25 +0000 (18:17 +0200)]
use %m printf specifier where appropriate
function old new delta
out 85 75 -10
udhcpd_main 1472 1461 -11
open_stdio_to_tty 98 85 -13
init_exec 245 232 -13
udhcpc_main 2763 2749 -14
do_cmd 4771 4755 -16
status_line_bold_errno 32 14 -18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/7 up/down: 0/-95) Total: -95 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 29 Sep 2017 16:02:01 +0000 (18:02 +0200)]
udhcpc[6]: make log2 messages for chaddr field indented like the rest
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 29 Sep 2017 13:55:24 +0000 (15:55 +0200)]
udhcpc: paranoia when using kernel UDP mode for sending renew: server ID may be bogus
With new code, we request that target IP (server ID) must be directly reachable.
If it's not, this happens:
udhcpc: waiting 2000 seconds
udhcpc: entering listen mode: kernel
udhcpc: opening listen socket on *:68 wlan0
udhcpc: entering renew state
udhcpc: sending renew to 1.1.1.1
udhcpc: send: Network is unreachable
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.1.1.1 needs routing, this is fishy!
udhcpc: entering rebinding state
udhcpc: entering listen mode: raw
udhcpc: created raw socket
udhcpc: sending renew to 0.0.0.0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ going to use broadcast
which is the desired behavior. Before the patch, packet to 1.1.1.1 was routed
over eth0 (!) and maybe even into Internet (!!!).
function old new delta
udhcpc_main 2752 2763 +11
udhcp_send_kernel_packet 295 301 +6
send_renew 82 84 +2
send_packet 166 168 +2
bcast_or_ucast 23 25 +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 23/0) Total: 23 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 29 Sep 2017 12:09:02 +0000 (14:09 +0200)]
udhcpc[6]: initialize entire sockaddr_ll
I see random field values like sll_hatype=0x267 when I strace.
They seem to not matter, but just in case they sometimes do,
let's at least have deterministic values (via memset(0)).
function old new delta
change_listen_mode 308 322 +14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 18 Sep 2017 14:28:43 +0000 (16:28 +0200)]
regularize format of source file headers, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 18 Sep 2017 13:45:13 +0000 (15:45 +0200)]
ip,ip*: make them NOEXEC
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 18 Sep 2017 12:34:15 +0000 (14:34 +0200)]
update NOFORK_NOEXEC.lst
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 18 Sep 2017 11:09:11 +0000 (13:09 +0200)]
httpd: fix handling of range requests
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 18 Sep 2017 10:16:47 +0000 (12:16 +0200)]
stty: add cmspar, flusho, extproc attributes
function old new delta
mode_info 688 704 +16
mode_name 502 516 +14
wrapf 162 157 -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 30/-5) Total: 25 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 15 Sep 2017 16:55:53 +0000 (18:55 +0200)]
netcat: net applet (alias to nc)
function old new delta
packed_usage 31807 31856 +49
applet_names 2701 2708 +7
applet_main 1560 1564 +4
applet_install_loc 195 196 +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 61/0) Total: 61 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 15 Sep 2017 15:19:55 +0000 (17:19 +0200)]
Clarify OPOST bit meaning
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 15 Sep 2017 15:14:01 +0000 (17:14 +0200)]
less,microcom,lineedit: use common routine to set raw termios
function old new delta
get_termios_and_make_raw - 139 +139
xget1 39 8 -31
read_line_input 3912 3867 -45
less_main 2525 2471 -54
set_termios_to_raw 116 36 -80
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/4 up/down: 139/-210) Total: -71 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 15 Sep 2017 13:23:47 +0000 (15:23 +0200)]
hexedit: code shrink
function old new delta
hexedit_main 1171 1170 -1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 15 Sep 2017 12:00:41 +0000 (14:00 +0200)]
hexedit: fixes to "goto address" code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 14 Sep 2017 11:57:07 +0000 (13:57 +0200)]
hexedit: position in correct column on "goto" command
function old new delta
hexedit_main 1169 1202 +33
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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>