aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-05-09dc: code shrinkDenys Vlasenko
function old new delta check_under 20 21 +1 print_no_pop 32 27 -5 pop 24 18 -6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 1/-11) Total: -10 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-03ps: ensure fields are separated by at least one space, closes 11826Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-02login: remove extra IF(), no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-30Optionally re-introduce bb_info_msg()James Byrne
Between Busybox 1.24.2 and 1.25.0 the bb_info_msg() function was eliminated and calls to it changed to be bb_error_msg(). The downside of this is that daemons now log all messages to syslog at the LOG_ERR level which makes it hard to filter errors from informational messages. This change optionally re-introduces bb_info_msg(), controlled by a new option FEATURE_SYSLOG_INFO, restores all the calls to bb_info_msg() that were removed (only in applets that set logmode to LOGMODE_SYSLOG or LOGMODE_BOTH), and also changes informational messages in ifplugd and ntpd. The code size change of this is as follows (using 'defconfig' on x86_64 with gcc 7.3.0-27ubuntu1~18.04) function old new delta bb_info_msg - 182 +182 bb_vinfo_msg - 27 +27 static.log7 194 198 +4 log8 190 191 +1 log5 190 191 +1 crondlog 45 - -45 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 3/0 up/down: 215/-45) Total: 170 bytes If you don't care about everything being logged at LOG_ERR level then when FEATURE_SYSLOG_INFO is disabled Busybox actually gets smaller: function old new delta static.log7 194 200 +6 log8 190 193 +3 log5 190 193 +3 syslog_level 1 - -1 bb_verror_msg 583 581 -2 crondlog 45 - -45 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 3/1 up/down: 12/-48) Total: -36 bytes Signed-off-by: James Byrne <james.byrne@origamienergy.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-29libbbb: find_mount_point() too eager to stat mounted devicesDenys Vlasenko
None of the below "devices" (first word on the line) are real. sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0 proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0 devtmpfs /dev devtmpfs rw,nosuid,size=7917900k,nr_inodes=1979475,mode=755 0 0 tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0 devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0 tmpfs /run tmpfs rw,nosuid,nodev,mode=755 0 0 pstore /sys/fs/pstore pstore rw,nosuid,nodev,noexec,relatime 0 0 configfs /sys/kernel/config configfs rw,relatime 0 0 tmpfs /tmp tmpfs rw,relatime 0 0 function old new delta find_mount_point 297 302 +5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-29start-stop-daemon: do try to close fds > 2Denys Vlasenko
sh -c 'exec 3>&1; exec start-stop-daemon -S -b -x /bin/sleep -- 123' now closes fd 3. function old new delta bb_daemonize_or_rexec 183 192 +9 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 9/0) Total: 9 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-29ip: fix comment placementDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-28ifupdown: close memory leakDenys Vlasenko
function old new delta execute_all 80 91 +11 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-28vi: enable 'dG' command. Closes 11801Ron Yorston
The 'G' command was omitted from the list of commands that change or delete whole lines. Add it in the appropriate places so the 'dG', 'cG' and 'yG' commands work, including in cases where an explicit line number has been supplied. function old new delta find_range 534 596 +62 .rodata 175166 175167 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 63/0) Total: 63 bytes Reported-by: David Kelly <david.kelly@liberica.ch> Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-28vi: fix changes to word at end of line. Closes 11796Ron Yorston
As reported in bug 11796 BusyBox vi incorrectly handles changes to a word at the end of a line. If the following line starts with whitespace changing or deleting the last word of a line with the 'cw' or 'dw' commands causes the lines to be joined. This happens because the range for the change returned by find_range() covers all whitespace after the word, including newlines. The problem can be fixed by setting 'ml' to zero to indicate to yank_delete() that processing should stop at the end of the current line. However, this results in a new problem. 'dw' correctly deletes all whitespace following the word but so does 'cw', which should preserve the trailing whitespace. To fix this the code to omit whitespace from the change is modified to include all whitespace not just blanks. function old new delta do_cmd 5034 5069 +35 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 35/0) Total: 35 bytes Reported-by: David Kelly <david.kelly@liberica.ch> Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-28ash,hush: ulimit: add -i RLIMIT_SIGPENDING, -q RLIMIT_MSGQUEUEDenys Vlasenko
function old new delta limits_tbl 104 120 +16 ulimit_opt_string 44 50 +6 limit_chars 14 16 +2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 24/0) Total: 24 bytes text data bss dec hex filename 981996 485 7296 989777 f1a51 busybox_old 982065 485 7296 989846 f1a96 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-28ash,hush: bash compat for ulimit: reorder to matchDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-27ash,hush: bash compat for ulimit: -w => -x, -p => -uDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-27ash,hush: fix ulimit to be more bash-compat, closes 11791Denys Vlasenko
function old new delta shell_builtin_ulimit 486 651 +165 limit_chars - 14 +14 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/0 up/down: 179/0) Total: 179 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-27start-stop-daemon: Fix -x is not required for -KAlexander Vickberg
Commit 088fec36fedff2cd50437c95b7fb430abf8d303c made -x required for all. However it isn't for -K. function old new delta start_stop_daemon_main 1084 1105 +21 packed_usage 33343 33326 -17 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 21/-17) Total: 4 bytes Signed-off-by: Alexander Vickberg <wickbergster@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-21examples/var_service: use "exec sleep 5" instead of "{ sleep 5; exit; }"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-19httpd: do disable header reading timeout even if proxyingDenys Vlasenko
function old new delta handle_incoming_and_exit 2362 2369 +7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-19httpd: use full size of iobuf[] when piping CGI dataDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-19httpd: do not set alarm() timeout if we read cached headerDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-19httpd: deindent code block, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-19httpd: require "HTTP/xyz" at the end of request lineDenys Vlasenko
function old new delta handle_incoming_and_exit 2379 2362 -17 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-17) Total: -17 bytes text data bss dec hex filename 981787 485 7296 989568 f1980 busybox_old 981779 485 7296 989560 f1978 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-19ash: catch error in arithmetic expansion in PS1Ron Yorston
Setting PS1 to: PS1='$((123+))' causes the shell to enter an infinite error loop: sh: arithmetic syntax error Catch any exception raised by expandarg() in expandstr() and allow processing to continue. function old new delta expandstr 262 344 +82 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 82/0) Total: 82 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-19ash: prevent error in backquotes in PS1 from exiting shellRon Yorston
Setting PS1 to: PS1='`xxx(`' causes the shell to terminate with the error: sh: syntax error: unexpected end of file (expecting ")") This happens because old-style backquotes require the input to be reread and thus call setinputstring() a second time. Prevent the problem by unwinding all recently opened files in expandstr(). function old new delta unwindfiles - 22 +22 expandstr 247 262 +15 forkchild 631 625 -6 evalcommand 1694 1685 -9 ash_main 1346 1336 -10 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/3 up/down: 37/-25) Total: 12 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-19dc.tests: fix two test case to also depend on DC_BIGChen Qi
Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-18httpd: pass authorization header to CGI if not BasicAlexander Vickberg
Pass the Authorization header to CGI if not of type Basic. This will make it possible for CGI to verify authorization headers of type Bearer <token>. function old new delta handle_incoming_and_exit 2370 2379 +9 Signed-off-by: Alexander Vickberg <wickbergster@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-17httpd: When sending gzipped content use content-length headerAlexander Vickberg
Today for gzipped content httpd is using a header with name Transfer-Length. However I can't find a header with that name in the standards. Instead use Content-Length. function old new delta .rodata 157940 157936 -4 send_headers 980 939 -41 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-45) Total: -45 bytes Signed-off-by: Alexander Vickberg <wickbergster@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-16ash: add bash-compatible EPOCH variablesRon Yorston
Bash 5.0 added the dynamic variable EPOCHSECONDS and EPOCHREALTIME which return the number of seconds since the Unix Epoch as an integer or float. These are useful for logging or tracing. function old new delta change_epoch - 78 +78 .rodata 175167 175235 +68 varinit_data 264 312 +48 change_seconds - 24 +24 change_realtime - 24 +24 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 2/0 up/down: 242/0) Total: 242 bytes text data bss dec hex filename 938508 4203 1888 944599 e69d7 busybox_old 938702 4203 1888 944793 e6a99 busybox_unstripped v2: Cast tv_sec and tv_usec to unsigned quantities. Add brackets to macros. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-16ash: an unset dynamic variable should not be dynamicRon Yorston
Commit b28d4c346 (ash: [VAR] Move unsetvar functionality into setvareq) dropped the code that caused dynamic variables to lose their special properties when unset. Add it back again. function old new delta setvareq 346 360 +14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 14/0) Total: 14 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-16hush: add bash-compatible EPOCH variablesRon Yorston
Bash 5.0 added the dynamic variable EPOCHSECONDS and EPOCHREALTIME which return the number of seconds since the Unix Epoch as an integer or float. These are useful for logging or tracing. function old new delta get_local_var_value 207 302 +95 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 95/0) Total: 95 bytes text data bss dec hex filename 938702 4203 1888 944793 e6a99 busybox_old 938797 4203 1888 944888 e6af8 busybox_unstripped Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-16httpd: extract query string only after proxying checkDenys Vlasenko
function old new delta handle_incoming_and_exit 2398 2370 -28 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-16httpd: make rmt_ip variable localDenys Vlasenko
function old new delta handle_incoming_and_exit 2385 2398 +13 if_ip_denied_send_HTTP_FORBIDDEN_and_exit 51 54 +3 get_line 110 106 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 16/-4) Total: 12 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-16httpd: check denied IPs even before reading 1st query lineDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-16httpd: do not decode URL and headers if proxying - send all verbatimDenys Vlasenko
function old new delta handle_incoming_and_exit 2566 2385 -181 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-16httpd: remove duplicate "decode URL escape sequences" codeDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-16httpd: put all headers into environment as HTTP_UPPERCASED_HEADER=valDenys Vlasenko
Set up environment variables before running the CGI script. The variables will be named HTTP_<filtered_name> where the <filtered_name> is the header name capitalized and all characters not matching [a-z] | [A-Z] | [0-9] replaced with '_'. function old new delta http_response 80 88 +8 http_response_type 20 22 +2 send_headers 718 715 -3 parse_conf 1481 1478 -3 get_line 128 110 -18 cgi_io_loop_and_exit 599 569 -30 send_cgi_and_exit 882 738 -144 handle_incoming_and_exit 2793 2592 -201 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/6 up/down: 10/-399) Total: -389 bytes text data bss dec hex filename 982178 485 7296 989959 f1b07 busybox_old 981675 485 7296 989456 f1910 busybox_unstripped Signed-off-by: Alexander Vickberg <wickbergster@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-16httpd: fix handling of EOF in get_line()Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-16httpd: add missing {}Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-16httpd: do not percent-decode URI if proxyingDenys Vlasenko
The proxying is documented as follows: P:/url:[http://]hostname[:port]/new/path Howeverm urlcopy is not a true copy anymore when it is fdprint'ed to proxy_fd, this is because percent_decode_in_place() is called after the copy is created. This breaks reverse proxying all URIs containing percent encoded spaces, e.g. - because a decoded URI will be printed out to proxy_fd instead of the original. The fix keeps the logic in place to canonicalize the uri first, before reverse proxying (one could argue that the uri should be proxied completely unaltered, except for the prefix rewrite). function old new delta handle_incoming_and_exit 2752 2792 +40 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-14httpd: fix proxy headers passing - full_write() instead of write()Denys Vlasenko
function old new delta handle_incoming_and_exit 2763 2752 -11 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-14httpd: if remote IP is denied, send FORBIDDEN reply earlierDenys Vlasenko
While at it, fix sighup_handler to not clobber errno. function old new delta send_HTTP_FORBIDDEN_and_exit_if_denied_ip - 47 +47 sighup_handler 15 30 +15 handle_incoming_and_exit 2791 2763 -28 checkPermIP 48 - -48 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 1/1 up/down: 62/-76) Total: -14 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-14udhcpc6: code shrinkDenys Vlasenko
function old new delta d6_read_interface 593 582 -11 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-13udhcpc6: add a few comments, no code changes.Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-13udhcpc6: make it enabled in defconfigDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-13examples/udhcp/simple.script: fix resolv.conf update if it is a dangling symlinkRolf Eike Beer
If /etc/resolv.conf is a symlink to a tmpfs and the actual file does not already exist, "readlink -f" will not detect it as symlink. Explicitely check for that condition before and touch the file, making the other code work as intended. Signed-off-by: Rolf Eike Beer <eb@emlix.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-13udhcp: add 100 and 101 dhcp options for ipv4Antoine Girard-Vallée
Support for the IEEE timezone string and timezone database strings (100 and 101 options respectively) is added for ipv4, conforming to RFC-4833. The two options are passed to hook scripts in the variables tzstr and tzdbstr. function old new delta dhcp_option_strings 280 294 +14 dhcp_optflags 76 80 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 18/0) Total: 18 bytes Signed-off-by: Antoine Girard-Vallée <antoine.girard-vallee@savoirfairelinux.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-13brctl: add TODO: "showmacs BR"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-13brctl: simplify str_to_jiffies()Denys Vlasenko
function old new delta write_uint - 96 +96 brctl_main 721 678 -43 write_ulong 96 - -96 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 0/1 up/down: 96/-139) Total: -43 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-13brctl: convert remaining commands to work via /sysDenys Vlasenko
function old new delta write_ulong - 96 +96 show_bridge 310 338 +28 static.ops 3 - -3 arm_ioctl 20 - -20 packed_usage 33344 33315 -29 brctl_main 885 721 -164 ------------------------------------------------------------------------------ (add/remove: 1/2 grow/shrink: 1/2 up/down: 124/-216) Total: -92 bytes text data bss dec hex filename 982112 485 7296 989893 f1ac5 busybox_old 982157 485 7296 989938 f1af2 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-12brctl: make "show" command retrieve data from /sysDenys Vlasenko
ioctl interface is obsolete and has no 32/64 compat shim, making "brctl show" fail for 32-bit userspace and 64-bit kernel. function old new delta show_bridge - 310 +310 read_file - 64 +64 if_indextoname 117 - -117 brctl_main 1183 885 -298 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 0/1 up/down: 374/-415) Total: -41 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-12stat: reduce storage for human-readable filesystem namesRon Yorston
function old new delta static.humanname - 236 +236 static.fstype - 140 +140 print_statfs 339 341 +2 static.humantypes 288 - -288 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 1/0 up/down: 378/-288) Total: 90 bytes text data bss dec hex filename 982183 485 7296 989964 f1b0c busybox_old 982152 485 7296 989933 f1aed busybox_unstripped Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>