| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The implementation of localtime(3) in the Microsoft Windows
runtime only accepts arguments between the Unix epoch (1970)
and either 2038 or 3000 for 32-bit or 64-bit systems respectively.
For values outside those limits it returns a NULL pointer.
Unfortunately, upstream BusyBox hardly ever bothers to check the
return value. Thus, when a call to stat(2) returned an all-zero
FILETIME for a file, the 'stat' applet failed. An all-zero FILETIME
represents a date in 1600, which is clearly before the Unix epoch.
Add a wrapper to localtime(3) which detects an out-of-range value
and returns a valid 'struct tm' for the Unix epoch. This is easier
than adding checks on the return value of every call to localtime(3).
Adds 32-48 bytes.
(GitHub issue #548)
|
| |\ |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
Treat /dev/tty as an alias for Windows' 'con' device. The code
is similar to that used for /dev/null.
Adds 24-48 bytes.
(GitHub issue #538)
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
Use the Gnulib implementation of flock(2) to allow the flock
applet to be enabled.
Costs 900-984 bytes.
(GitHub issue #528)
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
Use the (somewhat ancient) Microsoft RtlGenRandom() function to
provide random data for /dev/urandom.
Saves 176-240 bytes.
(GitHub issue #519)
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 6481bb22b (win32: use 64-bit time on 32-bit platforms) fails
to build with mingw32-gcc prior to mingw-w64 10.0.0.
Don't used 64-bit time for such builds.
mingw-w64 7.0.0 and below don't have some definitions required for
native TLS support. This is enabled by default in the 64-bit
Unicode build.
Add the definitions required for the default build. TLS 1.3
support needs more but isn't enabled by default.
(GitHub issue #527)
|
| | |
| |
| |
| |
| |
| |
| | |
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.
|
| |\| |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| | |
| |
| |
| |
| | |
The previous code had issues with buffer management,
resulting in failures.
|
| |\| |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| | |
| |
| |
| |
| |
| |
| | |
function old new delta
display 1485 1481 -4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |\| |
|
| | |
| |
| |
| | |
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| | |
| |
| |
| | |
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
On x86_64, they can be done in 16-byte blocks
64-bit:
function old new delta
xorbuf_3 - 84 +84
xorbuf64_3_aligned64 - 58 +58
smix1 687 712 +25
xwrite_encrypted 520 534 +14
xorbuf16_aligned_long - 13 +13
tls_xread_record 733 742 +9
xorbuf 21 13 -8
xorbuf_aligned_AES_BLOCK_SIZE 15 - -15
blockmix 814 762 -52
blockmix_salsa8 317 198 -119
blockmix_xor_save 1620 1499 -121
blockmix_xor 1543 1322 -221
------------------------------------------------------------------------------
(add/remove: 4/1 grow/shrink: 3/5 up/down: 203/-536) Total: -333 bytes
32-bit:
function old new delta
xorbuf_3 - 76 +76
xorbuf64_3_aligned64 - 36 +36
xorbuf16_aligned_long - 23 +23
xwrite_encrypted 499 507 +8
tls_xread_record 646 650 +4
xorbuf 22 11 -11
xorbuf_aligned_AES_BLOCK_SIZE 23 - -23
blockmix 1083 938 -145
blockmix_salsa8 415 210 -205
blockmix_salsa8_xor 601 163 -438
blockmix_xor 2103 1533 -570
blockmix_xor_save 2614 1859 -755
------------------------------------------------------------------------------
(add/remove: 4/1 grow/shrink: 2/6 up/down: 147/-2147) Total: -2000 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
cryptpw_main 214 223 +9
chpasswd_main 347 356 +9
passwd_main 931 934 +3
yescrypt_r 1084 1056 -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 21/-28) Total: -7 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
hmac_blocks - 88 +88
static.PBKDF2_SHA256 176 213 +37
yescrypt_kdf32_body 1046 1052 +6
static.smix 759 762 +3
hmac_block 88 64 -24
HMAC_SHA256_Final 53 - -53
HMAC_SHA256_Buf 58 - -58
HMAC_SHA256_Init 159 - -159
------------------------------------------------------------------------------
(add/remove: 1/3 grow/shrink: 3/1 up/down: 134/-294) Total: -160 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
hmac_block - 88 +88
hmac_peek_hash - 61 +61
hmac_end - 50 +50
hmac_begin 140 177 +37
hmac_hash_v - 30 +30
.rodata 105799 105787 -12
hmac_sha_precomputed 54 - -54
hmac_sha_precomputed_v 69 - -69
hmac 83 - -83
------------------------------------------------------------------------------
(add/remove: 5/3 grow/shrink: 1/1 up/down: 266/-218) Total: 48 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
num2str64_lsb_first 33 46 +13
yescrypt_r 1235 1133 -102
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 13/-102) Total: -89 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
a2i64 - 46 +46
yescrypt_r 1215 1235 +20
decode64_uint32 167 177 +10
atoi64 25 - -25
ascii_to_bin 53 - -53
static.atoi64_partial 77 - -77
------------------------------------------------------------------------------
(add/remove: 1/3 grow/shrink: 2/0 up/down: 76/-155) Total: -79 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
static.PBKDF2_SHA256 - 189 +189
HMAC_SHA256_Init - 159 +159
HMAC_SHA256_Buf - 58 +58
HMAC_SHA256_Final - 53 +53
i2a64 - 42 +42
yescrypt_r 1221 1215 -6
yescrypt_kdf32_body 1064 1046 -18
i64c 42 - -42
libcperciva_HMAC_SHA256_Final 53 - -53
libcperciva_HMAC_SHA256_Buf 58 - -58
ascii64 65 - -65
libcperciva_HMAC_SHA256_Init 159 - -159
PBKDF2_SHA256 386 - -386
------------------------------------------------------------------------------
(add/remove: 5/6 grow/shrink: 0/2 up/down: 501/-787) Total: -286 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| | |
| |
| |
| | |
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
It seems to work, but not at all optimized for size.
The extra copy of sha256 code need to be removed.
The yescrypt code in libbb/yescrypt/* is adapted from libxcrypt-4.4.38
with minimal edits, hopefully making it easier to track
backports by resetting the tree to this commit,
then comparing changes in upstream libxcrypt to the tree.
function old new delta
blockmix_xor_save - 7050 +7050
static.blockmix_xor - 6475 +6475
blockmix - 3390 +3390
SHA256_Transform - 3083 +3083
yescrypt_kdf_body - 1724 +1724
PBKDF2_SHA256 - 1003 +1003
smix1 - 960 +960
yescrypt_r - 890 +890
salsa20 - 804 +804
smix - 790 +790
smix2 - 659 +659
blockmix_salsa8_xor - 601 +601
yescrypt_kdf - 479 +479
blockmix_salsa8 - 415 +415
Krnd - 256 +256
_HMAC_SHA256_Init - 213 +213
_SHA256_Update - 198 +198
_SHA256_Final - 195 +195
decode64_uint32 - 166 +166
encode64 - 153 +153
decode64 - 136 +136
libcperciva_HMAC_SHA256_Buf - 132 +132
SHA256_Pad_Almost - 131 +131
salsa20_simd_unshuffle - 101 +101
salsa20_simd_shuffle - 101 +101
yes_crypt - 90 +90
libcperciva_SHA256_Buf - 86 +86
crypt_make_rand64encoded - 85 +85
static.atoi64_partial - 77 +77
alloc_region - 72 +72
ascii64 - 65 +65
PAD - 64 +64
_HMAC_SHA256_Final - 55 +55
static.cpu_to_be32_vect - 51 +51
free_region - 47 +47
libcperciva_SHA256_Init - 37 +37
yescrypt_init_local - 34 +34
crypt_make_pw_salt 92 125 +33
initial_state - 32 +32
.rodata 105771 105803 +32
atoi64 - 25 +25
explicit_bzero - 22 +22
pw_encrypt 920 941 +21
yescrypt_free_local - 9 +9
crypt_make_salt 85 - -85
------------------------------------------------------------------------------
(add/remove: 43/1 grow/shrink: 3/0 up/down: 31042/-85) Total: 30957 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |\| |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
"HISTFILESIZE=0" in profile wasn't working as intended,
"unset HISTFILE" wasn't preventing creation of history files
Now:
HISTSIZE=n allows to reduce in-memory history buffer
HISTFILESIZE=n allows to reduce history file size (0: truncate it)
unset HISTFILE allows to not save history file at all
function old new delta
exitshell 138 194 +56
hush_exit 97 143 +46
save_history 266 296 +30
hush_main 1170 1186 +16
.rodata 105762 105771 +9
load_history 246 254 +8
size_from_HISTFILESIZE 44 41 -3
read_line_input 2746 2712 -34
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 6/2 up/down: 165/-37) Total: 128 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
__ppoll_time64 - 211 +211
check_got_signal_and_poll - 164 +164
read_key 607 601 -6
shell_builtin_read 1328 1318 -10
------------------------------------------------------------------------------
(add/remove: 4/0 grow/shrink: 0/2 up/down: 375/-16) Total: 359 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
It was observed that getty crashes on RISC-V 64-bit target, with the
busybox binary compiled by clang/LLVM 17 with -O2. Not only getty,
but also some other applets like syslogd/vi are broken too.
Commit 5156b245 ("Make const ptr assign as function call in clang")
introduced XZALLOC_CONST_PTR() to defeat the compiler optimization,
however it only fixed a small number of broken places when compiling
busybox with clang/LLVM. A large number of places remain broken.
This commit treats ASSIGN_CONST_PTR() the same way as XZALLOC_CONST_PTR().
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| | |
| |
| |
| | |
No functional changes.
|
| | |
| |
| |
| |
| |
| |
| | |
Not enabled by default.
When enabled without TLS 1.3 support, saves 16784-18776 bytes.
(GitHub PR #510)
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Implement a minimal stty applet for Windows.
- Display and set terminal rows and columns
- Enable/disable raw/cooked mode
- Enable/disable echo mode
- Implement 'stty sane' to reset raw/cooked/echo
Adds 2120-2304 bytes.
(GitHub issue #58)
|
| | |
| |
| |
| |
| |
| |
| | |
There were two copies of the static function die_if_error().
Replace these with a single external function.
Saves 16 bytes.
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |\| |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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)
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The Windows API strips trailing dots and spaces from the last
component of a path. cmd.exe handles this quirk when changing
directory by adjusting its idea of the current directory to match
reality. The shell in busybox-w32 didn't do this, leading to some
confusion.
Fix the shell's cd builtin so it works more like cmd.exe.
Adds 64-80 bytes.
(GitHub issue #478)
|
| | |
| |
| |
| |
| |
| |
| |
| | |
Since we don't use is_in_supplementary_groups() there's no need for
the cached_groupinfo structure to include the members required for
its support or for them to be initialised.
Saves 32 bytes.
|
| |\| |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This allows to simplify "which" applet code
function old new delta
find_executable 93 111 +18
which_main 191 177 -14
builtin_source 316 294 -22
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 18/-36) Total: -18 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Recent upstream changes to file permission tests added a function
to check and cache values in the supplementary group list.
The implementation of getgroups() in the Windows port adds no
useful information beyond what can be obtained by checking the
current effective gid, which all callers of the new function
already do. The function can be replaced with a simple 'FALSE'.
Saves 232-288 bytes.
|
| |\| |
|