If we don't do that, if INT trap was set, ^C will set a flag
"run trap later" and _return_, which is not expected by the NOFORK!
function old new delta
clear_traps - 107 +107
evalcommand 1617 1631 +14
shellexec 471 476 +5
setsignal 333 327 -6
forkchild 620 480 -140
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/2 up/down: 126/-146) Total: -20 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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>
Set up the signal handler once, outside of main loop.
Do not reset the timer if headers are big - they still are expected
to arrive quickly.
function old new delta
httpd_main 913 939 +26
handle_incoming_and_exit 2312 2306 -6
get_line 134 126 -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 26/-14) Total: 12 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This removes the need to check various corner cases later.
function old new delta
get_line 108 130 +22
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Pre-configuring "Linux User" as Full Name is confusing a lot of users
downstream.[1] For example, in geary e-mails were sent out as "Linux
User"[2] and I also saw a couple of git commits with this name. This name
does not bring any more improvements than just leaving this field
empty, and let applications most likely fallback to the username.
Alternative would be to set the field to `&` (Capitalized username,
according to passwd(5)) or that we just set the GECOS field downstream.
[1] https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/issues/2214
[2] https://gitlab.gnome.org/GNOME/geary/-/issues/1486
function old new delta
.rodata 106455 106441 -14
Signed-off-by: Achill Gilgenast <achill@achill.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
The output of md5sum/sha1sum contains a character to indicate
what mode was used to read the file - '*' for binary, and ' '
for text or where binary is insignificant.
This flag character makes a difference for the ffmpeg testsuite.
This testsuite contains a number of reference files (e.g. [1]),
containing the expected md5sum output for those files, which is
checked verbatim.
By making busybox's md5sum honor this flag in the output,
ffmpeg's testsuite can run successfully on top of busybox.
The flag is only partially implemented; in coreutils md5sum,
a later "-t" option overrides an earlier "-b" option. Here,
just check if a "-b" option was specified or not. Neither
flag affects how the files actually are read.
[1] 894da5ca7d/tests/ref/acodec/flac
Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Currently, if a skip value is larger than the file size, cmp will continue
to loop and call getc() until the skip count is satisfied, even though
EOF has been reached.
For large skip values (e.g., 1 billion), this results in significant
CPU waste and execution time (e.g., 11 seconds on a modern CPU).
This patch checks for EOF inside the skip loop and breaks early.
Test case:
$ touch empty.txt
$ time ./busybox cmp empty.txt empty.txt 1000000000 1000000000
Before:
real 0m10.937s
After:
real 0m0.002s
function old new delta
cmp_main 594 616 +22
Signed-off-by: Giorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
When running `pgrep -x example` against a process `/bin/example --arg`,
BusyBox fails to match, while GNU pgrep succeeds. The reason is that the
comparison is done only against the full argv[0] rather than comm. This
patch changes pgrep -x to also try /proc/[pid]/comm for exact matching.
function old new delta
pgrep_main 681 670 -11
Signed-off-by: Paulius Zaleckas <paulius.zaleckas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Since commit 551bfdb97 (ls: implement -q, fix -w0, reduce startup
time) the '--color' option behaves as though the default argument
'always' had been specified.
This is due to an explicit short option for '--color' being given,
but without specifying that an argument is expected.
function old new delta
.rodata 106027 106029 +2
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>