aboutsummaryrefslogtreecommitdiff
path: root/archival/bbunzip.c
AgeCommit message (Collapse)Author
2019-11-08unxz: show -t in --helpDenys Vlasenko
function old new delta packed_usage 33236 33247 +11 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-07-02libbb: reduce the overhead of single parameter bb_error_msg() callsJames Byrne
Back in 2007, commit 0c97c9d43707 ("'simple' error message functions by Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower overhead call to bb_perror_msg() when only a string was being printed with no parameters. This saves space for some CPU architectures because it avoids the overhead of a call to a variadic function. However there has never been a simple version of bb_error_msg(), and since 2007 many new calls to bb_perror_msg() have been added that only take a single parameter and so could have been using bb_simple_perror_message(). This changeset introduces 'simple' versions of bb_info_msg(), bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and bb_herror_msg_and_die(), and replaces all calls that only take a single parameter, or use something like ("%s", arg), with calls to the corresponding 'simple' version. Since it is likely that single parameter calls to the variadic functions may be accidentally reintroduced in the future a new debugging config option WARN_SIMPLE_MSG has been introduced. This uses some macro magic which will cause any such calls to generate a warning, but this is turned off by default to avoid use of the unpleasant macros in normal circumstances. This is a large changeset due to the number of calls that have been replaced. The only files that contain changes other than simple substitution of function calls are libbb.h, libbb/herror_msg.c, libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c, networking/udhcp/common.h and util-linux/mdev.c additonal macros have been added for logging so that single parameter and multiple parameter logging variants exist. The amount of space saved varies considerably by architecture, and was found to be as follows (for 'defconfig' using GCC 7.4): Arm: -92 bytes MIPS: -52 bytes PPC: -1836 bytes x86_64: -938 bytes Note that for the MIPS architecture only an exception had to be made disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h) because it made these files larger on MIPS. Signed-off-by: James Byrne <james.byrne@origamienergy.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-28config: update size informationDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-01libarchive: move bbunpack constants to bb_archive.hDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-18regularize format of source file headers, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-08getopt32: remove applet_long_optionsDenys Vlasenko
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-02config: do not use `a' quoting in help textsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-21config: deindent all help textsDenys Vlasenko
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-20libarchive: FEATURE_LZMA_FAST should be visible if FEATURE_SEAMLESS_LZMADenys Vlasenko
While at it, tweak some config help texts. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-20bzcat,zcat: simplify code if gunzip/bunzip2 is not selectedDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-18Update menuconfig items with approximate applet sizesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-04bzcat: compile bunzip2_main() if BZCAT.Denys Vlasenko
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-03fixes for bugs found by make_single_applets.shDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-06-15archival: add option -k "keep" to gzip/bzip2/lzop, add -U "nokeep" to lzopDenys Vlasenko
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-01-29*: add comment about APPLET_ODDNAME formatDenys Vlasenko
It confused me more than once Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-10Big cleanup in config help and descriptionDenys Vlasenko
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-09unzip: optional support for bzip2 and lzmaDenys Vlasenko
function old new delta unzip_main 2376 2476 +100 bbunpack 750 745 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09Allow 'gzip -d' and 'bzip2 -d' without gunzip or bunzip2Kang-Che Sung
Idea copied from the "ip" applet. Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-08bunzip2: fix code bloat caused by zcat's seamless magicKang-Che Sung
This example single-applet configuration would trigger the bloat: CONFIG_FEATURE_SEAMLESS_XZ=y CONFIG_FEATURE_SEAMLESS_LZMA=y CONFIG_FEATURE_SEAMLESS_BZ2=y CONFIG_FEATURE_SEAMLESS_GZ=y CONFIG_BUNZIP2=y # CONFIG_ZCAT is not set # All other applets disabled Here, the resulting "busybox-bunzip2" binary would contain unpack_gz_stream, unpack_lzma_stream and unpack_xz_stream functions code. In other words, the gzip, lzma and xz decompressors' code are linked into the binary unnecessarily. This happens because SEAMLESS_MAGIC != 0 and compiler is unable to figure out that SEAMLESS_MAGIC bit is never set. Fix this by disabling SEAMLESS_MAGIC option flag (setting its value to 0) when zcat is disabled. This will help the compiler optimize out bbunpack() and no longer generate open_zipped() function call. Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-23fix breakage found by mass one-applet buildsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-08randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-16Make bzcat, lzcat, xzcat, zcat, lzopcat, unlzop individually selectableDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-06-20libarchive: fix xmalloc_open_zipped_read_close() on NOMMUDenys Vlasenko
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>
2015-10-27gzip: add support for --no-name long optionAaro Koskinen
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-27gunzip: add support for long optionsAaro Koskinen
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-25tweak defconfigDenys Vlasenko
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>
2014-12-07libarchive: add capability to unpack to mem.bufferDenys Vlasenko
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-07Rename transformer_aux_data_t -> transformer_state_tDenys Vlasenko
No code changes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-02zcat: complain if input is not compressedDenys Vlasenko
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>
2013-11-14archival/*: move "config:" snippets into .c filesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-14archival/*: move "applet:" snippets into .c files, part 2Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-14archival/*: move "applet:" snippets into .c filesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-14archival/*: move "kbuild:" snippets into .c filesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-30unpackers: by users' request, print compression percentage if -v and DESKTOPDenys Vlasenko
function old new delta bbunpack 634 731 +97 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-03archival: note implicit dependencies between lzop & bbunzipMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-02-28bbunzip: fix order of flags vs bit definesMike Frysinger
Too much code shuffling. Reported-by: Mandeep Singh Baines <msb@chromium.org> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-02-28bbunzip: ignore the -q flag with the decompressorsMike Frysinger
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-28zcat: fix "zcat FILE" trying to do detection twiceDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-28zcat: if seamless uncompressors are defined, autodetect file's formatDenys Vlasenko
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-28fix error message on failure to oen /dev/null; fix zcat's help textDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-06Move seamless .Z support into unpack_gz_streamDenys Vlasenko
unpack_gz_stream 566 643 +77 unpack_gunzip 123 12 -111 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-06update seamless uncompression codeDenys Vlasenko
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>
2011-10-31bzcat: fix unpacking of more than one file, and unpacking of zero-size bz2. ↵Denys Vlasenko
Closes 4393 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-22rename archive.h to bb_archive.h. no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05*: remove "Options:" string from help textsDenys Vlasenko
function old new delta packed_usage 28706 28623 -83 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-27move help text from include/usage.src.h to archival/*.cPere Orga
Signed-off-by: Pere Orga <gotrunks@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-18mass removal of underscores from _BB_DIR_foo and _BB_SUID_fooDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-03rename archival/libunarchive -> archival/libarchive; move bz/ into itDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-09tweak help textDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16*: make GNU licensing statement forms more regularDenys Vlasenko
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>