| Commit message (Collapse) | Author | Files | Lines |
|
Allow applets to open the "files" /dev/stdin, /dev/stdout and
/dev/stderr. The 'stat' and 'ls' applets pretend they exist.
Adds 48-56 bytes.
|
|
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.
|
|
Additional support for background jobs was added in commits
010abea6f and 1403d81c4.
The condition ENABLE_PLATFORM_POSIX || JOBS_WIN32 in showjob()
is always true. The conditional compilation can be removed.
|
|
This didn't produce the expected output when run from ash:
ash -c "echo abc | sed s/a/x/" <&-
In general, if the last command in the pipe read from stdin the
command didn't work; if it read from file descriptor 0 (e.g. cat)
it did.
Closing a file descriptor caused the corresponding stream to
become invalid. For performance reasons the shell in busybox-w32
runs applets without an exec(), but that results in their seeing
the invalid stream from their parent.
Avoid the problem by calling exec() in such cases. This causes the
child process to get a new stdin stream initialised from the file
descriptor. The test also applies to stdout and stderr. There's
no discernable affect on performance when running the test suite.
Adds 64-96 bytes.
(GitHub issue #558)
|
|
function old new delta
ash_main 1624 1645 +21
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
find_command 961 963 +2
evalcommand 1631 1633 +2
hashcmd 299 300 +1
describe_command 320 321 +1
clearcmdentry 93 94 +1
cdcmd 695 696 +1
pstrcmp1 16 - -16
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 6/0 up/down: 8/-16) Total: -8 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
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.
|
|
|
|
function old new delta
.rodata 106853 106846 -7
builtintab 352 344 -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-15) Total: -15 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
cmdlookup_pp - 120 +120
find_command 953 961 +8
unsetcmd 74 76 +2
hashcmd 297 299 +2
lastcmdentry 4 - -4
delete_cmd_entry 47 43 -4
cmdlookup 132 - -132
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 3/1 up/down: 132/-140) Total: -8 bytes
text data bss dec hex filename
47470 8 149 47627 ba0b shell/ash.o.orig
47466 8 145 47619 ba03 shell/ash.o
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
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
|
|
conditionalize code which depends on it
With !ASH_JOB_CONTROL:
function old new delta
cmdloop 363 351 -12
exitcmd 47 31 -16
.rodata 106422 106398 -24
stoppedjobs 58 - -58
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/3 up/down: 0/-110) Total: -110 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
tryexec - 60 +60
shellexec 476 349 -127
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 60/-127) Total: -67 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
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 make applet is based on code from pdpmake. Make a few minor
adjustments to bring the two into line.
The only one of any significance is setting 'target' to NULL in
docmds().
Adds 16 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>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
fg_bgcmd 294 296 +2
killpg 43 - -43
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/0 up/down: 2/-43) Total: -41 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
handle_incoming_and_exit 2270 2334 +64
send_cgi_and_exit 790 754 -36
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 64/-36) Total: 28 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
parse_with_base 174 196 +22
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
send_file_and_exit 931 933 +2
get_line 126 120 -6
httpd_main 968 959 -9
send_headers 708 694 -14
handle_incoming_and_exit 2285 2270 -15
cgi_io_loop_and_exit 635 620 -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/5 up/down: 2/-59) Total: -57 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
parse_expr 986 998 +12
chain_group 633 640 +7
next_token 930 934 +4
getvar_s 102 101 -1
awk_main 891 888 -3
evaluate 3379 3355 -24
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/3 up/down: 23/-28) Total: -5 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
httpd_main 957 968 +11
log_and_exit 25 26 +1
send_headers 712 708 -4
handle_incoming_and_exit 2292 2285 -7
sigalrm_handler 102 93 -9
parse_conf 1332 1323 -9
send_cgi_and_exit 803 790 -13
cgi_io_loop_and_exit 656 635 -21
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/6 up/down: 12/-63) Total: -51 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
cgi_io_loop_and_exit 496 656 +160
sigalrm_handler 1 102 +101
.rodata 106814 106853 +39
send_cgi_and_exit 770 803 +33
packed_usage 35894 35924 +30
httpd_main 950 957 +7
handle_incoming_and_exit 2297 2292 -5
send_REQUEST_TIMEOUT_and_exit 10 - -10
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 6/1 up/down: 370/-15) Total: 355 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
One more from the POSIX documentation and some examples from
coreutils.
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Do one less write()
function old new delta
handle_incoming_and_exit 2290 2297 +7
cgi_io_loop_and_exit 498 500 +2
.rodata 106821 106814 -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 9/-7) Total: 2 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
cgi_io_loop_and_exit 477 498 +21
.rodata 106830 106821 -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 21/-9) Total: 12 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
log_and_exit 33 25 -8
handle_incoming_and_exit 2298 2290 -8
send_cgi_and_exit 784 770 -14
cgi_io_loop_and_exit 538 477 -61
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-91) Total: -91 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
send_file_and_exit 891 931 +40
send_EOF_and_exit - 14 +14
cgi_io_loop_and_exit 535 538 +3
log_and_exit 44 33 -11
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/1 up/down: 57/-11) Total: 46 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
send_file_and_exit 891 930 +39
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
prepare_write_timeout - 29 +29
static.tv - 16 +16
httpd_main 939 950 +11
send_file_and_exit 887 891 +4
handle_incoming_and_exit 2306 2298 -8
cgi_io_loop_and_exit 552 535 -17
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/2 up/down: 60/-25) Total: 35 bytes
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>
|
|
function old new delta
get_line 130 134 +4
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>
|
|
function old new delta
handle_incoming_and_exit 2264 2312 +48
httpd_main 915 913 -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 48/-2) Total: 46 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
We were lacking even basic rate-limiting.
function old new delta
httpd_main 648 915 +267
handle_incoming_and_exit 2235 2264 +29
packed_usage 35868 35894 +26
cgi_io_loop_and_exit 537 552 +15
send_headers 704 712 +8
get_line 106 108 +2
.rodata 106829 106830 +1
send_file_and_exit 890 887 -3
mini_httpd 161 - -161
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 7/1 up/down: 348/-164) Total: 184 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
sighup_handler 30 47 +17
httpd_main 710 695 -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 17/-15) Total: 2 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
httpd_main 701 710 +9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
text data bss dec hex filename
4003 40 352 4395 112b httpd_ratelimit_cgi
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
send_cgi_and_exit 711 784 +73
vmstat_main 657 708 +51
.rodata 106746 106778 +32
send_file_and_exit 877 887 +10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 166/0) Total: 166 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|