Denys Vlasenko
cc55bbef75
traceroute: code shrink
...
Move init code to a separate function.
function old new delta
traceroute_init - 1203 +1203
common_traceroute_main 3391 2141 -1250
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 1203/-1250) Total: -47 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-12 18:09:45 +01:00
Denys Vlasenko
70726640b3
traceroute: code shrink
...
Do not pass "from" and "to" addresses as parameters, keep them in globals
function old new delta
common_traceroute_main 3426 3391 -35
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-12 18:09:45 +01:00
Denys Vlasenko
d0dea17900
traceroute: code shrink
...
Do not byteswap ident (why we were doing it?)
function old new delta
common_traceroute_main 3544 3426 -118
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-12 18:09:45 +01:00
Denys Vlasenko
3978adc445
traceroute: fix traceroute6 -I (icmp mode)
...
function old new delta
common_traceroute_main 3530 3544 +14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-12 18:09:45 +01:00
Denys Vlasenko
ef2366cdca
nsenter: stop option parsing on 1st non-option
...
"nsenter ls -l" gives: invalid option -- 'l'
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-12 08:44:32 +01:00
Denys Vlasenko
030fe31760
libbb: make msleep() result in only one syscall instead of looping
...
function old new delta
msleep 45 52 +7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-11 16:48:47 +01:00
Denys Vlasenko
56ee576507
mount: fix incorrect "success" exitcode if loop device setup fails
...
When mounting, in parallel, multiple loop devices (squashfs for the
submitter's case), the following behavior can be observed:
stat64(/path/to/image, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0
openat(AT_FDCWD, /path/to/image, O_RDWR|O_LARGEFILE) = 3
openat(AT_FDCWD, /dev/loop-control, O_RDWR|O_LARGEFILE|O_CLOEXEC) = 4
ioctl(4, LOOP_CTL_GET_FREE) = 12
close(4) = 0
openat(AT_FDCWD, /dev/loop12, O_RDWR|O_LARGEFILE) = 4
ioctl(4, LOOP_GET_STATUS64, {lo_offset=0, lo_number=12, lo_flags=LO_FLAGS_AUTOCLEAR, lo_file_name=/path/to/image, ...}) = 0
close(4) = 0
close(3) = 0
write(2, "mount: can't setup loop device\n", 31mount: can't setup loop device
) = 31
exit_group(0) = ?
+++ exited with 0 +++
The ioctl LOOP_CTL_GET_FREE has resulted in the same result for
a competing mount process. The subsequent ioctl LOOP_GET_STATUS64
fails, having succeeded for the competing mount process.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-09 20:56:43 +01:00
Denys Vlasenko
e7d853b4eb
wget: do not ftruncate if -O- is used, closes 13351
...
function old new delta
wget_main 2558 2571 +13
retrieve_file_data 612 621 +9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 22/0) Total: 22 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-08 19:06:28 +01:00
Xabier Oneca
abaee4aada
mkdtemp: proper error detection on mktemp
...
On error, mktemp returns an empty string, not NULL.
Signed-off-by: Xabier Oneca <xoneca@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-08 18:46:32 +01:00
Denys Vlasenko
c9b93cf290
tar: expand --help
...
function old new delta
packed_usage 33486 33590 +104
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-08 16:46:41 +01:00
Denys Vlasenko
34c5115a7f
mount: implement -o nosymfollow, remove bogus -o union
...
The (1 << 8) MS_ flag is MS_NOSYMFOLLOW, not MS_UNION.
As far as I see in git history of kernel and util-linux,
MS_UNION did not ever exist.
Why did it appear in our tree in 2009?...
function old new delta
mount_option_str 379 385 +6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-06 21:56:22 +01:00
Denys Vlasenko
696c38ddca
mount: add -o nostrictatime and -o [no]lazytime
...
function old new delta
mount_option_str 345 379 +34
mount_options 176 188 +12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 46/0) Total: 46 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-06 20:59:41 +01:00
Denys Vlasenko
b1eedfcfa1
mount: do not guess mount as NFS if "hostname:" contains slashes
...
function old new delta
singlemount 1273 1295 +22
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-05 14:14:11 +01:00
Denys Vlasenko
758c2bd58e
awk: add a test that $NF is empty
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-04 19:00:06 +01:00
Denys Vlasenko
f4f6e5144b
libbb: exec_login_shell() - new function
...
function old new delta
exec_login_shell - 12 +12
sulogin_main 247 240 -7
login_main 960 953 -7
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 12/-14) Total: -2 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-02 21:51:08 +01:00
Denys Vlasenko
0622416fec
libbb: code shrink in exec_shell()
...
function old new delta
exec_shell 129 120 -9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-02 21:39:57 +01:00
Denys Vlasenko
2075aa93e0
libbb: rename run_shell() to exec_shell()
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-02 21:28:47 +01:00
Denys Vlasenko
b4f93f562d
mount: do not guess bind mounts as nfs
...
Fails as follows:
$ mount -o bind /dev/disk/by-path/pci-0000:13:00.0-scsi-0:0:3:0 /dir
mount: bad address '/dev/disk/by-path/pci-0000'
function old new delta
singlemount 1256 1273 +17
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-02 19:10:22 +01:00
Denys Vlasenko
665a659530
awk: FS regex matches only non-empty separators (gawk compat)
...
function old new delta
awk_split 484 553 +69
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-02 19:07:31 +01:00
Denys Vlasenko
50ead33c45
login: log to syslog every bad password, not only 3rd
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-02 17:47:16 +01:00
Denys Vlasenko
6599e380ed
mount: make filesystems[] array byte-aligned
...
text data bss dec hex filename
1021120 559 5052 1026731 faaab busybox_old
1021092 559 5052 1026703 faa8f busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-30 15:10:43 +01:00
Denys Vlasenko
6cc4962b60
decrease padding: gcc-9.3.1 slaps 32-byte alignment on arrays willy-nilly
...
text data bss dec hex filename
1021236 559 5052 1026847 fab1f busybox_old
1021120 559 5052 1026731 faaab busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-30 14:58:02 +01:00
Denys Vlasenko
965b795b87
decrease paddign: gcc-9.3.1 slaps 32-byte alignment on arrays willy-nilly
...
text data bss dec hex filename
1021988 559 5052 1027599 fae0f busybox_old
1021236 559 5052 1026847 fab1f busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-30 13:03:03 +01:00
Denys Vlasenko
2fba2f5bb9
unicode: relax array alignment for tables
...
text data bss dec hex filename
1022075 559 5052 1027686 fae66 busybox_old
1021988 559 5052 1027599 fae0f busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-30 11:30:17 +01:00
Denys Vlasenko
33e955ab91
unicode: fix handling of short 1-4 char tables
...
function old new delta
in_uint16_table 92 107 +15
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-30 11:18:00 +01:00
Denys Vlasenko
eb773054e4
libbb: code shrink
...
function old new delta
generate_uuid 124 103 -21
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-29 14:24:14 +01:00
Denys Vlasenko
6a55b4e403
libbb: introduce and use msleep()
...
function old new delta
msleep - 45 +45
watchdog_main 271 266 -5
common_traceroute_main 3546 3530 -16
beep_main 277 248 -29
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/3 up/down: 45/-50) Total: -5 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-29 12:40:25 +01:00
Denys Vlasenko
b86a9ed699
use write_str() functions where appropriate
...
function old new delta
chat_main 1300 1295 -5
finalize_tty_attrs 80 70 -10
getty_main 1538 1519 -19
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-34) Total: -34 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-29 11:49:37 +01:00
Denys Vlasenko
ec16c030bd
libbb: introduce and use sleep1()
...
function old new delta
sleep1 - 9 +9
run_shutdown_and_kill_processes 97 95 -2
restore_state_and_exit 116 114 -2
reread_partition_table 67 65 -2
flush_buffer_cache 80 78 -2
chat_main 1302 1300 -2
timeout_main 310 307 -3
telnet_main 1235 1232 -3
stop_handler 86 83 -3
process_action 1078 1075 -3
nbdclient_main 1185 1182 -3
init_main 789 786 -3
getty_main 1541 1538 -3
do_time 410 407 -3
runsv_main 1682 1677 -5
pause_and_low_level_reboot 59 54 -5
inetd_main 1917 1911 -6
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/16 up/down: 9/-50) Total: -41 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-29 11:37:34 +01:00
Denys Vlasenko
87bd558f3f
libbb: bb_do_delay(3) -> pause_after_failed_login(), and stop looping there
...
function old new delta
pause_after_failed_login - 9 +9
vlock_main 358 353 -5
sulogin_main 252 247 -5
su_main 484 479 -5
passwd_main 936 931 -5
login_main 967 962 -5
bb_do_delay 68 - -68
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/5 up/down: 9/-93) Total: -84 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-29 11:32:48 +01:00
Denys Vlasenko
32a8f70ac1
libbb: in @SECONDS date format, use 64-bit time if libc allows
...
function old new delta
packed_usage 33472 33486 +14
parse_datestr 919 916 -3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-28 23:21:13 +01:00
Denys Vlasenko
4dee016059
date: tweak --help: -D FMT is used for -s TIME as well
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-28 23:04:09 +01:00
Denys Vlasenko
56a5731a1a
date: remove non-standard special-casing of date '+%f'
...
git log did not reveal why it is there.
function old new delta
date_main 1016 995 -21
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-28 22:07:00 +01:00
Denys Vlasenko
f26c5660c2
date: trim --help (no need to show long opts)
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-28 22:01:15 +01:00
Denys Vlasenko
900eae1738
date: support -Ins, more compatible timezone display in -I
...
function old new delta
date_main 941 1016 +75
static.isoformats 28 31 +3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 78/0) Total: 78 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-28 21:44:58 +01:00
Denys Vlasenko
ab6991c6f5
date: for -uR and -uIh, timezone still have to be shown at +hhmm, not as abbreviation
...
function old new delta
date_main 963 941 -22
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-28 20:58:42 +01:00
Denys Vlasenko
818a4aa2ef
fix comments
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-28 14:22:52 +01:00
Denys Vlasenko
ae04ce82cf
base32/64: "truncated base64 input" -> "truncated input"
...
text data bss dec hex filename
1021739 559 5052 1027350 fad16 busybox_old
1021732 559 5052 1027343 fad0f busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-28 13:43:54 +01:00
Denys Vlasenko
885121e25d
libbb: change decode_base32/64 API to return the end of _dst_, not _src_.
...
function old new delta
decode_base64 173 178 +5
read_base64 222 220 -2
decode_base32 186 182 -4
handle_incoming_and_exit 2263 2239 -24
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 5/-30) Total: -25 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-28 13:27:36 +01:00
Denys Vlasenko
fc6faac84e
libbb: trim base32/64 tables
...
function old new delta
bb_uuenc_tbl_base64 66 65 -1
bb_uuenc_tbl_base32 34 32 -2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-28 12:48:34 +01:00
Denys Vlasenko
f140b49f5f
base32/64: code shrink
...
function old new delta
decode_base64 178 173 -5
decode_base32 217 186 -31
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-36) Total: -36 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-28 12:33:50 +01:00
Denys Vlasenko
7467e905e5
base32/64: code shrink
...
function old new delta
decode_base64 180 178 -2
decode_base32 224 217 -7
read_base64 236 222 -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-23) Total: -23 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-28 09:50:14 +01:00
Denys Vlasenko
2cd37d65e2
libbb: faster and smaller decode_base32()
...
function old new delta
decode_base32 275 224 -51
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-27 21:25:34 +01:00
Denys Vlasenko
170b8628fa
libbb: smaller and faster decode_base64()
...
function old new delta
decode_base64 195 180 -15
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-27 20:45:15 +01:00
Denys Vlasenko
dc68a5ddac
sha3sum: fix --help: -a does not depend on FEATURE_MD5_SHA1_SUM_CHECK
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-27 15:55:46 +01:00
Denys Vlasenko
cdab3c4fac
base32/64: decode in-place
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-27 15:39:23 +01:00
Denys Vlasenko
c8b3d9a145
base32/64: implement -w COL
...
function old new delta
baseNUM_main 568 655 +87
packed_usage 33478 33533 +55
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 142/0) Total: 142 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-27 15:25:31 +01:00
Denys Vlasenko
fc63549352
free: code shrink
...
function old new delta
free_main 664 657 -7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-27 12:40:31 +01:00
Denys Vlasenko
20900489a1
base32: new applet
...
function old new delta
baseNUM_main - 568 +568
decode_base32 - 275 +275
bb_uuenc_tbl_base32 - 34 +34
read_base64 218 236 +18
applet_names 2732 2739 +7
applet_main 1580 1584 +4
packed_usage 33480 33478 -2
base64_main 208 - -208
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 3/1 up/down: 906/-210) Total: 696 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-26 09:04:16 +01:00
Denys Vlasenko
03eb6eba43
mdev: clear LOGMODE_STDIO only directly before daemonizing
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-22 16:35:56 +01:00