Age | Commit message (Collapse) | Author |
|
EINTR _should_ only happen on two signals we trap, and safe_poll
_should_ work here just fine, but there were kernel bugs where spurious EINTRs
happen (e.g. on ptrace attach). Be safe.
function old new delta
udhcpd_main 1437 1468 +31
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
In other words: try to correct initially existing clock offset first,
before assuming that our clock drifts.
function old new delta
update_local_clock 826 834 +8
ntp_init 550 557 +7
filter_datapoints 179 173 -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 15/-6) Total: 9 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Fixes:
commit 52a515d18724bbb34e3ccbbb0218efcc4eccc0a8
"udhcp: use poll() instead of select()"
Feb 16 2017
udhcp_sp_read() is meant to check whether signal pipe indeed has some data to read.
In the above commit, it was changed as follows:
- if (!FD_ISSET(signal_pipe.rd, rfds))
+ if (!pfds[0].revents)
return 0;
The problem is, the check was working for select() purely by accident.
Caught signal interrupts select()/poll() syscalls, they return with EINTR
(regardless of SA_RESTART flag in sigaction). _Then_ signal handler is invoked.
IOW: they can't see any changes to fd state caused by signal haldler
(in our case, signal handler makes signal pipe ready to be read).
For select(), it means that rfds[] bit array is unmodified, bit of signal
pipe's read fd is still set, and the above check "works": it thinks select()
says there is data to read.
This accident does not work for poll(): .revents stays clear, and we do not
try reading signal pipe as we should. In udhcpd, we fall through and block
in socket read. Further SIGTERM signals simply cause socket read to be
interrupted and then restarted (since SIGTERM handler has SA_RESTART=1).
Fixing this as follows: remove the check altogether. Set signal pipe read fd
to nonblocking mode. Always read it in udhcp_sp_read().
If read fails, assume it's EAGAIN and return 0 ("no signal seen").
udhcpd avoids reading signal pipe on every recvd packet by looping if EINTR
(using safe_poll()) - thus ensuring we have correct .revents for all fds -
and calling udhcp_sp_read() only if pfds[0].revents!=0.
udhcpc performs much fewer reads (typically it sleeps >99.999% of the time),
there is no need to optimize it: can call udhcp_sp_read() after each poll
unconditionally.
To robustify socket reads, unconditionally set pfds[1].revents=0
in udhcp_sp_fd_set() (which is before poll), and check it before reading
network socket in udhcpd.
TODO:
This might still fail: if pfds[1].revents=POLLIN, socket read may still block.
There are rare cases when select/poll indicates that data can be read,
but then actual read still blocks (one such case is UDP packets with
wrong checksum). General advise is, if you use a poll/select loop,
keep all your fds nonblocking.
Maybe we should also do that to our network sockets?
function old new delta
udhcp_sp_setup 55 65 +10
udhcp_sp_fd_set 54 60 +6
udhcp_sp_read 46 36 -10
udhcpd_main 1451 1437 -14
udhcpc_main 2723 2708 -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/3 up/down: 16/-39) Total: -23 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
packed_usage 32547 32550 +3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
packed_usage 32543 32547 +4
ipcs_main 1014 980 -34
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 4/-34) Total: -30 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
packed_usage 32539 32543 +4
format 1 - -1
do_shm 883 880 -3
do_sem 636 633 -3
do_msg 782 779 -3
ipcs_main 1049 1014 -35
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/4 up/down: 4/-45) Total: -41 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
handle_input 549 560 +11
top_main 889 891 +2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
display_process_list 1018 999 -19
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This avoids pulling in gmtime's static buffer:
function old new delta
svlogd_main 1401 1412 +11
send_headers 668 678 +10
gmtime 21 - -21
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 2/0 up/down: 21/-21) Total: 0 bytes
text data bss dec hex filename
920221 555 5804 926580 e2374 busybox_old
920221 555 5740 926516 e2334 busybox_unstripped
^^^^
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
run_pipe 1589 1591 +2
pseudo_exec_argv 374 375 +1
builtin_type 114 115 +1
find_function 8 - -8
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 3/0 up/down: 4/-8) Total: -4 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
These were data/bss:
static.proc_read 1 - -1
int_list 4 - -4
int_last 4 - -4
We never call display_interfaces() twice, thus code to not scan /proc twice
never triggers.
function old new delta
do_if_print - 1998 +1998
display_interfaces 145 249 +104
static.proc_read 1 - -1
add_interface 104 103 -1
int_list 4 - -4
int_last 4 - -4
if_readlist_proc 560 542 -18
if_readconf 141 - -141
do_if_fetch 643 - -643
ife_print 1296 - -1296
------------------------------------------------------------------------------
(add/remove: 1/6 grow/shrink: 1/2 up/down: 2102/-2108) Total: -6 bytes
text data bss dec hex filename
933084 473 6844 940401 e5971 busybox_old
933087 473 6836 940396 e596c busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
ife_print 1293 1296 +3
display_interfaces 145 146 +1
if_readconf 162 141 -21
if_readlist_proc 631 560 -71
do_if_fetch 753 643 -110
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/3 up/down: 4/-202) Total: -198 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
When fetching a https:// URL with HTTP proxy configured
(e.g. with environment variable http_proxy=http://your-proxy:3128)
busybox was making a https connection to the proxy.
This was because the protocol scheme for the target URL was used to determine whether to connect to the proxy over SSL or not.
When the proxy is in use, the decision on whether to connect to the proxy over https
should based on the proxy URL not on the target URL.
function old new delta
wget_main 2381 2387 +6
Signed-off-by: Peter Lloyd <l-busybox@pgl22.co.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Move some distro specific include files into the appropriate #ifdef
blocks to make the code more portable.
Signed-off-by: Sean MacLennan <seanm@seanm.ca>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
It turns out bkslash_in_varexp.tests was a bash bug :]
ash and hush fail "corrected" bkslash_in_varexp.tests as well,
just not as badly as I thought (hush gets half of the cases right).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-5 (-5)
Function old new delta
skip_dev_pfx 30 25 -5
Total: Before=779966, After=779961, chg -0.00%
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
tcpudpsvd_main 1775 1780 +5
ipsvd_perhost_add 108 107 -1
cclen 4 - -4
cc 4 - -4
ipsvd_perhost_init 30 25 -5
ipsvd_perhost_remove 80 44 -36
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/3 up/down: 5/-50) Total: -45 bytes
text data bss dec hex filename
933358 473 6852 940683 e5a8b busybox_old
933326 473 6844 940643 e5a63 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
lineedit_read_key 269 261 -8
win_changed 47 - -47
read_line_input 3884 3821 -63
cmdedit_setwidth 63 - -63
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 0/2 up/down: 0/-181) Total: -181 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
df_main 1065 1064 -1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Reported for Pascal Bellard.
function old new delta
df_main 1054 1065 +11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Trying to install busybox with hardlinks and a custom PREFIX will fail
for applets not in the /bin directory, because relative pathnames are
used. applets/install.sh is *supposed to* use the absolute pathname
for hardlinks but it fails to do so because the wrong check is used
in the if statement.
While fixing it, shore up other sloppy coding in applets/install.sh
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
od_main 2164 2179 +15
address_fmt 8 - -8
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 15/-8) Total: 7 bytes
text data bss dec hex filename
930954 481 6852 938287 e512f busybox_old
930977 473 6852 938302 e513e busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This also makes OPT_STR reused:
text data bss dec hex filename
930979 481 6852 938312 e5148 busybox_old
930954 481 6852 938287 e512f busybox_unstripped
^^^^^^
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
compare_keys 794 795 +1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
sort_main 786 862 +76
compare_keys 720 794 +74
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 150/0) Total: 150 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Attaching an interface to a VRF is done by setting the interface's
master. Besides VRF, this can also be used for bridges.
function old new delta
set_master - 142 +142
do_iplink 1262 1357 +95
packed_usage 32546 32539 -7
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 237/-7) Total: 230 bytes
Signed-off-by: Jan Luebbe <jluebbe@debian.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
VRF interfaces have a mandatory table parameter, which needs to be
specified using a RTNL attribute.
function old new delta
do_add_or_delete 1150 1254 +104
packed_usage 32444 32546 +102
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 206/0) Total: 206 bytes
Signed-off-by: Jan Luebbe <jluebbe@debian.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
While at it, add -t to --help, and fix comments which say that -t is ignored
function old new delta
packed_usage 32427 32444 +17
umount_main 558 552 -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 17/-6) Total: 11 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This mostly reverts commit bc9bbeb2b81001e8731cd2ae501c8fccc8d87cc7
"libarchive: do not extract unsafe symlinks unless $EXTRACT_UNSAFE_SYMLINKS=1"
Users report that it is somewhat too restrictive. See
https://bugs.busybox.net/show_bug.cgi?id=8411
In particular, this interferes with unpacking of busybox-based
filesystems with links like "sbin/applet" -> "../bin/busybox".
The change is made smaller by deleting ARCHIVE_EXTRACT_QUIET flag -
it is unused since 2010, and removing conditionals on it
allows commonalizing some error message codes.
function old new delta
create_or_remember_symlink - 94 +94
create_symlinks_from_list - 64 +64
tar_main 1002 1006 +4
unzip_main 2732 2724 -8
data_extract_all 984 891 -93
unsafe_symlink_target 147 - -147
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 1/2 up/down: 162/-248) Total: -86 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
"warning: large integer implicitly truncated to unsigned type [-Woverflow]"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
tls_xread_record 499 489 -10
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
sendping6 80 85 +5
sendping4 106 111 +5
sendping_tail 209 204 -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 10/-5) Total: 5 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
common_ping_main 1757 1862 +105
packed_usage 32367 32427 +60
sendping_tail 236 209 -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 165/-27) Total: 138 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Compiles to ~25 bytes if enabled.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Incidentally, this fixes LINENO bug here:
echo "1:${LINENO}"
echo "2:`echo; echo`" # was counting lines in the `cmd` output as LINENO++
echo "3:${LINENO}"
function old new delta
parse_and_run_file 53 71 +18
expand_vars_to_list 1187 1164 -23
setup_file_in_str 25 - -25
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 18/-48) Total: -30 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
readtoken1 2602 2608 +6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
get_sanitized_hdr - 156 +156
fgets_trim_sanitize - 128 +128
ftpcmd 129 133 +4
parse_url 461 454 -7
sanitize_string 14 - -14
wget_main 2431 2381 -50
fgets_and_trim 119 - -119
gethdr 163 - -163
------------------------------------------------------------------------------
(add/remove: 2/3 grow/shrink: 1/2 up/down: 288/-353) Total: -65 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Test scripts that use CONFIG_* variables need to source .config.
Since this wasn't being done for busybox many tests were skipped.
As a result new failures due to changes in help output were missed.
Also remove some unnecessary echos in the bzcat script.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
the patch getopt32: remove opt_complementary 22542eca18e5807b72ddc78999f5101e33f17a53
introduced a regressed in the cp command since it removed all aliases of arguments
if long_opts is not configured.
Patch by Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
catcher 310 309 -1
arping_main 1668 1641 -27
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|