aboutsummaryrefslogtreecommitdiff
path: root/libbb (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'busybox' into mergeHEADmergemasterRon Yorston4 days1-1/+1
|\
| * libbb/loop: fix existence check for LOOP_CONFIGURE ioctlWouter Franken13 days1-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The LOOP_CONFIGURE ioctl is supported in 5.8 kernels and up. To have backwards compatibility there is a config option CONFIG_TRY_LOOP_CONFIGURE that will check if the ioctl exists and if not fall back to old way of configuring loop devices. Normally errno will be set to EINVAL when this ioctl does not exist. However, when kernel config CONFIG_COMPAT is enabled, then compat_ioctl is called. In that case -ENOIOCTLCMD is returned by loop device driver and generic ioctl wrapper will set errno to ENOTTY. Because busybox does not expect this it will fail to mount loop devices in this case. This patch fixes the check for the existence of the ioctl LOOP_CONFIGURE by checking if errno is one of both: EINVAL or ENOTTY. function old new delta set_loop 809 821 +12 Signed-off-by: Wouter Franken <wouter.franken_ext@softathome.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | libbb: fix regression where 'which' output duplicate slashesRon Yorston7 days1-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If an element of $PATH had a trailing slash 'which' displayed two slashes when an executable was found in that directory. This is a regression caused by upstream commit 49d9e06fb (libbb: modify find_executable() to not temporarily write to PATH). Prior to this commit find_executable() used concat_path_file() to build the path of the executable. This avoids including duplicate slashes in its output. The new code didn't. Add a test in find_executable() to detect the problem. It still fails if there are multiple trailing slashes. Don't do that. Adds 48 bytes.
* | libbb: code shrinkRon Yorston11 days2-16/+30
| | | | | | | | | | | | | | Fix some compiler warnings and move the CNG algorithm caches into get_alg_handle(). Saves 32 bytes in the x86_64 build with CNG enabled.
* | libbb: update CNG API config messagerfl89011 days1-2/+3
| |
* | libbb: refactor CNG hashing implementationrfl89012 days2-26/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing CNG implementation relied on multiple features only implemented in "newer" Windows versions. This new implementation does not use the aforementioned features and is therefore compatible with systems running Windows Vista or higher. function old new delta .rdata 87112 87288 +176 hmac_peek_hash 80 208 +128 get_alg_handle - 96 +96 algorithm_provider_hmac_cache - 48 +48 algorithm_provider_cache - 48 +48 alg_id_mappings - 48 +48 sha512_begin 16 48 +32 sha384_begin 16 48 +32 sha256_begin 16 48 +32 sha1_begin 16 48 +32 md5_begin 16 32 +16 hmac_hash_v 48 64 +16 hmac_end 48 64 +16 hmac_blocks.constprop.0 96 112 +16 __imp_BCryptOpenAlgorithmProvider - 8 +8 __imp_BCryptDuplicateHash - 8 +8 BCryptOpenAlgorithmProvider - 8 +8 BCryptDuplicateHash - 8 +8 ------------------------------------------------------------------------------ (add/remove: 8/0 grow/shrink: 10/0 up/down: 768/0) Total: 768 bytes
* | join: add some more testsRon Yorston2026-01-231-1/+1
| | | | | | | | | | One more from the POSIX documentation and some examples from coreutils.
* | win32: wcwidth_alt.c: update to Unicode 17 (latest)Avi Halachmi (:avih)2025-12-291-16/+24
| | | | | | | | | | | | Used the command: ./scripts/mkwcwidth DL=latest FAST_FUNC > libbb/wcwidth_alt.c
* | win32: wcwidth_alt.c: update to Unicode 16.0.0Avi Halachmi (:avih)2025-12-291-16/+29
| | | | | | | | | | | | | | | | | | | | | | Updated using: ./scripts/mkwcwidth DL=16.0.0 FAST_FUNC > libbb/wcwidth_alt.c The latest currently is 17.0.0, but because we were previously with 15.1 tables, have the 16.0 tables in history just in case. Next commit will update to the latest version.
* | win32: wcwidth_alt.c: new generator script, re-generate codeAvi Halachmi (:avih)2025-12-291-20/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, scripts/mkwcwidth generated a wcwidth implementation based on input from the python wcwidth: https://github.com/jquast/wcwidth . However, that project is not updated frequently, and the less dependencies - the better. This new script instead prints an implementation based directly on the original Unicode files - which it can also download. It generates the same code as before (same data structures, etc). It was then used to re-generate libbb/wcwidth_alt.c, as follows: ./scripts/mkwcwidth DL=15.1.0 FAST_FUNC > libbb/wcwidth_alt.c This is the same Unicode version as the previous file, just to make the codepoint differences visible easily. These differences are very small, and the script itself explains where and why it differs from https://github.com/jquast/wcwidth . Next commits will update the tables to the latest unicode version.
* | win32: wcwidth_alt.c: remove codepoint comments (no-op)Avi Halachmi (:avih)2025-12-291-450/+450
| | | | | | | | | | | | | | The next commit will replace scripts/mkwcwidth, and the new script doesn't add codepoint comments, so delete the comments now, so that it would be easier to compare wcwidth_alt.c when it's updated using the new script.
* | win32: fix printable-chars with no-op utf8 manifestAvi Halachmi (:avih)2025-12-261-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When unicode is enabled at build time, but disabled at runtime (commit 208649d7), we already do some runtime ACP tests and act accordingly (we know unicode is not in effect) in mingw non-upstream code (UTF8_OUTPUT, etc - see previous commit). However, there's at least one upstream unicode code path which was not touched until now - printable chars. This code is used by applets like "ls" to display "?" instead of non-printable chars, where upstream considers byte values above 127 as non-printable, but the busybox-w32 code should consider them printable when unicode is disabled (ANSI codepage). We already have code for that when unicode is disabled at build time (at printable_string2), but when unicode is enabled at build time then it enters a different code path (which still tests dynamically whether unicode is enabled - and correctly deduces that it isn't when unicode is disabled despite the utf8 manifest). Modify unicode_conv_to_printable2 similar to how printable_string2 is modified - but only when unicode is disabled due to the manifest not being in effect (unicode build on win XP/7/8). A unicode build on XP/7/8 _should_ now behave reasonably close to a non-unicode build on such systems. Known issues: There's one known issue, and that's tab completion doesn't case-fix the completion. E.g. ~/desk<tab> completes to ~/desktop/ instead of to ~/Desktop/ (capital D). This issue exists in unicode builds also on win10+, and is caused by the fact that when unicode is enabled at build-time, line-editing uses (32bit) wchar_t, and of the mingw changes in line-edit, only the backslash-to-slash was ported also to the wchar_t editing, while case-fix was not (see FIXME at libbb/lineedit.c in commit 0efc7474). status: This combination of unicode-enabled build running on XP/7/8 was NOT tested extensively, so some issues might remain, but other than the case-fix with tab-completion, there are no known issues. Main area where more testing is needed is editing (probably mainly interactive shell command prompt and vi). Testing: To test how a unicode-enabled build behaves when unicode is disabled in runtime, other than actually running it on win XP/7/8, one way would be to find a combination of build-config values to enable all the unicode features but not the manifest itself, but that's tricky. Instead, one could simply delete the manifest from a pre-compiled binary (mingw{64u,32w}_defconfig), so that it would run in ANSI mode even on win10+, with the build-time unicode code paths still enabled at the binary. One tool to edit windows binaries is https://github.com/avih/perc . To delete the manifest, use "perc -D -t MANIFEST busybox.exe" .
* | win32: add a config for 32-bit build with UnicodeRon Yorston2025-12-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that a binary with a UTF-8 manifest can run on Windows XP it's possible to configure a build which supports Unicode on Windows 10+ but which still runs on legacy systems. - Add the config file mingw32w_defconfig. This is a 32-bit build with the UTF-8 manifest which also runs on legacy systems. - A new config option, FEATURE_FAIL_IF_UTF8_MANIFEST_UNSUPPORTED, allows the check for legacy systems to be skipped. - An incompatibility with Windows XP in writeCon_utf8() has been fixed. See this GitHub issue for details: https://github.com/skeeto/w64devkit/issues/315
* | Merge branch 'busybox' into mergeRon Yorston2025-11-112-5/+13
|\|
| * 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>
| * busybox: optional --version supportDenys Vlasenko2025-10-131-4/+12
| | | | | | | | | | | | | | function old new delta busybox_main 695 734 +39 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2025-10-091-0/+9
|\|
| * nsenter,unshare: don't use xvfork_parent_waits_and_exits(), it SEGVs on ppc64leDenys Vlasenko2025-10-081-0/+9
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2025-09-111-9/+9
|\|
| * *: code shrink using sigprocmask2() where appropriateDenys Vlasenko2025-08-111-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta sig_unblock 41 43 +2 sig_block 41 40 -1 sigprocmask_allsigs 33 31 -2 wait_for_child_or_signal 202 193 -9 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/3 up/down: 2/-12) Total: -10 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: eval: Add vfork supportDenys Vlasenko2025-08-091-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upstream commit: Date: Sat, 19 May 2018 02:39:56 +0800 eval: Add vfork support This patch adds basic vfork support for the case of a simple command. Upstream commit: Date: Tue, 12 Jan 2021 17:11:19 +1100 jobs: Always reset SIGINT/SIGQUIT handlers On Fri, Jan 08, 2021 at 08:55:41PM +0000, Harald van Dijk wrote: > On 18/05/2018 19:39, Herbert Xu wrote: > > This patch adds basic vfork support for the case of a simple command. > > ... @@ -879,17 +892,30 @@ forkchild(struct job *jp, union node *n, int > > mode) > > } > > } > > if (!oldlvl && iflag) { > > - setsignal(SIGINT); > > - setsignal(SIGQUIT); > > + if (mode != FORK_BG) { > > + setsignal(SIGINT); > > + setsignal(SIGQUIT); > > + } > > setsignal(SIGTERM); > > } > > + > > + if (lvforked) > > + return; > > + > > for (jp = curjob; jp; jp = jp->prev_job) > > freejob(jp); > > } > > This leaves SIGQUIT ignored in background jobs in interactive shells. > > ENV= dash -ic 'dash -c "kill -QUIT \$\$; echo huh" & wait' > > As of dash 0.5.11, this prints "huh". Before, the subprocess process killed > itself before it could print anything. Other shells do not leave SIGQUIT > ignored. > > (In a few other shells, this also prints "huh", but in those other shells, > that is because the inner shell chooses to ignore SIGQUIT, not because the > outer shell leaves it ignored.) Thanks for catching this. I have no idea how that got in there and it makes no sense whatsoever. This patch removes the if conditional. Fixes: e94a964e7dd0 ("eval: Add vfork support") Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | ash: eval: Add vfork supportRon Yorston2025-09-071-0/+12
| | | | | | | | | | | | | | Merge upstream commit df154028d. Since we don't have vfork() on Windows we continue to use the spawn_forkshell() mechanism. Although there is some rearrangement of the code it's functionally the same.
* | Merge branch 'busybox' into mergeRon Yorston2025-09-061-15/+22
|\|
| * top,pmap: speed up /smaps parsingDenys Vlasenko2025-08-061-13/+20
| | | | | | | | | | | | | | | | | | | | | | function old new delta procps_read_smaps 515 529 +14 procps_get_maps 685 665 -20 .rodata 105847 105820 -27 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 14/-47) Total: -33 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: fix too-narrow variable in procps_read_smaps() causing incorrect sizesDenys Vlasenko2025-08-061-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: make read_cmdline() replace chars 1..31 with '?', not spaceDenys Vlasenko2025-08-061-1/+1
| | | | | | | | | | | | Space was too inconspicuous on output Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | lineedit: fix PS1='\W' for root directoryRon Yorston2025-08-221-1/+1
| | | | | | | | | | | | | | | | | | | | An upstream bug caused '\W' to return an empty string for the root directory of any drive. bash displays '/' in similar circumstances on Linux. Adds 16 bytes. (GitHub issue #516)
* | Merge branch 'busybox' into mergeRon Yorston2025-08-159-133/+305
|\|
| * top: simplify command line readingDenys Vlasenko2025-08-061-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta cmdline_to_line_buf_and_print - 48 +48 read_cmdline 326 327 +1 display_topmem_process_list 523 505 -18 display_process_list 1186 1161 -25 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/2 up/down: 49/-43) Total: 6 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * top,pmap: do not use common code for reading /proc/PID/smapsDenys Vlasenko2025-08-051-82/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The logic is in fact quite far from common. While at it, stop accounting "---p" mappings as mapped (e.g. VSZ in top). Nothing is mapped there (why would kernel waste RAM to map pages which can't be accessed?). function old new delta read_smaps - 562 +562 read_cmdline 315 326 +11 print_smaprec 97 101 +4 procps_scan 1219 1211 -8 .rodata 115541 115533 -8 skip_whitespace_if_prefixed_with 25 - -25 procps_read_smaps 864 577 -287 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 2/3 up/down: 577/-328) Total: 249 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * top: fix display of very large VSZDenys Vlasenko2025-08-051-3/+22
| | | | | | | | | | | | | | | | | | | | function old new delta display_process_list 1366 1403 +37 handle_input 628 636 +8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 45/0) Total: 45 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: simplify concat_path_file()Denys Vlasenko2025-08-041-2/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: much faster concat_path_file()Denys Vlasenko2025-08-041-0/+75
| | | | | | | | | | | | | | function old new delta concat_path_file 68 127 +59 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell: fix the check of empty HISTFILEDenys Vlasenko2025-08-031-1/+1
| | | | | | | | | | | | | | | | The check for "" history file is done on a wrong state pointer. Fixes: shell: empty HISTFILE disables history saving, just as unset one did Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ftpd: code shrink, move replace_char() to libbbDenys Vlasenko2025-08-021-0/+14
| | | | | | | | | | | | | | | | | | | | | | function old new delta modprobe_main 803 804 +1 escape_text 127 122 -5 replace 18 - -18 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/1 up/down: 1/-23) Total: -22 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb/dump: much faster formatting of %_u on x86Denys Vlasenko2025-08-011-2/+18
| | | | | | | | | | | | | | function old new delta display 1485 1481 -4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb/yescrypt: code shrinkDenys Vlasenko2025-08-011-4/+9
| | | | | | | | | | | | | | function old new delta static.PBKDF2_SHA256 219 165 -54 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ls: fix -Q to match GNUDenys Vlasenko2025-08-012-20/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta print_name 137 229 +92 display_files 375 402 +27 c_escape_conv_str00 - 24 +24 display 1476 1485 +9 conv_str 33 - -33 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 3/0 up/down: 152/-33) Total: 119 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ls: implement -q, fix -w0, reduce startup timeDenys Vlasenko2025-07-311-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta ls_main 598 660 +62 ls_longopts - 47 +47 G_isatty - 36 +36 print_name 102 134 +32 display_files 358 374 +16 .rodata 105829 105833 +4 vgetopt32 1330 1317 -13 static.ls_longopts 47 - -47 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 4/1 up/down: 197/-60) Total: 137 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * sha384sum: new appletAndy Knowles2025-07-301-13/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta sha512384_end - 198 +198 packed_usage 35021 35134 +113 init384 - 80 +80 sha384_begin - 19 +19 sha384_end - 10 +10 applet_names 2823 2833 +10 md5_sha1_sum_main 501 507 +6 sha3_end 54 59 +5 applet_main 1628 1632 +4 show_usage_if_dash_dash_help 79 72 -7 hash_file 358 344 -14 sha512_end 197 10 -187 ------------------------------------------------------------------------------ (add/remove: 4/0 grow/shrink: 5/3 up/down: 445/-208) Total: 237 bytes Signed-off-by: Andy Knowles <aknowles@galleonec.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Post-merge fixesRon Yorston2025-08-121-1/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upstream has moved some functions from networking/tls.c to a new file, libbb/hash_hmac.c. The merge didn't adjust this code to allow it to work with the native Windows checksum API. This only matters if FEATURE_USE_CNG_API is enabled and CONFIG_FEATURE_TLS_SCHANNEL isn't. In that case the wget applet fails to handle https. None of the default configurations has this combination, but it should work. Make it so. The Windows code doesn't implement hmac_block(), as that's only used for password encryption which isn't currently supported. The variadic function hmac_peek_hash() isn't declared FAST_FUNC, as that causes clang to issue many warnings.
* | Merge branch 'busybox' into mergeRon Yorston2025-08-1219-331/+2862
|\|
| * libbb: SHA-NI - document that unpckhpd also works, no code changesDenys Vlasenko2025-07-222-0/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: SHA-NI code shrinkDenys Vlasenko2025-07-222-34/+66
| | | | | | | | | | | | | | function old new delta sha256_process_block64_shaNI 673 657 -16 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: change define names in SHA-NI code to match kernel source more closelyDenys Vlasenko2025-07-212-166/+166
| | | | | | | | | | | | No code changes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb/yescrypt: de-unroll salsa20()Denys Vlasenko2025-07-202-23/+76
| | | | | | | | | | | | | | function old new delta salsa20 760 296 -464 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: crypt_make_pw_salt(): fix yescrypt's random salt last charDenys Vlasenko2025-07-191-3/+11
| | | | | | | | | | | | | | function old new delta crypt_make_pw_salt 128 146 +18 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cryptpw: fix detection of crypt algo from salt (was broken if default isn't DES)Denys Vlasenko2025-07-191-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | The symptom is: "cryptpw ... implicit" testsuite tests were failing if CONFIG_FEATURE_DEFAULT_PASSWD_ALGO is not "des". function old new delta cryptpw_main 223 283 +60 pw_encrypt 974 975 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 61/0) Total: 61 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb/yescrypt: code shrinkDenys Vlasenko2025-07-191-28/+25
| | | | | | | | | | | | | | function old new delta blockmix_xor_save 1169 708 -461 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb/yescrypt: actually, largest allowed salt is 86 chars, support thatDenys Vlasenko2025-07-172-12/+16
| | | | | | | | | | | | | | function old new delta yescrypt_r 767 756 -11 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>