aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Use Windows library for cryptographic checksumscng_backendRon Yorston2025-06-099-9/+155
| | | | | | | | | | | | | Add a new feature to libbb, FEATURE_USE_CNG_API, which enables the use of the Cryptography API: Next Generation library to calculate checksums. It is disabled by default except in the mingw64u default config, as the API requires Windows 10+ to function. Usage of this API provides a size benefit and delegates hardware optimizations to the operating system cryptography library. Based on GitHub PR #498 by rfl890. Saves 4064 bytes in the mingw64u case.
* win32: update implementation of select(2)Ron Yorston2025-05-261-2/+5
| | | | | | | | Apply gnulib commit 034af0e401 (select, pselect: Fix test failure on native Windows). * lib/select.c (rpl_select): Fail if nfds is out-of-range. * lib/pselect.c (pselect): Likewise.
* win32: update implementation of strptime(3)Ron Yorston2025-05-261-18/+18
| | | | Changes are mostly cosmetic.
* win32: update inet_pton(3) implementationRon Yorston2025-05-261-0/+1
| | | | | | | | | | | | | | | | | | | Apply musl commit 7e13e5ae (inet_pton: fix uninitialized memory use for IPv4-mapped IPv6 addresses). When a dot is encountered, the loop counter is incremented before exiting the loop, but the corresponding ip array element is left uninitialized, so the subsequent memmove (if "::" was seen) and the loop copying ip to the output buffer will operate on an uninitialized uint16_t. The uninitialized data never directly influences the control flow and is overwritten on successful return by the second half of the parsed IPv4 address. But it's better to fix this to avoid unexpected transformations by a sufficiently smart compiler and reports from UB-detection tools. Adds 16 bytes.
* win32: update glob(3) implementationRon Yorston2025-05-261-1/+1
| | | | | | | | | | | Apply musl commit 79bdacff (glob: fix wrong return code when aborting before any matches). when the result count was zero, glob was ignoring a possible GLOB_ABORTED error code and returning GLOB_NOMATCH. whether this happened could be nondeterministic and dependent on the order of dirent enumeration, in cases where multiple matches were present and only some produced errors.
* Merge branch 'busybox' into mergeRon Yorston2025-05-1920-119/+286
|\
| * cpio: error out if the file to be achived is >=4GBDenys Vlasenko2025-04-211-0/+6
| | | | | | | | | | | | | | | | | | | | function old new delta .rodata 105715 105751 +36 cpio_o 1145 1167 +22 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 58/0) Total: 58 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * rpm2cpio: extract cpio even if compression is not knownDenys Vlasenko2025-04-201-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | This is more useful than failing outright. function old new delta rpm2cpio_main 110 144 +34 .rodata 105681 105715 +34 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 68/0) Total: 68 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb/archival: make setup_unzip_on_fd() return bytes read if not compressedDenys Vlasenko2025-04-207-23/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | setup_unzip_on_fd() does not return the transformer structure, so the user does not know how much to seek back (or alternatively what the signature was) when compressor signature is not detected. Currently not needed (the only user is tar which dies anyway). However, rpm2cpio may need this if we extend it to extract the internal .cpio even if cpio's compressions algo is not known. function old new delta setup_unzip_on_fd 53 59 +6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * runit: fix setuidgid help textJ. Neuschäfer2025-04-171-1/+2
| | | | | | | | | | Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * archival: disallow path traversals (CVE-2023-39810)Denys Vlasenko2025-04-165-2/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create new configure option for archival/libarchive based extractions to disallow path traversals. As this is a paranoid option and might introduce backward incompatibility, default it to no. Fixes: CVE-2023-39810 Based on the patch by Peter Kaestle <peter.kaestle@nokia.com> function old new delta data_extract_all 921 945 +24 strip_unsafe_prefix 101 102 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 25/0) Total: 25 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * syslogd: Fix 'OPT_locallog' check regression in 'syslogd_main'Grant Erickson2025-04-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the recent refactoring of 'syslogd_main', a regression was introduced in handling the manual bitwise OR of 'OPT_locallog' as follows: if (ENABLE_FEATURE_REMOTE_LOG && !(opts & OPT_remotelog)) // -R option_mask32 |= OPT_locallog; 'opts' represents the locally-scoped output of 'getopt32' and 'option_mask32' represents the globally-scoped state of the same. Consequently, the above performs a bitwise OR to include 'OPT_locallog' of the globally-scoped option state, which 'opts' will not reflect locally. Manipulating the global, rather than local, state is correct as 'timestamp_and_log_internal' will later need to check 'OPT_locallog'. However, when the aforementioned refactor occurred, the following regressing change was made: - if (!ENABLE_FEATURE_REMOTE_LOG || (option_mask32 & OPT_locallog)) { + if (!ENABLE_FEATURE_REMOTE_LOG || (opts & OPT_locallog)) { breaking the spatially- and temporally-removed check in 'timestamp_and_log_internal'. Fixes: 02378ce20c6d2 ("syslogd: decrease stack usage, ~50 bytes") function old new delta syslogd_init 1140 1137 -3 Signed-off-by: Grant Erickson <gerickson@nuovations.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * udhcpd: send DHCPOFFERs as unicast (unless clients specifically asks for bcast)Denys Vlasenko2025-04-071-16/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | RFC 2131 says we should do that. Evidently, since for so many years no one complained, sending them broadcast works too, but finally we've got someone who wants RFC-compliand behavior. function old new delta send_packet 141 179 +38 .rodata 105680 105681 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 39/0) Total: 39 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Makefile: fix passing of EXTRA_LDLIBSDenys Vlasenko2025-04-061-1/+5
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * init: improve log message when a process exits: show exit codeSébastien Parisot2025-04-061-3/+15
| | | | | | | | | | | | | | | | | | | | | | function old new delta .rodata 105649 105680 +31 init_main 776 804 +28 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 59/0) Total: 59 bytes Signed-off-by: Sébastien Parisot <sparisot@free-mobile.fr> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * udhcpc6: fix copy-paste error in "generate a consistent IAID" commitDenys Vlasenko2025-02-091-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * udhcpc6: generate a consistent IAIDZhou Siqi2025-02-091-2/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, udhcpc6 does not meet the requirements for Identity Association in RFC 3315. This is a specific explanation in RFC 3315 protocol: https://datatracker.ietf.org/doc/html/rfc3315#section-10 "The IAID uniquely identifies the IA and must be chosen to be unique among the IAIDs on the client. The IAID is chosen by the client. For any given use of an IA by the client, the IAID for that IA MUST be consistent across restarts of the DHCP client." This patch makes the client generate a consistent IAID based on the MAC address. function old new delta send_d6_discover 285 270 -15 Signed-off-by: Zhou Siqi <zhousiqi5@huawei.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * udhcpc6: move block comment, no code changesDenys Vlasenko2025-02-091-61/+61
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * udhcpc6: improvementsLaurent Bercot2025-02-092-32/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several small improvements to udhcpc6. - Remove usage text for the nonexistent -B option. - Fix a segfault when renewing an IA_PD lease without IA_NA (which means the client hasn't been assigned an ip, so we cannot locally bind to it). - Fix NAK management: check the option length, and print the status code and status message - Add a -m option to always send renew requests as multicast. These last two changes are useful to deal with hopelessly broken DHCPv6 servers such as the one from the Orange Livebox (one of the main French ISPs) which I'm currently having the displeasure to have to talk to, hence the patch. function old new delta static.send_d6_renew - 126 +126 .rodata 105598 105649 +51 udhcpc6_main 2607 2650 +43 packed_usage 34933 34953 +20 d6_send_kernel_packet_from_client_data_ifindex 266 282 +16 send_d6_renew 174 - -174 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 4/0 up/down: 256/-174) Total: 82 bytes Signed-off-by: Laurent Bercot <ska-dietlibc@skarnet.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | build system: include stack unwind tablesRon Yorston2025-05-186-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 9b80b903c7 (build system: stop .eh_frame generation) added compiler flags to prevent unwind tables being included in the binary. BusyBox doesn't normally require such tables and the size of the binary was much reduced. Windows' Control Flow Guard feature needs unwind tables. Without them calls to longjmp(3), widely used in BusyBox, fail. Add a configuration option to control whether or not unwind tables are included. (GitHub issue #495)
* | Update PDCursesRon Yorston2025-04-1027-360/+420
| |
* | win32: fake directories in readdir(2)Ron Yorston2025-03-171-5/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The emulation of readdir(2) didn't include the '.' and '..' directories in the root of a logical drive. This resulted in the 'ls' applet (and others) not matching the expected Unix behaviour. Alter the emulation of readdir(2) to include fake '.' and '..' directories if necessary. Adds 88-112 bytes. (GitHub issue #487)
* | win32: enhanced support for SIGPIPEFRP-5579-g5749feb35Ron Yorston2025-02-081-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 68ddd4ec3c (win32: emulate SIGPIPE) allowed broken pipes to be detected so that processes could either return EPIPE or terminate. Later, commit 1b2ee3667 (win32: add fake HUP and QUIT signals) added support for two additional fake signals, thus allowing the 'kill' applet to refer to them by name and the shell to define (though not execute) traps for them. Add PIPE to the list of signals known to 'kill' and the shell, though still without support for calling the trap function. (GitHub issue #482)
* | win32: retry when command needs elevated privilegesRon Yorston2025-02-034-12/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Some installer programs have an entry in their manifest to indicate that they need elevated privileges. The shell in busybox-w32 was unable to run such programs. When a program fails to run with ERROR_ELEVATION_REQUIRED, try again using ShellExecuteEx() with the 'runas' verb to give it elevated privileges. Adds 272-288 bytes. (GitHub issue #481)
* | make: fix detection of target rule with inline commandRon Yorston2025-01-221-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit f9d10b2b6 (make: fix detection of target rules (take 2)) added code to handle the case where a target rule had an inline command with a ';' separator in a macro. This required all macros on the line to be expanded, including those in the inline command. The ';' should first be searched for in the original line (without any macro expansion) and only if that fails should macros be expanded. This matches the behaviour of GNU and Unix V7 make. BSD and Schily make don't handle the case where the ';' is in a macro. (pdpmake GitHub issue 73)
* | make: fix single-suffix inference rule regressionRon Yorston2025-01-212-3/+24
| | | | | | | | | | | | | | | | | | | | | | | | Commit 85bbce87d (make: support GNU/BSD suffixes and inference rules) added code to handle inference rules with arbitrary suffixes. Unfortunately it failed to check for a single-suffix rule in the case where no known suffix was found. Add the necessary code and a test which would have caught the problem. Adds 48 bytes. (pdpmake GitHub issue 72)
* | make: phony targets and double colon rulesRon Yorston2025-01-161-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 770bad1fe (make: disallow inference rules for phony targets) added the GNU/BSD make feature that inference rules aren't used for phony targets. Normally a double-colon rule without associated commands causes an inference rule search. If the target of the double-colon rule was phony no search was carried out and the rule failed. As a result of this perl failed to build (on Linux, I didn't try on Windows). When a double-colon rule has no commands and a phony target the prerequisites should be built and the rule should succeed. Adds 32 bytes. (pdpmake GitHub issue #70)
* | make: minor tweaksRon Yorston2025-01-161-32/+37
| | | | | | | | | | | | | | | | | | | | | | Move the code to remove the suffix from a target into a separate function. There's no need to test for non-NULL 'makefile' in newcmd(). Cosmetic changes. Saves 0-16 bytes.
* | make: support GNU/BSD suffixes and inference rulesRon Yorston2025-01-143-71/+224
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The specification of inference rules in POSIX implies that only suffixes starting with a period and containing no other periods are to be considered. In contrast, both GNU and BSD make allow suffixes to contain an arbitrary number of periods, or none at all. Allow this as an extension. Adds 640-816 bytes. (pdpmake GitHub issue 70)
* | win32: fix compilation with FEATURE_SH_NOFORK disabledRon Yorston2024-12-312-3/+5
| | | | | | | | | | Compiling with FEATURE_SH_NOFORK disabled resulted in an error and a warning. Fixing these doesn't change the default build.
* | Merge branch 'busybox' into mergeRon Yorston2024-12-307-208/+422
|\|
| * cut: code shrinkDenys Vlasenko2024-12-211-6/+5
| | | | | | | | | | | | | | | | | | move "linenum" manipulations to the one place where it is used. function old new delta cut_main 1373 1360 -13 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: code shrinkDenys Vlasenko2024-12-211-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | This change eliminates one temporary: - if (dcount++ < cut_list[cl_pos].startpos) + dcount++; + if (dcount <= cut_list[cl_pos].startpos) function old new delta cut_main 1402 1373 -29 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: fix up -D/-s behavior with -FDenys Vlasenko2024-12-202-5/+36
| | | | | | | | | | | | | | | | | | | | function old new delta cut_main 1388 1402 +14 packed_usage 34934 34933 -1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 14/-1) Total: 13 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: remove unnecessary initialization of regmatch_tDenys Vlasenko2024-12-201-1/+1
| | | | | | | | | | | | | | function old new delta cut_main 1404 1388 -16 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: shorten error messages on bad syntax even moreDenys Vlasenko2024-12-161-10/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | $ cut -s -b3 cut: -s requires -f or -F $ cut -d@ -b3 cut: -d DELIM requires -f or -F function old new delta static.requires_f - 19 +19 static._op_on_field 32 - -32 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 0/0 up/down: 19/-32) Total: -13 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: shorten error messages on bad syntaxDenys Vlasenko2024-12-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't need to mimic GNU cut error messages. $ cut -d@ -b3 cut: -d DELIM makes sense only with -f or -F $ cut -s -b3 cut: -s makes sense only with -f or -F function old new delta static._op_on_field 31 32 +1 .rodata 105659 105598 -61 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 1/-61) Total: -60 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: terminate cut_list[] so that we don't need "size of the array" variableDenys Vlasenko2024-12-161-20/+25
| | | | | | | | | | | | | | function old new delta cut_main 1410 1404 -6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: we can't get empty cut_list[], remove the check for thatDenys Vlasenko2024-12-161-8/+11
| | | | | | | | | | | | | | function old new delta .rodata 105685 105659 -26 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: disallow -f '' and -f '-'Denys Vlasenko2024-12-151-15/+19
| | | | | | | | | | | | | | function old new delta cut_main 1391 1410 +19 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: fix -F n-m to match toyboxDenys Vlasenko2024-12-142-3/+28
| | | | | | | | | | | | | | function old new delta cut_main 1339 1391 +52 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: simplify getopt32 codeDenys Vlasenko2024-12-131-11/+8
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: "it's legal to pass an empty list" seems to be untrueDenys Vlasenko2024-12-131-46/+44
| | | | | | | | | | | | | | function old new delta cut_main 1344 1339 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: whitespace fixesDenys Vlasenko2024-12-131-3/+3
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: tweak commentsDenys Vlasenko2024-12-131-3/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: fix handling of -d ''Denys Vlasenko2024-12-132-1/+13
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: prevent infinite loop if -F REGEX matches empty delimiterDenys Vlasenko2024-12-131-1/+3
| | | | | | | | | | | | | | function old new delta cut_main 1339 1348 +9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: tweak --helpDenys Vlasenko2024-12-112-11/+10
| | | | | | | | | | | | | | | | | | | | | | function old new delta packed_usage 34901 34934 +33 cut_main 1353 1339 -14 .rodata 105724 105685 -39 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 33/-53) Total: -20 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: fix -d$'\n' --output-delimiter=@@ behaviorDenys Vlasenko2024-12-102-7/+53
| | | | | | | | | | | | | | | | | | | | function old new delta cut_main 1261 1353 +92 packed_usage 34925 34901 -24 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 92/-24) Total: 68 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: implement --output-delimiterDenys Vlasenko2024-12-102-10/+49
| | | | | | | | | | | | | | | | | | | | function old new delta cut_main 1204 1261 +57 static.cut_longopts - 20 +20 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/0 up/down: 77/0) Total: 77 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>