Denys Vlasenko
10f516500e
gzip2: small simplification in mainSimpleSort()
...
function old new delta
mainQSort3 1165 1163 -2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 19:11:00 +01:00
Denys Vlasenko
0599a137ba
bzip2: a few more locals converted to generic types
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 18:47:34 +01:00
Denys Vlasenko
8e31412231
bzip2: eliminate one parameter to mainQSort3()
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 18:28:10 +01:00
Denys Vlasenko
9431bdd189
bzip2: small simplification in mainSort()
...
function old new delta
mainSort 1127 1118 -9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 18:11:08 +01:00
Denys Vlasenko
fe1bab4d35
bzip2: convert some locals to unsigned's
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 18:03:33 +01:00
Denys Vlasenko
c364d32ccc
bzip2: runningOrder[] values are always 0..255, make it uint8
...
function old new delta
mainSort 1171 1124 -47
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 17:44:00 +01:00
Denys Vlasenko
df23f55e39
bzip2: remove redundant clearing of an alredy unset bit
...
function old new delta
mainSort 1178 1171 -7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 17:38:23 +01:00
Denys Vlasenko
524fa29a93
bzip2: eliminate write-only local numQSorted
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 17:30:16 +01:00
Denys Vlasenko
2109fce410
bzip2: make locals in mainSort() saner, convert one of them from uint16 to unsigned
...
function old new delta
mainSort 1192 1178 -14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 17:22:06 +01:00
Denys Vlasenko
aaa3818a75
bzip2: remove redundant loop termination check in mainSort()
...
function old new delta
mainSort 1202 1192 -10
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 16:43:33 +01:00
Denys Vlasenko
e59e5ff96e
bzip2: reduce indentation, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 15:59:46 +01:00
Denys Vlasenko
9e5662ea74
bzip2: reuse zPend processing code
...
function old new delta
generateMTFValues 378 357 -21
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 15:53:17 +01:00
Denys Vlasenko
2cfe10a558
bzip2: shrink makeMaps_e()
...
function old new delta
generateMTFValues 378 368 -10
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 15:31:54 +01:00
Denys Vlasenko
1cbcb02316
bzip2: optimize zPend variable code
...
function old new delta
generateMTFValues 433 378 -55
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 15:26:00 +01:00
Denys Vlasenko
fc228b48c9
bzip2: have two separate "store bit 0" and "store bit 1" functions
...
function old new delta
sendMTFValues 2051 2085 +34
bsW1_0 - 33 +33
BZ2_compressBlock 225 223 -2
bsW1 52 - -52
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/1 up/down: 67/-54) Total: 13 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 14:56:43 +01:00
Denys Vlasenko
feafb3423e
bzip2: ~1% speedup by special-casing "store 1 bit" function
...
function old new delta
bsW1 - 52 +52
BZ2_compressBlock 230 225 -5
BZ2_blockSort 125 118 -7
sendMTFValues 2070 2051 -19
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/3 up/down: 52/-31) Total: 21 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 04:43:46 +01:00
Denys Vlasenko
982c44d030
bzip2: rewrite bit of code which depends on integer overflow
...
function old new delta
sendMTFValues 2093 2070 -23
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 03:34:40 +01:00
Denys Vlasenko
83dd4ff696
bzip2: delete write-only fave[] array
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 03:17:48 +01:00
Denys Vlasenko
3a2c97bd12
bgip2: fewer specifically-sized [u]int32_t's locals in sendMTFValues
...
Generic ints/unsigneds are usually fine. Yes, really.
function old new delta
sendMTFValues 2100 2093 -7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 03:14:07 +01:00
Denys Vlasenko
359230da8e
bzip2: code shrink
...
function old new delta
sendMTFValues 2111 2100 -11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 02:03:42 +01:00
Denys Vlasenko
e594fb2171
bzip2: code shrink
...
function old new delta
BZ2_compressBlock 225 230 +5
handle_compress 356 355 -1
bsW16 59 56 -3
bsW 64 61 -3
bsFinishWrite 37 32 -5
prepare_new_block 48 34 -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/5 up/down: 5/-26) Total: -21 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 01:30:12 +01:00
Denys Vlasenko
125c3ff4b1
bzip2: code shrink
...
function old new delta
bsW16 - 59 +59
sendMTFValues 2116 2111 -5
bsPutU16 36 - -36
bsPutU32 76 31 -45
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/2 up/down: 59/-86) Total: -27 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-02 20:59:28 +01:00
Denys Vlasenko
ddacb03e87
libbb: commonalize a bit of little-endian CRC32 table generation code
...
function old new delta
global_crc32_new_table_le - 11 +11
crc32_new_table_le - 9 +9
inflate_unzip_internal 560 556 -4
flash_eraseall_main 823 819 -4
unpack_xz_stream 2403 2394 -9
lzop_main 121 112 -9
gzip_main 187 178 -9
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/5 up/down: 20/-35) Total: -15 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-01 10:56:19 +01:00
Denys Vlasenko
d6f0f03b68
libarchive: move bbunpack constants to bb_archive.h
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-01 09:13:14 +01:00
Denys Vlasenko
99ac1759dd
lzop: code shrink
...
function old new delta
lzo_decompress 526 524 -2
lzo_compress 473 470 -3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-01 01:41:31 +01:00
Denys Vlasenko
97058d0585
unlzop: fix --help: it has -U instead of -k
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-01 01:03:50 +01:00
Denys Vlasenko
1b8ac93a20
bzip2: code shrink, stop using global data variable
...
function old new delta
compressStream 523 538 +15
level 1 - -1
bzip2_main 110 73 -37
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 15/-38) Total: -23 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-01 01:00:58 +01:00
Denys Vlasenko
54a174eb01
gzip: "compressed_len" is unused, stop wasting code and time calculating it
...
function old new delta
flush_block 595 523 -72
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-31 23:26:11 +01:00
Denys Vlasenko
a142926029
gzip: remove unnecessary forward declarations, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-31 18:16:34 +01:00
Denys Vlasenko
919bc9d43c
gzip: flush output buffer after stored blocks only if necessary
...
function old new delta
flush_block 671 680 +9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-31 17:37:32 +01:00
Denys Vlasenko
f21ebeece5
gzip: flush output buffer after stored blocks, they are not 32-bit aligned
...
function old new delta
flush_block 665 671 +6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-31 17:19:59 +01:00
Denys Vlasenko
ba63d70e2d
gzip: make debugging of bits_sent less ugly, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-31 17:00:41 +01:00
Denys Vlasenko
26eea71c87
gzip: code shrink
...
function old new delta
flush_block 668 665 -3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-31 16:36:17 +01:00
Denys Vlasenko
05251986c7
gzip: code shrink
...
Use one memset to clear part of G1, and all of G2.
function old new delta
pack_gzip 838 828 -10
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-31 16:11:56 +01:00
Denys Vlasenko
8fd35a1fa6
gzip: code shrink
...
function old new delta
pack_gzip 861 838 -23
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-31 15:42:45 +01:00
Denys Vlasenko
468731a86b
gzip: code shrink and speedup
...
function old new delta
pack_gzip 908 861 -47
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-31 15:32:32 +01:00
Denys Vlasenko
631c16855a
gzip: optionally faster put_32bit()
...
function old new delta
put_32bit 22 55 +33
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-31 00:42:29 +01:00
Denys Vlasenko
b7dfbbcdaa
gzip: speed up send_bits()
...
Replace one RMW op with store. This speeds up gzip of a png file by ~2%.
function old new delta
send_bits 62 66 +4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-31 00:01:06 +01:00
Denys Vlasenko
d7500f856d
gzip: use "unsigned" type for bit fields and bit counts
...
This does not change any logic, those values should always be positive.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-30 23:53:38 +01:00
Denys Vlasenko
6ba6a6f28e
gzip: use wider (32-bit, not 16) bi_buf
...
function old new delta
bi_windup 76 74 -2
send_bits 70 62 -8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-30 23:47:45 +01:00
Denys Vlasenko
e4c4e6ddc3
gzip: code shrink
...
function old new delta
send_bits 92 70 -22
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-30 22:37:06 +01:00
Denys Vlasenko
9c499a5af4
gzip: code shrink
...
function old new delta
fill_window_if_needed - 238 +238
deflate 924 907 -17
pack_gzip 809 790 -19
fill_window 216 - -216
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/2 up/down: 238/-252) Total: -14 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-30 18:15:39 +01:00
Denys Vlasenko
c6d2a26fac
gzip: code shrink (consolidate zeroing on reinit)
...
function old new delta
deflate - 938 +938
pack_gzip 1903 923 -980
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-30 17:39:57 +01:00
Denys Vlasenko
bb373dbc32
tar: accomodate non-terminated tar.chksum fields as seen from github.com
...
function old new delta
get_header_tar 1783 1696 -87
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-27 19:04:08 +01:00
Denys Vlasenko
e503962981
gzip: fix debug code. Closes 10681
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-26 00:21:25 +01:00
Denys Vlasenko
a07fead823
tar: code shrink
...
function old new delta
packed_usage 31863 31853 -10
tar_main 1013 1002 -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-21) Total: -21 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-11-13 01:56:51 +01:00
Denys Vlasenko
931cf64ae7
tar: code shrink, better help text
...
function old new delta
tar_main 994 1013 +19
packed_usage 31893 31863 -30
writeTarFile 250 207 -43
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 19/-73) Total: -54 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-11-13 01:40:28 +01:00
Denys Vlasenko
02e93b3a28
tar: improve help text
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-11-10 22:14:22 +01:00
Eugene Rudoy
978810d7ac
unzip: add missing -j to trivial usage
...
Signed-off-by: Eugene Rudoy <gene.devel@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-11-09 12:47:56 +01:00
Eugene Rudoy
c6f213ade4
unzip: fix content listing and filtering when -j is used
...
Original Info-ZIP's unzip uses unstripped filenames
while doing content listing and filtering, i.e.
- in content listing mode -j is ignored completely
- filtering is applied to non-stripped names, -j
takes effect first while extracting the files
997ad2c64a
strips path
components a little bit too early resulting in behavior
deviations.
Fix it by doing stripping after listing/filtering.
p.s. Info-ZIP's unzip behavior is the same as
that of tar in --strip-components=NUM mode
Signed-off-by: Eugene Rudoy <gene.devel@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-11-09 12:45:50 +01:00
Denys Vlasenko
9ac42c5005
unlzma: fix SEGV, closes 10436
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-10-27 15:37:03 +02:00
Denys Vlasenko
0402cb32df
bunzip2: fix runCnt overflow from bug 10431
...
This particular corrupted file can be dealth with by using "unsigned".
If there will be cases where it genuinely overflows, there is a disabled
code to deal with that too.
function old new delta
get_next_block 1678 1667 -11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-10-22 18:23:23 +02:00
Denys Vlasenko
2ab9403119
whitespace and comment format fixes, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-10-05 15:33:28 +02:00
Denys Vlasenko
ebe6d9d875
whitespace and comment format fixes, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-10-05 14:40:24 +02:00
Denys Vlasenko
0c4dbd481a
regularize format of source file headers, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-18 16:28:43 +02:00
Ron Yorston
6bafcfb67a
tar: fix handling of first argument without '-'
...
The following no longer works as expected:
$ ./busybox tar xfz test.tgz
tar: can't open 'z': No such file or directory
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-23 12:19:44 +02:00
Ron Yorston
e837a0dbbe
libarchive: fix build failure on NOMMU systems
...
In the old code fd was an argument, now we need to get the file descriptor
from the xstate structure.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-22 15:41:33 +02:00
Denys Vlasenko
efcc89b21b
rpm,rpm2cpio: do not compile not-configurred parts of rpm.c
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-22 15:33:04 +02:00
Denys Vlasenko
5da5365d3c
rpm,rpm2cpio: INIT_G() was missing (it is a nop here so far)
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-10 13:22:01 +02:00
Denys Vlasenko
bc9bbeb2b8
libarchive: do not extract unsafe symlinks unless $EXTRACT_UNSAFE_SYMLINKS=1
...
function old new delta
unsafe_symlink_target - 147 +147
unzip_main 2711 2732 +21
copy_file 1657 1678 +21
tar_main 999 971 -28
data_extract_all 1038 984 -54
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/2 up/down: 189/-82) Total: 107 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-10 11:52:42 +02:00
Denys Vlasenko
0cf64c8b5d
rpm2cpio: handle LZMA compressed rpms. closes 10166
...
function old new delta
rpm2cpio_main 78 120 +42
setup_lzma_on_fd - 29 +29
fork_transformer_and_free - 28 +28
...
setup_unzip_on_fd 56 32 -24
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 3/5 up/down: 104/-67) Total: 37 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-10 10:36:37 +02:00
Denys Vlasenko
3c9b8fe252
rpm2cpio: use rpm_gettags
...
function old new delta
rpm_gettags - 451 +451
rpm2cpio_main 140 78 -62
skip_header 92 - -92
rpm_main 1477 1049 -428
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/2 up/down: 451/-582) Total: -131 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-10 09:56:49 +02:00
Denys Vlasenko
e5650a40d4
rpm: prepare rpm_gettags for reuse in rpm2cpio
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-10 09:41:57 +02:00
Denys Vlasenko
3fa9262dcd
rpm,rpm2cpio: put both sources into one file, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-10 09:32:19 +02:00
Denys Vlasenko
9be166b5dd
rpm: code shrink
...
function old new delta
rpm_getstr0 - 7 +7
rpm_getstr 112 110 -2
rpm_getint 120 118 -2
bsearch_rpmtag 15 13 -2
shell_builtin_read 1334 1320 -14
rpm_main 1548 1474 -74
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/5 up/down: 7/-94) Total: -87 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-09 18:20:01 +02:00
Denys Vlasenko
22542eca18
getopt32: remove opt_complementary
...
function old new delta
vgetopt32 1318 1392 +74
runsvdir_main 703 713 +10
bb_make_directory 423 425 +2
collect_cpu 546 545 -1
opt_chars 3 - -3
opt_complementary 4 - -4
tftpd_main 567 562 -5
ntp_init 476 471 -5
zcip_main 1266 1256 -10
xxd_main 428 418 -10
whois_main 140 130 -10
who_main 463 453 -10
which_main 212 202 -10
wget_main 2535 2525 -10
watchdog_main 291 281 -10
watch_main 222 212 -10
vlock_main 399 389 -10
uuencode_main 332 322 -10
uudecode_main 316 306 -10
unlink_main 45 35 -10
udhcpd_main 1482 1472 -10
udhcpc_main 2762 2752 -10
tune2fs_main 290 280 -10
tunctl_main 366 356 -10
truncate_main 218 208 -10
tr_main 518 508 -10
time_main 1134 1124 -10
tftp_main 286 276 -10
telnetd_main 1873 1863 -10
tcpudpsvd_main 1785 1775 -10
taskset_main 521 511 -10
tar_main 1009 999 -10
tail_main 1644 1634 -10
syslogd_main 1967 1957 -10
switch_root_main 368 358 -10
svlogd_main 1454 1444 -10
sv 1296 1286 -10
stat_main 104 94 -10
start_stop_daemon_main 1028 1018 -10
split_main 542 532 -10
sort_main 796 786 -10
slattach_main 624 614 -10
shuf_main 504 494 -10
setsid_main 96 86 -10
setserial_main 1132 1122 -10
setfont_main 388 378 -10
setconsole_main 78 68 -10
sendmail_main 1209 1199 -10
sed_main 677 667 -10
script_main 1077 1067 -10
run_parts_main 325 315 -10
rtcwake_main 454 444 -10
rm_main 175 165 -10
reformime_main 119 109 -10
readlink_main 123 113 -10
rdate_main 246 236 -10
pwdx_main 189 179 -10
pstree_main 317 307 -10
pscan_main 663 653 -10
popmaildir_main 818 808 -10
pmap_main 80 70 -10
nc_main 1042 1032 -10
mv_main 558 548 -10
mountpoint_main 477 467 -10
mount_main 1264 1254 -10
modprobe_main 768 758 -10
modinfo_main 333 323 -10
mktemp_main 200 190 -10
mkswap_main 324 314 -10
mkfs_vfat_main 1489 1479 -10
microcom_main 715 705 -10
md5_sha1_sum_main 521 511 -10
man_main 867 857 -10
makedevs_main 1052 1042 -10
ls_main 563 553 -10
losetup_main 432 422 -10
loadfont_main 89 79 -10
ln_main 524 514 -10
link_main 75 65 -10
ipcalc_main 544 534 -10
iostat_main 2397 2387 -10
install_main 768 758 -10
id_main 480 470 -10
i2cset_main 1239 1229 -10
i2cget_main 380 370 -10
i2cdump_main 1482 1472 -10
i2cdetect_main 682 672 -10
hwclock_main 406 396 -10
httpd_main 741 731 -10
grep_main 837 827 -10
getty_main 1559 1549 -10
fuser_main 297 287 -10
ftpgetput_main 345 335 -10
ftpd_main 2232 2222 -10
fstrim_main 251 241 -10
fsfreeze_main 77 67 -10
fsck_minix_main 2921 2911 -10
flock_main 314 304 -10
flashcp_main 740 730 -10
flash_eraseall_main 833 823 -10
fdformat_main 532 522 -10
expand_main 680 670 -10
eject_main 335 325 -10
dumpleases_main 630 620 -10
du_main 314 304 -10
dos2unix_main 441 431 -10
diff_main 1350 1340 -10
df_main 1064 1054 -10
date_main 1095 1085 -10
cut_main 961 951 -10
cryptpw_main 228 218 -10
crontab_main 575 565 -10
crond_main 1149 1139 -10
cp_main 370 360 -10
common_traceroute_main 3834 3824 -10
common_ping_main 1767 1757 -10
comm_main 239 229 -10
cmp_main 655 645 -10
chrt_main 379 369 -10
chpst_main 704 694 -10
chpasswd_main 308 298 -10
chown_main 171 161 -10
chmod_main 158 148 -10
cat_main 428 418 -10
bzip2_main 120 110 -10
blkdiscard_main 264 254 -10
base64_main 221 211 -10
arping_main 1665 1655 -10
ar_main 556 546 -10
adjtimex_main 406 396 -10
adduser_main 882 872 -10
addgroup_main 411 401 -10
acpid_main 1198 1188 -10
optstring 11 - -11
opt_string 18 - -18
OPT_STR 25 - -25
ubi_tools_main 1288 1258 -30
ls_options 31 - -31
------------------------------------------------------------------------------
(add/remove: 0/6 grow/shrink: 3/129 up/down: 86/-1383) Total: -1297 bytes
text data bss dec hex filename
915428 485 6876 922789 e14a5 busybox_old
914629 485 6872 921986 e1182 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-08 21:55:02 +02:00
Denys Vlasenko
036585a911
getopt32: remove applet_long_options
...
FEATURE_GETOPT_LONG made dependent on LONG_OPTS.
The folloving options are removed, now LONG_OPTS enables long options
for affected applets:
FEATURE_ENV_LONG_OPTIONS FEATURE_EXPAND_LONG_OPTIONS
FEATURE_UNEXPAND_LONG_OPTIONS FEATURE_MKDIR_LONG_OPTIONS
FEATURE_MV_LONG_OPTIONS FEATURE_RMDIR_LONG_OPTIONS
FEATURE_ADDGROUP_LONG_OPTIONS FEATURE_ADDUSER_LONG_OPTIONS
FEATURE_HWCLOCK_LONG_OPTIONS FEATURE_NSENTER_LONG_OPTS
FEATURE_CHCON_LONG_OPTIONS FEATURE_RUNCON_LONG_OPTIONS
They either had a small number of long options, or their long options are
essential.
Example: upstream addgroup and adduser have ONLY longopts,
we should probably go further and get rid
of non-standard short options.
To this end, make addgroup and adduser "select LONG_OPTS".
We had this breakage caused by us even in our own package!
#if ENABLE_LONG_OPTS || !ENABLE_ADDGROUP
/* We try to use --gid, not -g, because "standard" addgroup
* has no short option -g, it has only long --gid.
*/
argv[1] = (char*)"--gid";
#else
/* Breaks if system in fact does NOT use busybox addgroup */
argv[1] = (char*)"-g";
#endif
xargs: its lone longopt no longer depends on DESKTOP, only on LONG_OPTS.
hwclock TODO: get rid of incompatible -t, -l aliases to --systz, --localtime
Shorten help texts by omitting long option when short opt alternative exists.
Reduction of size comes from the fact that store of an immediate
(an address of longopts) to a fixed address (global variable)
is a longer insn than pushing that immediate or passing it in a register.
This effect is CPU-agnostic.
function old new delta
getopt32 1350 22 -1328
vgetopt32 - 1318 +1318
getopt32long - 24 +24
tftpd_main 562 567 +5
scan_recursive 376 380 +4
collect_cpu 545 546 +1
date_main 1096 1095 -1
hostname_main 262 259 -3
uname_main 259 255 -4
setpriv_main 362 358 -4
rmdir_main 191 187 -4
mv_main 562 558 -4
ipcalc_main 548 544 -4
ifenslave_main 641 637 -4
gzip_main 192 188 -4
gunzip_main 77 73 -4
fsfreeze_main 81 77 -4
flock_main 318 314 -4
deluser_main 337 333 -4
cp_main 374 370 -4
chown_main 175 171 -4
applet_long_options 4 - -4
xargs_main 894 889 -5
wget_main 2540 2535 -5
udhcpc_main 2767 2762 -5
touch_main 436 431 -5
tar_main 1014 1009 -5
start_stop_daemon_main 1033 1028 -5
sed_main 682 677 -5
script_main 1082 1077 -5
run_parts_main 330 325 -5
rtcwake_main 459 454 -5
od_main 2169 2164 -5
nl_main 201 196 -5
modprobe_main 773 768 -5
mkdir_main 160 155 -5
ls_main 568 563 -5
install_main 773 768 -5
hwclock_main 411 406 -5
getopt_main 622 617 -5
fstrim_main 256 251 -5
env_main 198 193 -5
dumpleases_main 635 630 -5
dpkg_main 3991 3986 -5
diff_main 1355 1350 -5
cryptpw_main 233 228 -5
cpio_main 593 588 -5
conspy_main 1135 1130 -5
chpasswd_main 313 308 -5
adduser_main 887 882 -5
addgroup_main 416 411 -5
ftpgetput_main 351 345 -6
get_terminal_width_height 242 234 -8
expand_main 690 680 -10
static.expand_longopts 18 - -18
static.unexpand_longopts 27 - -27
mkdir_longopts 28 - -28
env_longopts 30 - -30
static.ifenslave_longopts 34 - -34
mv_longopts 46 - -46
static.rmdir_longopts 48 - -48
packed_usage 31739 31687 -52
------------------------------------------------------------------------------
(add/remove: 2/8 grow/shrink: 3/49 up/down: 1352/-1840) Total: -488 bytes
text data bss dec hex filename
915681 485 6880 923046 e15a6 busybox_old
915428 485 6876 922789 e14a5 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-08 17:09:40 +02:00
Denys Vlasenko
76b65624b9
unxz: get_le32 macro is obviously wrong
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-07 20:56:54 +02:00
Denys Vlasenko
dd5a40246b
getopt32: move support for "always treat first arg as option" to users (tar/ar)
...
Now getopt() never leaks (and never performs) any xmalloc's.
function old new delta
ar_main 522 556 +34
tar_main 986 1014 +28
getopt32 1458 1350 -108
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 62/-108) Total: -46 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-04 16:46:17 +02:00
Denys Vlasenko
18e781dc02
config: do not use `a' quoting in help texts
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-02 14:12:48 +02:00
Natanael Copa
46f3f16b58
unzip: fix regression on big-endian machines
...
This fixes a regression which was introduced with commit 2a0867a5
("unzip: optional support for bzip2 and lzma") and causes unzip to exit
with error when extracting archives:
unzip: unsupported method 2048
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-27 15:38:55 +02:00
Denys Vlasenko
b920a38dc0
tar: postpone creation of symlinks with "suspicious" targets. Closes 8411
...
function old new delta
data_extract_all 968 1038 +70
tar_main 952 986 +34
scan_tree 258 262 +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 108/0) Total: 108 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-24 17:20:13 +02:00
Denys Vlasenko
72089cf6b4
config: deindent all help texts
...
Those two spaces after tab have no effect, and always a nuisance when editing.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-21 09:50:55 +02:00
Denys Vlasenko
75d151e31d
libarchive: FEATURE_LZMA_FAST should be visible if FEATURE_SEAMLESS_LZMA
...
While at it, tweak some config help texts.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-20 23:28:00 +02:00
Denys Vlasenko
ad37abf423
unzip: sanitize filename length: malloc(1234mb) is not funny
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-20 20:21:50 +02:00
Denys Vlasenko
997ad2c64a
unzip: implement -j, closes 9126
...
function old new delta
unzip_main 2642 2703 +61
packed_usage 31747 31770 +23
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 84/0) Total: 84 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-20 20:04:49 +02:00
Denys Vlasenko
bff9bbc73f
unzip: robustify overwrite checks
...
function old new delta
get_lstat_mode - 55 +55
unzip_main 2667 2642 -25
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 55/-25) Total: 30 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-20 18:56:05 +02:00
Denys Vlasenko
13ae85edd1
unzip: support symlinks. Closes 10031
...
function old new delta
unzip_main 2519 2667 +148
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-20 18:34:51 +02:00
Denys Vlasenko
ebe3c35d00
bzcat,zcat: simplify code if gunzip/bunzip2 is not selected
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-20 16:25:03 +02:00
Denys Vlasenko
4eed2c6c50
Update menuconfig items with approximate applet sizes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-18 22:01:24 +02:00
Denys Vlasenko
2c1258c620
Move get_unaligned_le32() macros to platform.h
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-15 20:22:25 +02:00
Denys Vlasenko
38d966943f
unzip: TODO for symlink support
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-11 22:10:52 +02:00
Peter Korsgaard
d13c1762a8
dpkg: fix CONFIG_FEATURE_CLEAN_UP handling
...
dpkg moved to away from dynamically allocating the hashtables in commit
c87339d584
(dpkg: trivial code shrinkage, and redo G trick correctly) almost
ten years ago, but the cleanup code was never adjusted to match.
Glibc loudly complains about this:
*** Error in `dpkg': free(): invalid pointer: 0x0000007fac3478c0 ***
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-05 23:15:13 +02:00
Denys Vlasenko
034ceabe82
bzcat: compile bunzip2_main() if BZCAT.
...
Currently, BZCAT (and BUNZIP2) selects FEATURE_BZIP2_DECOMPRESS,
thus, "#if ENABLE_FEATURE_BZIP2_DECOMPRESS" around bunzip2_main()
is sufficient. But let's robustify it.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-04 16:23:36 +02:00
Denys Vlasenko
d4e4fdb5ce
fixes for bugs found by make_single_applets.sh
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-03 21:31:16 +02:00
Denys Vlasenko
1c013fae28
archival: add option -k "keep" to gzip/bzip2/lzop, add -U "nokeep" to lzop
...
function old new delta
bbunpack 745 779 +34
lzop_main 93 121 +28
do_lzo_compress 320 328 +8
packed_usage 31685 31653 -32
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 70/-32) Total: 38 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-06-15 18:07:04 +02:00
Denys Vlasenko
5d72ae53c9
fix "ifdef ENABLE_foo": should always be "#if ENABLE_foo"
...
function old new delta
pack_gzip 1729 1789 +60
fill_window 220 216 -4
static.gzip_level_config 24 - -24
gzip_main 275 192 -83
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/2 up/down: 60/-111) Total: -51 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-06-15 17:11:59 +02:00
Ming Liu
978307f8a1
tar: add IF_FEATURE_* checks
...
A following linking error was observed:
| ==========
| archival/lib.a(tar.o): In function `tar_main':
| archival/tar.c:1168: undefined reference to `unpack_Z_stream'
| archival/tar.c:1168: undefined reference to `unpack_Z_stream'
| ld: busybox_unstripped: hidden symbol `unpack_Z_stream' isn't defined
| ld: final link failed: Bad value
this happened with clang compiler, with the following configs:
| CONFIG_TAR=y
| # CONFIG_FEATURE_SEAMLESS_Z is not set
which can be fixed by adding IF_FEATURE_* checks in.
Signed-off-by: Ming Liu <peter.x.liu@external.atlascopco.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-06-13 19:13:37 +02:00
Denys Vlasenko
10ad622dc2
Spelling fixes in comments, documentation, tests and examples
...
By klemens <ka7@github.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-17 16:13:32 +02:00
Denys Vlasenko
876c121ccb
whitespace fix
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-03-24 15:00:12 +01:00
Kang-Che Sung
74c2215086
Fix FEATURE_{GZIP,BZIP2}_DECOMPRESS link error
...
... when gzip is selected but not gunzip nor zcat, or when bzip2 is
selected but not bunzip2 nor bzcat.
This regression is introduced in b130f9f758
("Allow 'gzip -d' and 'bzip2 -d' without gunzip or bunzip2")
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-17 20:15:27 +01:00
Rostislav Skudnov
8762512fdb
Replace int -> uint to avoid signed integer overflow
...
An example of such an error (should be compiled with DEBUG_SANITIZE):
runtime error: left shift of 1 by 31 places cannot be represented in
type 'int'
Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-04 23:10:22 +01:00
Denys Vlasenko
205d48e948
*: add comment about APPLET_ODDNAME format
...
It confused me more than once
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-29 14:57:33 +01:00
Denys Vlasenko
06f20bf675
link: new applet
...
coreutils grew itself a tiny simplistic alternative to ln:
Usage: link FILE LINK
Create hard LINK to FILE
function old new delta
link_main - 75 +75
packed_usage 31114 31131 +17
applet_names 2564 2569 +5
applet_main 1480 1484 +4
applet_install_loc 185 186 +1
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/0 up/down: 102/0) Total: 102 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-26 00:27:53 +01:00
Denys Vlasenko
f560422fa0
Big cleanup in config help and description
...
Redundant help texts (one which only repeats the description)
are deleted.
Descriptions and help texts are trimmed.
Some config options are moved, even across menus.
No config option _names_ are changed.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-10 14:58:54 +01:00
Denys Vlasenko
590402bb55
unlzma: expand comments, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09 14:28:25 +01:00
Denys Vlasenko
3989e5adf4
unlzma: fix erroneous "while" instead of "if". Closes 4682
...
These parts of the code essentially check whether
stepping back by rep0 goes negative or not.
LZMA SDK from lzma1604.7z has the following in the corresponding places:
... = dic[dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0)]
Clearly, not loop here.
Technically, "while" here works: if condition is false (because pos
underflowed), it iterates once, adds header.dict_size (a.k.a. dicBufSize),
this makes pos positive but smaller than header.dict_size, and loop exits.
Now we'll just check for negative result of subtraction, which is less code:
function old new delta
unpack_lzma_stream 2659 2641 -18
(I hope 2 Gbyte+ dictionaries won't be in use soon).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09 14:02:55 +01:00
Denys Vlasenko
8c1d857d25
unzip: match "Defl:?" display with info-zip; cosmetic code shuffling
...
Large nested indented code blocks made more sane with a few gotos.
function old new delta
unzip_main 2491 2519 +28
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09 13:10:10 +01:00
Denys Vlasenko
6b4f4b5284
unzip: optional support for xz
...
function old new delta
unzip_main 2476 2491 +15
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09 11:12:01 +01:00
Denys Vlasenko
2a0867a5ed
unzip: optional support for bzip2 and lzma
...
function old new delta
unzip_main 2376 2476 +100
bbunpack 750 745 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09 10:58:37 +01:00