aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* httpd: code shrinkbusyboxDenys Vlasenko11 days1-18/+22
| | | | | | | | | | | | | | function old new delta send_file_and_exit 931 933 +2 get_line 126 120 -6 httpd_main 968 959 -9 send_headers 708 694 -14 handle_incoming_and_exit 2285 2270 -15 cgi_io_loop_and_exit 635 620 -15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/5 up/down: 2/-59) Total: -57 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: use more understandable form of "split-globals" trickDenys Vlasenko11 days2-39/+36
| | | | | | | | | | | | | | function old new delta parse_expr 986 998 +12 chain_group 633 640 +7 next_token 930 934 +4 getvar_s 102 101 -1 awk_main 891 888 -3 evaluate 3379 3355 -24 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/3 up/down: 23/-28) Total: -5 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* httpd: code shrink via "split-globals" trickDenys Vlasenko11 days2-3/+18
| | | | | | | | | | | | | | | | function old new delta httpd_main 957 968 +11 log_and_exit 25 26 +1 send_headers 712 708 -4 handle_incoming_and_exit 2292 2285 -7 sigalrm_handler 102 93 -9 parse_conf 1332 1323 -9 send_cgi_and_exit 803 790 -13 cgi_io_loop_and_exit 656 635 -21 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/6 up/down: 12/-63) Total: -51 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* httpd: implement POSTDATA read timeout, and -K KILLSECS CGI lifetime controlDenys Vlasenko11 days1-59/+110
| | | | | | | | | | | | | | | | function old new delta cgi_io_loop_and_exit 496 656 +160 sigalrm_handler 1 102 +101 .rodata 106814 106853 +39 send_cgi_and_exit 770 803 +33 packed_usage 35894 35924 +30 httpd_main 950 957 +7 handle_incoming_and_exit 2297 2292 -5 send_REQUEST_TIMEOUT_and_exit 10 - -10 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 6/1 up/down: 370/-15) Total: 355 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* httpd: fix incorrect == comparison in last commit, must be !=Denys Vlasenko12 days1-1/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* httpd: smarter handling of CGI's "Status: " headerDenys Vlasenko12 days1-10/+13
| | | | | | | | | | | | | Do one less write() function old new delta handle_incoming_and_exit 2290 2297 +7 cgi_io_loop_and_exit 498 500 +2 .rodata 106821 106814 -7 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 9/-7) Total: 2 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* httpd: simplify CGI headers handling, check "HTTP/1.1" prefix, not just "HTTP"Denys Vlasenko12 days2-28/+32
| | | | | | | | | | function old new delta cgi_io_loop_and_exit 477 498 +21 .rodata 106830 106821 -9 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 21/-9) Total: 12 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* httpd: simplify CGI code a bit, add a bunch of TODOs and FIXMEsDenys Vlasenko12 days2-29/+37
| | | | | | | | | | | | function old new delta log_and_exit 33 25 -8 handle_incoming_and_exit 2298 2290 -8 send_cgi_and_exit 784 770 -14 cgi_io_loop_and_exit 538 477 -61 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-91) Total: -91 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* httpd: do not force clean connection termination on write errors and timeoutsDenys Vlasenko13 days1-24/+45
| | | | | | | | | | | | function old new delta send_file_and_exit 891 931 +40 send_EOF_and_exit - 14 +14 cgi_io_loop_and_exit 535 538 +3 log_and_exit 44 33 -11 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/1 up/down: 57/-11) Total: 46 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* httpd: make timeout messages less confusingDenys Vlasenko13 days1-6/+10
| | | | | | | function old new delta send_file_and_exit 891 930 +39 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* httpd: time out data writes after 60 seconds of no progressDenys Vlasenko13 days1-13/+45
| | | | | | | | | | | | | | function old new delta prepare_write_timeout - 29 +29 static.tv - 16 +16 httpd_main 939 950 +11 send_file_and_exit 887 891 +4 handle_incoming_and_exit 2306 2298 -8 cgi_io_loop_and_exit 552 535 -17 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 2/2 up/down: 60/-25) Total: 35 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* httpd: optimize header reading timeout codeDenys Vlasenko13 days1-4/+10
| | | | | | | | | | | | | | | Set up the signal handler once, outside of main loop. Do not reset the timer if headers are big - they still are expected to arrive quickly. function old new delta httpd_main 913 939 +26 handle_incoming_and_exit 2312 2306 -6 get_line 134 126 -8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 26/-14) Total: 12 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* httpd: when reading headers, abort if they are too longDenys Vlasenko13 days1-7/+9
| | | | | | | function old new delta get_line 130 134 +4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* httpd: reject request line and headers with control charsDenys Vlasenko13 days1-0/+12
| | | | | | | | | This removes the need to check various corner cases later. function old new delta get_line 108 130 +22 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* httpd: allow http2 requests if proxying, tighten METHOD checksDenys Vlasenko13 days1-9/+16
| | | | | | | | | | function old new delta handle_incoming_and_exit 2264 2312 +48 httpd_main 915 913 -2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 48/-2) Total: 46 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* httpd: fix compilation script of httpd_ratelimit_cgi.cDenys Vlasenko13 days2-2/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* httpd: add -M MAXCONN - do not accept unlimited number of connectionsDenys Vlasenko13 days1-19/+86
| | | | | | | | | | | | | | | | | | | We were lacking even basic rate-limiting. function old new delta httpd_main 648 915 +267 handle_incoming_and_exit 2235 2264 +29 packed_usage 35868 35894 +26 cgi_io_loop_and_exit 537 552 +15 send_headers 704 712 +8 get_line 106 108 +2 .rodata 106829 106830 +1 send_file_and_exit 890 887 -3 mini_httpd 161 - -161 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 7/1 up/down: 348/-164) Total: 184 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* httpd: stop disabling/enabling SIGHUP in every childDenys Vlasenko14 days1-8/+13
| | | | | | | | | | function old new delta sighup_handler 30 47 +17 httpd_main 710 695 -15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 17/-15) Total: 2 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* httpd: remove one close() from main loopDenys Vlasenko14 days1-5/+6
| | | | | | | function old new delta httpd_main 701 710 +9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* networking/httpd_ratelimit_cgi.c: new example CGI handlerDenys Vlasenko14 days2-1/+248
| | | | | | | text data bss dec hex filename 4003 40 352 4395 112b httpd_ratelimit_cgi Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* httpd: expand logging: now can see what CGIs are startedDenys Vlasenko14 days1-26/+45
| | | | | | | | | | | | function old new delta send_cgi_and_exit 711 784 +73 vmstat_main 657 708 +51 .rodata 106746 106778 +32 send_file_and_exit 877 887 +10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/0 up/down: 166/0) Total: 166 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vmstat: fix I/O, int and ctxt rates: need to be divided by secondsDenys Vlasenko2026-01-201-5/+8
| | | | | | | function old new delta vmstat_main 657 708 +51 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vmstat: fixes for >4TB memory and long sampling intervalsDenys Vlasenko2026-01-201-39/+75
| | | | | | | | | | | function old new delta load_row 661 1061 +400 vmstat_main 561 657 +96 .rodata 106716 106746 +30 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 526/0) Total: 526 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vmstat: fix "vmstat N 0" to act compatibly (do not print infinitely)Denys Vlasenko2026-01-191-5/+12
| | | | | | | function old new delta vmstat_main 559 561 +2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vmstat: smarter handling of header re-printingDenys Vlasenko2026-01-191-23/+30
| | | | | | | | | | function old new delta vmstat_main 230 559 +329 print_row 340 - -340 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/0 up/down: 329/-340) Total: -11 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vmstat: show shorter, human-readable accumulating counts if they grow largeDenys Vlasenko2026-01-181-13/+29
| | | | | | | | | | function old new delta print_row 247 340 +93 .rodata 106717 106716 -1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 93/-1) Total: 92 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vmstat: reduce the chances of misaligned columnsDenys Vlasenko2026-01-181-8/+26
| | | | | | | function old new delta print_row 215 247 +32 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vmstat: code shrinkDenys Vlasenko2026-01-181-28/+39
| | | | | | | | | | | function old new delta load_row 667 661 -6 next_col 105 59 -46 coldescs 239 146 -93 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-145) Total: -145 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* procps: new applet: vmstatDavid Leonard2026-01-181-0/+483
| | | | | | | | | | | | | | | | | | | | | | | Adds a compact vmstat applet that matches the default behaviour of procps's vmstat. function old new delta load_row - 667 +667 .rodata 106441 106717 +276 coldescs - 239 +239 vmstat_main - 230 +230 print_row - 215 +215 next_col - 105 +105 find_col - 78 +78 packed_usage 35828 35868 +40 applet_names 2849 2856 +7 applet_main 1640 1644 +4 applet_install_loc 205 206 +1 ------------------------------------------------------------------------------ (add/remove: 7/0 grow/shrink: 5/0 up/down: 1862/0) Total: 1862 bytes Signed-off-by: David Leonard <d+busybox@adaptive-enterprises.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* adduser: remove preconfigured GECOS full name fieldAchill Gilgenast2026-01-181-1/+1
| | | | | | | | | | | | | | | | | | | | Pre-configuring "Linux User" as Full Name is confusing a lot of users downstream.[1] For example, in geary e-mails were sent out as "Linux User"[2] and I also saw a couple of git commits with this name. This name does not bring any more improvements than just leaving this field empty, and let applications most likely fallback to the username. Alternative would be to set the field to `&` (Capitalized username, according to passwd(5)) or that we just set the GECOS field downstream. [1] https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/issues/2214 [2] https://gitlab.gnome.org/GNOME/geary/-/issues/1486 function old new delta .rodata 106455 106441 -14 Signed-off-by: Achill Gilgenast <achill@achill.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* md5/sha1sum: Honor the -b flag in the outputMartin Storsjö2026-01-182-4/+22
| | | | | | | | | | | | | | | | | | | | | | | | The output of md5sum/sha1sum contains a character to indicate what mode was used to read the file - '*' for binary, and ' ' for text or where binary is insignificant. This flag character makes a difference for the ffmpeg testsuite. This testsuite contains a number of reference files (e.g. [1]), containing the expected md5sum output for those files, which is checked verbatim. By making busybox's md5sum honor this flag in the output, ffmpeg's testsuite can run successfully on top of busybox. The flag is only partially implemented; in coreutils md5sum, a later "-t" option overrides an earlier "-b" option. Here, just check if a "-b" option was specified or not. Neither flag affects how the files actually are read. [1] https://code.ffmpeg.org/FFmpeg/FFmpeg/src/commit/894da5ca7d742e4429ffb2af534fcda0103ef593/tests/ref/acodec/flac Signed-off-by: Martin Storsjö <martin@martin.st> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* cmp: fix -n causing all diffs to be output, implement size suffixes for SKIPDenys Vlasenko2026-01-184-20/+77
| | | | | | | | | | function old new delta packed_usage 35802 35828 +26 cmp_main 616 595 -21 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 26/-21) Total: 5 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* cmp: stop skipping bytes if EOF is reachedGiorgi Tchankvetadze2026-01-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, if a skip value is larger than the file size, cmp will continue to loop and call getc() until the skip count is satisfied, even though EOF has been reached. For large skip values (e.g., 1 billion), this results in significant CPU waste and execution time (e.g., 11 seconds on a modern CPU). This patch checks for EOF inside the skip loop and breaks early. Test case: $ touch empty.txt $ time ./busybox cmp empty.txt empty.txt 1000000000 1000000000 Before: real 0m10.937s After: real 0m0.002s function old new delta cmp_main 594 616 +22 Signed-off-by: Giorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* coreutils: fixes for coreutils/id_test.sh scriptDenys Vlasenko2026-01-181-11/+11
| | | | | | Patch from Tito Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* networking/udhcp: fix typo in commentGiorgi Tchankvetadze2026-01-141-1/+1
| | | | | Signed-off-by: Giorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* xxd: fix -pANYTHING handling (-pc50 does not mean -p -c50)Denys Vlasenko2025-11-302-7/+31
| | | | | | | | | | | function old new delta packed_usage 35768 35802 +34 xxd_main 1447 1449 +2 .rodata 106438 106439 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 37/0) Total: 37 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* tls: better error message when TLS record is truncatedDenys Vlasenko2025-11-251-1/+4
| | | | | | | | | | function old new delta .rodata 106388 106438 +50 tls_xread_record 650 681 +31 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 81/0) Total: 81 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* eject: fix missing -s option in trivial usageDenys Vlasenko2025-11-081-1/+1
| | | | | | | | | | Fixes missing [-s] option in trivial usage section of `eject --help` function old new delta packed_usage 35125 35127 +2 Signed-off-by: Nir Lichtman <nir@lichtman.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* dd: fix overflow for very large count/seek/skip valuesDenys Vlasenko2025-11-082-9/+7
| | | | | | | | | | | | function old new delta xatoull_range_sfx - 49 +49 dd_main 1607 1640 +33 bb_banner 47 46 -1 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/1 up/down: 82/-1) Total: 81 bytes Signed-off-by: Sertonix <sertonix@posteo.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* pgrep/pkill: fix -x to also match comm fieldDenys Vlasenko2025-11-081-4/+4
| | | | | | | | | | | | | When running `pgrep -x example` against a process `/bin/example --arg`, BusyBox fails to match, while GNU pgrep succeeds. The reason is that the comparison is done only against the full argv[0] rather than comm. This patch changes pgrep -x to also try /proc/[pid]/comm for exact matching. function old new delta pgrep_main 681 670 -11 Signed-off-by: Paulius Zaleckas <paulius.zaleckas@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: restore functionality of --colorDenys Vlasenko2025-11-081-1/+1
| | | | | | | | | | | | | | | Since commit 551bfdb97 (ls: implement -q, fix -w0, reduce startup time) the '--color' option behaves as though the default argument 'always' had been specified. This is due to an explicit short option for '--color' being given, but without specifying that an argument is expected. function old new delta .rodata 106027 106029 +2 Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: fix PS1='\W' for root directoryDenys Vlasenko2025-11-081-1/+1
| | | | | | | | | | | | | '\W' in PS1 returned an empty string for the root directory. bash displays '/' in similar circumstances. Avoid returning an empty string for the directory. function old new delta parse_and_put_prompt 873 883 +10 Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* last: fix ignoring the first login entryDenys Vlasenko2025-11-081-1/+1
| | | | | | | | The first login entry is ignored if a log file contains more than one entry. To fix it, do not break the while loop if the offset is zero. Signed-off-by: Dmitry Klochkov <dmitry.klochkov@bell-sw.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* busybox: optional --version supportDenys Vlasenko2025-10-132-4/+19
| | | | | | | function old new delta busybox_main 695 734 +39 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ntpd: set tmx.maxerror properly - avoid STA_UNSYNCDenys Vlasenko2025-10-111-5/+12
| | | | | | | function old new delta update_local_clock 872 951 +79 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* nsenter,unshare: don't use xvfork_parent_waits_and_exits(), it SEGVs on ppc64leDenys Vlasenko2025-10-083-2/+25
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* cp: fix `cp -aT` overwriting symlink to directoriesDenys Vlasenko2025-10-071-1/+2
| | | | | | | | | | | | busybox cp refuses to overwrite another symlink to a directory due to an incorrect stat() call that should be lstat(). When using -T, we want to consider the target argument directly without resolving symlinks. function old new delta cp_main 496 514 +18 Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* chrt: support passing `-p 0` to operate on selfDenys Vlasenko2025-10-071-3/+10
| | | | | | | | | | | | | Specifying a PID of 0 for the -p option of chrt would previously result in a "number 0... not in range" error. Now, it means instead that the calling process (i.e. chrt itself) should be operated on; this is to be consistent with the behavior of util-linux's version of chrt. function old new delta chrt_main 462 474 +12 Signed-off-by: Zuo An <zuoan.penguin@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* selinux: fix potential segfault in sestatusDenys Vlasenko2025-10-071-2/+2
| | | | | | | | | | | | | | | | Remove the puts(cterm) call that was likely leftover debugging code. The controlling terminal name is already properly displayed via the 'Controlling term:' label, so the raw terminal name output was redundant and could cause issues when cterm is NULL. Also add proper cleanup for the allocated cterm string. function old new delta ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0) Total: 0 bytes Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: warn about range in ':!' commandDenys Vlasenko2025-10-071-0/+4
| | | | | | | | | | | | | | Currently vi in Busybox doesn't support filtering text through an external command with ':1,2!cmd'. Instead it behaves as if no range had been supplied and displays the output of the command. Issue a warning and do nothing in such cases. function old new delta colon 3993 4010 +17 Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>