diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-08-05 13:10:34 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-08-05 13:10:34 +0000 |
| commit | e9ad84dfd4c7eb2936374f02989dacf7026a7276 (patch) | |
| tree | 37412d21c0a2ccec7c162e0fb42833058f5934e3 | |
| parent | 9b44613202a6f2f080ec23746d0680dcef88628d (diff) | |
| download | busybox-w32-e9ad84dfd4c7eb2936374f02989dacf7026a7276.tar.gz busybox-w32-e9ad84dfd4c7eb2936374f02989dacf7026a7276.tar.bz2 busybox-w32-e9ad84dfd4c7eb2936374f02989dacf7026a7276.zip | |
*: 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
| -rw-r--r-- | TODO_config_nommu | 86 | ||||
| -rw-r--r-- | archival/Config.in | 114 | ||||
| -rw-r--r-- | archival/bbunzip.c | 12 | ||||
| -rw-r--r-- | archival/dpkg.c | 8 | ||||
| -rw-r--r-- | archival/dpkg_deb.c | 4 | ||||
| -rw-r--r-- | archival/libunarchive/Kbuild | 26 | ||||
| -rw-r--r-- | archival/libunarchive/decompress_bunzip2.c | 29 | ||||
| -rw-r--r-- | archival/libunarchive/decompress_uncompress.c | 8 | ||||
| -rw-r--r-- | archival/libunarchive/filter_accept_list_reassign.c | 15 | ||||
| -rw-r--r-- | archival/libunarchive/get_header_tar.c | 4 | ||||
| -rw-r--r-- | archival/libunarchive/get_header_tar_bz2.c | 2 | ||||
| -rw-r--r-- | archival/rpm.c | 24 | ||||
| -rw-r--r-- | archival/tar.c | 92 | ||||
| -rw-r--r-- | include/libbb.h | 5 | ||||
| -rw-r--r-- | include/unarchive.h | 19 | ||||
| -rw-r--r-- | include/usage.h | 14 | ||||
| -rw-r--r-- | libbb/appletlib.c | 3 | ||||
| -rw-r--r-- | libbb/read.c | 89 | ||||
| -rw-r--r-- | modutils/Config.in | 7 | ||||
| -rw-r--r-- | modutils/modprobe-small.c | 12 | ||||
| -rw-r--r-- | scripts/defconfig | 70 |
21 files changed, 324 insertions, 319 deletions
diff --git a/TODO_config_nommu b/TODO_config_nommu index 308e5d7fa..90bd5b24a 100644 --- a/TODO_config_nommu +++ b/TODO_config_nommu | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | # | 1 | # |
| 2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
| 3 | # Busybox version: 1.11.0.svn | 3 | # Busybox version: 1.12.0.svn |
| 4 | # Mon Apr 21 23:20:35 2008 | 4 | # Tue Aug 5 14:43:04 2008 |
| 5 | # | 5 | # |
| 6 | CONFIG_HAVE_DOT_CONFIG=y | 6 | CONFIG_HAVE_DOT_CONFIG=y |
| 7 | 7 | ||
| @@ -13,6 +13,7 @@ CONFIG_HAVE_DOT_CONFIG=y | |||
| 13 | # General Configuration | 13 | # General Configuration |
| 14 | # | 14 | # |
| 15 | CONFIG_DESKTOP=y | 15 | CONFIG_DESKTOP=y |
| 16 | CONFIG_FEATURE_ASSUME_UNICODE=y | ||
| 16 | CONFIG_FEATURE_BUFFERS_USE_MALLOC=y | 17 | CONFIG_FEATURE_BUFFERS_USE_MALLOC=y |
| 17 | # CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set | 18 | # CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set |
| 18 | # CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set | 19 | # CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set |
| @@ -38,21 +39,25 @@ CONFIG_FEATURE_HAVE_RPC=y | |||
| 38 | # Build Options | 39 | # Build Options |
| 39 | # | 40 | # |
| 40 | # CONFIG_STATIC is not set | 41 | # CONFIG_STATIC is not set |
| 42 | # CONFIG_PIE is not set | ||
| 41 | CONFIG_NOMMU=y | 43 | CONFIG_NOMMU=y |
| 42 | # CONFIG_BUILD_LIBBUSYBOX is not set | 44 | # CONFIG_BUILD_LIBBUSYBOX is not set |
| 43 | # CONFIG_FEATURE_INDIVIDUAL is not set | 45 | # CONFIG_FEATURE_INDIVIDUAL is not set |
| 44 | # CONFIG_FEATURE_SHARED_BUSYBOX is not set | 46 | # CONFIG_FEATURE_SHARED_BUSYBOX is not set |
| 45 | CONFIG_LFS=y | 47 | CONFIG_LFS=y |
| 48 | CONFIG_CROSS_COMPILER_PREFIX="" | ||
| 46 | 49 | ||
| 47 | # | 50 | # |
| 48 | # Debugging Options | 51 | # Debugging Options |
| 49 | # | 52 | # |
| 50 | # CONFIG_DEBUG is not set | 53 | # CONFIG_DEBUG is not set |
| 54 | # CONFIG_DEBUG_PESSIMIZE is not set | ||
| 51 | # CONFIG_WERROR is not set | 55 | # CONFIG_WERROR is not set |
| 52 | CONFIG_NO_DEBUG_LIB=y | 56 | CONFIG_NO_DEBUG_LIB=y |
| 53 | # CONFIG_DMALLOC is not set | 57 | # CONFIG_DMALLOC is not set |
| 54 | # CONFIG_EFENCE is not set | 58 | # CONFIG_EFENCE is not set |
| 55 | CONFIG_INCLUDE_SUSv2=y | 59 | CONFIG_INCLUDE_SUSv2=y |
| 60 | # CONFIG_PARSE is not set | ||
| 56 | 61 | ||
| 57 | # | 62 | # |
| 58 | # Installation Options | 63 | # Installation Options |
| @@ -86,6 +91,7 @@ CONFIG_FEATURE_VERBOSE_CP_MESSAGE=y | |||
| 86 | CONFIG_FEATURE_COPYBUF_KB=4 | 91 | CONFIG_FEATURE_COPYBUF_KB=4 |
| 87 | CONFIG_MONOTONIC_SYSCALL=y | 92 | CONFIG_MONOTONIC_SYSCALL=y |
| 88 | CONFIG_IOCTL_HEX2STR_ERROR=y | 93 | CONFIG_IOCTL_HEX2STR_ERROR=y |
| 94 | CONFIG_FEATURE_HWIB=y | ||
| 89 | 95 | ||
| 90 | # | 96 | # |
| 91 | # Applets | 97 | # Applets |
| @@ -94,6 +100,10 @@ CONFIG_IOCTL_HEX2STR_ERROR=y | |||
| 94 | # | 100 | # |
| 95 | # Archival Utilities | 101 | # Archival Utilities |
| 96 | # | 102 | # |
| 103 | CONFIG_FEATURE_SEAMLESS_LZMA=y | ||
| 104 | CONFIG_FEATURE_SEAMLESS_BZ2=y | ||
| 105 | CONFIG_FEATURE_SEAMLESS_GZ=y | ||
| 106 | CONFIG_FEATURE_SEAMLESS_Z=y | ||
| 97 | CONFIG_AR=y | 107 | CONFIG_AR=y |
| 98 | CONFIG_FEATURE_AR_LONG_FILENAMES=y | 108 | CONFIG_FEATURE_AR_LONG_FILENAMES=y |
| 99 | CONFIG_BUNZIP2=y | 109 | CONFIG_BUNZIP2=y |
| @@ -104,17 +114,11 @@ CONFIG_DPKG=y | |||
| 104 | CONFIG_DPKG_DEB=y | 114 | CONFIG_DPKG_DEB=y |
| 105 | CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY=y | 115 | CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY=y |
| 106 | CONFIG_GUNZIP=y | 116 | CONFIG_GUNZIP=y |
| 107 | CONFIG_FEATURE_GUNZIP_UNCOMPRESS=y | ||
| 108 | CONFIG_GZIP=y | 117 | CONFIG_GZIP=y |
| 109 | CONFIG_RPM2CPIO=y | 118 | CONFIG_RPM2CPIO=y |
| 110 | CONFIG_RPM=y | 119 | CONFIG_RPM=y |
| 111 | CONFIG_FEATURE_RPM_BZ2=y | ||
| 112 | CONFIG_TAR=y | 120 | CONFIG_TAR=y |
| 113 | CONFIG_FEATURE_TAR_CREATE=y | 121 | CONFIG_FEATURE_TAR_CREATE=y |
| 114 | CONFIG_FEATURE_TAR_GZIP=y | ||
| 115 | CONFIG_FEATURE_TAR_BZIP2=y | ||
| 116 | CONFIG_FEATURE_TAR_LZMA=y | ||
| 117 | CONFIG_FEATURE_TAR_COMPRESS=y | ||
| 118 | CONFIG_FEATURE_TAR_AUTODETECT=y | 122 | CONFIG_FEATURE_TAR_AUTODETECT=y |
| 119 | CONFIG_FEATURE_TAR_FROM=y | 123 | CONFIG_FEATURE_TAR_FROM=y |
| 120 | CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y | 124 | CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y |
| @@ -128,17 +132,6 @@ CONFIG_FEATURE_LZMA_FAST=y | |||
| 128 | CONFIG_UNZIP=y | 132 | CONFIG_UNZIP=y |
| 129 | 133 | ||
| 130 | # | 134 | # |
| 131 | # Common options for cpio and tar | ||
| 132 | # | ||
| 133 | |||
| 134 | # | ||
| 135 | # Common options for dpkg and dpkg_deb | ||
| 136 | # | ||
| 137 | CONFIG_FEATURE_DEB_TAR_GZ=y | ||
| 138 | CONFIG_FEATURE_DEB_TAR_BZ2=y | ||
| 139 | CONFIG_FEATURE_DEB_TAR_LZMA=y | ||
| 140 | |||
| 141 | # | ||
| 142 | # Coreutils | 135 | # Coreutils |
| 143 | # | 136 | # |
| 144 | CONFIG_BASENAME=y | 137 | CONFIG_BASENAME=y |
| @@ -216,6 +209,7 @@ CONFIG_SEQ=y | |||
| 216 | CONFIG_SHA1SUM=y | 209 | CONFIG_SHA1SUM=y |
| 217 | CONFIG_SLEEP=y | 210 | CONFIG_SLEEP=y |
| 218 | CONFIG_FEATURE_FANCY_SLEEP=y | 211 | CONFIG_FEATURE_FANCY_SLEEP=y |
| 212 | CONFIG_FEATURE_FLOAT_SLEEP=y | ||
| 219 | CONFIG_SORT=y | 213 | CONFIG_SORT=y |
| 220 | CONFIG_FEATURE_SORT_BIG=y | 214 | CONFIG_FEATURE_SORT_BIG=y |
| 221 | CONFIG_SPLIT=y | 215 | CONFIG_SPLIT=y |
| @@ -386,8 +380,9 @@ CONFIG_MESG=y | |||
| 386 | # Login/Password Management Utilities | 380 | # Login/Password Management Utilities |
| 387 | # | 381 | # |
| 388 | CONFIG_FEATURE_SHADOWPASSWDS=y | 382 | CONFIG_FEATURE_SHADOWPASSWDS=y |
| 389 | CONFIG_USE_BB_SHADOW=y | ||
| 390 | CONFIG_USE_BB_PWD_GRP=y | 383 | CONFIG_USE_BB_PWD_GRP=y |
| 384 | CONFIG_USE_BB_SHADOW=y | ||
| 385 | CONFIG_USE_BB_CRYPT=y | ||
| 391 | CONFIG_ADDGROUP=y | 386 | CONFIG_ADDGROUP=y |
| 392 | CONFIG_FEATURE_ADDUSER_TO_GROUP=y | 387 | CONFIG_FEATURE_ADDUSER_TO_GROUP=y |
| 393 | CONFIG_DELGROUP=y | 388 | CONFIG_DELGROUP=y |
| @@ -424,25 +419,30 @@ CONFIG_LSATTR=y | |||
| 424 | # | 419 | # |
| 425 | # Linux Module Utilities | 420 | # Linux Module Utilities |
| 426 | # | 421 | # |
| 427 | CONFIG_INSMOD=y | 422 | CONFIG_MODPROBE_SMALL=y |
| 428 | CONFIG_FEATURE_INSMOD_VERSION_CHECKING=y | 423 | CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE=y |
| 429 | CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS=y | 424 | CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED=y |
| 430 | CONFIG_FEATURE_INSMOD_LOADINKMEM=y | 425 | # CONFIG_DEPMOD is not set |
| 431 | CONFIG_FEATURE_INSMOD_LOAD_MAP=y | 426 | # CONFIG_FEATURE_DEPMOD_PRUNE_FANCY is not set |
| 432 | CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL=y | 427 | # CONFIG_FEATURE_DEPMOD_ALIAS is not set |
| 433 | CONFIG_RMMOD=y | 428 | # CONFIG_INSMOD is not set |
| 434 | CONFIG_LSMOD=y | 429 | # CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set |
| 435 | CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT=y | 430 | # CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set |
| 436 | CONFIG_MODPROBE=y | 431 | # CONFIG_FEATURE_INSMOD_LOADINKMEM is not set |
| 437 | CONFIG_FEATURE_MODPROBE_MULTIPLE_OPTIONS=y | 432 | # CONFIG_FEATURE_INSMOD_LOAD_MAP is not set |
| 438 | CONFIG_FEATURE_MODPROBE_FANCY_ALIAS=y | 433 | # CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set |
| 439 | 434 | # CONFIG_RMMOD is not set | |
| 440 | # | 435 | # CONFIG_LSMOD is not set |
| 441 | # Options common to multiple modutils | 436 | # CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set |
| 442 | # | 437 | # CONFIG_MODPROBE is not set |
| 443 | CONFIG_FEATURE_CHECK_TAINTED_MODULE=y | 438 | # CONFIG_FEATURE_MODPROBE_MULTIPLE_OPTIONS is not set |
| 444 | CONFIG_FEATURE_2_4_MODULES=y | 439 | # CONFIG_FEATURE_MODPROBE_FANCY_ALIAS is not set |
| 445 | CONFIG_FEATURE_2_6_MODULES=y | 440 | # CONFIG_FEATURE_MODPROBE_BLACKLIST is not set |
| 441 | # CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set | ||
| 442 | # CONFIG_FEATURE_2_4_MODULES is not set | ||
| 443 | # CONFIG_FEATURE_2_6_MODULES is not set | ||
| 444 | CONFIG_DEFAULT_MODULES_DIR="/lib/modules" | ||
| 445 | CONFIG_DEFAULT_DEPMOD_FILE="modules.dep" | ||
| 446 | # CONFIG_FEATURE_QUERY_MODULE_INTERFACE is not set | 446 | # CONFIG_FEATURE_QUERY_MODULE_INTERFACE is not set |
| 447 | 447 | ||
| 448 | # | 448 | # |
| @@ -525,6 +525,7 @@ CONFIG_RTCWAKE=y | |||
| 525 | CONFIG_SCRIPT=y | 525 | CONFIG_SCRIPT=y |
| 526 | CONFIG_SETARCH=y | 526 | CONFIG_SETARCH=y |
| 527 | CONFIG_SWAPONOFF=y | 527 | CONFIG_SWAPONOFF=y |
| 528 | CONFIG_FEATURE_SWAPON_PRI=y | ||
| 528 | CONFIG_SWITCH_ROOT=y | 529 | CONFIG_SWITCH_ROOT=y |
| 529 | CONFIG_UMOUNT=y | 530 | CONFIG_UMOUNT=y |
| 530 | CONFIG_FEATURE_UMOUNT_ALL=y | 531 | CONFIG_FEATURE_UMOUNT_ALL=y |
| @@ -562,7 +563,10 @@ CONFIG_DC=y | |||
| 562 | CONFIG_EJECT=y | 563 | CONFIG_EJECT=y |
| 563 | CONFIG_FEATURE_EJECT_SCSI=y | 564 | CONFIG_FEATURE_EJECT_SCSI=y |
| 564 | CONFIG_FBSPLASH=y | 565 | CONFIG_FBSPLASH=y |
| 566 | CONFIG_INOTIFYD=y | ||
| 565 | CONFIG_LAST=y | 567 | CONFIG_LAST=y |
| 568 | CONFIG_FEATURE_LAST_SMALL=y | ||
| 569 | # CONFIG_FEATURE_LAST_FANCY is not set | ||
| 566 | CONFIG_LESS=y | 570 | CONFIG_LESS=y |
| 567 | CONFIG_FEATURE_LESS_MAXLINES=9999999 | 571 | CONFIG_FEATURE_LESS_MAXLINES=9999999 |
| 568 | CONFIG_FEATURE_LESS_BRACKETS=y | 572 | CONFIG_FEATURE_LESS_BRACKETS=y |
| @@ -590,7 +594,6 @@ CONFIG_RUNLEVEL=y | |||
| 590 | CONFIG_RX=y | 594 | CONFIG_RX=y |
| 591 | CONFIG_SETSID=y | 595 | CONFIG_SETSID=y |
| 592 | CONFIG_STRINGS=y | 596 | CONFIG_STRINGS=y |
| 593 | CONFIG_SYMLINKS=y | ||
| 594 | CONFIG_TASKSET=y | 597 | CONFIG_TASKSET=y |
| 595 | CONFIG_FEATURE_TASKSET_FANCY=y | 598 | CONFIG_FEATURE_TASKSET_FANCY=y |
| 596 | CONFIG_TIME=y | 599 | CONFIG_TIME=y |
| @@ -675,6 +678,7 @@ CONFIG_NC_SERVER=y | |||
| 675 | CONFIG_NC_EXTRA=y | 678 | CONFIG_NC_EXTRA=y |
| 676 | CONFIG_NETSTAT=y | 679 | CONFIG_NETSTAT=y |
| 677 | CONFIG_FEATURE_NETSTAT_WIDE=y | 680 | CONFIG_FEATURE_NETSTAT_WIDE=y |
| 681 | CONFIG_FEATURE_NETSTAT_PRG=y | ||
| 678 | CONFIG_NSLOOKUP=y | 682 | CONFIG_NSLOOKUP=y |
| 679 | CONFIG_PING=y | 683 | CONFIG_PING=y |
| 680 | CONFIG_PING6=y | 684 | CONFIG_PING6=y |
| @@ -765,6 +769,7 @@ CONFIG_FEATURE_SH_IS_NONE=y | |||
| 765 | # CONFIG_ASH_MATH_SUPPORT_64 is not set | 769 | # CONFIG_ASH_MATH_SUPPORT_64 is not set |
| 766 | # CONFIG_ASH_GETOPTS is not set | 770 | # CONFIG_ASH_GETOPTS is not set |
| 767 | # CONFIG_ASH_BUILTIN_ECHO is not set | 771 | # CONFIG_ASH_BUILTIN_ECHO is not set |
| 772 | # CONFIG_ASH_BUILTIN_PRINTF is not set | ||
| 768 | # CONFIG_ASH_BUILTIN_TEST is not set | 773 | # CONFIG_ASH_BUILTIN_TEST is not set |
| 769 | # CONFIG_ASH_CMDCMD is not set | 774 | # CONFIG_ASH_CMDCMD is not set |
| 770 | # CONFIG_ASH_MAIL is not set | 775 | # CONFIG_ASH_MAIL is not set |
| @@ -778,6 +783,7 @@ CONFIG_HUSH_JOB=y | |||
| 778 | CONFIG_HUSH_TICK=y | 783 | CONFIG_HUSH_TICK=y |
| 779 | CONFIG_HUSH_IF=y | 784 | CONFIG_HUSH_IF=y |
| 780 | CONFIG_HUSH_LOOPS=y | 785 | CONFIG_HUSH_LOOPS=y |
| 786 | CONFIG_HUSH_CASE=y | ||
| 781 | CONFIG_LASH=y | 787 | CONFIG_LASH=y |
| 782 | CONFIG_MSH=y | 788 | CONFIG_MSH=y |
| 783 | 789 | ||
diff --git a/archival/Config.in b/archival/Config.in index b26be6486..d6332a2b2 100644 --- a/archival/Config.in +++ b/archival/Config.in | |||
| @@ -5,6 +5,30 @@ | |||
| 5 | 5 | ||
| 6 | menu "Archival Utilities" | 6 | menu "Archival Utilities" |
| 7 | 7 | ||
| 8 | config FEATURE_SEAMLESS_LZMA | ||
| 9 | bool "Make tar, rpm, man, modprobe etc understand .lzma data" | ||
| 10 | default n | ||
| 11 | help | ||
| 12 | Make tar, rpm, man, modprobe etc understand .lzma data. | ||
| 13 | |||
| 14 | config FEATURE_SEAMLESS_BZ2 | ||
| 15 | bool "Make tar, rpm, man, modprobe etc understand .bz2 data" | ||
| 16 | default n | ||
| 17 | help | ||
| 18 | Make tar, rpm, man, modprobe etc understand .bz2 data. | ||
| 19 | |||
| 20 | config FEATURE_SEAMLESS_GZ | ||
| 21 | bool "Make tar, rpm, man, modprobe etc understand .gz data" | ||
| 22 | default n | ||
| 23 | help | ||
| 24 | Make tar, rpm, man, modprobe etc understand .gz data. | ||
| 25 | |||
| 26 | config FEATURE_SEAMLESS_Z | ||
| 27 | bool "Make tar and gunzip understand .Z data" | ||
| 28 | default n | ||
| 29 | help | ||
| 30 | Make tar and gunzip understand .Z data. | ||
| 31 | |||
| 8 | config AR | 32 | config AR |
| 9 | bool "ar" | 33 | bool "ar" |
| 10 | default n | 34 | default n |
| @@ -126,15 +150,6 @@ config GUNZIP | |||
| 126 | You can use the `-t' option to test the integrity of | 150 | You can use the `-t' option to test the integrity of |
| 127 | an archive, without decompressing it. | 151 | an archive, without decompressing it. |
| 128 | 152 | ||
| 129 | config FEATURE_GUNZIP_UNCOMPRESS | ||
| 130 | bool "Uncompress support" | ||
| 131 | default n | ||
| 132 | depends on GUNZIP | ||
| 133 | help | ||
| 134 | Enable if you want gunzip to have the ability to decompress | ||
| 135 | archives created by the program compress (not much | ||
| 136 | used anymore). | ||
| 137 | |||
| 138 | config GZIP | 153 | config GZIP |
| 139 | bool "gzip" | 154 | bool "gzip" |
| 140 | default n | 155 | default n |
| @@ -154,13 +169,6 @@ config RPM | |||
| 154 | help | 169 | help |
| 155 | Mini RPM applet - queries and extracts RPM packages. | 170 | Mini RPM applet - queries and extracts RPM packages. |
| 156 | 171 | ||
| 157 | config FEATURE_RPM_BZ2 | ||
| 158 | bool "Enable handling of rpms with bzip2-compressed data inside" | ||
| 159 | default n | ||
| 160 | depends on RPM | ||
| 161 | help | ||
| 162 | Enable handling of rpms with bzip2-compressed data inside. | ||
| 163 | |||
| 164 | config TAR | 172 | config TAR |
| 165 | bool "tar" | 173 | bool "tar" |
| 166 | default n | 174 | default n |
| @@ -179,42 +187,10 @@ config FEATURE_TAR_CREATE | |||
| 179 | If you enable this option you'll be able to create | 187 | If you enable this option you'll be able to create |
| 180 | tar archives using the `-c' option. | 188 | tar archives using the `-c' option. |
| 181 | 189 | ||
| 182 | config FEATURE_TAR_GZIP | ||
| 183 | bool "Enable -z option" | ||
| 184 | default y | ||
| 185 | depends on TAR | ||
| 186 | help | ||
| 187 | If you enable this option tar will be able to call gzip, | ||
| 188 | when creating or extracting tar gziped archives. | ||
| 189 | |||
| 190 | config FEATURE_TAR_BZIP2 | ||
| 191 | bool "Enable -j option to handle .tar.bz2 files" | ||
| 192 | default n | ||
| 193 | depends on TAR | ||
| 194 | help | ||
| 195 | If you enable this option you'll be able to extract | ||
| 196 | archives compressed with bzip2. | ||
| 197 | |||
| 198 | config FEATURE_TAR_LZMA | ||
| 199 | bool "Enable -a option to handle .tar.lzma files" | ||
| 200 | default n | ||
| 201 | depends on TAR | ||
| 202 | help | ||
| 203 | If you enable this option you'll be able to extract | ||
| 204 | archives compressed with lzma. | ||
| 205 | |||
| 206 | config FEATURE_TAR_COMPRESS | ||
| 207 | bool "Enable -Z option" | ||
| 208 | default n | ||
| 209 | depends on TAR | ||
| 210 | help | ||
| 211 | If you enable this option tar will be able to call uncompress, | ||
| 212 | when extracting .tar.Z archives. | ||
| 213 | |||
| 214 | config FEATURE_TAR_AUTODETECT | 190 | config FEATURE_TAR_AUTODETECT |
| 215 | bool "Autodetect gz/bz2 compresses tarballs" | 191 | bool "Autodetect gz/bz2 compressed tarballs" |
| 216 | default n | 192 | default n |
| 217 | depends on FEATURE_TAR_GZIP || FEATURE_TAR_BZIP2 | 193 | depends on FEATURE_SEAMLESS_Z || FEATURE_SEAMLESS_GZ || FEATURE_SEAMLESS_BZ2 || FEATURE_SEAMLESS_LZMA |
| 218 | help | 194 | help |
| 219 | With this option tar can automatically detect gzip/bzip2 compressed | 195 | With this option tar can automatically detect gzip/bzip2 compressed |
| 220 | tarballs. Currently it works only on files (not pipes etc). | 196 | tarballs. Currently it works only on files (not pipes etc). |
| @@ -312,42 +288,4 @@ config UNZIP | |||
| 312 | current directory. Use the `-d' option to extract to a | 288 | current directory. Use the `-d' option to extract to a |
| 313 | directory of your choice. | 289 | directory of your choice. |
| 314 | 290 | ||
| 315 | comment "Common options for cpio and tar" | ||
| 316 | depends on CPIO || TAR | ||
| 317 | |||
| 318 | comment "Common options for dpkg and dpkg_deb" | ||
| 319 | depends on DPKG || DPKG_DEB | ||
| 320 | |||
| 321 | config FEATURE_DEB_TAR_GZ | ||
| 322 | bool "gzip debian packages (normal)" | ||
| 323 | default y if DPKG || DPKG_DEB | ||
| 324 | depends on DPKG || DPKG_DEB | ||
| 325 | help | ||
| 326 | This is the default compression method inside the debian ar file. | ||
| 327 | |||
| 328 | If you want compatibility with standard .deb's you should say yes | ||
| 329 | here. | ||
| 330 | |||
| 331 | config FEATURE_DEB_TAR_BZ2 | ||
| 332 | bool "bzip2 debian packages" | ||
| 333 | default n | ||
| 334 | depends on DPKG || DPKG_DEB | ||
| 335 | help | ||
| 336 | This allows dpkg and dpkg-deb to extract deb's that are compressed | ||
| 337 | internally with bzip2 instead of gzip. | ||
| 338 | |||
| 339 | You only want this if you are creating your own custom debian | ||
| 340 | packages that use an internal control.tar.bz2 or data.tar.bz2. | ||
| 341 | |||
| 342 | config FEATURE_DEB_TAR_LZMA | ||
| 343 | bool "lzma debian packages" | ||
| 344 | default n | ||
| 345 | depends on DPKG || DPKG_DEB | ||
| 346 | help | ||
| 347 | This allows dpkg and dpkg-deb to extract deb's that are compressed | ||
| 348 | internally with lzma instead of gzip. | ||
| 349 | |||
| 350 | You only want this if you are creating your own custom debian | ||
| 351 | packages that use an internal control.tar.lzma or data.tar.lzma. | ||
| 352 | |||
| 353 | endmenu | 291 | endmenu |
diff --git a/archival/bbunzip.c b/archival/bbunzip.c index 65bb8b7f4..c7962058e 100644 --- a/archival/bbunzip.c +++ b/archival/bbunzip.c | |||
| @@ -161,7 +161,7 @@ char* make_new_name_bunzip2(char *filename) | |||
| 161 | static | 161 | static |
| 162 | USE_DESKTOP(long long) int unpack_bunzip2(void) | 162 | USE_DESKTOP(long long) int unpack_bunzip2(void) |
| 163 | { | 163 | { |
| 164 | return unpack_bz2_stream(STDIN_FILENO, STDOUT_FILENO); | 164 | return unpack_bz2_stream_prime(STDIN_FILENO, STDOUT_FILENO); |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 167 | int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
| @@ -218,8 +218,8 @@ char* make_new_name_gunzip(char *filename) | |||
| 218 | 218 | ||
| 219 | extension++; | 219 | extension++; |
| 220 | if (strcmp(extension, "tgz" + 1) == 0 | 220 | if (strcmp(extension, "tgz" + 1) == 0 |
| 221 | #if ENABLE_FEATURE_GUNZIP_UNCOMPRESS | 221 | #if ENABLE_FEATURE_SEAMLESS_Z |
| 222 | || strcmp(extension, "Z") == 0 | 222 | || (extension[0] == 'Z' && extension[1] == '\0') |
| 223 | #endif | 223 | #endif |
| 224 | ) { | 224 | ) { |
| 225 | extension[-1] = '\0'; | 225 | extension[-1] = '\0'; |
| @@ -244,8 +244,8 @@ USE_DESKTOP(long long) int unpack_gunzip(void) | |||
| 244 | unsigned char magic2; | 244 | unsigned char magic2; |
| 245 | 245 | ||
| 246 | magic2 = xread_char(STDIN_FILENO); | 246 | magic2 = xread_char(STDIN_FILENO); |
| 247 | if (ENABLE_FEATURE_GUNZIP_UNCOMPRESS && magic2 == 0x9d) { | 247 | if (ENABLE_FEATURE_SEAMLESS_Z && magic2 == 0x9d) { |
| 248 | status = uncompress(STDIN_FILENO, STDOUT_FILENO); | 248 | status = unpack_Z_stream(STDIN_FILENO, STDOUT_FILENO); |
| 249 | } else if (magic2 == 0x8b) { | 249 | } else if (magic2 == 0x8b) { |
| 250 | status = unpack_gz_stream(STDIN_FILENO, STDOUT_FILENO); | 250 | status = unpack_gz_stream(STDIN_FILENO, STDOUT_FILENO); |
| 251 | } else { | 251 | } else { |
| @@ -351,7 +351,7 @@ USE_DESKTOP(long long) int unpack_uncompress(void) | |||
| 351 | if ((xread_char(STDIN_FILENO) != 0x1f) || (xread_char(STDIN_FILENO) != 0x9d)) { | 351 | if ((xread_char(STDIN_FILENO) != 0x1f) || (xread_char(STDIN_FILENO) != 0x9d)) { |
| 352 | bb_error_msg("invalid magic"); | 352 | bb_error_msg("invalid magic"); |
| 353 | } else { | 353 | } else { |
| 354 | status = uncompress(STDIN_FILENO, STDOUT_FILENO); | 354 | status = unpack_Z_stream(STDIN_FILENO, STDOUT_FILENO); |
| 355 | } | 355 | } |
| 356 | return status; | 356 | return status; |
| 357 | } | 357 | } |
diff --git a/archival/dpkg.c b/archival/dpkg.c index 54e963233..f31a7f017 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c | |||
| @@ -1438,10 +1438,10 @@ static void init_archive_deb_control(archive_handle_t *ar_handle) | |||
| 1438 | tar_handle->src_fd = ar_handle->src_fd; | 1438 | tar_handle->src_fd = ar_handle->src_fd; |
| 1439 | 1439 | ||
| 1440 | /* We don't care about data.tar.* or debian-binary, just control.tar.* */ | 1440 | /* We don't care about data.tar.* or debian-binary, just control.tar.* */ |
| 1441 | #if ENABLE_FEATURE_DEB_TAR_GZ | 1441 | #if ENABLE_FEATURE_SEAMLESS_GZ |
| 1442 | llist_add_to(&(ar_handle->accept), (char*)"control.tar.gz"); | 1442 | llist_add_to(&(ar_handle->accept), (char*)"control.tar.gz"); |
| 1443 | #endif | 1443 | #endif |
| 1444 | #if ENABLE_FEATURE_DEB_TAR_BZ2 | 1444 | #if ENABLE_FEATURE_SEAMLESS_BZ2 |
| 1445 | llist_add_to(&(ar_handle->accept), (char*)"control.tar.bz2"); | 1445 | llist_add_to(&(ar_handle->accept), (char*)"control.tar.bz2"); |
| 1446 | #endif | 1446 | #endif |
| 1447 | 1447 | ||
| @@ -1458,10 +1458,10 @@ static void init_archive_deb_data(archive_handle_t *ar_handle) | |||
| 1458 | tar_handle->src_fd = ar_handle->src_fd; | 1458 | tar_handle->src_fd = ar_handle->src_fd; |
| 1459 | 1459 | ||
| 1460 | /* We don't care about control.tar.* or debian-binary, just data.tar.* */ | 1460 | /* We don't care about control.tar.* or debian-binary, just data.tar.* */ |
| 1461 | #if ENABLE_FEATURE_DEB_TAR_GZ | 1461 | #if ENABLE_FEATURE_SEAMLESS_GZ |
| 1462 | llist_add_to(&(ar_handle->accept), (char*)"data.tar.gz"); | 1462 | llist_add_to(&(ar_handle->accept), (char*)"data.tar.gz"); |
| 1463 | #endif | 1463 | #endif |
| 1464 | #if ENABLE_FEATURE_DEB_TAR_BZ2 | 1464 | #if ENABLE_FEATURE_SEAMLESS_BZ2 |
| 1465 | llist_add_to(&(ar_handle->accept), (char*)"data.tar.bz2"); | 1465 | llist_add_to(&(ar_handle->accept), (char*)"data.tar.bz2"); |
| 1466 | #endif | 1466 | #endif |
| 1467 | 1467 | ||
diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c index 9e6340fd3..f94c90c55 100644 --- a/archival/dpkg_deb.c +++ b/archival/dpkg_deb.c | |||
| @@ -31,12 +31,12 @@ int dpkg_deb_main(int argc, char **argv) | |||
| 31 | ar_archive->sub_archive = tar_archive; | 31 | ar_archive->sub_archive = tar_archive; |
| 32 | ar_archive->filter = filter_accept_list_reassign; | 32 | ar_archive->filter = filter_accept_list_reassign; |
| 33 | 33 | ||
| 34 | #if ENABLE_FEATURE_DEB_TAR_GZ | 34 | #if ENABLE_FEATURE_SEAMLESS_GZ |
| 35 | llist_add_to(&(ar_archive->accept), (char*)"data.tar.gz"); | 35 | llist_add_to(&(ar_archive->accept), (char*)"data.tar.gz"); |
| 36 | llist_add_to(&control_tar_llist, (char*)"control.tar.gz"); | 36 | llist_add_to(&control_tar_llist, (char*)"control.tar.gz"); |
| 37 | #endif | 37 | #endif |
| 38 | 38 | ||
| 39 | #if ENABLE_FEATURE_DEB_TAR_BZ2 | 39 | #if ENABLE_FEATURE_SEAMLESS_BZ2 |
| 40 | llist_add_to(&(ar_archive->accept), (char*)"data.tar.bz2"); | 40 | llist_add_to(&(ar_archive->accept), (char*)"data.tar.bz2"); |
| 41 | llist_add_to(&control_tar_llist, (char*)"control.tar.bz2"); | 41 | llist_add_to(&control_tar_llist, (char*)"control.tar.bz2"); |
| 42 | #endif | 42 | #endif |
diff --git a/archival/libunarchive/Kbuild b/archival/libunarchive/Kbuild index 468a7e82a..364f9174c 100644 --- a/archival/libunarchive/Kbuild +++ b/archival/libunarchive/Kbuild | |||
| @@ -32,36 +32,20 @@ DPKG_FILES:= \ | |||
| 32 | get_header_tar.o \ | 32 | get_header_tar.o \ |
| 33 | filter_accept_list_reassign.o | 33 | filter_accept_list_reassign.o |
| 34 | 34 | ||
| 35 | lib-$(CONFIG_RPM) += open_transformer.o | ||
| 36 | lib-$(CONFIG_FEATURE_TAR_BZIP2) += open_transformer.o | ||
| 37 | lib-$(CONFIG_FEATURE_TAR_LZMA) += open_transformer.o | ||
| 38 | lib-$(CONFIG_FEATURE_TAR_GZIP) += open_transformer.o | ||
| 39 | lib-$(CONFIG_FEATURE_TAR_COMPRESS) += open_transformer.o | ||
| 40 | lib-$(CONFIG_FEATURE_DEB_TAR_GZ) += open_transformer.o | ||
| 41 | lib-$(CONFIG_FEATURE_DEB_TAR_BZ2) += open_transformer.o | ||
| 42 | lib-$(CONFIG_FEATURE_DEB_TAR_LZMA) += open_transformer.o | ||
| 43 | |||
| 44 | lib-$(CONFIG_FEATURE_MODPROBE_SMALL_ZIPPED) += open_transformer.o decompress_unzip.o decompress_bunzip2.o | ||
| 45 | |||
| 46 | lib-$(CONFIG_AR) += get_header_ar.o unpack_ar_archive.o | 35 | lib-$(CONFIG_AR) += get_header_ar.o unpack_ar_archive.o |
| 47 | lib-$(CONFIG_BUNZIP2) += decompress_bunzip2.o | 36 | lib-$(CONFIG_BUNZIP2) += decompress_bunzip2.o |
| 48 | lib-$(CONFIG_UNLZMA) += decompress_unlzma.o | 37 | lib-$(CONFIG_UNLZMA) += decompress_unlzma.o |
| 49 | lib-$(CONFIG_CPIO) += get_header_cpio.o | 38 | lib-$(CONFIG_CPIO) += get_header_cpio.o |
| 50 | lib-$(CONFIG_DPKG) += $(DPKG_FILES) | 39 | lib-$(CONFIG_DPKG) += $(DPKG_FILES) |
| 51 | lib-$(CONFIG_DPKG_DEB) += $(DPKG_FILES) | 40 | lib-$(CONFIG_DPKG_DEB) += $(DPKG_FILES) |
| 52 | lib-$(CONFIG_FEATURE_DEB_TAR_GZ) += decompress_unzip.o get_header_tar_gz.o | ||
| 53 | lib-$(CONFIG_FEATURE_DEB_TAR_BZ2) += decompress_bunzip2.o get_header_tar_bz2.o | ||
| 54 | lib-$(CONFIG_FEATURE_DEB_TAR_LZMA) += decompress_unlzma.o get_header_tar_lzma.o | ||
| 55 | lib-$(CONFIG_GUNZIP) += decompress_unzip.o | 41 | lib-$(CONFIG_GUNZIP) += decompress_unzip.o |
| 56 | lib-$(CONFIG_FEATURE_GUNZIP_UNCOMPRESS) += decompress_uncompress.o | ||
| 57 | lib-$(CONFIG_RPM2CPIO) += decompress_unzip.o get_header_cpio.o | 42 | lib-$(CONFIG_RPM2CPIO) += decompress_unzip.o get_header_cpio.o |
| 58 | lib-$(CONFIG_RPM) += decompress_unzip.o get_header_cpio.o | 43 | lib-$(CONFIG_RPM) += open_transformer.o decompress_unzip.o get_header_cpio.o |
| 59 | lib-$(CONFIG_FEATURE_RPM_BZ2) += decompress_bunzip2.o | ||
| 60 | lib-$(CONFIG_TAR) += get_header_tar.o | 44 | lib-$(CONFIG_TAR) += get_header_tar.o |
| 61 | lib-$(CONFIG_FEATURE_TAR_BZIP2) += decompress_bunzip2.o get_header_tar_bz2.o | ||
| 62 | lib-$(CONFIG_FEATURE_TAR_LZMA) += decompress_unlzma.o get_header_tar_lzma.o | ||
| 63 | lib-$(CONFIG_FEATURE_TAR_GZIP) += decompress_unzip.o get_header_tar_gz.o | ||
| 64 | lib-$(CONFIG_FEATURE_TAR_COMPRESS) += decompress_uncompress.o | ||
| 65 | lib-$(CONFIG_UNCOMPRESS) += decompress_uncompress.o | 45 | lib-$(CONFIG_UNCOMPRESS) += decompress_uncompress.o |
| 66 | lib-$(CONFIG_UNZIP) += decompress_unzip.o | 46 | lib-$(CONFIG_UNZIP) += decompress_unzip.o |
| 47 | lib-$(CONFIG_FEATURE_SEAMLESS_Z) += open_transformer.o decompress_uncompress.o | ||
| 48 | lib-$(CONFIG_FEATURE_SEAMLESS_GZ) += open_transformer.o decompress_unzip.o get_header_tar_gz.o | ||
| 49 | lib-$(CONFIG_FEATURE_SEAMLESS_BZ2) += open_transformer.o decompress_bunzip2.o get_header_tar_bz2.o | ||
| 50 | lib-$(CONFIG_FEATURE_SEAMLESS_LZMA) += open_transformer.o decompress_unlzma.o get_header_tar_lzma.o | ||
| 67 | lib-$(CONFIG_FEATURE_COMPRESS_USAGE) += decompress_bunzip2.o | 51 | lib-$(CONFIG_FEATURE_COMPRESS_USAGE) += decompress_bunzip2.o |
diff --git a/archival/libunarchive/decompress_bunzip2.c b/archival/libunarchive/decompress_bunzip2.c index 654dc28a9..b53720f23 100644 --- a/archival/libunarchive/decompress_bunzip2.c +++ b/archival/libunarchive/decompress_bunzip2.c | |||
| @@ -590,7 +590,8 @@ int FAST_FUNC start_bunzip(bunzip_data **bdp, int in_fd, const unsigned char *in | |||
| 590 | bunzip_data *bd; | 590 | bunzip_data *bd; |
| 591 | unsigned i; | 591 | unsigned i; |
| 592 | enum { | 592 | enum { |
| 593 | BZh0 = ('B' << 24) + ('Z' << 16) + ('h' << 8) + '0' | 593 | BZh0 = ('B' << 24) + ('Z' << 16) + ('h' << 8) + '0', |
| 594 | h0 = ('h' << 8) + '0', | ||
| 594 | }; | 595 | }; |
| 595 | 596 | ||
| 596 | /* Figure out how much data to allocate */ | 597 | /* Figure out how much data to allocate */ |
| @@ -617,12 +618,18 @@ int FAST_FUNC start_bunzip(bunzip_data **bdp, int in_fd, const unsigned char *in | |||
| 617 | if (i) return i; | 618 | if (i) return i; |
| 618 | 619 | ||
| 619 | /* Ensure that file starts with "BZh['1'-'9']." */ | 620 | /* Ensure that file starts with "BZh['1'-'9']." */ |
| 620 | i = get_bits(bd, 32); | 621 | /* Update: now caller verifies 1st two bytes, makes .gz/.bz2 |
| 621 | if ((unsigned)(i - BZh0 - 1) >= 9) return RETVAL_NOT_BZIP_DATA; | 622 | * integration easier */ |
| 623 | /* was: */ | ||
| 624 | /* i = get_bits(bd, 32); */ | ||
| 625 | /* if ((unsigned)(i - BZh0 - 1) >= 9) return RETVAL_NOT_BZIP_DATA; */ | ||
| 626 | i = get_bits(bd, 16); | ||
| 627 | if ((unsigned)(i - h0 - 1) >= 9) return RETVAL_NOT_BZIP_DATA; | ||
| 622 | 628 | ||
| 623 | /* Fourth byte (ascii '1'-'9') indicates block size in units of 100k of | 629 | /* Fourth byte (ascii '1'-'9') indicates block size in units of 100k of |
| 624 | uncompressed data. Allocate intermediate buffer for block. */ | 630 | uncompressed data. Allocate intermediate buffer for block. */ |
| 625 | bd->dbufSize = 100000 * (i - BZh0); | 631 | /* bd->dbufSize = 100000 * (i - BZh0); */ |
| 632 | bd->dbufSize = 100000 * (i - h0); | ||
| 626 | 633 | ||
| 627 | /* Cannot use xmalloc - may leak bd in NOFORK case! */ | 634 | /* Cannot use xmalloc - may leak bd in NOFORK case! */ |
| 628 | bd->dbuf = malloc_or_warn(bd->dbufSize * sizeof(int)); | 635 | bd->dbuf = malloc_or_warn(bd->dbufSize * sizeof(int)); |
| @@ -682,6 +689,17 @@ unpack_bz2_stream(int src_fd, int dst_fd) | |||
| 682 | return i ? i : USE_DESKTOP(total_written) + 0; | 689 | return i ? i : USE_DESKTOP(total_written) + 0; |
| 683 | } | 690 | } |
| 684 | 691 | ||
| 692 | USE_DESKTOP(long long) int FAST_FUNC | ||
| 693 | unpack_bz2_stream_prime(int src_fd, int dst_fd) | ||
| 694 | { | ||
| 695 | unsigned char magic[2]; | ||
| 696 | xread(src_fd, magic, 2); | ||
| 697 | if (magic[0] != 'B' || magic[1] != 'Z') { | ||
| 698 | bb_error_msg_and_die("invalid magic"); | ||
| 699 | } | ||
| 700 | return unpack_bz2_stream(src_fd, dst_fd); | ||
| 701 | } | ||
| 702 | |||
| 685 | #ifdef TESTING | 703 | #ifdef TESTING |
| 686 | 704 | ||
| 687 | static char *const bunzip_errors[] = { | 705 | static char *const bunzip_errors[] = { |
| @@ -693,9 +711,10 @@ static char *const bunzip_errors[] = { | |||
| 693 | /* Dumb little test thing, decompress stdin to stdout */ | 711 | /* Dumb little test thing, decompress stdin to stdout */ |
| 694 | int main(int argc, char **argv) | 712 | int main(int argc, char **argv) |
| 695 | { | 713 | { |
| 696 | int i = unpack_bz2_stream(0, 1); | 714 | int i; |
| 697 | char c; | 715 | char c; |
| 698 | 716 | ||
| 717 | int i = unpack_bz2_stream_prime(0, 1); | ||
| 699 | if (i < 0) | 718 | if (i < 0) |
| 700 | fprintf(stderr, "%s\n", bunzip_errors[-i]); | 719 | fprintf(stderr, "%s\n", bunzip_errors[-i]); |
| 701 | else if (read(STDIN_FILENO, &c, 1)) | 720 | else if (read(STDIN_FILENO, &c, 1)) |
diff --git a/archival/libunarchive/decompress_uncompress.c b/archival/libunarchive/decompress_uncompress.c index 161570040..fe1491e71 100644 --- a/archival/libunarchive/decompress_uncompress.c +++ b/archival/libunarchive/decompress_uncompress.c | |||
| @@ -1,6 +1,4 @@ | |||
| 1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
| 2 | #include "libbb.h" | ||
| 3 | |||
| 4 | /* uncompress for busybox -- (c) 2002 Robert Griebl | 2 | /* uncompress for busybox -- (c) 2002 Robert Griebl |
| 5 | * | 3 | * |
| 6 | * based on the original compress42.c source | 4 | * based on the original compress42.c source |
| @@ -26,6 +24,10 @@ | |||
| 26 | * | 24 | * |
| 27 | */ | 25 | */ |
| 28 | 26 | ||
| 27 | #include "libbb.h" | ||
| 28 | #include "unarchive.h" | ||
| 29 | |||
| 30 | |||
| 29 | /* Default input buffer size */ | 31 | /* Default input buffer size */ |
| 30 | #define IBUFSIZ 2048 | 32 | #define IBUFSIZ 2048 |
| 31 | 33 | ||
| @@ -71,7 +73,7 @@ | |||
| 71 | */ | 73 | */ |
| 72 | 74 | ||
| 73 | USE_DESKTOP(long long) int FAST_FUNC | 75 | USE_DESKTOP(long long) int FAST_FUNC |
| 74 | uncompress(int fd_in, int fd_out) | 76 | unpack_Z_stream(int fd_in, int fd_out) |
| 75 | { | 77 | { |
| 76 | USE_DESKTOP(long long total_written = 0;) | 78 | USE_DESKTOP(long long total_written = 0;) |
| 77 | USE_DESKTOP(long long) int retval = -1; | 79 | USE_DESKTOP(long long) int retval = -1; |
diff --git a/archival/libunarchive/filter_accept_list_reassign.c b/archival/libunarchive/filter_accept_list_reassign.c index 4dbc2d13e..f1de4e803 100644 --- a/archival/libunarchive/filter_accept_list_reassign.c +++ b/archival/libunarchive/filter_accept_list_reassign.c | |||
| @@ -23,22 +23,25 @@ char FAST_FUNC filter_accept_list_reassign(archive_handle_t *archive_handle) | |||
| 23 | 23 | ||
| 24 | /* Find extension */ | 24 | /* Find extension */ |
| 25 | name_ptr = strrchr(archive_handle->file_header->name, '.'); | 25 | name_ptr = strrchr(archive_handle->file_header->name, '.'); |
| 26 | if (!name_ptr) | ||
| 27 | return EXIT_FAILURE; | ||
| 28 | name_ptr++; | ||
| 26 | 29 | ||
| 27 | /* Modify the subarchive handler based on the extension */ | 30 | /* Modify the subarchive handler based on the extension */ |
| 28 | if (ENABLE_FEATURE_DEB_TAR_GZ | 31 | if (ENABLE_FEATURE_SEAMLESS_GZ |
| 29 | && strcmp(name_ptr, ".gz") == 0 | 32 | && strcmp(name_ptr, "gz") == 0 |
| 30 | ) { | 33 | ) { |
| 31 | archive_handle->action_data_subarchive = get_header_tar_gz; | 34 | archive_handle->action_data_subarchive = get_header_tar_gz; |
| 32 | return EXIT_SUCCESS; | 35 | return EXIT_SUCCESS; |
| 33 | } | 36 | } |
| 34 | if (ENABLE_FEATURE_DEB_TAR_BZ2 | 37 | if (ENABLE_FEATURE_SEAMLESS_BZ2 |
| 35 | && strcmp(name_ptr, ".bz2") == 0 | 38 | && strcmp(name_ptr, "bz2") == 0 |
| 36 | ) { | 39 | ) { |
| 37 | archive_handle->action_data_subarchive = get_header_tar_bz2; | 40 | archive_handle->action_data_subarchive = get_header_tar_bz2; |
| 38 | return EXIT_SUCCESS; | 41 | return EXIT_SUCCESS; |
| 39 | } | 42 | } |
| 40 | if (ENABLE_FEATURE_DEB_TAR_LZMA | 43 | if (ENABLE_FEATURE_SEAMLESS_LZMA |
| 41 | && strcmp(name_ptr, ".lzma") == 0 | 44 | && strcmp(name_ptr, "lzma") == 0 |
| 42 | ) { | 45 | ) { |
| 43 | archive_handle->action_data_subarchive = get_header_tar_lzma; | 46 | archive_handle->action_data_subarchive = get_header_tar_lzma; |
| 44 | return EXIT_SUCCESS; | 47 | return EXIT_SUCCESS; |
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c index 5310f3f7c..bf0f92b25 100644 --- a/archival/libunarchive/get_header_tar.c +++ b/archival/libunarchive/get_header_tar.c | |||
| @@ -148,12 +148,12 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle) | |||
| 148 | * we can switch to get_header_tar_gz/bz2/lzma(). | 148 | * we can switch to get_header_tar_gz/bz2/lzma(). |
| 149 | * Needs seekable fd. I wish recv(MSG_PEEK) works | 149 | * Needs seekable fd. I wish recv(MSG_PEEK) works |
| 150 | * on any fd... */ | 150 | * on any fd... */ |
| 151 | #if ENABLE_FEATURE_TAR_GZIP | 151 | #if ENABLE_FEATURE_SEAMLESS_GZ |
| 152 | if (tar.name[0] == 0x1f && tar.name[1] == (char)0x8b) { /* gzip */ | 152 | if (tar.name[0] == 0x1f && tar.name[1] == (char)0x8b) { /* gzip */ |
| 153 | get_header_ptr = get_header_tar_gz; | 153 | get_header_ptr = get_header_tar_gz; |
| 154 | } else | 154 | } else |
| 155 | #endif | 155 | #endif |
| 156 | #if ENABLE_FEATURE_TAR_BZIP2 | 156 | #if ENABLE_FEATURE_SEAMLESS_BZ2 |
| 157 | if (tar.name[0] == 'B' && tar.name[1] == 'Z' | 157 | if (tar.name[0] == 'B' && tar.name[1] == 'Z' |
| 158 | && tar.name[2] == 'h' && isdigit(tar.name[3]) | 158 | && tar.name[2] == 'h' && isdigit(tar.name[3]) |
| 159 | ) { /* bzip2 */ | 159 | ) { /* bzip2 */ |
diff --git a/archival/libunarchive/get_header_tar_bz2.c b/archival/libunarchive/get_header_tar_bz2.c index 035c10bfb..615bbba4a 100644 --- a/archival/libunarchive/get_header_tar_bz2.c +++ b/archival/libunarchive/get_header_tar_bz2.c | |||
| @@ -11,7 +11,7 @@ char FAST_FUNC get_header_tar_bz2(archive_handle_t *archive_handle) | |||
| 11 | /* Can't lseek over pipes */ | 11 | /* Can't lseek over pipes */ |
| 12 | archive_handle->seek = seek_by_read; | 12 | archive_handle->seek = seek_by_read; |
| 13 | 13 | ||
| 14 | open_transformer(archive_handle->src_fd, unpack_bz2_stream, "bunzip2"); | 14 | open_transformer(archive_handle->src_fd, unpack_bz2_stream_prime, "bunzip2"); |
| 15 | archive_handle->offset = 0; | 15 | archive_handle->offset = 0; |
| 16 | while (get_header_tar(archive_handle) == EXIT_SUCCESS) | 16 | while (get_header_tar(archive_handle) == EXIT_SUCCESS) |
| 17 | continue; | 17 | continue; |
diff --git a/archival/rpm.c b/archival/rpm.c index e6dd3d853..e1f3c8930 100644 --- a/archival/rpm.c +++ b/archival/rpm.c | |||
| @@ -206,27 +206,27 @@ static void extract_cpio_gz(int fd) | |||
| 206 | archive_handle->src_fd = fd; | 206 | archive_handle->src_fd = fd; |
| 207 | /*archive_handle->offset = 0; - init_handle() did it */ | 207 | /*archive_handle->offset = 0; - init_handle() did it */ |
| 208 | 208 | ||
| 209 | // TODO: open_zipped does the same | ||
| 210 | |||
| 209 | xread(archive_handle->src_fd, &magic, 2); | 211 | xread(archive_handle->src_fd, &magic, 2); |
| 210 | #if BB_MMU | 212 | #if BB_MMU |
| 211 | xformer = unpack_gz_stream; | 213 | xformer = unpack_gz_stream; |
| 212 | #else | 214 | #else |
| 213 | xformer_prog = "gunzip"; | 215 | xformer_prog = "gunzip"; |
| 214 | #endif | 216 | #endif |
| 215 | if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) { | 217 | if (magic[0] != 0x1f || magic[1] != 0x8b) { |
| 216 | if (ENABLE_FEATURE_RPM_BZ2 | 218 | if (!ENABLE_FEATURE_SEAMLESS_BZ2 |
| 217 | && (magic[0] == 0x42) && (magic[1] == 0x5a)) { | 219 | || magic[0] != 'B' || magic[1] != 'Z' |
| 220 | ) { | ||
| 221 | bb_error_msg_and_die("no gzip" | ||
| 222 | USE_FEATURE_SEAMLESS_BZ2("/bzip2") | ||
| 223 | " magic"); | ||
| 224 | } | ||
| 218 | #if BB_MMU | 225 | #if BB_MMU |
| 219 | xformer = unpack_bz2_stream; | 226 | xformer = unpack_bz2_stream; |
| 220 | #else | 227 | #else |
| 221 | xformer_prog = "bunzip2"; | 228 | xformer_prog = "bunzip2"; |
| 222 | #endif | 229 | #endif |
| 223 | /* We can do better, need modifying unpack_bz2_stream to not require | ||
| 224 | * first 2 bytes. Not very hard to do... I mean, TODO :) */ | ||
| 225 | xlseek(archive_handle->src_fd, -2, SEEK_CUR); | ||
| 226 | } else | ||
| 227 | bb_error_msg_and_die("no gzip" | ||
| 228 | USE_FEATURE_RPM_BZ2("/bzip") | ||
| 229 | " magic"); | ||
| 230 | } else { | 230 | } else { |
| 231 | #if !BB_MMU | 231 | #if !BB_MMU |
| 232 | /* NOMMU version of open_transformer execs an external unzipper that should | 232 | /* NOMMU version of open_transformer execs an external unzipper that should |
diff --git a/archival/tar.c b/archival/tar.c index b2481b843..45701c985 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
| @@ -36,7 +36,7 @@ | |||
| 36 | #define block_buf bb_common_bufsiz1 | 36 | #define block_buf bb_common_bufsiz1 |
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | #if !ENABLE_FEATURE_TAR_GZIP && !ENABLE_FEATURE_TAR_BZIP2 | 39 | #if !ENABLE_FEATURE_SEAMLESS_GZ && !ENABLE_FEATURE_SEAMLESS_BZ2 |
| 40 | /* Do not pass gzip flag to writeTarFile() */ | 40 | /* Do not pass gzip flag to writeTarFile() */ |
| 41 | #define writeTarFile(tar_fd, verboseFlag, dereferenceFlag, include, exclude, gzip) \ | 41 | #define writeTarFile(tar_fd, verboseFlag, dereferenceFlag, include, exclude, gzip) \ |
| 42 | writeTarFile(tar_fd, verboseFlag, dereferenceFlag, include, exclude) | 42 | writeTarFile(tar_fd, verboseFlag, dereferenceFlag, include, exclude) |
| @@ -503,19 +503,19 @@ static int FAST_FUNC writeFileToTarball(const char *fileName, struct stat *statb | |||
| 503 | return TRUE; | 503 | return TRUE; |
| 504 | } | 504 | } |
| 505 | 505 | ||
| 506 | #if ENABLE_FEATURE_TAR_GZIP || ENABLE_FEATURE_TAR_BZIP2 | 506 | #if ENABLE_FEATURE_SEAMLESS_GZ || ENABLE_FEATURE_SEAMLESS_BZ2 |
| 507 | #if !(ENABLE_FEATURE_TAR_GZIP && ENABLE_FEATURE_TAR_BZIP2) | 507 | #if !(ENABLE_FEATURE_SEAMLESS_GZ && ENABLE_FEATURE_SEAMLESS_BZ2) |
| 508 | #define vfork_compressor(tar_fd, gzip) vfork_compressor(tar_fd) | 508 | #define vfork_compressor(tar_fd, gzip) vfork_compressor(tar_fd) |
| 509 | #endif | 509 | #endif |
| 510 | /* Don't inline: vfork scares gcc and pessimizes code */ | 510 | /* Don't inline: vfork scares gcc and pessimizes code */ |
| 511 | static void NOINLINE vfork_compressor(int tar_fd, int gzip) | 511 | static void NOINLINE vfork_compressor(int tar_fd, int gzip) |
| 512 | { | 512 | { |
| 513 | pid_t gzipPid; | 513 | pid_t gzipPid; |
| 514 | #if ENABLE_FEATURE_TAR_GZIP && ENABLE_FEATURE_TAR_BZIP2 | 514 | #if ENABLE_FEATURE_SEAMLESS_GZ && ENABLE_FEATURE_SEAMLESS_BZ2 |
| 515 | const char *zip_exec = (gzip == 1) ? "gzip" : "bzip2"; | 515 | const char *zip_exec = (gzip == 1) ? "gzip" : "bzip2"; |
| 516 | #elif ENABLE_FEATURE_TAR_GZIP | 516 | #elif ENABLE_FEATURE_SEAMLESS_GZ |
| 517 | const char *zip_exec = "gzip"; | 517 | const char *zip_exec = "gzip"; |
| 518 | #else /* only ENABLE_FEATURE_TAR_BZIP2 */ | 518 | #else /* only ENABLE_FEATURE_SEAMLESS_BZ2 */ |
| 519 | const char *zip_exec = "bzip2"; | 519 | const char *zip_exec = "bzip2"; |
| 520 | #endif | 520 | #endif |
| 521 | // On Linux, vfork never unpauses parent early, although standard | 521 | // On Linux, vfork never unpauses parent early, although standard |
| @@ -579,7 +579,7 @@ static void NOINLINE vfork_compressor(int tar_fd, int gzip) | |||
| 579 | bb_perror_msg_and_die("cannot exec %s", zip_exec); | 579 | bb_perror_msg_and_die("cannot exec %s", zip_exec); |
| 580 | } | 580 | } |
| 581 | } | 581 | } |
| 582 | #endif /* ENABLE_FEATURE_TAR_GZIP || ENABLE_FEATURE_TAR_BZIP2 */ | 582 | #endif /* ENABLE_FEATURE_SEAMLESS_GZ || ENABLE_FEATURE_SEAMLESS_BZ2 */ |
| 583 | 583 | ||
| 584 | 584 | ||
| 585 | /* gcc 4.2.1 inlines it, making code bigger */ | 585 | /* gcc 4.2.1 inlines it, making code bigger */ |
| @@ -601,7 +601,7 @@ static NOINLINE int writeTarFile(int tar_fd, int verboseFlag, | |||
| 601 | if (fstat(tbInfo.tarFd, &tbInfo.statBuf) < 0) | 601 | if (fstat(tbInfo.tarFd, &tbInfo.statBuf) < 0) |
| 602 | bb_perror_msg_and_die("cannot stat tar file"); | 602 | bb_perror_msg_and_die("cannot stat tar file"); |
| 603 | 603 | ||
| 604 | #if ENABLE_FEATURE_TAR_GZIP || ENABLE_FEATURE_TAR_BZIP2 | 604 | #if ENABLE_FEATURE_SEAMLESS_GZ || ENABLE_FEATURE_SEAMLESS_BZ2 |
| 605 | if (gzip) | 605 | if (gzip) |
| 606 | vfork_compressor(tbInfo.tarFd, gzip); | 606 | vfork_compressor(tbInfo.tarFd, gzip); |
| 607 | #endif | 607 | #endif |
| @@ -637,7 +637,7 @@ static NOINLINE int writeTarFile(int tar_fd, int verboseFlag, | |||
| 637 | if (errorFlag) | 637 | if (errorFlag) |
| 638 | bb_error_msg("error exit delayed from previous errors"); | 638 | bb_error_msg("error exit delayed from previous errors"); |
| 639 | 639 | ||
| 640 | #if ENABLE_FEATURE_TAR_GZIP || ENABLE_FEATURE_TAR_BZIP2 | 640 | #if ENABLE_FEATURE_SEAMLESS_GZ || ENABLE_FEATURE_SEAMLESS_BZ2 |
| 641 | if (gzip) { | 641 | if (gzip) { |
| 642 | int status; | 642 | int status; |
| 643 | if (safe_waitpid(-1, &status, 0) == -1) | 643 | if (safe_waitpid(-1, &status, 0) == -1) |
| @@ -679,7 +679,7 @@ static llist_t *append_file_list_to_list(llist_t *list) | |||
| 679 | #define append_file_list_to_list(x) 0 | 679 | #define append_file_list_to_list(x) 0 |
| 680 | #endif | 680 | #endif |
| 681 | 681 | ||
| 682 | #if ENABLE_FEATURE_TAR_COMPRESS | 682 | #if ENABLE_FEATURE_SEAMLESS_Z |
| 683 | static char FAST_FUNC get_header_tar_Z(archive_handle_t *archive_handle) | 683 | static char FAST_FUNC get_header_tar_Z(archive_handle_t *archive_handle) |
| 684 | { | 684 | { |
| 685 | /* Can't lseek over pipes */ | 685 | /* Can't lseek over pipes */ |
| @@ -692,7 +692,7 @@ static char FAST_FUNC get_header_tar_Z(archive_handle_t *archive_handle) | |||
| 692 | bb_error_msg_and_die("invalid magic"); | 692 | bb_error_msg_and_die("invalid magic"); |
| 693 | } | 693 | } |
| 694 | 694 | ||
| 695 | open_transformer(archive_handle->src_fd, uncompress, "uncompress"); | 695 | open_transformer(archive_handle->src_fd, unpack_Z_stream, "uncompress"); |
| 696 | archive_handle->offset = 0; | 696 | archive_handle->offset = 0; |
| 697 | while (get_header_tar(archive_handle) == EXIT_SUCCESS) | 697 | while (get_header_tar(archive_handle) == EXIT_SUCCESS) |
| 698 | continue; | 698 | continue; |
| @@ -729,14 +729,14 @@ static void handle_SIGCHLD(int status) | |||
| 729 | 729 | ||
| 730 | enum { | 730 | enum { |
| 731 | OPTBIT_KEEP_OLD = 7, | 731 | OPTBIT_KEEP_OLD = 7, |
| 732 | USE_FEATURE_TAR_CREATE( OPTBIT_CREATE ,) | 732 | USE_FEATURE_TAR_CREATE( OPTBIT_CREATE ,) |
| 733 | USE_FEATURE_TAR_CREATE( OPTBIT_DEREFERENCE ,) | 733 | USE_FEATURE_TAR_CREATE( OPTBIT_DEREFERENCE ,) |
| 734 | USE_FEATURE_TAR_BZIP2( OPTBIT_BZIP2 ,) | 734 | USE_FEATURE_SEAMLESS_BZ2( OPTBIT_BZIP2 ,) |
| 735 | USE_FEATURE_TAR_LZMA( OPTBIT_LZMA ,) | 735 | USE_FEATURE_SEAMLESS_LZMA(OPTBIT_LZMA ,) |
| 736 | USE_FEATURE_TAR_FROM( OPTBIT_INCLUDE_FROM,) | 736 | USE_FEATURE_TAR_FROM( OPTBIT_INCLUDE_FROM,) |
| 737 | USE_FEATURE_TAR_FROM( OPTBIT_EXCLUDE_FROM,) | 737 | USE_FEATURE_TAR_FROM( OPTBIT_EXCLUDE_FROM,) |
| 738 | USE_FEATURE_TAR_GZIP( OPTBIT_GZIP ,) | 738 | USE_FEATURE_SEAMLESS_GZ( OPTBIT_GZIP ,) |
| 739 | USE_FEATURE_TAR_COMPRESS(OPTBIT_COMPRESS ,) | 739 | USE_FEATURE_SEAMLESS_Z( OPTBIT_COMPRESS ,) |
| 740 | OPTBIT_NOPRESERVE_OWN, | 740 | OPTBIT_NOPRESERVE_OWN, |
| 741 | OPTBIT_NOPRESERVE_PERM, | 741 | OPTBIT_NOPRESERVE_PERM, |
| 742 | OPT_TEST = 1 << 0, // t | 742 | OPT_TEST = 1 << 0, // t |
| @@ -747,14 +747,14 @@ enum { | |||
| 747 | OPT_P = 1 << 5, // p | 747 | OPT_P = 1 << 5, // p |
| 748 | OPT_VERBOSE = 1 << 6, // v | 748 | OPT_VERBOSE = 1 << 6, // v |
| 749 | OPT_KEEP_OLD = 1 << 7, // k | 749 | OPT_KEEP_OLD = 1 << 7, // k |
| 750 | OPT_CREATE = USE_FEATURE_TAR_CREATE( (1<<OPTBIT_CREATE )) + 0, // c | 750 | OPT_CREATE = USE_FEATURE_TAR_CREATE( (1 << OPTBIT_CREATE )) + 0, // c |
| 751 | OPT_DEREFERENCE = USE_FEATURE_TAR_CREATE( (1<<OPTBIT_DEREFERENCE )) + 0, // h | 751 | OPT_DEREFERENCE = USE_FEATURE_TAR_CREATE( (1 << OPTBIT_DEREFERENCE )) + 0, // h |
| 752 | OPT_BZIP2 = USE_FEATURE_TAR_BZIP2( (1<<OPTBIT_BZIP2 )) + 0, // j | 752 | OPT_BZIP2 = USE_FEATURE_SEAMLESS_BZ2( (1 << OPTBIT_BZIP2 )) + 0, // j |
| 753 | OPT_LZMA = USE_FEATURE_TAR_LZMA( (1<<OPTBIT_LZMA )) + 0, // a | 753 | OPT_LZMA = USE_FEATURE_SEAMLESS_LZMA((1 << OPTBIT_LZMA )) + 0, // a |
| 754 | OPT_INCLUDE_FROM = USE_FEATURE_TAR_FROM( (1<<OPTBIT_INCLUDE_FROM)) + 0, // T | 754 | OPT_INCLUDE_FROM = USE_FEATURE_TAR_FROM( (1 << OPTBIT_INCLUDE_FROM)) + 0, // T |
| 755 | OPT_EXCLUDE_FROM = USE_FEATURE_TAR_FROM( (1<<OPTBIT_EXCLUDE_FROM)) + 0, // X | 755 | OPT_EXCLUDE_FROM = USE_FEATURE_TAR_FROM( (1 << OPTBIT_EXCLUDE_FROM)) + 0, // X |
| 756 | OPT_GZIP = USE_FEATURE_TAR_GZIP( (1<<OPTBIT_GZIP )) + 0, // z | 756 | OPT_GZIP = USE_FEATURE_SEAMLESS_GZ( (1 << OPTBIT_GZIP )) + 0, // z |
| 757 | OPT_COMPRESS = USE_FEATURE_TAR_COMPRESS((1<<OPTBIT_COMPRESS )) + 0, // Z | 757 | OPT_COMPRESS = USE_FEATURE_SEAMLESS_Z( (1 << OPTBIT_COMPRESS )) + 0, // Z |
| 758 | OPT_NOPRESERVE_OWN = 1 << OPTBIT_NOPRESERVE_OWN , // no-same-owner | 758 | OPT_NOPRESERVE_OWN = 1 << OPTBIT_NOPRESERVE_OWN , // no-same-owner |
| 759 | OPT_NOPRESERVE_PERM = 1 << OPTBIT_NOPRESERVE_PERM, // no-same-permissions | 759 | OPT_NOPRESERVE_PERM = 1 << OPTBIT_NOPRESERVE_PERM, // no-same-permissions |
| 760 | }; | 760 | }; |
| @@ -772,20 +772,20 @@ static const char tar_longopts[] ALIGN1 = | |||
| 772 | "create\0" No_argument "c" | 772 | "create\0" No_argument "c" |
| 773 | "dereference\0" No_argument "h" | 773 | "dereference\0" No_argument "h" |
| 774 | # endif | 774 | # endif |
| 775 | # if ENABLE_FEATURE_TAR_BZIP2 | 775 | # if ENABLE_FEATURE_SEAMLESS_BZ2 |
| 776 | "bzip2\0" No_argument "j" | 776 | "bzip2\0" No_argument "j" |
| 777 | # endif | 777 | # endif |
| 778 | # if ENABLE_FEATURE_TAR_LZMA | 778 | # if ENABLE_FEATURE_SEAMLESS_LZMA |
| 779 | "lzma\0" No_argument "a" | 779 | "lzma\0" No_argument "a" |
| 780 | # endif | 780 | # endif |
| 781 | # if ENABLE_FEATURE_TAR_FROM | 781 | # if ENABLE_FEATURE_TAR_FROM |
| 782 | "files-from\0" Required_argument "T" | 782 | "files-from\0" Required_argument "T" |
| 783 | "exclude-from\0" Required_argument "X" | 783 | "exclude-from\0" Required_argument "X" |
| 784 | # endif | 784 | # endif |
| 785 | # if ENABLE_FEATURE_TAR_GZIP | 785 | # if ENABLE_FEATURE_SEAMLESS_GZ |
| 786 | "gzip\0" No_argument "z" | 786 | "gzip\0" No_argument "z" |
| 787 | # endif | 787 | # endif |
| 788 | # if ENABLE_FEATURE_TAR_COMPRESS | 788 | # if ENABLE_FEATURE_SEAMLESS_Z |
| 789 | "compress\0" No_argument "Z" | 789 | "compress\0" No_argument "Z" |
| 790 | # endif | 790 | # endif |
| 791 | "no-same-owner\0" No_argument "\xfd" | 791 | "no-same-owner\0" No_argument "\xfd" |
| @@ -834,12 +834,12 @@ int tar_main(int argc UNUSED_PARAM, char **argv) | |||
| 834 | #endif | 834 | #endif |
| 835 | opt = getopt32(argv, | 835 | opt = getopt32(argv, |
| 836 | "txC:f:Opvk" | 836 | "txC:f:Opvk" |
| 837 | USE_FEATURE_TAR_CREATE( "ch" ) | 837 | USE_FEATURE_TAR_CREATE( "ch" ) |
| 838 | USE_FEATURE_TAR_BZIP2( "j" ) | 838 | USE_FEATURE_SEAMLESS_BZ2( "j" ) |
| 839 | USE_FEATURE_TAR_LZMA( "a" ) | 839 | USE_FEATURE_SEAMLESS_LZMA("a" ) |
| 840 | USE_FEATURE_TAR_FROM( "T:X:") | 840 | USE_FEATURE_TAR_FROM( "T:X:") |
| 841 | USE_FEATURE_TAR_GZIP( "z" ) | 841 | USE_FEATURE_SEAMLESS_GZ( "z" ) |
| 842 | USE_FEATURE_TAR_COMPRESS("Z" ) | 842 | USE_FEATURE_SEAMLESS_Z( "Z" ) |
| 843 | , &base_dir // -C dir | 843 | , &base_dir // -C dir |
| 844 | , &tar_filename // -f filename | 844 | , &tar_filename // -f filename |
| 845 | USE_FEATURE_TAR_FROM(, &(tar_handle->accept)) // T | 845 | USE_FEATURE_TAR_FROM(, &(tar_handle->accept)) // T |
| @@ -922,8 +922,7 @@ int tar_main(int argc UNUSED_PARAM, char **argv) | |||
| 922 | 922 | ||
| 923 | tar_stream = stdout; | 923 | tar_stream = stdout; |
| 924 | /* Mimicking GNU tar 1.15.1: */ | 924 | /* Mimicking GNU tar 1.15.1: */ |
| 925 | flags = O_WRONLY|O_CREAT|O_TRUNC; | 925 | flags = O_WRONLY | O_CREAT | O_TRUNC; |
| 926 | /* was doing unlink; open(O_WRONLY|O_CREAT|O_EXCL); why? */ | ||
| 927 | } else { | 926 | } else { |
| 928 | tar_stream = stdin; | 927 | tar_stream = stdin; |
| 929 | flags = O_RDONLY; | 928 | flags = O_RDONLY; |
| @@ -933,7 +932,14 @@ int tar_main(int argc UNUSED_PARAM, char **argv) | |||
| 933 | tar_handle->src_fd = fileno(tar_stream); | 932 | tar_handle->src_fd = fileno(tar_stream); |
| 934 | tar_handle->seek = seek_by_read; | 933 | tar_handle->seek = seek_by_read; |
| 935 | } else { | 934 | } else { |
| 936 | tar_handle->src_fd = xopen(tar_filename, flags); | 935 | if (ENABLE_FEATURE_TAR_AUTODETECT && flags == O_RDONLY) { |
| 936 | get_header_ptr = get_header_tar; | ||
| 937 | tar_handle->src_fd = open_zipped(tar_filename); | ||
| 938 | if (tar_handle->src_fd < 0) | ||
| 939 | bb_perror_msg_and_die("can't open '%s'", tar_filename); | ||
| 940 | } else { | ||
| 941 | tar_handle->src_fd = xopen(tar_filename, flags); | ||
| 942 | } | ||
| 937 | } | 943 | } |
| 938 | } | 944 | } |
| 939 | 945 | ||
| @@ -947,11 +953,11 @@ int tar_main(int argc UNUSED_PARAM, char **argv) | |||
| 947 | 953 | ||
| 948 | /* create an archive */ | 954 | /* create an archive */ |
| 949 | if (opt & OPT_CREATE) { | 955 | if (opt & OPT_CREATE) { |
| 950 | #if ENABLE_FEATURE_TAR_GZIP || ENABLE_FEATURE_TAR_BZIP2 | 956 | #if ENABLE_FEATURE_SEAMLESS_GZ || ENABLE_FEATURE_SEAMLESS_BZ2 |
| 951 | int zipMode = 0; | 957 | int zipMode = 0; |
| 952 | if (ENABLE_FEATURE_TAR_GZIP && (opt & OPT_GZIP)) | 958 | if (ENABLE_FEATURE_SEAMLESS_GZ && (opt & OPT_GZIP)) |
| 953 | zipMode = 1; | 959 | zipMode = 1; |
| 954 | if (ENABLE_FEATURE_TAR_BZIP2 && (opt & OPT_BZIP2)) | 960 | if (ENABLE_FEATURE_SEAMLESS_BZ2 && (opt & OPT_BZIP2)) |
| 955 | zipMode = 2; | 961 | zipMode = 2; |
| 956 | #endif | 962 | #endif |
| 957 | /* NB: writeTarFile() closes tar_handle->src_fd */ | 963 | /* NB: writeTarFile() closes tar_handle->src_fd */ |
diff --git a/include/libbb.h b/include/libbb.h index 9cbab4f1d..3996846b5 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
| @@ -597,6 +597,7 @@ extern void *xmalloc_read(int fd, size_t *maxsz_p) FAST_FUNC; | |||
| 597 | /* Returns NULL if file can't be opened */ | 597 | /* Returns NULL if file can't be opened */ |
| 598 | extern void *xmalloc_open_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC; | 598 | extern void *xmalloc_open_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC; |
| 599 | /* Autodetects .gz etc */ | 599 | /* Autodetects .gz etc */ |
| 600 | extern int open_zipped(const char *fname) FAST_FUNC; | ||
| 600 | extern void *xmalloc_open_zipped_read_close(const char *fname, size_t *maxsz_p) FAST_FUNC; | 601 | extern void *xmalloc_open_zipped_read_close(const char *fname, size_t *maxsz_p) FAST_FUNC; |
| 601 | /* Never returns NULL */ | 602 | /* Never returns NULL */ |
| 602 | extern void *xmalloc_xopen_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC; | 603 | extern void *xmalloc_xopen_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC; |
| @@ -1039,10 +1040,6 @@ const char *bb_basename(const char *name) FAST_FUNC; | |||
| 1039 | char *last_char_is(const char *s, int c) FAST_FUNC; | 1040 | char *last_char_is(const char *s, int c) FAST_FUNC; |
| 1040 | 1041 | ||
| 1041 | 1042 | ||
| 1042 | USE_DESKTOP(long long) int uncompress(int fd_in, int fd_out) FAST_FUNC; | ||
| 1043 | int inflate(int in, int out) FAST_FUNC; | ||
| 1044 | |||
| 1045 | |||
| 1046 | int bb_make_directory(char *path, long mode, int flags) FAST_FUNC; | 1043 | int bb_make_directory(char *path, long mode, int flags) FAST_FUNC; |
| 1047 | 1044 | ||
| 1048 | int get_signum(const char *name) FAST_FUNC; | 1045 | int get_signum(const char *name) FAST_FUNC; |
diff --git a/include/unarchive.h b/include/unarchive.h index cf23d98bf..7ff791be5 100644 --- a/include/unarchive.h +++ b/include/unarchive.h | |||
| @@ -98,9 +98,9 @@ extern void header_verbose_list(const file_header_t *file_header) FAST_FUNC; | |||
| 98 | extern char get_header_ar(archive_handle_t *archive_handle) FAST_FUNC; | 98 | extern char get_header_ar(archive_handle_t *archive_handle) FAST_FUNC; |
| 99 | extern char get_header_cpio(archive_handle_t *archive_handle) FAST_FUNC; | 99 | extern char get_header_cpio(archive_handle_t *archive_handle) FAST_FUNC; |
| 100 | extern char get_header_tar(archive_handle_t *archive_handle) FAST_FUNC; | 100 | extern char get_header_tar(archive_handle_t *archive_handle) FAST_FUNC; |
| 101 | extern char get_header_tar_gz(archive_handle_t *archive_handle) FAST_FUNC; | ||
| 101 | extern char get_header_tar_bz2(archive_handle_t *archive_handle) FAST_FUNC; | 102 | extern char get_header_tar_bz2(archive_handle_t *archive_handle) FAST_FUNC; |
| 102 | extern char get_header_tar_lzma(archive_handle_t *archive_handle) FAST_FUNC; | 103 | extern char get_header_tar_lzma(archive_handle_t *archive_handle) FAST_FUNC; |
| 103 | extern char get_header_tar_gz(archive_handle_t *archive_handle) FAST_FUNC; | ||
| 104 | 104 | ||
| 105 | extern void seek_by_jump(const archive_handle_t *archive_handle, unsigned amount) FAST_FUNC; | 105 | extern void seek_by_jump(const archive_handle_t *archive_handle, unsigned amount) FAST_FUNC; |
| 106 | extern void seek_by_read(const archive_handle_t *archive_handle, unsigned amount) FAST_FUNC; | 106 | extern void seek_by_read(const archive_handle_t *archive_handle, unsigned amount) FAST_FUNC; |
| @@ -120,17 +120,22 @@ typedef struct inflate_unzip_result { | |||
| 120 | uint32_t crc; | 120 | uint32_t crc; |
| 121 | } inflate_unzip_result; | 121 | } inflate_unzip_result; |
| 122 | 122 | ||
| 123 | extern USE_DESKTOP(long long) int unpack_bz2_stream(int src_fd, int dst_fd) FAST_FUNC; | 123 | USE_DESKTOP(long long) int inflate_unzip(inflate_unzip_result *res, off_t compr_size, int src_fd, int dst_fd) FAST_FUNC; |
| 124 | extern USE_DESKTOP(long long) int inflate_unzip(inflate_unzip_result *res, off_t compr_size, int src_fd, int dst_fd) FAST_FUNC; | 124 | /* lzma unpacker takes .lzma stream from offset 0 */ |
| 125 | extern USE_DESKTOP(long long) int unpack_gz_stream(int src_fd, int dst_fd) FAST_FUNC; | 125 | USE_DESKTOP(long long) int unpack_lzma_stream(int src_fd, int dst_fd) FAST_FUNC; |
| 126 | extern USE_DESKTOP(long long) int unpack_lzma_stream(int src_fd, int dst_fd) FAST_FUNC; | 126 | /* the rest wants 2 first bytes already skipped by the caller */ |
| 127 | USE_DESKTOP(long long) int unpack_bz2_stream(int src_fd, int dst_fd) FAST_FUNC; | ||
| 128 | USE_DESKTOP(long long) int unpack_gz_stream(int src_fd, int dst_fd) FAST_FUNC; | ||
| 129 | USE_DESKTOP(long long) int unpack_Z_stream(int fd_in, int fd_out) FAST_FUNC; | ||
| 130 | /* wrapper which checks first two bytes to be "BZ" */ | ||
| 131 | USE_DESKTOP(long long) int unpack_bz2_stream_prime(int src_fd, int dst_fd) FAST_FUNC; | ||
| 127 | 132 | ||
| 128 | #if BB_MMU | 133 | #if BB_MMU |
| 129 | extern void open_transformer(int fd, | 134 | void open_transformer(int fd, |
| 130 | USE_DESKTOP(long long) int FAST_FUNC (*transformer)(int src_fd, int dst_fd)) FAST_FUNC; | 135 | USE_DESKTOP(long long) int FAST_FUNC (*transformer)(int src_fd, int dst_fd)) FAST_FUNC; |
| 131 | #define open_transformer(fd, transformer, transform_prog) open_transformer(fd, transformer) | 136 | #define open_transformer(fd, transformer, transform_prog) open_transformer(fd, transformer) |
| 132 | #else | 137 | #else |
| 133 | extern void open_transformer(int src_fd, const char *transform_prog) FAST_FUNC; | 138 | void open_transformer(int src_fd, const char *transform_prog) FAST_FUNC; |
| 134 | #define open_transformer(fd, transformer, transform_prog) open_transformer(fd, transform_prog) | 139 | #define open_transformer(fd, transformer, transform_prog) open_transformer(fd, transform_prog) |
| 135 | #endif | 140 | #endif |
| 136 | 141 | ||
diff --git a/include/usage.h b/include/usage.h index ae6d2bcb6..78f40367e 100644 --- a/include/usage.h +++ b/include/usage.h | |||
| @@ -3943,9 +3943,9 @@ | |||
| 3943 | "nameserver 10.0.0.1\n" | 3943 | "nameserver 10.0.0.1\n" |
| 3944 | 3944 | ||
| 3945 | #define tar_trivial_usage \ | 3945 | #define tar_trivial_usage \ |
| 3946 | "-[" USE_FEATURE_TAR_CREATE("c") USE_FEATURE_TAR_GZIP("z") \ | 3946 | "-[" USE_FEATURE_TAR_CREATE("c") USE_FEATURE_SEAMLESS_GZ("z") \ |
| 3947 | USE_FEATURE_TAR_BZIP2("j") USE_FEATURE_TAR_LZMA("a") \ | 3947 | USE_FEATURE_SEAMLESS_BZ2("j") USE_FEATURE_SEAMLESS_LZMA("a") \ |
| 3948 | USE_FEATURE_TAR_COMPRESS("Z") "xtvO] " \ | 3948 | USE_FEATURE_SEAMLESS_Z("Z") "xtvO] " \ |
| 3949 | USE_FEATURE_TAR_FROM("[-X FILE] ") \ | 3949 | USE_FEATURE_TAR_FROM("[-X FILE] ") \ |
| 3950 | "[-f TARFILE] [-C DIR] [FILE(s)]..." | 3950 | "[-f TARFILE] [-C DIR] [FILE(s)]..." |
| 3951 | #define tar_full_usage "\n\n" \ | 3951 | #define tar_full_usage "\n\n" \ |
| @@ -3956,16 +3956,16 @@ | |||
| 3956 | "\n x Extract" \ | 3956 | "\n x Extract" \ |
| 3957 | "\n t List" \ | 3957 | "\n t List" \ |
| 3958 | "\nArchive format selection:" \ | 3958 | "\nArchive format selection:" \ |
| 3959 | USE_FEATURE_TAR_GZIP( \ | 3959 | USE_FEATURE_SEAMLESS_GZ( \ |
| 3960 | "\n z Filter the archive through gzip" \ | 3960 | "\n z Filter the archive through gzip" \ |
| 3961 | ) \ | 3961 | ) \ |
| 3962 | USE_FEATURE_TAR_BZIP2( \ | 3962 | USE_FEATURE_SEAMLESS_BZ2( \ |
| 3963 | "\n j Filter the archive through bzip2" \ | 3963 | "\n j Filter the archive through bzip2" \ |
| 3964 | ) \ | 3964 | ) \ |
| 3965 | USE_FEATURE_TAR_LZMA( \ | 3965 | USE_FEATURE_SEAMLESS_LZMA( \ |
| 3966 | "\n a Filter the archive through lzma" \ | 3966 | "\n a Filter the archive through lzma" \ |
| 3967 | ) \ | 3967 | ) \ |
| 3968 | USE_FEATURE_TAR_COMPRESS( \ | 3968 | USE_FEATURE_SEAMLESS_Z( \ |
| 3969 | "\n Z Filter the archive through compress" \ | 3969 | "\n Z Filter the archive through compress" \ |
| 3970 | ) \ | 3970 | ) \ |
| 3971 | "\nFile selection:" \ | 3971 | "\nFile selection:" \ |
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index beb1d6fcb..2bab0eba6 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c | |||
| @@ -73,7 +73,8 @@ static const char *unpack_usage_messages(void) | |||
| 73 | 73 | ||
| 74 | i = start_bunzip(&bd, | 74 | i = start_bunzip(&bd, |
| 75 | /* src_fd: */ -1, | 75 | /* src_fd: */ -1, |
| 76 | /* inbuf: */ (void *)packed_usage, | 76 | //FIXME: can avoid storing these 2 bytes! |
| 77 | /* inbuf: */ (void *)packed_usage + 2, | ||
| 77 | /* len: */ sizeof(packed_usage)); | 78 | /* len: */ sizeof(packed_usage)); |
| 78 | /* read_bunzip can longjmp to start_bunzip, and ultimately | 79 | /* read_bunzip can longjmp to start_bunzip, and ultimately |
| 79 | * end up here with i != 0 on read data errors! Not trivial */ | 80 | * end up here with i != 0 on read data errors! Not trivial */ |
diff --git a/libbb/read.c b/libbb/read.c index 18f62838e..9f6bfcd1b 100644 --- a/libbb/read.c +++ b/libbb/read.c | |||
| @@ -8,7 +8,14 @@ | |||
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | #include "libbb.h" | 10 | #include "libbb.h" |
| 11 | #if ENABLE_FEATURE_MODPROBE_SMALL_ZIPPED | 11 | |
| 12 | #define ZIPPED (ENABLE_FEATURE_SEAMLESS_LZMA \ | ||
| 13 | || ENABLE_FEATURE_SEAMLESS_BZ2 \ | ||
| 14 | || ENABLE_FEATURE_SEAMLESS_GZ \ | ||
| 15 | /* || ENABLE_FEATURE_SEAMLESS_Z */ \ | ||
| 16 | ) | ||
| 17 | |||
| 18 | #if ZIPPED | ||
| 12 | #include "unarchive.h" | 19 | #include "unarchive.h" |
| 13 | #endif | 20 | #endif |
| 14 | 21 | ||
| @@ -299,24 +306,81 @@ void* FAST_FUNC xmalloc_xopen_read_close(const char *filename, size_t *maxsz_p) | |||
| 299 | return buf; | 306 | return buf; |
| 300 | } | 307 | } |
| 301 | 308 | ||
| 302 | #if ENABLE_FEATURE_MODPROBE_SMALL_ZIPPED | 309 | int FAST_FUNC open_zipped(const char *fname) |
| 310 | { | ||
| 311 | #if !ZIPPED | ||
| 312 | return open(fname, O_RDONLY); | ||
| 313 | #else | ||
| 314 | unsigned char magic[2]; | ||
| 315 | char *sfx; | ||
| 316 | int fd; | ||
| 317 | #if BB_MMU | ||
| 318 | USE_DESKTOP(long long) int FAST_FUNC (*xformer)(int src_fd, int dst_fd); | ||
| 319 | enum { xformer_prog = 0 }; | ||
| 320 | #else | ||
| 321 | enum { xformer = 0 }; | ||
| 322 | const char *xformer_prog; | ||
| 323 | #endif | ||
| 324 | |||
| 325 | fd = open(fname, O_RDONLY); | ||
| 326 | if (fd < 0) | ||
| 327 | return fd; | ||
| 328 | |||
| 329 | sfx = strrchr(fname, '.'); | ||
| 330 | if (sfx) { | ||
| 331 | if (ENABLE_FEATURE_SEAMLESS_LZMA && strcmp(sfx, ".lzma") == 0) | ||
| 332 | /* .lzma has no header/signature, just trust it */ | ||
| 333 | open_transformer(fd, unpack_lzma_stream, "unlzma"); | ||
| 334 | else | ||
| 335 | if ((ENABLE_FEATURE_SEAMLESS_GZ && strcmp(sfx, ".gz") == 0) | ||
| 336 | || (ENABLE_FEATURE_SEAMLESS_BZ2 && strcmp(sfx, ".bz2") == 0) | ||
| 337 | ) { | ||
| 338 | /* .gz and .bz2 both have 2-byte signature, and their | ||
| 339 | * unpack_XXX_stream want this header skipped. */ | ||
| 340 | xread(fd, &magic, 2); | ||
| 341 | #if BB_MMU | ||
| 342 | xformer = unpack_gz_stream; | ||
| 343 | #else | ||
| 344 | xformer_prog = "gunzip"; | ||
| 345 | #endif | ||
| 346 | if (magic[0] != 0x1f || magic[1] != 0x8b) { | ||
| 347 | if (!ENABLE_FEATURE_SEAMLESS_BZ2 | ||
| 348 | || magic[0] != 'B' || magic[1] != 'Z' | ||
| 349 | ) { | ||
| 350 | bb_error_msg_and_die("no gzip" | ||
| 351 | USE_FEATURE_SEAMLESS_BZ2("/bzip2") | ||
| 352 | " magic"); | ||
| 353 | } | ||
| 354 | #if BB_MMU | ||
| 355 | xformer = unpack_bz2_stream; | ||
| 356 | #else | ||
| 357 | xformer_prog = "bunzip2"; | ||
| 358 | #endif | ||
| 359 | } else { | ||
| 360 | #if !BB_MMU | ||
| 361 | /* NOMMU version of open_transformer execs | ||
| 362 | * an external unzipper that wants | ||
| 363 | * file position at the start of the file */ | ||
| 364 | xlseek(fd, 0, SEEK_SET); | ||
| 365 | #endif | ||
| 366 | } | ||
| 367 | open_transformer(fd, xformer, xformer_prog); | ||
| 368 | } | ||
| 369 | } | ||
| 370 | |||
| 371 | return fd; | ||
| 372 | #endif | ||
| 373 | } | ||
| 374 | |||
| 303 | void* FAST_FUNC xmalloc_open_zipped_read_close(const char *fname, size_t *maxsz_p) | 375 | void* FAST_FUNC xmalloc_open_zipped_read_close(const char *fname, size_t *maxsz_p) |
| 304 | { | 376 | { |
| 377 | int fd; | ||
| 305 | char *image; | 378 | char *image; |
| 306 | char *suffix; | ||
| 307 | 379 | ||
| 308 | int fd = open(fname, O_RDONLY); | 380 | fd = open_zipped(fname); |
| 309 | if (fd < 0) | 381 | if (fd < 0) |
| 310 | return NULL; | 382 | return NULL; |
| 311 | 383 | ||
| 312 | suffix = strrchr(fname, '.'); | ||
| 313 | if (suffix) { | ||
| 314 | if (strcmp(suffix, ".gz") == 0) | ||
| 315 | open_transformer(fd, unpack_gz_stream, "gunzip"); | ||
| 316 | else if (strcmp(suffix, ".bz2") == 0) | ||
| 317 | open_transformer(fd, unpack_bz2_stream, "bunzip2"); | ||
| 318 | } | ||
| 319 | |||
| 320 | image = xmalloc_read(fd, maxsz_p); | 384 | image = xmalloc_read(fd, maxsz_p); |
| 321 | if (!image) | 385 | if (!image) |
| 322 | bb_perror_msg("read error from '%s'", fname); | 386 | bb_perror_msg("read error from '%s'", fname); |
| @@ -324,4 +388,3 @@ void* FAST_FUNC xmalloc_open_zipped_read_close(const char *fname, size_t *maxsz_ | |||
| 324 | 388 | ||
| 325 | return image; | 389 | return image; |
| 326 | } | 390 | } |
| 327 | #endif | ||
diff --git a/modutils/Config.in b/modutils/Config.in index f76a0820e..a430fcac3 100644 --- a/modutils/Config.in +++ b/modutils/Config.in | |||
| @@ -54,13 +54,6 @@ config FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED | |||
| 54 | Check if the module is already loaded. | 54 | Check if the module is already loaded. |
| 55 | N.B. It's racy. | 55 | N.B. It's racy. |
| 56 | 56 | ||
| 57 | config FEATURE_MODPROBE_SMALL_ZIPPED | ||
| 58 | bool "Handle gzipped or bzipped modules" | ||
| 59 | default n | ||
| 60 | depends on MODPROBE_SMALL | ||
| 61 | help | ||
| 62 | Handle compressed modules. Bloaty. Sloooow. | ||
| 63 | |||
| 64 | config DEPMOD | 57 | config DEPMOD |
| 65 | bool "depmod" | 58 | bool "depmod" |
| 66 | default n | 59 | default n |
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c index ea130b83c..ac08ba7d7 100644 --- a/modutils/modprobe-small.c +++ b/modutils/modprobe-small.c | |||
| @@ -100,7 +100,7 @@ static char* find_keyword(char *ptr, size_t len, const char *word) | |||
| 100 | { | 100 | { |
| 101 | int wlen; | 101 | int wlen; |
| 102 | 102 | ||
| 103 | if (!ptr) /* happens if read_module cannot read it */ | 103 | if (!ptr) /* happens if xmalloc_open_zipped_read_close cannot read it */ |
| 104 | return NULL; | 104 | return NULL; |
| 105 | 105 | ||
| 106 | wlen = strlen(word); | 106 | wlen = strlen(word); |
| @@ -141,12 +141,6 @@ static char* str_2_list(const char *str) | |||
| 141 | return dst; | 141 | return dst; |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | #if ENABLE_FEATURE_MODPROBE_SMALL_ZIPPED | ||
| 145 | # define read_module xmalloc_open_zipped_read_close | ||
| 146 | #else | ||
| 147 | # define read_module xmalloc_open_read_close | ||
| 148 | #endif | ||
| 149 | |||
| 150 | /* We use error numbers in a loose translation... */ | 144 | /* We use error numbers in a loose translation... */ |
| 151 | static const char *moderror(int err) | 145 | static const char *moderror(int err) |
| 152 | { | 146 | { |
| @@ -173,7 +167,7 @@ static int load_module(const char *fname, const char *options) | |||
| 173 | char *module_image; | 167 | char *module_image; |
| 174 | dbg1_error_msg("load_module('%s','%s')", fname, options); | 168 | dbg1_error_msg("load_module('%s','%s')", fname, options); |
| 175 | 169 | ||
| 176 | module_image = read_module(fname, &len); | 170 | module_image = xmalloc_open_zipped_read_close(fname, &len); |
| 177 | r = (!module_image || init_module(module_image, len, options ? options : "") != 0); | 171 | r = (!module_image || init_module(module_image, len, options ? options : "") != 0); |
| 178 | free(module_image); | 172 | free(module_image); |
| 179 | dbg1_error_msg("load_module:%d", r); | 173 | dbg1_error_msg("load_module:%d", r); |
| @@ -195,7 +189,7 @@ static void parse_module(module_info *info, const char *pathname) | |||
| 195 | 189 | ||
| 196 | /* Read (possibly compressed) module */ | 190 | /* Read (possibly compressed) module */ |
| 197 | len = 64 * 1024 * 1024; /* 64 Mb at most */ | 191 | len = 64 * 1024 * 1024; /* 64 Mb at most */ |
| 198 | module_image = read_module(pathname, &len); | 192 | module_image = xmalloc_open_zipped_read_close(pathname, &len); |
| 199 | //TODO: optimize redundant module body reads | 193 | //TODO: optimize redundant module body reads |
| 200 | 194 | ||
| 201 | /* "alias1 symbol:sym1 alias2 symbol:sym2" */ | 195 | /* "alias1 symbol:sym1 alias2 symbol:sym2" */ |
diff --git a/scripts/defconfig b/scripts/defconfig index 2948016ee..404c50dbe 100644 --- a/scripts/defconfig +++ b/scripts/defconfig | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | # | 1 | # |
| 2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
| 3 | # Busybox version: 1.11.0.svn | 3 | # Busybox version: 1.12.0.svn |
| 4 | # Wed Jun 25 12:56:32 2008 | 4 | # Tue Aug 5 14:44:22 2008 |
| 5 | # | 5 | # |
| 6 | CONFIG_HAVE_DOT_CONFIG=y | 6 | CONFIG_HAVE_DOT_CONFIG=y |
| 7 | 7 | ||
| @@ -57,6 +57,7 @@ CONFIG_NO_DEBUG_LIB=y | |||
| 57 | # CONFIG_DMALLOC is not set | 57 | # CONFIG_DMALLOC is not set |
| 58 | # CONFIG_EFENCE is not set | 58 | # CONFIG_EFENCE is not set |
| 59 | CONFIG_INCLUDE_SUSv2=y | 59 | CONFIG_INCLUDE_SUSv2=y |
| 60 | # CONFIG_PARSE is not set | ||
| 60 | 61 | ||
| 61 | # | 62 | # |
| 62 | # Installation Options | 63 | # Installation Options |
| @@ -99,6 +100,10 @@ CONFIG_FEATURE_HWIB=y | |||
| 99 | # | 100 | # |
| 100 | # Archival Utilities | 101 | # Archival Utilities |
| 101 | # | 102 | # |
| 103 | CONFIG_FEATURE_SEAMLESS_LZMA=y | ||
| 104 | CONFIG_FEATURE_SEAMLESS_BZ2=y | ||
| 105 | CONFIG_FEATURE_SEAMLESS_GZ=y | ||
| 106 | CONFIG_FEATURE_SEAMLESS_Z=y | ||
| 102 | CONFIG_AR=y | 107 | CONFIG_AR=y |
| 103 | CONFIG_FEATURE_AR_LONG_FILENAMES=y | 108 | CONFIG_FEATURE_AR_LONG_FILENAMES=y |
| 104 | CONFIG_BUNZIP2=y | 109 | CONFIG_BUNZIP2=y |
| @@ -109,17 +114,11 @@ CONFIG_FEATURE_CPIO_O=y | |||
| 109 | # CONFIG_DPKG_DEB is not set | 114 | # CONFIG_DPKG_DEB is not set |
| 110 | # CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set | 115 | # CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set |
| 111 | CONFIG_GUNZIP=y | 116 | CONFIG_GUNZIP=y |
| 112 | CONFIG_FEATURE_GUNZIP_UNCOMPRESS=y | ||
| 113 | CONFIG_GZIP=y | 117 | CONFIG_GZIP=y |
| 114 | CONFIG_RPM2CPIO=y | 118 | CONFIG_RPM2CPIO=y |
| 115 | CONFIG_RPM=y | 119 | CONFIG_RPM=y |
| 116 | CONFIG_FEATURE_RPM_BZ2=y | ||
| 117 | CONFIG_TAR=y | 120 | CONFIG_TAR=y |
| 118 | CONFIG_FEATURE_TAR_CREATE=y | 121 | CONFIG_FEATURE_TAR_CREATE=y |
| 119 | CONFIG_FEATURE_TAR_GZIP=y | ||
| 120 | CONFIG_FEATURE_TAR_BZIP2=y | ||
| 121 | CONFIG_FEATURE_TAR_LZMA=y | ||
| 122 | CONFIG_FEATURE_TAR_COMPRESS=y | ||
| 123 | CONFIG_FEATURE_TAR_AUTODETECT=y | 122 | CONFIG_FEATURE_TAR_AUTODETECT=y |
| 124 | CONFIG_FEATURE_TAR_FROM=y | 123 | CONFIG_FEATURE_TAR_FROM=y |
| 125 | CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y | 124 | CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y |
| @@ -133,13 +132,6 @@ CONFIG_FEATURE_LZMA_FAST=y | |||
| 133 | CONFIG_UNZIP=y | 132 | CONFIG_UNZIP=y |
| 134 | 133 | ||
| 135 | # | 134 | # |
| 136 | # Common options for cpio and tar | ||
| 137 | # | ||
| 138 | # CONFIG_FEATURE_DEB_TAR_GZ is not set | ||
| 139 | # CONFIG_FEATURE_DEB_TAR_BZ2 is not set | ||
| 140 | # CONFIG_FEATURE_DEB_TAR_LZMA is not set | ||
| 141 | |||
| 142 | # | ||
| 143 | # Coreutils | 135 | # Coreutils |
| 144 | # | 136 | # |
| 145 | CONFIG_BASENAME=y | 137 | CONFIG_BASENAME=y |
| @@ -217,6 +209,7 @@ CONFIG_SEQ=y | |||
| 217 | CONFIG_SHA1SUM=y | 209 | CONFIG_SHA1SUM=y |
| 218 | CONFIG_SLEEP=y | 210 | CONFIG_SLEEP=y |
| 219 | CONFIG_FEATURE_FANCY_SLEEP=y | 211 | CONFIG_FEATURE_FANCY_SLEEP=y |
| 212 | CONFIG_FEATURE_FLOAT_SLEEP=y | ||
| 220 | CONFIG_SORT=y | 213 | CONFIG_SORT=y |
| 221 | CONFIG_FEATURE_SORT_BIG=y | 214 | CONFIG_FEATURE_SORT_BIG=y |
| 222 | CONFIG_SPLIT=y | 215 | CONFIG_SPLIT=y |
| @@ -426,29 +419,28 @@ CONFIG_LSATTR=y | |||
| 426 | # | 419 | # |
| 427 | # Linux Module Utilities | 420 | # Linux Module Utilities |
| 428 | # | 421 | # |
| 429 | CONFIG_DEPMOD=y | 422 | CONFIG_MODPROBE_SMALL=y |
| 430 | CONFIG_FEATURE_DEPMOD_PRUNE_FANCY=y | 423 | CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE=y |
| 431 | CONFIG_FEATURE_DEPMOD_ALIAS=y | 424 | CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED=y |
| 432 | CONFIG_INSMOD=y | 425 | # CONFIG_DEPMOD is not set |
| 433 | CONFIG_FEATURE_INSMOD_VERSION_CHECKING=y | 426 | # CONFIG_FEATURE_DEPMOD_PRUNE_FANCY is not set |
| 434 | CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS=y | 427 | # CONFIG_FEATURE_DEPMOD_ALIAS is not set |
| 435 | CONFIG_FEATURE_INSMOD_LOADINKMEM=y | 428 | # CONFIG_INSMOD is not set |
| 436 | CONFIG_FEATURE_INSMOD_LOAD_MAP=y | 429 | # CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set |
| 437 | CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL=y | 430 | # CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set |
| 438 | CONFIG_RMMOD=y | 431 | # CONFIG_FEATURE_INSMOD_LOADINKMEM is not set |
| 439 | CONFIG_LSMOD=y | 432 | # CONFIG_FEATURE_INSMOD_LOAD_MAP is not set |
| 440 | CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT=y | 433 | # CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set |
| 441 | CONFIG_MODPROBE=y | 434 | # CONFIG_RMMOD is not set |
| 442 | CONFIG_FEATURE_MODPROBE_MULTIPLE_OPTIONS=y | 435 | # CONFIG_LSMOD is not set |
| 443 | CONFIG_FEATURE_MODPROBE_FANCY_ALIAS=y | 436 | # CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set |
| 444 | CONFIG_FEATURE_MODPROBE_BLACKLIST=y | 437 | # CONFIG_MODPROBE is not set |
| 445 | 438 | # CONFIG_FEATURE_MODPROBE_MULTIPLE_OPTIONS is not set | |
| 446 | # | 439 | # CONFIG_FEATURE_MODPROBE_FANCY_ALIAS is not set |
| 447 | # Options common to multiple modutils | 440 | # CONFIG_FEATURE_MODPROBE_BLACKLIST is not set |
| 448 | # | 441 | # CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set |
| 449 | CONFIG_FEATURE_CHECK_TAINTED_MODULE=y | 442 | # CONFIG_FEATURE_2_4_MODULES is not set |
| 450 | CONFIG_FEATURE_2_4_MODULES=y | 443 | # CONFIG_FEATURE_2_6_MODULES is not set |
| 451 | CONFIG_FEATURE_2_6_MODULES=y | ||
| 452 | CONFIG_DEFAULT_MODULES_DIR="/lib/modules" | 444 | CONFIG_DEFAULT_MODULES_DIR="/lib/modules" |
| 453 | CONFIG_DEFAULT_DEPMOD_FILE="modules.dep" | 445 | CONFIG_DEFAULT_DEPMOD_FILE="modules.dep" |
| 454 | # CONFIG_FEATURE_QUERY_MODULE_INTERFACE is not set | 446 | # CONFIG_FEATURE_QUERY_MODULE_INTERFACE is not set |
| @@ -686,6 +678,7 @@ CONFIG_NC_SERVER=y | |||
| 686 | CONFIG_NC_EXTRA=y | 678 | CONFIG_NC_EXTRA=y |
| 687 | CONFIG_NETSTAT=y | 679 | CONFIG_NETSTAT=y |
| 688 | CONFIG_FEATURE_NETSTAT_WIDE=y | 680 | CONFIG_FEATURE_NETSTAT_WIDE=y |
| 681 | CONFIG_FEATURE_NETSTAT_PRG=y | ||
| 689 | CONFIG_NSLOOKUP=y | 682 | CONFIG_NSLOOKUP=y |
| 690 | CONFIG_PING=y | 683 | CONFIG_PING=y |
| 691 | CONFIG_PING6=y | 684 | CONFIG_PING6=y |
| @@ -794,6 +787,7 @@ CONFIG_ASH_RANDOM_SUPPORT=y | |||
| 794 | # CONFIG_HUSH_TICK is not set | 787 | # CONFIG_HUSH_TICK is not set |
| 795 | # CONFIG_HUSH_IF is not set | 788 | # CONFIG_HUSH_IF is not set |
| 796 | # CONFIG_HUSH_LOOPS is not set | 789 | # CONFIG_HUSH_LOOPS is not set |
| 790 | # CONFIG_HUSH_CASE is not set | ||
| 797 | # CONFIG_LASH is not set | 791 | # CONFIG_LASH is not set |
| 798 | # CONFIG_MSH is not set | 792 | # CONFIG_MSH is not set |
| 799 | 793 | ||
