Denys Vlasenko
87a08e476b
lzop: remove method checks which are always true/false
...
function old new delta
do_lzo_compress 232 224 -8
lzo_compress 531 488 -43
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-51) Total: -51 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-08 16:44:45 +02:00
Denys Vlasenko
3d4f688a19
lzop: buffer several 32-bit writes when we start a new compressed block
...
function old new delta
lzo_compress 483 531 +48
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-08 16:31:02 +02:00
Denys Vlasenko
24ef5c6375
lzop: reuse strings
...
function old new delta
lzo_compress 470 483 +13
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 13/0) Total: 13 bytes
text data bss dec hex filename
940011 477 7284 947772 e763c busybox_old
939976 477 7284 947737 e7619 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-08 14:00:03 +02:00
Denys Vlasenko
15684bf545
lzop: checksum reads do not need to be checksummed
...
function old new delta
do_lzo_decompress 404 427 +23
f_read32 22 - -22
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-08 13:45:04 +02:00
Denys Vlasenko
3a7d16d488
lzop: don't support ancient versions < 0.94 (15 Oct 1997)
...
0.94 came only 2 months after initial 0.90:
0.90 (10 Aug 1997): First public release of lzop
...
0.94 (15 Oct 1997): Header format change
function old new delta
do_lzo_decompress 411 404 -7
f_read8 24 - -24
f_read16 31 - -31
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 0/1 up/down: 0/-62) Total: -62 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-08 13:35:28 +02:00
Denys Vlasenko
434f95960a
lzop: code shrink by using header_t matching on-disk layout
...
function old new delta
add_bytes_to_chksum 37 47 +10
lzo_decompress 524 532 +8
init_chksum 14 21 +7
chksum_getresult 13 17 +4
f_read 33 28 -5
f_write8 20 - -20
f_write32 22 - -22
f_write16 25 - -25
f_write 36 - -36
do_lzo_compress 328 232 -96
do_lzo_decompress 526 411 -115
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 4/3 up/down: 29/-319) Total: -290 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-08 13:33:43 +02:00
Denys Vlasenko
7924b69f99
tar: trim help text
...
Usage: tar c|x|t [-ZzJjahmvokO] [-f TARFILE] [-C DIR] [-T FILE] [-X FILE] [--exclude PATTERN]... [FILE]...
Create, extract, or list files from a tar file
Operation: <============== DELETED
c Create
x Extract
t List
-f FILE Name of TARFILE ('-' for stdin/out)
-C DIR Change to DIR before operation
-v Verbose
-O Extract to stdout
-m Don't restore mtime
-o Don't restore user:group
-k Don't replace existing files
-Z (De)compress using compress
-z (De)compress using gzip
-J (De)compress using xz
-j (De)compress using bzip2
-a (De)compress using lzma
-h Follow symlinks
-T FILE File with names to include
-X FILE File with glob patterns to exclude
--exclude PATTERN Glob pattern to exclude
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-07 21:04:39 +02:00
Denys Vlasenko
899ae5337a
libbb: new function bb_die_memory_exhausted
...
function old new delta
bb_die_memory_exhausted - 10 +10
xstrdup 28 23 -5
xsetenv 27 22 -5
xrealloc 32 27 -5
xputenv 22 17 -5
xmalloc 30 25 -5
xfdopen_helper 40 35 -5
xasprintf 44 39 -5
wget_main 2387 2382 -5
open_socket 54 49 -5
glob_brace 419 414 -5
bb_get_chunk_from_file 146 141 -5
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/11 up/down: 10/-55) Total: -45 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-01 19:59:37 +02:00
Natanael Copa
d9503224c8
cpio: extract "unsafe" symlinks the same way tar/unzip does
...
function old new delta
cpio_main 588 596 +8
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-03-30 20:18:12 +02:00
Denys Vlasenko
3c08437db7
tar: add -o and -k to short --help too
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-03-16 04:02:23 +01:00
Denys Vlasenko
1ee222e1bf
tar: add -k and -o to --help
...
-o Don't restore user:group
-k Don't replace existing files
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-03-16 03:55:14 +01:00
Denys Vlasenko
a84db18fc7
tar,unzip: postpone creation of symlinks with "suspicious" targets
...
This mostly reverts commit bc9bbeb2b8
"libarchive: do not extract unsafe symlinks unless $EXTRACT_UNSAFE_SYMLINKS=1"
Users report that it is somewhat too restrictive. See
https://bugs.busybox.net/show_bug.cgi?id=8411
In particular, this interferes with unpacking of busybox-based
filesystems with links like "sbin/applet" -> "../bin/busybox".
The change is made smaller by deleting ARCHIVE_EXTRACT_QUIET flag -
it is unused since 2010, and removing conditionals on it
allows commonalizing some error message codes.
function old new delta
create_or_remember_symlink - 94 +94
create_symlinks_from_list - 64 +64
tar_main 1002 1006 +4
unzip_main 2732 2724 -8
data_extract_all 984 891 -93
unsafe_symlink_target 147 - -147
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 1/2 up/down: 162/-248) Total: -86 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-20 16:06:53 +01:00
Denys Vlasenko
4cae044b43
bzip2: expose tuning knob for faster/smaller code
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-07 01:33:25 +01:00
Denys Vlasenko
5cdd120f0c
unzip: do not set directory mode to 0777
...
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=882177
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-06 17:59:32 +01:00
Denys Vlasenko
0a90960f44
ar: hopefully fix out-of-bounds read in get_header_ar()
...
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=882175
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-06 17:39:45 +01:00
Denys Vlasenko
c2a51b0cf1
bzip2: work around bad compiler optimization
...
gc-6.1.1 x86_64:
function old new delta
generateMTFValues 380 367 -13
gcc-4.3.1 386:
function old new delta
inner_loop - 41 +41
generateMTFValues 357 294 -63
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 41/-63) Total: -22 bytes
gcc-6.3.0 386:
function old new delta
inner_loop - 36 +36
generateMTFValues 363 250 -113
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 36/-113) Total: -77 bytes
The last case, gcc-6.3.0, runs almost 3 times faster after this change.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-05 00:34:08 +01:00
Denys Vlasenko
2598915d43
gunzip: fix from gzip-1.3.12 for gzip file with all zero length codes
...
Corresponding changelog from gzip-1.3.12 reads:
"""
2006-12-20 Paul Eggert <eggert@cs.ucla.edu>
* inflate.c (huft_build): Fix regression that caused gzip to
refuse to uncompress null input (all zero length codes). Problem
reported by Yiorgos Adamopoulos. This regression was caused by
the security patch installed 2006-11-20, which in turn came from
Debian, which in turn apparently came from Thomas Biege of SuSe.
"""
function old new delta
huft_build 1176 1216 +40
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-04 00:15:29 +01:00
Denys Vlasenko
0e60a36c92
bzip2: move runningOrder[] back to stack - 256 bytes is not much
...
function old new delta
mainSort 1119 1108 -11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 22:52:55 +01:00
Denys Vlasenko
86be6d5ba9
bzip2: move ->origPtr out of struct EState, make a few members smaller
...
function old new delta
BZ2_compressBlock 223 228 +5
BZ2_blockSort 85 88 +3
generateMTFValues 356 357 +1
handle_compress 355 349 -6
compressStream 538 531 -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 9/-13) Total: -4 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 20:51:12 +01:00
Denys Vlasenko
c9ae8d770b
bzip2: pass sorting params through EState* pointer
...
function old new delta
mainGtU 499 515 +16
sendMTFValues 2085 2094 +9
mainSort 1116 1119 +3
generateMTFValues 357 356 -1
fallbackSort 1719 1705 -14
mainQSort3 1163 1141 -22
BZ2_blockSort 118 85 -33
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/4 up/down: 28/-70) Total: -42 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-03 20:19:51 +01:00
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