Denys Vlasenko
49d9e06fba
libbb: modify find_executable() to not temporarily write to PATH
...
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>
2024-10-08 04:03:17 +02:00
Denys Vlasenko
96b0607302
ash: cache more of uid/gid syscalls
...
Testcase:
setuidgid 1:1 strace ash -c 'test -x TODO; test -x TODO; echo $?'
should show that second "test -x" does not query ids again.
function old new delta
ash_main 1236 1256 +20
get_cached_euid - 19 +19
get_cached_egid - 19 +19
test_main 56 72 +16
test_exec 119 135 +16
is_in_supplementary_groups 52 57 +5
nexpr 718 702 -16
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 4/1 up/down: 95/-16) Total: 79 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2024-10-07 07:28:44 +02:00
Denys Vlasenko
d26e958725
ash: make "test -x" use cached groupinfo
...
function old new delta
test_main2 - 407 +407
testcmd 10 23 +13
test_main 418 56 -362
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 420/-362) Total: 58 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2024-10-07 07:14:27 +02:00
Denys Vlasenko
4c1d645c86
libbb: simplify parameter passing in is_in_supplementary_groups()
...
function old new delta
is_in_supplementary_groups 54 52 -2
nexpr 721 718 -3
test_exec 125 119 -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-11) Total: -11 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2024-10-07 06:36:00 +02:00
Denys Vlasenko
748b168154
libbb: move is_in_supplementary_groups() from test to libbb
...
function old new delta
is_in_supplementary_groups - 54 +54
nexpr 766 721 -45
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 54/-45) Total: 9 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2024-10-07 01:20:43 +02:00
Denys Vlasenko
e5b0547ac8
lineedit: make save_history() FAST_FUNC
...
function old new delta
save_history 267 266 -1
hush_exit 98 97 -1
exitshell 140 138 -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-4) Total: -4 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2024-09-27 19:35:50 +02:00
Denys Vlasenko
41b47398f5
libbb: fix 64-bit bb_popcnt_long
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2024-05-31 23:37:28 +02:00
Denys Vlasenko
2075553a1b
libbb: add bit counting function, use where appropriate
...
Although "naive" counting function is not too slow and is smaller,
using it on e.g. each of 1024 words of CPU mask feels wrong.
function old new delta
bb_popcnt_32 - 52 +52
get_prefix 323 321 -2
nproc_main 206 199 -7
d4_run_script 739 731 -8
ipcalc_main 533 507 -26
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/4 up/down: 52/-43) Total: 9 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2024-05-31 16:03:23 +02:00
Denys Vlasenko
5a68a246e7
nproc: prepare for arbitrarily large CPU masks
...
function old new delta
get_malloc_cpu_affinity - 76 +76
nproc_main 216 206 -10
process_pid_str 250 206 -44
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/2 up/down: 76/-54) Total: 22 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2024-05-31 11:58:48 +02:00
Denys Vlasenko
58ca629fd2
start-stop-daemon: do not lose error messages with -b
...
function old new delta
start_stop_daemon_main 1186 1206 +20
bb_daemonize_or_rexec 196 212 +16
bb_banner 47 46 -1
packed_usage 34656 34645 -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 36/-12) Total: 24 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-11-08 14:07:20 +01:00
Denys Vlasenko
791b222dd5
sleep: fix "sleep -- ARGS"
...
function old new delta
sleep_main 116 119 +3
printf_main 860 837 -23
single_argv 50 25 -25
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 3/-48) Total: -45 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-10-02 13:56:32 +02:00
Denys Vlasenko
c484846c44
introduce and use exitcode_t
...
function old new delta
strings_main 422 420 -2
setfattr_main 175 173 -2
brctl_main 1548 1546 -2
makedevs_main 979 975 -4
rev_main 337 332 -5
getfattr_main 307 302 -5
cut_main 1201 1196 -5
cksum_main 398 393 -5
umount_main 573 565 -8
ln_main 516 508 -8
expand_main 660 652 -8
df_main 1068 1060 -8
renice_main 346 332 -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/13 up/down: 0/-76) Total: -76 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-07-17 17:29:36 +02:00
Denys Vlasenko
5e0411a7fb
ash: disable sleep as builtin, closes 15619
...
Has a few annoying problems:
* sleepcmd() -> sleep_main(), the parsing of bad arguments exits the shell.
* sleep_for_duration() in sleep_main() has to be interruptible for
^C traps to work, which may be a problem for other users
of sleep_for_duration().
* BUT, if sleep_for_duration() is interruptible, then SIGCHLD interrupts it
as well (try "/bin/sleep 1 & sleep 10").
* sleep_main() must not allocate anything as ^C in ash longjmp's.
(currently, allocations are only on error paths, in message printing).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-07-10 10:53:23 +02:00
Denys Vlasenko
648f506949
libbb: code shrink: introduce and use [_]exit_FAILURE()
...
function old new delta
exit_FAILURE - 7 +7
_exit_FAILURE - 7 +7
run 198 199 +1
restore_state_and_exit 114 115 +1
xbsd_write_bootstrap 399 397 -2
vfork_compressor 209 207 -2
sig_handler 12 10 -2
serial_ctl 154 152 -2
parse_args 1169 1167 -2
onintr 21 19 -2
make_new_session 493 491 -2
login_main 988 986 -2
gotsig 35 33 -2
do_iplink 1315 1313 -2
addgroup_main 397 395 -2
inetd_main 1911 1908 -3
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/12 up/down: 16/-25) Total: -9 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-06-15 11:55:56 +02:00
Denys Vlasenko
a26711a2d1
libbb: consolidate NOMMU fix of restoring high bit in argv[0][0]
...
function old new delta
fork_or_rexec 46 56 +10
bootchartd_main 1087 1079 -8
cpio_main 674 661 -13
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 10/-21) Total: -11 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-04-06 21:20:28 +02:00
Denys Vlasenko
27be0e8cfe
shell: fix compile failures in some configs
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-01-03 08:28:16 +01:00
Shawn Landden
58598eb709
ash: optional sleep builtin
...
function old new delta
sleepcmd - 10 +10
builtintab 352 360 +8
.rodata 105264 105271 +7
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/0 up/down: 25/0) Total: 25 bytes
Signed-off-by: Shawn Landden <shawnlandden@tutanota.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-08-27 19:56:21 +02:00
Ron Yorston
7d1c7d8337
ash,hush: use HOME for tab completion and prompts
...
ash and hush correctly use the value of HOME for tilde expansion.
However the line editing code in libbb obtains the user's home
directory by calling getpwuid(). Thus tildes in tab completion
and prompts may be interpreted differently than in tilde expansion.
When the line editing code is invoked from a shell make it use the
shell's interpretation of tilde. This is similar to how GNU readline
and bash collaborate.
function old new delta
get_homedir_or_NULL 29 72 +43
optschanged 119 126 +7
hush_main 1204 1211 +7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 57/0) Total: 57 bytes
v2: Always check for HOME before trying the password database: this
is what GNU readline does.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-06-26 18:05:50 +02:00
Khem Raj
117a8c9b7a
apply const trick to ptr_to_globals
...
This was missing in the previous attempt to fix it via [1]
This helps fix segfaults when compiling with clang ( seen on riscv64 )
[ 452.428349] less[270]: unhandled signal 11 code 0x1 at 0x000000000000000c in busybox.nosuid[2ab7491000+ba000]
[ 452.430246] CPU: 3 PID: 270 Comm: less Not tainted 5.15.13-yocto-standard #1
[ 452.431323] Hardware name: riscv-virtio,qemu (DT)
[ 452.431925] epc : 0000002ab74a19ee ra : 0000002ab74a19dc sp : 0000003fec6ec980
[ 452.432725] gp : 0000002ab754dcb0 tp : 0000003f88783800 t0 : 0000003f8878d4a0
[ 452.433744] t1 : 0000002ab749b00c t2 : 0000000000000000 s0 : 0000003fec6ecc38
[ 452.434732] s1 : 000000000000004c a0 : 00000000ffffffff a1 : 0000002ab754dde0
[ 452.435861] a2 : 0000000000000000 a3 : 0000000000000100 a4 : 0000002ab754f3a0
[ 452.436787] a5 : 0000002ab754f3a0 a6 : 0000000000000000 a7 : 0000002ab754f2a0
[ 452.437974] s2 : 0000000000000002 s3 : 0000002ab754b6c8 s4 : 0000002ab749b60e
[ 452.438781] s5 : 0000000000000000 s6 : 0000002ab754b6c8 s7 : 0000003f88943060
[ 452.439723] s8 : 0000003f88944050 s9 : 0000002ad8502e88 s10: 0000002ad8502de8
[ 452.440538] s11: 0000000000000014 t3 : 0000003f887fceb6 t4 : 0000003f8893af0c
[ 452.441438] t5 : 0000000000000000 t6 : 0000003f88923000
[1] https://git.busybox.net/busybox/commit/?id=1f925038a
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-01-23 23:13:44 +01:00
Denys Vlasenko
1e825acf8d
libbb: shrink lineedit_read_key()
...
function old new delta
lineedit_read_key 237 231 -6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-01-18 00:36:42 +01:00
Denys Vlasenko
12566e7f9b
ash,hush: fix handling of SIGINT while waiting for interactive input
...
function old new delta
lineedit_read_key 160 237 +77
__pgetc 522 589 +67
fgetc_interactive 244 309 +65
safe_read_key - 39 +39
read_key 588 607 +19
record_pending_signo 23 32 +9
signal_handler 75 81 +6
.rodata 104312 104309 -3
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 6/1 up/down: 282/-3) Total: 279 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-01-17 11:46:23 +01:00
Denys Vlasenko
c2788f88f4
libbb: introduce and use chdir_or_warn()
...
function old new delta
chdir_or_warn - 37 +37
send_cgi_and_exit 720 711 -9
xchdir 27 15 -12
setup_environment 233 217 -16
fork_job 449 433 -16
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/4 up/down: 37/-53) Total: -16 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-01-13 12:56:10 +01:00
Denys Vlasenko
931c55f9e2
libbb: invert the meaning of SETUP_ENV_NO_CHDIR -> SETUP_ENV_CHDIR
...
Double negatives are hard to grok.
function old new delta
login_main 986 988 +2
su_main 474 470 -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 2/-4) Total: -2 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-01-13 12:50:48 +01:00
Denys Vlasenko
d162a7b978
sulogin: increase util-linux compatibility
...
Change to root's HOME. Set some envvars. Steal ctty if necessary and possible.
function old new delta
sulogin_main 240 340 +100
setup_environment 225 233 +8
su_main 479 474 -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 108/-5) Total: 103 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-01-12 23:19:11 +01:00
Denys Vlasenko
6062c0d19b
libbb: change xstrndup, xmemdup to take size_t as size parameter
...
Also, remove entirely usually-disabled paranoia check (was also using
wrong config option to enable itself).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-01-05 23:03:54 +01:00
Denys Vlasenko
db5546ca10
libbb: code shrink: introduce and use [_]exit_SUCCESS()
...
function old new delta
exit_SUCCESS - 7 +7
_exit_SUCCESS - 7 +7
run_pipe 1562 1567 +5
pseudo_exec_argv 399 400 +1
finish 86 87 +1
start_stop_daemon_main 1109 1107 -2
shutdown_on_signal 38 36 -2
runsv_main 1662 1660 -2
redirect 1070 1068 -2
read_line 79 77 -2
pause_and_low_level_reboot 54 52 -2
list_i2c_busses_and_exit 483 481 -2
less_exit 12 10 -2
identify 4123 4121 -2
grep_file 1161 1159 -2
getty_main 1519 1517 -2
fsck_minix_main 2681 2679 -2
free_session 132 130 -2
fdisk_main 4739 4737 -2
clean_up_and_exit 53 51 -2
bsd_select 1566 1564 -2
bb_daemonize_or_rexec 198 196 -2
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 3/17 up/down: 21/-34) Total: -13 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-01-05 22:16:06 +01:00
Denys Vlasenko
31f45c1b36
libbb: factor out fflush_stdout_and_exit(EXIT_SUCCESS)
...
function old new delta
fflush_stdout_and_exit_SUCCESS - 7 +7
xxd_main 890 888 -2
vlock_main 353 351 -2
uuencode_main 318 316 -2
uniq_main 427 425 -2
uname_main 250 248 -2
sort_main 853 851 -2
shuf_main 500 498 -2
route_main 238 236 -2
readlink_main 113 111 -2
nice_main 156 154 -2
last_main 957 955 -2
ipcs_main 960 958 -2
env_main 209 207 -2
chrt_main 464 462 -2
cal_main 921 919 -2
baseNUM_main 650 648 -2
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/16 up/down: 7/-32) Total: -25 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-01-04 23:31:58 +01:00
Denys Vlasenko
7c3e96d4b3
shell: use more compact SHELL_ASH / HUSH config defines. no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-10-12 01:24:32 +02:00
Denys Vlasenko
5acf5e1f87
shell: fix script's comm field if ENABLE_FEATURE_PREFER_APPLETS=y
...
function old new delta
re_execed_comm - 46 +46
main 72 86 +14
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 60/0) Total: 60 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-10-11 18:44:00 +02:00
YU Jincheng
5156b24553
Make const ptr assign as function call in clang
...
- This can act as memory barrier in clang to avoid
read before assign of a const ptr
Signed-off-by: LoveSy <shana@zju.edu.cn>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-10-09 22:30:45 +02:00
Ron Yorston
94eb1c4dc6
libbb: better coreutils compatibility for realpath
...
Add some tests which coreutils realpath pass but BusyBox realpath
fails (bar one). Adjust xmalloc_realpath_coreutils() so the tests
pass:
- Expand symbolic links before testing whether the last path component
exists.
- When the link target is a relative path canonicalize it by passing
it through xmalloc_realpath_coreutils() as already happens for
absolute paths.
- Ignore trailing slashes when finding the last path component and
correctly handle the case where the only slash is at the start of
the path. This requires ignoring superfluous leading slashes.
- Undo all changes to the path so error messages from the caller show
the original filename.
function old new delta
xmalloc_realpath_coreutils 214 313 +99
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-10-09 01:47:12 +02:00
Denys Vlasenko
049775b2ef
libbb.h: fix logic selecting incorrect BB_STRTOOFF for !LFS configs
...
BB_STRTOOFF() was equal to bb_strtou(). On x86_64, it's incorrect.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-10-08 15:54:40 +02:00
YU Jincheng
1f925038ab
*: generalize "const trick"
...
While at it, change all "__asm__" to "asm"
Co-authored-by: canyie <31466456+canyie@users.noreply.github.com>
Signed-off-by: YU Jincheng <shana@zju.edu.cn>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-10-07 15:22:35 +02:00
Denys Vlasenko
6279aec03d
libbb: clarify what bb_mode_string() generates
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-09-17 17:10:38 +02:00
Denys Vlasenko
59ac467dc6
libbb: eliminate a static data array in bb_mode_string()
...
function old new delta
print_stat 861 869 +8
header_verbose_list_ar 73 77 +4
display_single 975 979 +4
header_verbose_list 237 239 +2
bb_mode_string 124 115 -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/1 up/down: 18/-9) Total: 9 bytes
text data bss dec hex filename
1043136 559 5052 1048747 1000ab busybox_old
1043153 559 5020 1048732 10009c busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-09-17 01:18:31 +02:00
Denys Vlasenko
4958c18134
libbb: code shrink bb_parse_mode
...
function old new delta
bb_parse_mode 393 398 +5
static.who_mask 16 8 -8
static.perm_mask 24 12 -12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 5/-20) Total: -15 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-09-17 00:47:23 +02:00
Ron Yorston
9fe1548bbf
date,touch: allow timezone offsets in dates
...
Allow ISO 8601 style dates to include a timezone offset. Like
the '@' format these dates aren't relative to the user's current
timezone and shouldn't be subject to DST adjustment.
- The implementation uses the strptime() '%z' format specifier.
This an extension which may not be available so the use of
timezones is a configuration option.
- The 'touch' applet has been updated to respect whether DST
adjustment is required, matching 'date'.
function old new delta
parse_datestr 624 730 +106
static.fmt_str 106 136 +30
touch_main 388 392 +4
date_main 818 819 +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 141/0) Total: 141 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-09-17 00:11:30 +02:00
Denys Vlasenko
1746218bee
move iterate_on_dir() from e2fsprogs to libbb
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-24 11:42:55 +02:00
Denys Vlasenko
56bbbfae7d
cp: implement -n
...
function old new delta
.rodata 103681 103722 +41
packed_usage 33698 33717 +19
copy_file 1678 1696 +18
cp_main 500 492 -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 78/-8) Total: 70 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-22 15:28:34 +02:00
Denys Vlasenko
0ec52d438a
cp: implement -t DIR
...
function old new delta
packed_usage 33713 33734 +21
.rodata 103670 103672 +2
cp_main 506 500 -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 23/-6) Total: 17 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-21 19:38:39 +02:00
Denys Vlasenko
dc30f3dce2
free: implement -h
...
function old new delta
.rodata 103331 103363 +32
packed_usage 33652 33654 +2
free_main 657 588 -69
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 34/-69) Total: -35 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-18 12:08:02 +02:00
Denys Vlasenko
5dadd497ff
runsv: robustify signal handling - SIGTERM to child between vfork and exec could mess things up
...
While at it, rename bb_signals_recursive_norestart() to bb_signals_norestart():
"recursive" was implying we are setting SA_NODEFER allowing signal handler
to be entered recursively, but we do not do that.
function old new delta
bb_signals_norestart - 70 +70
startservice 380 394 +14
bb_signals_recursive_norestart 70 - -70
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/0 up/down: 84/-70) Total: 14 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-05 16:20:05 +02:00
Sören Tempel
3d9c649158
ls: don't output any colors with TERM=dumb
...
The TERM variable is usually set to "dumb" to indicate that the terminal
does not support any ANSI escape sequences. Presently, ls does not honor
this variable and outputs colors anyhow which results in unreadable
output, unless the user explicitly disables colors using `ls
--color=never`. The rational behind this change is that ls should "just
work" by default, even on dumb terminals.
For this reason, this patch adds a check which additionally consults the
TERM variable before printing any colors. This is analogous to the
existing check for ensuring that standard output is a tty. As such,
colors can still be forced with `--color=force`, even if TERM is set to
dumb.
function old new delta
is_TERM_dumb - 40 +40
ls_main 579 598 +19
.rodata 103246 103251 +5
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/0 up/down: 64/0) Total: 64 bytes
Signed-off-by: Sören Tempel <soeren+git@soeren-tempel.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-04 22:39:10 +02:00
Denys Vlasenko
d005c9f4c7
libbb.h: inline byteswaps
...
function old new delta
recv_and_process_peer_pkt 2173 2245 +72
machtime_dg 97 114 +17
machtime_stream 29 45 +16
fmt_time_bernstein_25 132 139 +7
aesgcm_GHASH 183 184 +1
dumpleases_main 519 516 -3
__bswap_32 3 - -3
udhcp_run_script 743 739 -4
tls_xread_record 634 630 -4
select_lease_time 56 52 -4
rdate_main 260 256 -4
get_prefix 327 323 -4
udhcp_listen_socket 185 180 -5
sha1_process_block64 361 356 -5
sendping6 81 76 -5
sendping4 107 102 -5
read32 27 22 -5
ll_proto_a2n 112 107 -5
bb_lookup_port 102 97 -5
udhcpc_main 2615 2609 -6
tftpd_main 579 573 -6
str2sockaddr 558 552 -6
GMULT 136 130 -6
sha1_end 73 66 -7
ntpd_main 1361 1354 -7
ntohl 7 - -7
inet_addr_match 93 86 -7
htonl 7 - -7
do_iplink 1259 1252 -7
do_add_or_delete 1138 1131 -7
create_and_bind_or_die 117 110 -7
bind_for_passive_mode 124 117 -7
xconnect_ftpdata 98 90 -8
rpm_getint 118 110 -8
read_leases 304 296 -8
read_config 216 208 -8
udhcp_send_kernel_packet 336 327 -9
udhcp_recv_kernel_packet 143 134 -9
sha256_process_block64 451 442 -9
d6_send_kernel_packet_from_client_data_ifindex 275 266 -9
write_leases 215 205 -10
wget_main 2518 2508 -10
udhcpd_main 1528 1518 -10
tftp_protocol 2019 2009 -10
ftpd_main 2159 2149 -10
des_crypt 1318 1308 -10
send_ACK 138 127 -11
ipaddr_modify 1618 1607 -11
udhcp_str2optset 650 638 -12
init_d6_packet 115 103 -12
xwrite_encrypted 512 499 -13
tls_handshake 2060 2047 -13
pscan_main 607 594 -13
perform_d6_release 240 227 -13
ip_port_str 135 122 -13
handle_incoming_and_exit 2230 2217 -13
INET_setroute 751 737 -14
traceroute_init 1153 1137 -16
nc_main 1055 1039 -16
udhcp_init_header 92 75 -17
volume_id_probe_hfs_hfsplus 512 494 -18
send_offer 455 435 -20
do_lzo_decompress 507 487 -20
add_client_options 229 209 -20
ipcalc_main 554 533 -21
dhcprelay_main 966 943 -23
change_listen_mode 345 321 -24
send_packet 188 162 -26
static.xmalloc_optname_optval 709 681 -28
rpm_gettags 447 419 -28
machtime 28 - -28
catcher 299 270 -29
sfp_to_d 78 48 -30
reread_config_file 917 886 -31
lfp_to_d 84 51 -33
udhcp_recv_raw_packet 594 559 -35
nbdclient_main 1182 1145 -37
d_to_lfp 137 100 -37
lzo_compress 567 529 -38
d6_recv_raw_packet 299 254 -45
d_to_sfp 133 85 -48
d6_send_raw_packet_from_client_data_ifindex 427 379 -48
common_ping_main 1935 1887 -48
udhcp_send_raw_packet 467 416 -51
zcip_main 1219 1160 -59
udhcpc6_main 2636 2568 -68
do_lzo_compress 327 258 -69
send_arp_request 201 129 -72
common_traceroute_main 1699 1621 -78
arpping 523 437 -86
arping_main 1597 1481 -116
print_tunnel 678 550 -128
dnsd_main 1304 1164 -140
parse_args 1370 1169 -201
------------------------------------------------------------------------------
(add/remove: 0/6 grow/shrink: 5/85 up/down: 113/-2246) Total: -2133 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-24 11:54:50 +02:00
Denys Vlasenko
fe2d8065e3
fix gcc-11.0 warnings
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-14 17:52:18 +02:00
Denys Vlasenko
6bdfbc4cb5
libbb: fix '--help' handling in FEATURE_SH_NOFORK=y
...
Most BusyBox applets respond to the '--help' option by printing
a usage message. This is normally handled by busybox_main() so
applet main routines don't have support for '--help'.
In standalone shell mode with FEATURE_SH_NOFORK enabled nofork
applets are invoked directly, bypassing busybox_main(). This
results in inconsistent handling of '--help':
- applets which call getopt() report "unrecognized option '--help'"
and print help anyway;
- realpath says "--help: No such file or directory" and doesn't
print help;
- usleep says "invalid number '--help'" and doesn't print help.
Avoid inconsistency by checking for '--help' in run_nofork_applet().
Bug found by Ron Yorston.
function old new delta
show_usage_if_dash_dash_help - 70 +70
run_nofork_applet 347 362 +15
run_applet_no_and_exit 432 365 -67
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 85/-67) Total: 18 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-18 23:30:24 +01:00
Ron Yorston
cad3fc743a
libbb: introduce and use fputs_stdout
...
function old new delta
fputs_stdout - 12 +12
zxc_vm_process 7237 7230 -7
yes_main 85 78 -7
write_block 380 373 -7
wrapf 305 298 -7
strings_main 437 430 -7
show_bridge 353 346 -7
rev_main 384 377 -7
put_prompt_custom 58 51 -7
put_cur_glyph_and_inc_cursor 168 161 -7
print_numbered_lines 152 145 -7
print_named_ascii 130 123 -7
print_name 135 128 -7
print_login_issue 386 379 -7
print_ascii 208 201 -7
powertop_main 1249 1242 -7
od_main 1789 1782 -7
logread_main 518 511 -7
head_main 804 797 -7
display_process_list 1319 1312 -7
cut_main 1002 995 -7
bb_dump_dump 1550 1543 -7
bb_ask_noecho 393 386 -7
baseNUM_main 702 695 -7
expand_main 755 745 -10
dumpleases_main 497 487 -10
write1 12 - -12
putcsi 37 23 -14
print_login_prompt 55 41 -14
paste_main 525 511 -14
cat_main 440 426 -14
print_it 245 230 -15
print_addrinfo 1188 1171 -17
print_rule 770 750 -20
print_linkinfo 842 822 -20
httpd_main 791 771 -20
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/34 up/down: 12/-341) Total: -329 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-03 20:52:40 +01:00
Alex Samorukov
4a4b453a87
Fix for the FEATURE_UTMP on the FreeBSD
...
FreeBSD is not using <utmp.h> and does not define _PATH_UTMPX.
Tested with busybox applets depending on FEATURE_UTMP (e.g. who, users, etc)
Signed-off-by: Alex Samorukov <samm@os2.kiev.ua>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04 21:59:40 +01:00
Denys Vlasenko
3c13da3dab
libbb: introduce and use xgettimeofday(), do not truncate 64-bit time_t in shells
...
function old new delta
xgettimeofday - 11 +11
get_local_var_value 280 281 +1
svlogd_main 1323 1322 -1
change_epoch 67 66 -1
timestamp_and_log 461 458 -3
hwclock_main 301 298 -3
fmt_time_bernstein_25 135 132 -3
step_time 331 326 -5
script_main 1207 1202 -5
machtime 34 28 -6
curtime 61 54 -7
ts_main 423 415 -8
nmeter_main 761 751 -10
gettime1900d 67 46 -21
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/12 up/down: 12/-73) Total: -61 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-30 23:48:01 +01:00
Denys Vlasenko
00eb23b47a
bc: do not allocate line editing state until needed
...
function old new delta
xc_read_line 324 353 +29
free_line_input_t 34 39 +5
xc_vm_init 656 640 -16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 34/-16) Total: 18 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-21 21:36:58 +01:00