aboutsummaryrefslogtreecommitdiff
path: root/libbb (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix the flags for stat (again) (#601)mbartlett212026-06-221-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Revert "find: reset stat(2) flags before terminating" This reverts commit 228ee18fbe8cf408440e7bbe91db4ef201312983. * test: fix flags for stat with NOFORK test is a NOFORK applet, so the flags under mingw_stat may not have been reset before calling it. We have it so it also restores the flags after, since it could be called in the middle of another applet. This also needed a way to retrieve the flags, so they are just done through the return value. * Add comments about not having to restore flags Just for future reference * lineedit: use new flag restoring * win32: simplify mingw_access calling Since we now have a way to get the previous flags, mingw_access can be changed to ignore any stat flags * stat: comments from PR Adds 32 bytes.
* win32: Unix-like support for volume mountsRon Yorston2026-06-151-17/+31
| | | | | | | | | | | | | | | | | | Add code to distinguish between volume mount points and junctions. Volume mount points are to be treated like directries while junctions are like symlinks. Update the 'mntent' functions to scan drive letters first, then volume names and their associated mount points. By default the filesystem is returned as a drive letter, if possible, though the volume name is also returned. The function 'find_mount_point()' has been updated to use the new 'mntent' routines. Adds 772-803 bytes. Signed-off-by: Ron Yorston <rmy@pobox.com>
* win32: update current directory to target of symlinkRon Yorston2026-06-061-0/+4
| | | | | | | | | | | | | | | | If busybox.exe was started from a Windows command line in a directory which was the target of a symlink (or equivalent) 'ls' and 'stat' were unable to report the correct details of the current directory. Call 'chdir()' from the BusyBox main program to update our notion of our current directory. Adds 16 bytes. (GitHub issue #597) Signed-off-by: Ron Yorston <rmy@pobox.com>
* win32: skip check for execute with tab-completionmbartlett212026-05-201-0/+8
| | | | | Tab completion as arguments no longer reads a bit of each file to detect whether it is executable.
* libbb: reverse performance regression in bb_copyfd_*Ron Yorston2026-05-101-1/+4
| | | | | | | | | | | | | Commit c4f24ec9d (libbb: try to mitigate 'cat /dev/urandom') resulted in a 'cat' to the terminal taking ~25% longer than before. Raising the isatty() call out of the loop reduces the penalty to ~1%. Adds 16 bytes in the 32-bit build. (GitHub issue #585)
* libbb: try to mitigate 'cat /dev/urandom'Ron Yorston2026-05-081-0/+11
| | | | | | | | | | | | | | | | | | | | | | | Now that '/dev/urandom' can be used directly, people with a sense of curiosity and adventure have tried running 'cat /dev/urandom' or 'cat </dev/urandom'. The 'cat' applet in BusyBox is so efficient and ANSI escape handling is so inefficient that this overwhelms the capabilities of the Windows console or terminal to the extent that it's unable to process Ctrl-C requests in a timely manner. To give it a chance to catch up, force 'cat' to take a short nap from time to time (very short, zero length) but only when it's writing to a tty. The call to Sleep() is in a separate function to avoid unnecessary bloat in 32-bit builds, where its presence upsets the stack and requires much larger code for stack access. Adds 48 bytes. (GitHub issue #585)
* crond: build tweaksRon Yorston2026-05-031-5/+5
| | | | | | | | | | | | | | | Using 'depends on FEATURE_SYSLOG' is unreliable because FEATURE_SYSLOG can't be set directly. A POSIX build with all applets that need syslog disabled *except* crond may fail. Revert to using 'select FEATURE_SYSLOG' in crond and exclude the unused syslog code on Windows. If crond is unable to run sendmail report this in the error message. Update all default Windows configurations. (GitHub PR #561)
* Merge branch 'busybox' into mergeRon Yorston2026-03-1111-91/+553
|\
| * *: don't use getservbyname, it links in a static bufferDenys Vlasenko2026-02-253-25/+131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta bb_get_servport_by_name - 348 +348 bb_lookup_port 83 111 +28 reread_config_file 886 907 +21 static.se 16 - -16 getservbyname 53 - -53 getservbyname_r 284 - -284 ------------------------------------------------------------------------------ (add/remove: 2/5 grow/shrink: 2/0 up/down: 397/-353) Total: 44 bytes text data bss dec hex filename 1080084 555 5024 1085663 1090df busybox_old 1080144 555 4992 1085691 1090fb busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * netstat: fix breakage due to last commitDenys Vlasenko2026-02-241-6/+16
| | | | | | | | | | | | | | | | | | | | function old new delta bb_get_servname_by_port 182 195 +13 ip_port_str 121 120 -1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 13/-1) Total: 12 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * netstat,pscan: don't use getservbyport(), it links in a static bufferDenys Vlasenko2026-02-241-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta bb_get_servname_by_port - 182 +182 ip_port_str 112 121 +9 pscan_main 594 591 -3 getservbyport 53 - -53 getservbyport_r 430 - -430 ------------------------------------------------------------------------------ (add/remove: 2/4 grow/shrink: 1/1 up/down: 191/-486) Total: -295 bytes text data bss dec hex filename 1080362 555 5056 1085973 109215 busybox_old 1080067 555 5024 1085646 1090ce busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * telnetd: if vfork in make_new_session() fails, do close socket.Denys Vlasenko2026-02-241-24/+58
| | | | | | | | | | | | | | | | | | | | | | function old new delta telnetd_main 372 385 +13 make_new_session 550 552 +2 xgetpty 81 78 -3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 15/-3) Total: 12 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * telnet: rewrite to use ioloop()Denys Vlasenko2026-02-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now should never block on network I/O. Also, window resizing is dynamic now. function old new delta write_to_net - 596 +596 read_from_net - 543 +543 read_from_stdin - 227 +227 show_menu - 212 +212 write_to_stdout - 105 +105 have_data_to_write_to_net - 72 +72 have_data_to_write_to_stdout - 38 +38 put_iac_byte_escaped - 32 +32 ioloop_run 411 438 +27 have_buffer_to_read_from_stdin - 25 +25 have_buffer_to_read_from_net - 25 +25 .rodata 107125 107141 +16 handle_SIGWINCH - 15 +15 put_iac 36 28 -8 put_iac4_msb_lsb 19 - -19 iac_flush 36 - -36 setConMode 87 - -87 handle_net_output 110 - -110 con_escape 271 - -271 telnet_main 1232 476 -756 ------------------------------------------------------------------------------ (add/remove: 11/5 grow/shrink: 2/2 up/down: 1933/-1287) Total: 646 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * telnetd: do not send stray \r\n before /etc/issue.netDenys Vlasenko2026-02-231-2/+0
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: add generic "fd polling and I/O" loop, use it in telnetdDenys Vlasenko2026-02-211-0/+262
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We do it, badly, in many places. Better to use one robust implementation. Can be buggy yet. Initial use is in a rather old, rarely used tech: telnet. The I/O in telnetd should be fully non-blocking now, including pty delays handling. Several bugs in telnetd handling of IACs are fixed. function old new delta ioloop_run - 411 +411 net_to_pty__have_data_to_write - 368 +368 pty_to_net__write - 318 +318 net_to_pty__write - 180 +180 pty_to_net__read - 171 +171 net_to_pty__have_buffer_to_read_into - 164 +164 pty_to_net__have_buffer_to_read_into - 90 +90 net_to_pty__read - 87 +87 pty_to_net__have_data_to_write - 59 +59 make_new_session 491 550 +59 conn_close_fds - 52 +52 accept_conn__accept - 49 +49 conn_close_fds_remove_and_free - 27 +27 ioloop_remove_conn - 22 +22 remove_and_free_to_pty - 19 +19 ioloop_insert_conn - 10 +10 accept_conn__can_accept - 6 +6 accept_conn__return_zero - 3 +3 static.ayt_response - 2 +2 handle_sigchld 59 61 +2 free_session 130 - -130 telnetd_main 1797 367 -1430 ------------------------------------------------------------------------------ (add/remove: 19/1 grow/shrink: 2/1 up/down: 2099/-1560) Total: 539 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: better comments in read_key()Denys Vlasenko2026-02-151-37/+38
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * *: placate warnings where strchr/strstr returns constant pointerDenys Vlasenko2026-02-154-6/+7
| | | | | | | | | | | | | | | | | | Newer glibc is now smarter and can propagate const-ness from those! function old new delta readtoken1 3111 3108 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2026-02-123-4/+75
|\|
| * main: !CONFIG_BUSYBOX: "busybox --OPT" is not a call to applet "-OPT"Denys Vlasenko2026-02-081-1/+4
| | | | | | | | | | | | | | | | | | This was confusing: $ busybox --help -help: applet not found Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: introduce and use xasprintf_inplace()Denys Vlasenko2026-02-051-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta xasprintf_and_free - 49 +49 watch_main 269 282 +13 singlemount 1313 1315 +2 append_mount_options 157 149 -8 ip_port_str 122 112 -10 lsblk_main 869 858 -11 add_cmd 1178 1167 -11 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/4 up/down: 64/-40) Total: 24 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: use narrow isqrt() when 64-bit one is not needed (only "factor" uses it)Denys Vlasenko2026-02-041-3/+55
| | | | | | | | | | | | | | | | | | | | | | function old new delta isqrt_ull - 84 +84 create_J 1809 1808 -1 isqrt 106 38 -68 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/2 up/down: 84/-69) Total: 15 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Update default configurations; include uuid functionsRon Yorston2026-02-101-2/+3
| |
* | Merge branch 'busybox' into mergeRon Yorston2026-02-102-44/+16
|\|
| * fdisk: several fixes for 4K sector sizeDenys Vlasenko2026-02-041-41/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta bb_getsize_in_512sect - 187 +187 list_disk_name_and_sizes - 80 +80 get_geometry 511 535 +24 .rodata 107066 107088 +22 msg_building_new_label 143 142 -1 fdisk_main 4781 4775 -6 list_table 1423 1366 -57 list_disk_geometry 143 68 -75 bb_BLKGETSIZE_sectors 191 - -191 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 2/4 up/down: 313/-330) Total: -17 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * uuidgen: move UUID formatting to libbbDenys Vlasenko2026-02-031-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta format_uuid_DCE_37_chars - 94 +94 uuidgen_main 71 53 -18 .rodata 107089 107066 -23 mkswap_main 278 253 -25 volume_id_set_uuid 258 178 -80 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/4 up/down: 94/-146) Total: -52 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * util-linux: add minimal uuidgen implementationOsama Abdelkader via busybox2026-02-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a simple uuidgen utility that generates RFC 4122 compliant UUIDs (version 4, random). Uses the existing generate_uuid() function from libbb and volume_id_set_uuid() for formatting. Implementation suggested by Ulli. Features: - Generates standard format UUIDs: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - RFC 4122 version 4 compliant - Minimal implementation (~1.1 kb) - NOFORK applet for efficiency - Uses existing volume_id infrastructure for UUID formatting function old new delta uuidgen_main - 71 +71 applet_names 2862 2870 +8 .rodata 107010 107016 +6 applet_main 1648 1652 +4 applet_suid 103 104 +1 applet_install_loc 206 207 +1 applet_flags 103 104 +1 packed_usage 35952 35941 -11 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 6/1 up/down: 92/-11) Total: 81 bytes Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2026-02-041-1/+1
|\|
| * libbb/loop: fix existence check for LOOP_CONFIGURE ioctlWouter Franken2026-01-261-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 Yorston2026-02-011-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 Yorston2026-01-282-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 messagerfl8902026-01-281-2/+3
| |
* | libbb: refactor CNG hashing implementationrfl8902026-01-272-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>