diff options
Diffstat (limited to 'archival')
-rw-r--r-- | archival/Config.src | 2 | ||||
-rw-r--r-- | archival/bbunzip.c | 82 | ||||
-rw-r--r-- | archival/dpkg_deb.c | 88 | ||||
-rw-r--r-- | archival/libarchive/get_header_tar.c | 32 | ||||
-rw-r--r-- | archival/lzop.c | 32 |
5 files changed, 141 insertions, 95 deletions
diff --git a/archival/Config.src b/archival/Config.src index a9afaea5b..5e7cfc0a4 100644 --- a/archival/Config.src +++ b/archival/Config.src | |||
@@ -30,7 +30,7 @@ config FEATURE_SEAMLESS_GZ | |||
30 | Make tar, rpm, modprobe etc understand .gz data. | 30 | Make tar, rpm, modprobe etc understand .gz data. |
31 | 31 | ||
32 | config FEATURE_SEAMLESS_Z | 32 | config FEATURE_SEAMLESS_Z |
33 | bool "tar, rpm, modprobe etc understand .Z data" | 33 | bool "Make tar, rpm, modprobe etc understand .Z data" |
34 | default n # it is ancient | 34 | default n # it is ancient |
35 | help | 35 | help |
36 | Make tar, rpm, modprobe etc understand .Z data. | 36 | Make tar, rpm, modprobe etc understand .Z data. |
diff --git a/archival/bbunzip.c b/archival/bbunzip.c index 3a483219d..e1eec6d4b 100644 --- a/archival/bbunzip.c +++ b/archival/bbunzip.c | |||
@@ -293,18 +293,24 @@ int uncompress_main(int argc UNUSED_PARAM, char **argv) | |||
293 | //config: You can use the `-t' option to test the integrity of | 293 | //config: You can use the `-t' option to test the integrity of |
294 | //config: an archive, without decompressing it. | 294 | //config: an archive, without decompressing it. |
295 | //config: | 295 | //config: |
296 | //config:config ZCAT | ||
297 | //config: bool "zcat" | ||
298 | //config: default y | ||
299 | //config: help | ||
300 | //config: Alias to "gunzip -c". | ||
301 | //config: | ||
296 | //config:config FEATURE_GUNZIP_LONG_OPTIONS | 302 | //config:config FEATURE_GUNZIP_LONG_OPTIONS |
297 | //config: bool "Enable long options" | 303 | //config: bool "Enable long options" |
298 | //config: default y | 304 | //config: default y |
299 | //config: depends on GUNZIP && LONG_OPTS | 305 | //config: depends on (GUNZIP || ZCAT) && LONG_OPTS |
300 | //config: help | 306 | //config: help |
301 | //config: Enable use of long options. | 307 | //config: Enable use of long options. |
302 | 308 | ||
303 | //applet:IF_GUNZIP(APPLET(gunzip, BB_DIR_BIN, BB_SUID_DROP)) | 309 | //applet:IF_GUNZIP(APPLET(gunzip, BB_DIR_BIN, BB_SUID_DROP)) |
304 | //applet:IF_GUNZIP(APPLET_ODDNAME(zcat, gunzip, BB_DIR_BIN, BB_SUID_DROP, zcat)) | 310 | //applet:IF_ZCAT(APPLET_ODDNAME(zcat, gunzip, BB_DIR_BIN, BB_SUID_DROP, zcat)) |
305 | //kbuild:lib-$(CONFIG_GZIP) += bbunzip.o | ||
306 | //kbuild:lib-$(CONFIG_GUNZIP) += bbunzip.o | 311 | //kbuild:lib-$(CONFIG_GUNZIP) += bbunzip.o |
307 | #if ENABLE_GUNZIP | 312 | //kbuild:lib-$(CONFIG_ZCAT) += bbunzip.o |
313 | #if ENABLE_GUNZIP || ENABLE_ZCAT | ||
308 | static | 314 | static |
309 | char* FAST_FUNC make_new_name_gunzip(char *filename, const char *expected_ext UNUSED_PARAM) | 315 | char* FAST_FUNC make_new_name_gunzip(char *filename, const char *expected_ext UNUSED_PARAM) |
310 | { | 316 | { |
@@ -367,7 +373,7 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv) | |||
367 | * Normally, "zcat" is just "gunzip -c". | 373 | * Normally, "zcat" is just "gunzip -c". |
368 | * But if seamless magic is enabled, then we are much more clever. | 374 | * But if seamless magic is enabled, then we are much more clever. |
369 | */ | 375 | */ |
370 | if (applet_name[1] == 'c') | 376 | if (ENABLE_ZCAT && applet_name[1] == 'c') |
371 | option_mask32 |= OPT_STDOUT | SEAMLESS_MAGIC; | 377 | option_mask32 |= OPT_STDOUT | SEAMLESS_MAGIC; |
372 | 378 | ||
373 | return bbunpack(argv, unpack_gz_stream, make_new_name_gunzip, /*unused:*/ NULL); | 379 | return bbunpack(argv, unpack_gz_stream, make_new_name_gunzip, /*unused:*/ NULL); |
@@ -404,18 +410,24 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv) | |||
404 | //config: | 410 | //config: |
405 | //config: Unless you have a specific application which requires bunzip2, you | 411 | //config: Unless you have a specific application which requires bunzip2, you |
406 | //config: should probably say N here. | 412 | //config: should probably say N here. |
413 | //config: | ||
414 | //config:config BZCAT | ||
415 | //config: bool "bzcat" | ||
416 | //config: default y | ||
417 | //config: help | ||
418 | //config: Alias to "bunzip2 -c". | ||
407 | 419 | ||
408 | //applet:IF_BUNZIP2(APPLET(bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP)) | 420 | //applet:IF_BUNZIP2(APPLET(bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP)) |
409 | //applet:IF_BUNZIP2(APPLET_ODDNAME(bzcat, bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP, bzcat)) | 421 | //applet:IF_BZCAT(APPLET_ODDNAME(bzcat, bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP, bzcat)) |
410 | //kbuild:lib-$(CONFIG_BZIP2) += bbunzip.o | ||
411 | //kbuild:lib-$(CONFIG_BUNZIP2) += bbunzip.o | 422 | //kbuild:lib-$(CONFIG_BUNZIP2) += bbunzip.o |
412 | #if ENABLE_BUNZIP2 | 423 | //kbuild:lib-$(CONFIG_BZCAT) += bbunzip.o |
424 | #if ENABLE_BUNZIP2 || ENABLE_BZCAT | ||
413 | int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 425 | int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
414 | int bunzip2_main(int argc UNUSED_PARAM, char **argv) | 426 | int bunzip2_main(int argc UNUSED_PARAM, char **argv) |
415 | { | 427 | { |
416 | getopt32(argv, "cfvqdt"); | 428 | getopt32(argv, "cfvqdt"); |
417 | argv += optind; | 429 | argv += optind; |
418 | if (applet_name[2] == 'c') /* bzcat */ | 430 | if (ENABLE_BZCAT && applet_name[2] == 'c') /* bzcat */ |
419 | option_mask32 |= OPT_STDOUT; | 431 | option_mask32 |= OPT_STDOUT; |
420 | 432 | ||
421 | return bbunpack(argv, unpack_bz2_stream, make_new_name_generic, "bz2"); | 433 | return bbunpack(argv, unpack_bz2_stream, make_new_name_generic, "bz2"); |
@@ -483,27 +495,40 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv) | |||
483 | //config: The BusyBox unlzma applet is limited to decompression only. | 495 | //config: The BusyBox unlzma applet is limited to decompression only. |
484 | //config: On an x86 system, this applet adds about 4K. | 496 | //config: On an x86 system, this applet adds about 4K. |
485 | //config: | 497 | //config: |
486 | //config:config FEATURE_LZMA_FAST | 498 | //config:config LZCAT |
487 | //config: bool "Optimize unlzma for speed" | 499 | //config: bool "lzcat" |
488 | //config: default n | 500 | //config: default y |
489 | //config: depends on UNLZMA | ||
490 | //config: help | 501 | //config: help |
491 | //config: This option reduces decompression time by about 25% at the cost of | 502 | //config: unlzma is a compression utility using the Lempel-Ziv-Markov chain |
492 | //config: a 1K bigger binary. | 503 | //config: compression algorithm, and range coding. Compression |
504 | //config: is generally considerably better than that achieved by the bzip2 | ||
505 | //config: compressors. | ||
506 | //config: | ||
507 | //config: The BusyBox unlzma applet is limited to decompression only. | ||
508 | //config: On an x86 system, this applet adds about 4K. | ||
493 | //config: | 509 | //config: |
494 | //config:config LZMA | 510 | //config:config LZMA |
495 | //config: bool "Provide lzma alias which supports only unpacking" | 511 | //config: bool "lzma -d" |
496 | //config: default y | 512 | //config: default y |
497 | //config: depends on UNLZMA | ||
498 | //config: help | 513 | //config: help |
499 | //config: Enable this option if you want commands like "lzma -d" to work. | 514 | //config: Enable this option if you want commands like "lzma -d" to work. |
500 | //config: IOW: you'll get lzma applet, but it will always require -d option. | 515 | //config: IOW: you'll get lzma applet, but it will always require -d option. |
516 | //config: | ||
517 | //config:config FEATURE_LZMA_FAST | ||
518 | //config: bool "Optimize unlzma for speed" | ||
519 | //config: default n | ||
520 | //config: depends on UNLZMA || LZCAT || LZMA | ||
521 | //config: help | ||
522 | //config: This option reduces decompression time by about 25% at the cost of | ||
523 | //config: a 1K bigger binary. | ||
501 | 524 | ||
502 | //applet:IF_UNLZMA(APPLET(unlzma, BB_DIR_USR_BIN, BB_SUID_DROP)) | 525 | //applet:IF_UNLZMA(APPLET(unlzma, BB_DIR_USR_BIN, BB_SUID_DROP)) |
503 | //applet:IF_UNLZMA(APPLET_ODDNAME(lzcat, unlzma, BB_DIR_USR_BIN, BB_SUID_DROP, lzcat)) | 526 | //applet:IF_LZCAT(APPLET_ODDNAME(lzcat, unlzma, BB_DIR_USR_BIN, BB_SUID_DROP, lzcat)) |
504 | //applet:IF_LZMA(APPLET_ODDNAME(lzma, unlzma, BB_DIR_USR_BIN, BB_SUID_DROP, lzma)) | 527 | //applet:IF_LZMA(APPLET_ODDNAME(lzma, unlzma, BB_DIR_USR_BIN, BB_SUID_DROP, lzma)) |
505 | //kbuild:lib-$(CONFIG_UNLZMA) += bbunzip.o | 528 | //kbuild:lib-$(CONFIG_UNLZMA) += bbunzip.o |
506 | #if ENABLE_UNLZMA | 529 | //kbuild:lib-$(CONFIG_LZCAT) += bbunzip.o |
530 | //kbuild:lib-$(CONFIG_LZMA) += bbunzip.o | ||
531 | #if ENABLE_UNLZMA || ENABLE_LZCAT || ENABLE_LZMA | ||
507 | int unlzma_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 532 | int unlzma_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
508 | int unlzma_main(int argc UNUSED_PARAM, char **argv) | 533 | int unlzma_main(int argc UNUSED_PARAM, char **argv) |
509 | { | 534 | { |
@@ -514,7 +539,7 @@ int unlzma_main(int argc UNUSED_PARAM, char **argv) | |||
514 | bb_show_usage(); | 539 | bb_show_usage(); |
515 | # endif | 540 | # endif |
516 | /* lzcat? */ | 541 | /* lzcat? */ |
517 | if (applet_name[2] == 'c') | 542 | if (ENABLE_LZCAT && applet_name[2] == 'c') |
518 | option_mask32 |= OPT_STDOUT; | 543 | option_mask32 |= OPT_STDOUT; |
519 | 544 | ||
520 | argv += optind; | 545 | argv += optind; |
@@ -529,19 +554,26 @@ int unlzma_main(int argc UNUSED_PARAM, char **argv) | |||
529 | //config: help | 554 | //config: help |
530 | //config: unxz is a unlzma successor. | 555 | //config: unxz is a unlzma successor. |
531 | //config: | 556 | //config: |
557 | //config:config XZCAT | ||
558 | //config: bool "xzcat" | ||
559 | //config: default y | ||
560 | //config: help | ||
561 | //config: Alias to "unxz -c". | ||
562 | //config: | ||
532 | //config:config XZ | 563 | //config:config XZ |
533 | //config: bool "Provide xz alias which supports only unpacking" | 564 | //config: bool "xz -d" |
534 | //config: default y | 565 | //config: default y |
535 | //config: depends on UNXZ | ||
536 | //config: help | 566 | //config: help |
537 | //config: Enable this option if you want commands like "xz -d" to work. | 567 | //config: Enable this option if you want commands like "xz -d" to work. |
538 | //config: IOW: you'll get xz applet, but it will always require -d option. | 568 | //config: IOW: you'll get xz applet, but it will always require -d option. |
539 | 569 | ||
540 | //applet:IF_UNXZ(APPLET(unxz, BB_DIR_USR_BIN, BB_SUID_DROP)) | 570 | //applet:IF_UNXZ(APPLET(unxz, BB_DIR_USR_BIN, BB_SUID_DROP)) |
541 | //applet:IF_UNXZ(APPLET_ODDNAME(xzcat, unxz, BB_DIR_USR_BIN, BB_SUID_DROP, xzcat)) | 571 | //applet:IF_XZCAT(APPLET_ODDNAME(xzcat, unxz, BB_DIR_USR_BIN, BB_SUID_DROP, xzcat)) |
542 | //applet:IF_XZ(APPLET_ODDNAME(xz, unxz, BB_DIR_USR_BIN, BB_SUID_DROP, xz)) | 572 | //applet:IF_XZ(APPLET_ODDNAME(xz, unxz, BB_DIR_USR_BIN, BB_SUID_DROP, xz)) |
543 | //kbuild:lib-$(CONFIG_UNXZ) += bbunzip.o | 573 | //kbuild:lib-$(CONFIG_UNXZ) += bbunzip.o |
544 | #if ENABLE_UNXZ | 574 | //kbuild:lib-$(CONFIG_XZCAT) += bbunzip.o |
575 | //kbuild:lib-$(CONFIG_XZ) += bbunzip.o | ||
576 | #if ENABLE_UNXZ || ENABLE_XZCAT || ENABLE_XZ | ||
545 | int unxz_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 577 | int unxz_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
546 | int unxz_main(int argc UNUSED_PARAM, char **argv) | 578 | int unxz_main(int argc UNUSED_PARAM, char **argv) |
547 | { | 579 | { |
@@ -552,7 +584,7 @@ int unxz_main(int argc UNUSED_PARAM, char **argv) | |||
552 | bb_show_usage(); | 584 | bb_show_usage(); |
553 | # endif | 585 | # endif |
554 | /* xzcat? */ | 586 | /* xzcat? */ |
555 | if (applet_name[2] == 'c') | 587 | if (ENABLE_XZCAT && applet_name[2] == 'c') |
556 | option_mask32 |= OPT_STDOUT; | 588 | option_mask32 |= OPT_STDOUT; |
557 | 589 | ||
558 | argv += optind; | 590 | argv += optind; |
diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c index 0285273fe..86850469d 100644 --- a/archival/dpkg_deb.c +++ b/archival/dpkg_deb.c | |||
@@ -16,29 +16,20 @@ | |||
16 | //config: | 16 | //config: |
17 | //config: Unless you have a specific application which requires dpkg-deb, | 17 | //config: Unless you have a specific application which requires dpkg-deb, |
18 | //config: say N here. | 18 | //config: say N here. |
19 | //config: | ||
20 | //config:config FEATURE_DPKG_DEB_EXTRACT_ONLY | ||
21 | //config: bool "Extract only (-x)" | ||
22 | //config: default n | ||
23 | //config: depends on DPKG_DEB | ||
24 | //config: help | ||
25 | //config: This reduces dpkg-deb to the equivalent of | ||
26 | //config: "ar -p <deb> data.tar.gz | tar -zx". However it saves space as none | ||
27 | //config: of the extra dpkg-deb, ar or tar options are needed, they are linked | ||
28 | //config: to internally. | ||
29 | 19 | ||
30 | //applet:IF_DPKG_DEB(APPLET_ODDNAME(dpkg-deb, dpkg_deb, BB_DIR_USR_BIN, BB_SUID_DROP, dpkg_deb)) | 20 | //applet:IF_DPKG_DEB(APPLET_ODDNAME(dpkg-deb, dpkg_deb, BB_DIR_USR_BIN, BB_SUID_DROP, dpkg_deb)) |
21 | |||
31 | //kbuild:lib-$(CONFIG_DPKG_DEB) += dpkg_deb.o | 22 | //kbuild:lib-$(CONFIG_DPKG_DEB) += dpkg_deb.o |
32 | 23 | ||
33 | //usage:#define dpkg_deb_trivial_usage | 24 | //usage:#define dpkg_deb_trivial_usage |
34 | //usage: "[-cefxX] FILE [argument]" | 25 | //usage: "[-cefxX] FILE [DIR]" |
35 | //usage:#define dpkg_deb_full_usage "\n\n" | 26 | //usage:#define dpkg_deb_full_usage "\n\n" |
36 | //usage: "Perform actions on Debian packages (.debs)\n" | 27 | //usage: "Perform actions on Debian packages (.deb)\n" |
37 | //usage: "\n -c List contents of filesystem tree" | 28 | //usage: "\n -c List files" |
38 | //usage: "\n -e Extract control files to [argument] directory" | 29 | //usage: "\n -f Print control fields" |
39 | //usage: "\n -f Display control field name starting with [argument]" | 30 | //usage: "\n -e Extract control files to DIR (default: ./DEBIAN)" |
40 | //usage: "\n -x Extract packages filesystem tree to directory" | 31 | //usage: "\n -x Extract files to DIR (no default)" |
41 | //usage: "\n -X Verbose extract" | 32 | //usage: "\n -X Verbose -x" |
42 | //usage: | 33 | //usage: |
43 | //usage:#define dpkg_deb_example_usage | 34 | //usage:#define dpkg_deb_example_usage |
44 | //usage: "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n" | 35 | //usage: "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n" |
@@ -49,18 +40,17 @@ | |||
49 | #define DPKG_DEB_OPT_CONTENTS 1 | 40 | #define DPKG_DEB_OPT_CONTENTS 1 |
50 | #define DPKG_DEB_OPT_CONTROL 2 | 41 | #define DPKG_DEB_OPT_CONTROL 2 |
51 | #define DPKG_DEB_OPT_FIELD 4 | 42 | #define DPKG_DEB_OPT_FIELD 4 |
52 | #define DPKG_DEB_OPT_EXTRACT 8 | 43 | #define DPKG_DEB_OPT_EXTRACT_VERBOSE 8 |
53 | #define DPKG_DEB_OPT_EXTRACT_VERBOSE 16 | 44 | #define DPKG_DEB_OPT_EXTRACT 16 |
54 | 45 | ||
55 | int dpkg_deb_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 46 | int dpkg_deb_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
56 | int dpkg_deb_main(int argc, char **argv) | 47 | int dpkg_deb_main(int argc UNUSED_PARAM, char **argv) |
57 | { | 48 | { |
58 | archive_handle_t *ar_archive; | 49 | archive_handle_t *ar_archive; |
59 | archive_handle_t *tar_archive; | 50 | archive_handle_t *tar_archive; |
60 | llist_t *control_tar_llist = NULL; | 51 | llist_t *control_tar_llist = NULL; |
61 | unsigned opt; | 52 | unsigned opt; |
62 | const char *extract_dir; | 53 | const char *extract_dir; |
63 | int need_args; | ||
64 | 54 | ||
65 | /* Setup the tar archive handle */ | 55 | /* Setup the tar archive handle */ |
66 | tar_archive = init_handle(); | 56 | tar_archive = init_handle(); |
@@ -89,53 +79,45 @@ int dpkg_deb_main(int argc, char **argv) | |||
89 | llist_add_to(&control_tar_llist, (char*)"control.tar.xz"); | 79 | llist_add_to(&control_tar_llist, (char*)"control.tar.xz"); |
90 | #endif | 80 | #endif |
91 | 81 | ||
92 | opt_complementary = "c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX"; | 82 | /* Must have 1 or 2 args */ |
83 | opt_complementary = "-1:?2:c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX"; | ||
93 | opt = getopt32(argv, "cefXx"); | 84 | opt = getopt32(argv, "cefXx"); |
94 | argv += optind; | 85 | argv += optind; |
95 | argc -= optind; | 86 | //argc -= optind; |
96 | 87 | ||
97 | if (opt & DPKG_DEB_OPT_CONTENTS) { | 88 | extract_dir = argv[1]; |
89 | if (opt & DPKG_DEB_OPT_CONTENTS) { // -c | ||
98 | tar_archive->action_header = header_verbose_list; | 90 | tar_archive->action_header = header_verbose_list; |
91 | if (extract_dir) | ||
92 | bb_show_usage(); | ||
99 | } | 93 | } |
100 | extract_dir = NULL; | 94 | if (opt & DPKG_DEB_OPT_FIELD) { // -f |
101 | need_args = 1; | 95 | /* Print the entire control file */ |
102 | if (opt & DPKG_DEB_OPT_CONTROL) { | 96 | //TODO: standard tool accepts an optional list of fields to print |
103 | ar_archive->accept = control_tar_llist; | ||
104 | tar_archive->action_data = data_extract_all; | ||
105 | if (1 == argc) { | ||
106 | extract_dir = "./DEBIAN"; | ||
107 | } else { | ||
108 | need_args++; | ||
109 | } | ||
110 | } | ||
111 | if (opt & DPKG_DEB_OPT_FIELD) { | ||
112 | /* Print the entire control file | ||
113 | * it should accept a second argument which specifies a | ||
114 | * specific field to print */ | ||
115 | ar_archive->accept = control_tar_llist; | 97 | ar_archive->accept = control_tar_llist; |
116 | llist_add_to(&(tar_archive->accept), (char*)"./control"); | 98 | llist_add_to(&(tar_archive->accept), (char*)"./control"); |
117 | tar_archive->filter = filter_accept_list; | 99 | tar_archive->filter = filter_accept_list; |
118 | tar_archive->action_data = data_extract_to_stdout; | 100 | tar_archive->action_data = data_extract_to_stdout; |
101 | if (extract_dir) | ||
102 | bb_show_usage(); | ||
119 | } | 103 | } |
120 | if (opt & DPKG_DEB_OPT_EXTRACT) { | 104 | if (opt & DPKG_DEB_OPT_CONTROL) { // -e |
121 | tar_archive->action_header = header_list; | 105 | ar_archive->accept = control_tar_llist; |
122 | } | ||
123 | if (opt & (DPKG_DEB_OPT_EXTRACT_VERBOSE | DPKG_DEB_OPT_EXTRACT)) { | ||
124 | tar_archive->action_data = data_extract_all; | 106 | tar_archive->action_data = data_extract_all; |
125 | need_args = 2; | 107 | if (!extract_dir) |
108 | extract_dir = "./DEBIAN"; | ||
126 | } | 109 | } |
127 | 110 | if (opt & (DPKG_DEB_OPT_EXTRACT_VERBOSE | DPKG_DEB_OPT_EXTRACT)) { // -Xx | |
128 | if (need_args != argc) { | 111 | if (opt & DPKG_DEB_OPT_EXTRACT_VERBOSE) |
129 | bb_show_usage(); | 112 | tar_archive->action_header = header_list; |
113 | tar_archive->action_data = data_extract_all; | ||
114 | if (!extract_dir) | ||
115 | bb_show_usage(); | ||
130 | } | 116 | } |
131 | 117 | ||
132 | tar_archive->src_fd = ar_archive->src_fd = xopen(argv[0], O_RDONLY); | 118 | /* Standard tool supports "-" */ |
119 | tar_archive->src_fd = ar_archive->src_fd = xopen_stdin(argv[0]); | ||
133 | 120 | ||
134 | /* Work out where to extract the files */ | ||
135 | /* 2nd argument is a dir name */ | ||
136 | if (argv[1]) { | ||
137 | extract_dir = argv[1]; | ||
138 | } | ||
139 | if (extract_dir) { | 121 | if (extract_dir) { |
140 | mkdir(extract_dir, 0777); /* bb_make_directory(extract_dir, 0777, 0) */ | 122 | mkdir(extract_dir, 0777); /* bb_make_directory(extract_dir, 0777, 0) */ |
141 | xchdir(extract_dir); | 123 | xchdir(extract_dir); |
diff --git a/archival/libarchive/get_header_tar.c b/archival/libarchive/get_header_tar.c index ea91a883e..c7e3bc16e 100644 --- a/archival/libarchive/get_header_tar.c +++ b/archival/libarchive/get_header_tar.c | |||
@@ -113,11 +113,19 @@ static void process_pax_hdr(archive_handle_t *archive_handle, unsigned sz, int g | |||
113 | value = end + 1; | 113 | value = end + 1; |
114 | 114 | ||
115 | # if ENABLE_FEATURE_TAR_GNU_EXTENSIONS | 115 | # if ENABLE_FEATURE_TAR_GNU_EXTENSIONS |
116 | if (!global && is_prefixed_with(value, "path=")) { | 116 | if (!global) { |
117 | value += sizeof("path=") - 1; | 117 | if (is_prefixed_with(value, "path=")) { |
118 | free(archive_handle->tar__longname); | 118 | value += sizeof("path=") - 1; |
119 | archive_handle->tar__longname = xstrdup(value); | 119 | free(archive_handle->tar__longname); |
120 | continue; | 120 | archive_handle->tar__longname = xstrdup(value); |
121 | continue; | ||
122 | } | ||
123 | if (is_prefixed_with(value, "linkpath=")) { | ||
124 | value += sizeof("linkpath=") - 1; | ||
125 | free(archive_handle->tar__linkname); | ||
126 | archive_handle->tar__linkname = xstrdup(value); | ||
127 | continue; | ||
128 | } | ||
121 | } | 129 | } |
122 | # endif | 130 | # endif |
123 | 131 | ||
@@ -179,7 +187,13 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle) | |||
179 | * the message and we don't check whether we indeed | 187 | * the message and we don't check whether we indeed |
180 | * saw zero block directly before this. */ | 188 | * saw zero block directly before this. */ |
181 | if (i == 0) { | 189 | if (i == 0) { |
182 | bb_error_msg("short read"); | 190 | /* GNU tar 1.29 will be silent if tar archive ends abruptly |
191 | * (if there are no zero blocks at all, and last read returns zero, | ||
192 | * not short read 0 < len < 512). Complain only if | ||
193 | * the very first read fails. Grrr. | ||
194 | */ | ||
195 | if (archive_handle->offset == 0) | ||
196 | bb_error_msg("short read"); | ||
183 | /* this merely signals end of archive, not exit(1): */ | 197 | /* this merely signals end of archive, not exit(1): */ |
184 | return EXIT_FAILURE; | 198 | return EXIT_FAILURE; |
185 | } | 199 | } |
@@ -195,7 +209,11 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle) | |||
195 | archive_handle->offset += i; | 209 | archive_handle->offset += i; |
196 | 210 | ||
197 | /* If there is no filename its an empty header */ | 211 | /* If there is no filename its an empty header */ |
198 | if (tar.name[0] == 0 && tar.prefix[0] == 0) { | 212 | if (tar.name[0] == 0 && tar.prefix[0] == 0 |
213 | /* Have seen a tar archive with pax 'x' header supplying UTF8 filename, | ||
214 | * with actual file having all name fields NUL-filled. Check this: */ | ||
215 | && !p_longname | ||
216 | ) { | ||
199 | if (archive_handle->tar__end) { | 217 | if (archive_handle->tar__end) { |
200 | /* Second consecutive empty header - end of archive. | 218 | /* Second consecutive empty header - end of archive. |
201 | * Read until the end to empty the pipe from gz or bz2 | 219 | * Read until the end to empty the pipe from gz or bz2 |
diff --git a/archival/lzop.c b/archival/lzop.c index 202de4d03..e0e90ac6c 100644 --- a/archival/lzop.c +++ b/archival/lzop.c | |||
@@ -31,19 +31,33 @@ | |||
31 | //config: help | 31 | //config: help |
32 | //config: Lzop compression/decompresion. | 32 | //config: Lzop compression/decompresion. |
33 | //config: | 33 | //config: |
34 | //config:config UNLZOP | ||
35 | //config: bool "unlzop" | ||
36 | //config: default y | ||
37 | //config: help | ||
38 | //config: Lzop decompresion. | ||
39 | //config: | ||
40 | //config:config LZOPCAT | ||
41 | //config: bool "lzopcat" | ||
42 | //config: default y | ||
43 | //config: help | ||
44 | //config: Alias to "unlzop -c". | ||
45 | //config: | ||
34 | //config:config LZOP_COMPR_HIGH | 46 | //config:config LZOP_COMPR_HIGH |
35 | //config: bool "lzop compression levels 7,8,9 (not very useful)" | 47 | //config: bool "lzop compression levels 7,8,9 (not very useful)" |
36 | //config: default n | 48 | //config: default n |
37 | //config: depends on LZOP | 49 | //config: depends on LZOP || UNLZOP || LZOPCAT |
38 | //config: help | 50 | //config: help |
39 | //config: High levels (7,8,9) of lzop compression. These levels | 51 | //config: High levels (7,8,9) of lzop compression. These levels |
40 | //config: are actually slower than gzip at equivalent compression ratios | 52 | //config: are actually slower than gzip at equivalent compression ratios |
41 | //config: and take up 3.2K of code. | 53 | //config: and take up 3.2K of code. |
42 | 54 | ||
43 | //applet:IF_LZOP(APPLET(lzop, BB_DIR_BIN, BB_SUID_DROP)) | 55 | //applet:IF_LZOP(APPLET(lzop, BB_DIR_BIN, BB_SUID_DROP)) |
44 | //applet:IF_LZOP(APPLET_ODDNAME(lzopcat, lzop, BB_DIR_USR_BIN, BB_SUID_DROP, lzopcat)) | 56 | //applet:IF_UNLZOP(APPLET_ODDNAME(unlzop, lzop, BB_DIR_USR_BIN, BB_SUID_DROP, unlzop)) |
45 | //applet:IF_LZOP(APPLET_ODDNAME(unlzop, lzop, BB_DIR_USR_BIN, BB_SUID_DROP, unlzop)) | 57 | //applet:IF_LZOPCAT(APPLET_ODDNAME(lzopcat, lzop, BB_DIR_USR_BIN, BB_SUID_DROP, lzopcat)) |
46 | //kbuild:lib-$(CONFIG_LZOP) += lzop.o | 58 | //kbuild:lib-$(CONFIG_LZOP) += lzop.o |
59 | //kbuild:lib-$(CONFIG_UNLZOP) += lzop.o | ||
60 | //kbuild:lib-$(CONFIG_LZOPCAT) += lzop.o | ||
47 | 61 | ||
48 | //usage:#define lzop_trivial_usage | 62 | //usage:#define lzop_trivial_usage |
49 | //usage: "[-cfvd123456789CF] [FILE]..." | 63 | //usage: "[-cfvd123456789CF] [FILE]..." |
@@ -57,18 +71,18 @@ | |||
57 | //usage: "\n -C Also write checksum of compressed block" | 71 | //usage: "\n -C Also write checksum of compressed block" |
58 | //usage: | 72 | //usage: |
59 | //usage:#define lzopcat_trivial_usage | 73 | //usage:#define lzopcat_trivial_usage |
60 | //usage: "[-vCF] [FILE]..." | 74 | //usage: "[-vF] [FILE]..." |
61 | //usage:#define lzopcat_full_usage "\n\n" | 75 | //usage:#define lzopcat_full_usage "\n\n" |
62 | //usage: " -v Verbose" | 76 | //usage: " -v Verbose" |
63 | //usage: "\n -F Don't store or verify checksum" | 77 | //usage: "\n -F Don't verify checksum" |
64 | //usage: | 78 | //usage: |
65 | //usage:#define unlzop_trivial_usage | 79 | //usage:#define unlzop_trivial_usage |
66 | //usage: "[-cfvCF] [FILE]..." | 80 | //usage: "[-cfvF] [FILE]..." |
67 | //usage:#define unlzop_full_usage "\n\n" | 81 | //usage:#define unlzop_full_usage "\n\n" |
68 | //usage: " -c Write to stdout" | 82 | //usage: " -c Write to stdout" |
69 | //usage: "\n -f Force" | 83 | //usage: "\n -f Force" |
70 | //usage: "\n -v Verbose" | 84 | //usage: "\n -v Verbose" |
71 | //usage: "\n -F Don't store or verify checksum" | 85 | //usage: "\n -F Don't verify checksum" |
72 | 86 | ||
73 | #include "libbb.h" | 87 | #include "libbb.h" |
74 | #include "common_bufsiz.h" | 88 | #include "common_bufsiz.h" |
@@ -1111,10 +1125,10 @@ int lzop_main(int argc UNUSED_PARAM, char **argv) | |||
1111 | getopt32(argv, OPTION_STRING); | 1125 | getopt32(argv, OPTION_STRING); |
1112 | argv += optind; | 1126 | argv += optind; |
1113 | /* lzopcat? */ | 1127 | /* lzopcat? */ |
1114 | if (applet_name[4] == 'c') | 1128 | if (ENABLE_LZOPCAT && applet_name[4] == 'c') |
1115 | option_mask32 |= (OPT_STDOUT | OPT_DECOMPRESS); | 1129 | option_mask32 |= (OPT_STDOUT | OPT_DECOMPRESS); |
1116 | /* unlzop? */ | 1130 | /* unlzop? */ |
1117 | if (applet_name[4] == 'o') | 1131 | if (ENABLE_UNLZOP && applet_name[4] == 'o') |
1118 | option_mask32 |= OPT_DECOMPRESS; | 1132 | option_mask32 |= OPT_DECOMPRESS; |
1119 | 1133 | ||
1120 | global_crc32_table = crc32_filltable(NULL, 0); | 1134 | global_crc32_table = crc32_filltable(NULL, 0); |