Commit Graph

71 Commits

Author SHA1 Message Date
Denys Vlasenko
984b0a613a libarchive: fix xmalloc_open_zipped_read_close() on NOMMU
The somewhat new "unpack in memory" code was broken
for xmalloc_open_zipped_read_close() on NOMMU: we seek back
over signature, but then expect it to be already consumed.
Stop seeking back in this case.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-06-20 11:06:42 +02:00
Aaro Koskinen
cddc98eab7 gzip: add support for --no-name long option
Add support for --no-name long option. Just silently ignore it
like the short -n option.

This allows to use busybox gzip with Lynx browser.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-27 21:30:43 +01:00
Aaro Koskinen
fbe50cf6bc gunzip: add support for long options
Add support for long options.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-27 21:28:50 +01:00
Denys Vlasenko
db700330d8 tweak defconfig
MONOTONIC_SYSCALL=y by default

FEATURE_LAST_SMALL is gone: now FEATURE_LAST_FANCY is a "bool", not a "choice".

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-25 20:36:03 +01:00
Denys Vlasenko
b4c11c1397 libarchive: add capability to unpack to mem.buffer
The performance and number of processes for a "depmod -a" with gzipped
modules was abysmal. This patch adds a code path without fork,
benefiting all users of xmalloc_open_zipped_read_close.

"modinfo radeon.ko.gz", a single-file reader, got 30% faster.
"depmod -a", which used to fork over 800 times, got 20% faster.

Heavily based on a patch by Lauri Kasanen <curaga@operamail.com>

function                                             old     new   delta
setup_transformer_on_fd                                -     159    +159
transformer_write                                      -     122    +122
fork_transformer                                       -     112    +112
xmalloc_open_zipped_read_close                        63     118     +55
read_bunzip                                         1866    1896     +30
xtransformer_write                                     -      19     +19
unzip_main                                          2449    2462     +13
bbunpack                                             755     766     +11
unpack_lzma_stream                                  2717    2723      +6
unpack_xz_stream                                    2393    2397      +4
unpack_Z_stream                                     1173    1175      +2
inflate_unzip                                        111     105      -6
check_signature16                                     70      63      -7
unpack_bz2_stream                                    359     349     -10
unpack_unxz                                           12       -     -12
unpack_unlzma                                         12       -     -12
unpack_uncompress                                     12       -     -12
unpack_gunzip                                         12       -     -12
unpack_bunzip2                                        12       -     -12
open_transformer                                     106      92     -14
inflate_unzip_internal                              1945    1916     -29
unpack_gz_stream                                     693     655     -38
open_zipped                                           89      47     -42
setup_unzip_on_fd                                    142      53     -89
------------------------------------------------------------------------------
(add/remove: 4/5 grow/shrink: 7/8 up/down: 533/-295)          Total: 238 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-07 00:44:00 +01:00
Denys Vlasenko
e7800f351a Rename transformer_aux_data_t -> transformer_state_t
No code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-07 00:42:49 +01:00
Denys Vlasenko
640ce3de07 zcat: complain if input is not compressed
function                                             old     new   delta
buffer_fill_and_print                                178     191     +13
varvalue                                             735     743      +8
bbunpack                                             747     755      +8
open_zipped                                           85      89      +4
xmalloc_open_zipped_read_close                        61      63      +2
get_addr_1                                           240     242      +2
fbsplash_main                                       1228    1230      +2
pstree_main                                          322     321      -1
builtin_type                                         121     119      -2
do_load                                              954     926     -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/3 up/down: 39/-31)              Total: 8 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-02 02:06:38 +01:00
Denys Vlasenko
f6beef63c6 archival/*: move "config:" snippets into .c files
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-14 11:39:00 +01:00
Denys Vlasenko
ac21687309 archival/*: move "applet:" snippets into .c files, part 2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-14 11:38:18 +01:00
Denys Vlasenko
36184a487d archival/*: move "applet:" snippets into .c files
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-14 09:54:24 +01:00
Denys Vlasenko
66620fa626 archival/*: move "kbuild:" snippets into .c files
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-14 09:53:52 +01:00
Denys Vlasenko
d0bc708cb5 unpackers: by users' request, print compression percentage if -v and DESKTOP
function                                             old     new   delta
bbunpack                                             634     731     +97

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-30 05:41:11 +02:00
Mike Frysinger
93b51819cf archival: note implicit dependencies between lzop & bbunzip
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-03-03 00:48:53 -05:00
Mike Frysinger
08e28e806d bbunzip: fix order of flags vs bit defines
Too much code shuffling.

Reported-by: Mandeep Singh Baines <msb@chromium.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-02-28 21:28:21 -05:00
Mike Frysinger
920c1baab7 bbunzip: ignore the -q flag with the decompressors
The -q flag is used in shell scripts for suppressing output.
Have our applets swallow the flag for compatibility.

Reported-by: Mandeep Singh Baines <msb@chromium.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-02-28 17:21:50 -05:00
Denys Vlasenko
41655438c6 zcat: fix "zcat FILE" trying to do detection twice
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-28 18:37:04 +01:00
Denys Vlasenko
8e96efa323 zcat: if seamless uncompressors are defined, autodetect file's format
function                                             old     new   delta
bbunpack                                             526     622     +96
packed_usage                                       29335   29341      +6
gunzip_main                                           64      67      +3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-28 18:06:09 +01:00
Denys Vlasenko
f2d8478e56 fix error message on failure to oen /dev/null; fix zcat's help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-28 18:05:01 +01:00
Denys Vlasenko
02c3c38420 Move seamless .Z support into unpack_gz_stream
unpack_gz_stream                                     566     643     +77
unpack_gunzip                                        123      12    -111

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-06 16:32:06 +01:00
Denys Vlasenko
8a6a2f9c9c update seamless uncompression code
This change makes "tar tf hello_world.txz" work without
adding special-casing for ".txz" extension. It also removes
ever-growing magic checking code in rpm2cpio and get_header_tar -
we reuse one which lives in setup_unzip_on_fd.

function                                             old     new   delta
unpack_gz_stream                                       7     566    +559
check_signature16                                      -      70     +70
setup_unzip_on_fd                                     99     142     +43
handle_SIGCHLD                                         -      41     +41
unpack_bz2_stream                                    342     376     +34
unzip_main                                          2352    2385     +33
bbunpack                                             503     533     +30
open_transformer                                      74     102     +28
unpack_Z_stream                                     1278    1304     +26
unpack_gunzip                                        101     123     +22
init_transformer_aux_data                              -      18     +18
unpack_xz_stream                                    2388    2402     +14
open_zipped                                          131     141     +10
rpm_main                                            1358    1363      +5
get_header_tar_lzma                                   52      57      +5
get_header_tar_bz2                                    52      57      +5
unpack_lzma_stream                                  2698    2702      +4
hash_find                                            234     233      -1
get_header_tar                                      1759    1733     -26
get_header_tar_gz                                     92      57     -35
unpack_uncompress                                     51      12     -39
rpm2cpio_main                                        201     147     -54
unpack_unxz                                           67      12     -55
unpack_bz2_stream_prime                               55       -     -55
get_header_tar_Z                                      86       -     -86
unpack_gz_stream_with_info                           539       -    -539
------------------------------------------------------------------------------
(add/remove: 3/3 grow/shrink: 14/6 up/down: 947/-890)          Total: 57 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-06 16:27:48 +01:00
Denys Vlasenko
c531b9a3e4 bzcat: fix unpacking of more than one file, and unpacking of zero-size bz2. Closes 4393
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-31 01:05:16 +01:00
Denys Vlasenko
d184a728cf rename archive.h to bb_archive.h. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-22 12:45:14 +02:00
Denys Vlasenko
66426760be *: remove "Options:" string from help texts
function                                             old     new   delta
packed_usage                                       28706   28623     -83

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05 03:58:28 +02:00
Pere Orga
1f4447b2d4 move help text from include/usage.src.h to archival/*.c
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-27 22:40:30 +02:00
Denys Vlasenko
b9f2d9f7d9 mass removal of underscores from _BB_DIR_foo and _BB_SUID_foo
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-18 13:58:01 +01:00
Denys Vlasenko
833d4e7f84 rename archival/libunarchive -> archival/libarchive; move bz/ into it
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-03 02:38:31 +01:00
Denys Vlasenko
3b2acb759c tweak help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-09 21:10:32 +02:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 20:14:46 +02:00
Denys Vlasenko
9297dbc9d2 randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-05 21:37:12 +02:00
Denys Vlasenko
45f66167fe xz compression detection: avoid the need to seek
function                                             old     new   delta
unpack_unxz                                           12      67     +55
unpack_xz_stream                                    2357    2373     +16
xmalloc_read                                         197     199      +2
setup_unzip_on_fd                                    118      99     -19
rpm2cpio_main                                        222     203     -19
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 73/-38)             Total: 35 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-01 05:12:28 +02:00
Denys Vlasenko
f0f9470061 make it possible to keep usage texts in .c files
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-06 01:53:38 +02:00
Denys Vlasenko
6c5bf0d347 make it possible to have include/applets.h-esque entries in .c files
As an example, bunzip2 and bzcat is changed to use it.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-06 00:53:45 +02:00
Denys Vlasenko
39a04f71ca archival/*: shrink by reusing sufficiently similar functions
function                                             old     new   delta
append_ext                                             -      16     +16
unxz_main                                             77      83      +6
unlzma_main                                           77      83      +6
uncompress_main                                       42      48      +6
gzip_main                                            184     190      +6
bzip2_main                                           114     120      +6
bunzip2_main                                          61      67      +6
bbunpack                                             469     475      +6
send_tree                                            355     360      +5
lzop_main                                             89      92      +3
gunzip_main                                           61      64      +3
make_new_name_lzop                                    84      82      -2
make_new_name_gunzip                                 114     112      -2
make_new_name_unxz                                    14       -     -14
make_new_name_unlzma                                  14       -     -14
make_new_name_uncompress                              14       -     -14
make_new_name_bunzip2                                 14       -     -14
make_new_name_gzip                                    17       -     -17
make_new_name_bzip2                                   17       -     -17
------------------------------------------------------------------------------
(add/remove: 1/6 grow/shrink: 10/2 up/down: 69/-94)           Total: -25 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-31 14:18:57 +02:00
Denys Vlasenko
6948f210ed *: teach tar et. al. to understand .xz by heart
function                                             old     new   delta
unpack_xz_stream                                       -    4126   +4126
setup_unzip_on_fd                                     80     150     +70
open_zipped                                          113     131     +18
unpack_unxz                                            5      12      +7
send_tree                                            360     353      -7
unpack_xz_stream_stdin                              3953       -   -3953
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 3/1 up/down: 4221/-3960)        Total: 261 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-30 04:18:13 +02:00
Denys Vlasenko
d93f19e443 reorder parts of bbunzip.c, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-30 03:46:54 +02:00
Denys Vlasenko
602ce69afb unxz: new applet, complete with xzcat and xz -d aliases
function                                             old     new   delta
unpack_xz_stream_stdin                                 -    3953   +3953
lzma_main                                              -    2601   +2601
lzma_len                                               -     516    +516
dec_vli                                                -     165    +165
dict_repeat                                            -     103    +103
lzma_reset                                             -      98     +98
fill_temp                                              -      98     +98
crc32_validate                                         -      93     +93
xz_dec_reset                                           -      77     +77
unxz_main                                              -      77     +77
index_update                                           -      47     +47
xz_crc32                                               -      40     +40
packed_usage                                       27044   27060     +16
make_new_name_unxz                                     -      14     +14
applet_names                                        2240    2254     +14
applet_main                                         1312    1324     +12
applet_nameofs                                       656     662      +6
unpack_unxz                                            -       5      +5
send_tree                                            355     360      +5
applet_install_loc                                   164     166      +2
------------------------------------------------------------------------------
(add/remove: 15/0 grow/shrink: 6/0 up/down: 7942/0)          Total: 7942 bytes
   text    data     bss     dec     hex filename
 844032     453    6812  851297   cfd61 busybox_old
 852063     453    6812  859328   d1cc0 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-30 03:35:18 +02:00
Denys Vlasenko
e04c867a21 rename FEATURE_LZMA_ALIAS to just LZMA
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-30 03:33:50 +02:00
Bernhard Reutner-Fischer
7bdfb7cbf0 bbunzip: silence warning about unused variable
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-05-27 15:39:01 +02:00
Denys Vlasenko
ccb88a689e unlzma: add "lzma -d" alias, add -t support, rename lzmacat->lzcat
Also coalesce some common strings

   text    data     bss     dec     hex filename
 844110     453    6812  851375   cfdaf busybox_old
 844061     453    6812  851326   cfd7e busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-27 02:22:54 +02:00
Denys Vlasenko
dcbfaba264 fix improper utimes usage
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-29 19:40:36 +01:00
Denys Vlasenko
389cca4b9e some non-gnu compilers can't have non-const struct initializers
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-15 02:28:56 +01:00
Bernhard Reutner-Fischer
cc8b6871a7 use utimes() rather than obsolescent utime()
utime is obsolescent in POSIX.1-2008, use utimes() for now.
Untested.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2009-11-14 23:35:00 +01:00
Denys Vlasenko
dcd27abcc4 unpackers: check errors from close() too
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-05 03:03:07 +02:00
Denis Vlasenko
5e34ff29bc *: mass renaming of USE_XXXX to IF_XXXX
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially
badly named. It was not skipping anything!
2009-04-21 11:09:40 +00:00
Denis Vlasenko
1a9e9bdd93 gunzip: restore mtime. approx +80 bytes of code
rpm: make code more robust
lsmod: small code shrink
2008-11-01 12:54:56 +00:00
Denis Vlasenko
e9ad84dfd4 *: refactor handling of archived files. "tar f file.tar.lzma" now works too.
function                                             old     new   delta
unpack_Z_stream                                        -    1229   +1229
open_zipped                                            -     176    +176
unpack_bz2_stream_prime                                -      60     +60
tar_main                                             642     677     +35
find_main                                            406     418     +12
sv_main                                             1222    1233     +11
decode_format_string                                 829     837      +8
cmp_main                                             641     649      +8
popstring                                            134     140      +6
filter_accept_list_reassign                          120     125      +5
parse_and_put_prompt                                 800     804      +4
passwd_main                                         1053    1049      -4
make_new_name_gunzip                                 119     114      -5
rpm_main                                            1688    1670     -18
prepare                                              302     283     -19
xmalloc_open_zipped_read_close                       135      61     -74
uncompress                                          1229       -   -1229
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 8/5 up/down: 1554/-1349)        Total: 205 bytes
2008-08-05 13:10:34 +00:00
Denis Vlasenko
a60f84ebf0 *: rename ATTRIBUTE_XXX to just XXX. 2008-07-05 09:18:54 +00:00
Denis Vlasenko
defc1ea340 *: introduce and use FAST_FUNC: regparm on i386, otherwise no-on
text    data     bss     dec     hex filename
 808035     611    6868  815514   c719a busybox_old
 804472     611    6868  811951   c63af busybox_unstripped
2008-06-27 02:52:20 +00:00
Denis Vlasenko
a04cc47f1c b[un]zip2, g[un]zip: unlink destination if -f is given. Closes 3854 2008-06-25 20:54:45 +00:00
Denis Vlasenko
5297809c03 g[un]zip: accept and ignore -n (needed for kernel compile) 2008-03-30 13:11:47 +00:00