aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
| * cmp: code shrinkDenys Vlasenko2021-12-171-2/+2
| | | | | | | | | | | | | | function old new delta .rodata 104203 104201 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ed: add support for -p command-line option as mandated by POSIXSören Tempel2021-12-171-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The POSIX.1-2008 specification of ed(1) mandates two command-line options: -p (for specifying a prompt string) and -s (to suppress writing of byte counts). This commit adds support for the former. Furthermore, it also changes the default prompt string to an empty string (instead of ": ") since this is also mandated by POSIX: -p string Use string as the prompt string when in command mode. By default, there shall be no prompt string. function old new delta ed_main 112 144 +32 packed_usage 34074 34097 +23 doCommands 1889 1887 -2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 55/-2) Total: 53 bytes Signed-off-by: Sören Tempel <soeren+git@soeren-tempel.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cmp: add support for -nWalter Lozano2021-12-171-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support to for "-n" to cmp in order to compare at most n bytes. function old new delta cmp_main 552 589 +37 .rodata 104198 104203 +5 packed_usage 34102 34074 -28 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 42/-28) Total: 14 bytes Signed-off-by: Walter Lozano <walter.lozano@collabora.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * docs/embedded-scripts.txt: whitespace fixDenys Vlasenko2021-12-171-8/+8
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * find: implement -samefileAaro Koskinen2021-12-171-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta parse_params 1461 1606 +145 func_samefile - 42 +42 packed_usage 34079 34102 +23 static.params 261 271 +10 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 3/0 up/down: 220/0) Total: 220 bytes Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * printf: allow 0 as a flag and allow multiple flagsRon Yorston2021-12-172-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The '%' character in a format specification may be followed by one or more flags from the list "+- #0". BusyBox printf didn't support the '0' flag or allow multiple flags to be provided. As a result the formats '%0*d' and '%0 d' were considered to be invalid. The lack of support for '0' was pointed out by Andrew Snyder on the musl mailing list: https://www.openwall.com/lists/musl/2021/12/14/2 function old new delta printf_main 860 891 +31 .rodata 99281 99282 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 32/0) Total: 32 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * httpd: do not send Last-Modified / ETag / Content-Length for error pagesDenys Vlasenko2021-12-171-20/+14
| | | | | | | | | | | | | | | | function old new delta send_headers 713 701 -12 send_headers_and_exit 20 34 +14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * httpd: don't send Content-Length in error pages headerDenys Vlasenko2021-12-171-14/+21
| | | | | | | | | | | | | | function old new delta send_headers 701 713 +12 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libarchive/get_header_ar.c: fix extraction of archives from binutils in ↵Peter Korsgaard2021-12-121-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | deterministic mode GNU binutils in deterministic mode (ar rD or built with --enable-deterministic-archives) hard codes file mode to 0644 (NOT 0100644) since https://github.com/bminor/binutils-gdb/commit/36e4dce69dd2 This confuses busybox ar x (data_extract_all): touch a; ar rD a.ar a ar: creating a.ar busybox ar x a.ar ar: unrecognized file type hexdump -C a.ar 00000000 21 3c 61 72 63 68 3e 0a 61 2f 20 20 20 20 20 20 |!<arch>.a/ | 00000010 20 20 20 20 20 20 20 20 30 20 20 20 20 20 20 20 | 0 | 00000020 20 20 20 20 30 20 20 20 20 20 30 20 20 20 20 20 | 0 0 | 00000030 36 34 34 20 20 20 20 20 30 20 20 20 20 20 20 20 |644 0 | 00000040 20 20 60 0a | `.| As a workaround, force the mode bits to S_IFREG, as nothing else makes sense for ar. function old new delta get_header_ar 539 542 +3 Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * udhcpc6: fix udhcp_find_option to actually find DHCP6 optionsDenys Vlasenko2021-12-125-14/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | udhcp_insert_new_option treats code for IPv6 as follows: new->data[D6_OPT_CODE] = code >> 8; new->data[D6_OPT_CODE + 1] = code & 0xff; udhcp_find_option tests the code as follows: while (opt_list && opt_list->data[OPT_CODE] < code) ... if (opt_list && opt_list->data[OPT_CODE] == code) So yes, OPT_CODE and D6_OPT_CODE are both 0, but the D6_OPT_CLIENTID = 1 value means that the 1 is in the seconds byte, and udhcp_find_option is only looking at the first byte, So the send_d6_release can never find it the created option. function old new delta udhcp_find_option 28 53 +25 attach_option 276 284 +8 udhcpc6_main 2602 2607 +5 perform_d6_release 262 267 +5 udhcpd_main 1518 1520 +2 udhcpc_main 2542 2544 +2 add_serverid_and_clientid_options 46 48 +2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 7/0 up/down: 49/0) Total: 49 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Makefile.flags: use all cflags for crypt and rt checksMartin Kaiser2021-12-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To check if libcrypt and librt are available, we check if we can compile and link a simple test program. These checks do not match the actual linking if CONFIG_STATIC is enabled. For CONFIG_STATIC, CFLAGS_busybox is set to -static. The checks don't use CFLAGS_busybox and detect a shared libcrypt or librt. If we link busybox later and we have no static libcrypt or librt, linking will fail. Update the libcrypt and librt checks to use CFLAGS_busybox. Signed-off-by: Martin Kaiser <martin@kaiser.cx> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * wget: allow end-users to customize Content-Type for --post-data and --post-fileIldar Shaimordanov2021-12-121-13/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | More explanation in this PR: https://github.com/rmyorston/busybox-w32/pull/233 The real use-case: wget https://api.github.com/markdown/raw --header "Content-Type: text/plain" function old new delta wget_main 2560 2581 +21 wget_user_headers 62 76 +14 .rodata 104196 104197 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 36/0) Total: 36 bytes Signed-off-by: Ildar Shaimordanov <ildar.shaimordanov@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * uudecode: special-case "/dev/stdout", closes 14241Denys Vlasenko2021-12-122-2/+11
| | | | | | | | | | | | | | function old new delta uudecode_main 295 322 +27 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: P256: factor out "multiply then reduce" operationDenys Vlasenko2021-12-111-7/+13
| | | | | | | | | | | | | | | | | | | | function old new delta sp_256_mont_mul_and_reduce_8 - 44 +44 sp_256_ecc_mulmod_8 517 442 -75 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/1 up/down: 44/-75) Total: -31 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: x25519: code shrink by factoring out common codeDenys Vlasenko2021-12-011-47/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta fe_reduce - 37 +37 lm_add 67 43 -24 fe_mul_c 62 38 -24 fe_mul__distinct 138 112 -26 curve25519 800 767 -33 lm_sub 98 64 -34 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/5 up/down: 37/-141) Total: -104 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: P256: enable 64-bit version of montgomery reductionDenys Vlasenko2021-11-281-7/+8
| | | | | | | | | | | | | | | | | | | | After more testing, (1) I'm more sure it is indeed correct, and (2) it is a significant speedup - we do a lot of those multiplications. function old new delta sp_512to256_mont_reduce_8 191 223 +32 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: P256: add 64-bit montgomery reduce (disabled), small optimization in ↵Denys Vlasenko2021-11-281-18/+159
| | | | | | | | | | | | | | | | | | 32-bit code function old new delta sp_512to256_mont_reduce_8 191 185 -6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: P256: add comment on logic in sp_512to256_mont_reduce_8, no code changesDenys Vlasenko2021-11-281-10/+23
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: code shrink in des encryption, in setup_salt()Denys Vlasenko2021-11-282-15/+28
| | | | | | | | | | | | | | | | | | | | | | function old new delta pw_encrypt 978 971 -7 .rodata 108208 108192 -16 des_crypt 1211 1181 -30 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-53) Total: -53 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: P256: simplify sp_256_mont_inv_8 (no need for a temporary)Denys Vlasenko2021-11-281-6/+4
| | | | | | | | | | | | | | function old new delta sp_256_ecc_mulmod_8 543 517 -26 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libarchive: remove duplicate forward declarationBernhard Reutner-Fischer2021-11-281-1/+0
| | | | | | | | Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
| * tls: P256: pad struct sp_point to 64 bits (on 64-bit arches)Denys Vlasenko2021-11-281-5/+9
| | | | | | | | | | | | | | function old new delta curve_P256_compute_pubkey_and_premaster 198 190 -8 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: P256: trivial x86-64 fixDenys Vlasenko2021-11-271-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: P256: change logic so that we don't need double-wide vectors everywhereDenys Vlasenko2021-11-271-106/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change sp_256to512z_mont_{mul,sqr}_8 to not require/zero upper 256 bits. There is only one place where we actually used that (and that's why there used to be zeroing memset of top half!). Fix up that place. As a bonus, 256x256->512 multiply no longer needs to care for "r overlaps a or b" case. This shrinks sp_point structure as well, not just temporaries. function old new delta sp_256to512z_mont_mul_8 150 - -150 sp_256_mont_mul_8 - 147 +147 sp_256to512z_mont_sqr_8 7 - -7 sp_256_mont_sqr_8 - 7 +7 sp_256_ecc_mulmod_8 494 543 +49 sp_512to256_mont_reduce_8 243 249 +6 sp_256_point_from_bin2x32 73 70 -3 sp_256_proj_point_dbl_8 353 345 -8 sp_256_proj_point_add_8 544 499 -45 ------------------------------------------------------------------------------ (add/remove: 2/2 grow/shrink: 2/3 up/down: 209/-213) Total: -4 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: P256: do not open-code copying of struct variablesDenys Vlasenko2021-11-271-1/+3
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: P256: fix sp_256_div2_8 - it wouldn't use a[] if low bit is 0Denys Vlasenko2021-11-271-5/+7
| | | | | | | | | | | | | | | | It worked by chance because the only caller passed both parameters as two pointers to the same array. My fault (I made this error when converting from 26-bit code). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: P256: remove redundant zeroing in sp_256_map_8Denys Vlasenko2021-11-271-2/+0
| | | | | | | | | | | | | | | | | | Previous change made it obvious that we zero out already-zeroed high bits function old new delta sp_256_ecc_mulmod_8 534 494 -40 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: P256: explain which functions use double-wide arrays, no code changesDenys Vlasenko2021-11-271-153/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta sp_512to256_mont_reduce_8 - 243 +243 sp_256to512z_mont_mul_8 - 150 +150 sp_256to512z_mont_sqr_8 - 7 +7 sp_256_mont_sqr_8 7 - -7 sp_256_mont_mul_8 150 - -150 sp_256_mont_reduce_8 243 - -243 ------------------------------------------------------------------------------ (add/remove: 3/3 grow/shrink: 0/0 up/down: 400/-400) Total: 0 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: P256: remove constant-time trick in sp_256_proj_point_add_8Denys Vlasenko2021-11-271-42/+37
| | | | | | | | | | | | | | function old new delta sp_256_proj_point_add_8 576 544 -32 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: P256: do not open-code copying of struct variablesDenys Vlasenko2021-11-271-2/+2
| | | | | | | | | | | | | | function old new delta sp_256_ecc_mulmod_8 536 534 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: tweak debug printoutDenys Vlasenko2021-11-271-1/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: P256: 64-bit optimizationsDenys Vlasenko2021-11-272-15/+101
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta sp_256_proj_point_dbl_8 421 428 +7 sp_256_point_from_bin2x32 78 84 +6 sp_256_cmp_8 38 42 +4 sp_256_to_bin_8 28 31 +3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/0 up/down: 20/0) Total: 20 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * which: add -a to help textDenys Vlasenko2021-11-091-2/+3
| | | | | | | | | | | | | | function old new delta packed_usage 34075 34079 +4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cpio: add support for --renumber-inodes like GNU cpioAriadne Conill2021-10-131-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The --renumber-inodes option renumbers the inodes starting from 1, so that the sequence of inodes is always stable. This helps with reproducibility. function old new delta cpio_o 961 1045 +84 .rodata 78422 78440 +18 bbconfig_config_bz2 6168 6164 -4 packed_usage 25764 25756 -8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/2 up/down: 102/-12) Total: 90 bytes Signed-off-by: Ariadne Conill <ariadne@dereferenced.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cpio: add support for --ignore-devno like GNU cpioAriadne Conill2021-10-131-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The --ignore-devno option is used to set device numbers to (0, 0). This can be useful in verifying whether a CPIO archive is reproducible. function old new delta cpio_o 922 961 +39 .rodata 78407 78422 +15 bbconfig_config_bz2 6161 6167 +6 packed_usage 25770 25764 -6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 60/-6) Total: 54 bytes Signed-off-by: Ariadne Conill <ariadne@dereferenced.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | winansi: detect if running under WineRon Yorston2021-12-221-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Detect if running under Wine by checking for the wine_get_version function in ntdll.dll. This is how the Wine Developer FAQ suggests doing it. If running under Wine and not otherwise configured: - use ANSI emulation; - don't use alternate screen buffer in vi/less. Explicit settings of BB_SKIP_ANSI_EMULATION and BB_ALT_BUFFER will override the Wine defaults.
* | win32: fix implementation of readlink(2)Ron Yorston2021-11-251-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | Commit 35e32c2a71 (readlink(): do `NUL`-terminate the result) changed how our implementation of readlink(2) handles the case where the link is too long for the buffer. This broke xmalloc_readlink() which expects readlink(2) to behave as documented. As a results symbolic links with 80 or more characters didn't work properly. Revert the commit. (GitHub issue #237)
* | win32: add link to LWN article on shebangRon Yorston2021-11-141-1/+2
| |
* | rpm: code shrinkRon Yorston2021-11-141-0/+4
| | | | | | | | | | | | | | Since the WIN32 implementation of chown(2) does nothing there's no point in calling it. Saves 112 bytes.
* | win32: rename mingw_spawn_1Ron Yorston2021-11-011-8/+8
| | | | | | | | | | | | | | | | | | | | The name of the function mingw_spawn_1() wasn't particularly meaningful. Remove its envp argument (as all of its current callers pass a NULL pointer) and rename it mingw_spawnvp() to better reflect what it does. The path search it performs isn't the standard one: it has features specific to busybox-w32.
* | win32: pass NULL to spawnve, not environRon Yorston2021-10-282-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | Building busybox-w32 for use with UCRT results in mysterious failures. (GitHub issue #234) These are somehow related to the environment values passed to spawnve. In several places the global environ pointer was being passed to spawnve so the child would inherit its environment from the parent. This can also be achieved by passing a NULL pointer. This prevents the failures in at least some cases and also makes the binary smaller.
* | win32: rmdir(2) shouldn't delete symlinksFRP-4487-gd239d2d52Ron Yorston2021-10-171-1/+8
| | | | | | | | | | | | | | | | On Linux rmdir(2) refuses to delete a symlink to a directory on the obvious grounds that a symlink isn't a directory. Windows' rmdir() is less discriminating. Make our implementation of rmdir(2) behave more like Linux.
* | win32: code shrinkRon Yorston2021-10-161-9/+16
| | | | | | | | | | | | | | | | | | There are a few places in mingw.c where we want to determine if a file is a symbolic link. Previously these called mingw_lstat() which collects far more information than is actually needed. Create a new is_symlink() function which does the minimum work necessary.
* | ash: display job id and pid of background commandsRon Yorston2021-10-141-1/+5
| | | | | | | | | | | | | | Several common shells display the job id and pid of background commands. Even the Unix V7 Bourne shell displays the pid. This is unrelated to whether job control is available or enabled.
* | ash: silence compiler warningsRon Yorston2021-10-142-3/+9
| | | | | | | | | | On 64-bit systems mingw-w64 defines pid_t as a 64-bit integer so some printf calls caused compiler warnings.
* | realpath: improved support for Windows pathsRon Yorston2021-10-134-10/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upstream commit 94eb1c4dc (libbb: better coreutils compatibility for realpath) made some changes to xmalloc_realpath_coreutils(). This now needs to be updated to handle Windows paths. - Expose the macro is_unc_path() and part of the recent change to bb_get_last_path_component_nostrip() as a separate funtion, get_last_slash(); - Convert a couple of errors relating to network filesystems to ENOENT; - Adjust xmalloc_realpath_coreutils() to handle Windows directory separators, relative paths and UNC paths.
* | Merge branch 'busybox' into mergeRon Yorston2021-10-1367-1604/+2156
|\|
| * shell: tweak --helpDenys Vlasenko2021-10-132-2/+2
| | | | | | | | | | | | | | | | Even though formally it is -s [ARGS], "sh -s" without ARGS is the same as just "sh". And we are already over 80 chars wide for ash --help, so make it shorter. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: in a comment, document what -i might be doingDenys Vlasenko2021-10-132-6/+28
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ed: align output of read/write commands with POSIX-1.2008Sören Tempel2021-10-121-14/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | POSIX.1-2008 mandates the following regarding the write command: If the command is successful, the number of bytes written shall be written to standard output, unless the -s option was specified, in the following format: "%d\n", <number of bytes written> function old new delta readLines 447 409 -38 doCommands 1940 1889 -51 .rodata 104219 104163 -56 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-145) Total: -145 bytes Signed-off-by: Sören Tempel <soeren+git@soeren-tempel.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>