aboutsummaryrefslogtreecommitdiff
path: root/archival/libarchive (follow)
Commit message (Collapse)AuthorAgeFilesLines
* libarchive: alter handling of failure to create symlinksRon Yorston2022-09-271-19/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Unlike GNU tar upstream BusyBox tar treats all errors as fatal. Failure to create a symlink on Windows is very likely due to a lack of the required privilege. busybox-w32 therefore treats this case as a non-fatal error and, as far as possible, continues extracting files. However: - The inconsistency of this behaviour caused some confusion. - busybox-w32 tar didn't return an error status when a non-fatal error was encountered, unlike GNU tar. Change the implementation so extraction continues when symlink creation fails but the error report is deferred until all of the archive has been processed. Only one error is reported and it's treated as fatal. Saves 48-64 bytes. (GitHub issue #265)
* make: new appletRon Yorston2022-08-012-2/+7
| | | | | | | | | This is an experimental implementation of make for busybox-w32, based on my public domain POSIX make: https://frippery.org/make/ (GitHub issue #44)
* Merge busybox into mergeRon Yorston2022-02-092-1/+3
|\ | | | | | | | | | | | | | | Fix conflicts in reset and ash. Redefine the new safe_read_key() as a reference to read_key(). Disable SHA256_HWACCEL.
| * libbb: shrink lineedit_read_key()Denys Vlasenko2022-01-181-1/+1
| | | | | | | | | | | | | | function old new delta lineedit_read_key 237 231 -6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * fix "defined but not used" warningsDenys Vlasenko2022-01-171-0/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge busybox into mergeRon Yorston2021-12-271-1/+5
|\| | | | | | | Fix merge conflict in coreutils/timeout.c.
| * libarchive/get_header_ar.c: fix extraction of archives from binutils in ↵Peter Korsgaard2021-12-121-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | deterministic mode GNU binutils in deterministic mode (ar rD or built with --enable-deterministic-archives) hard codes file mode to 0644 (NOT 0100644) since https://github.com/bminor/binutils-gdb/commit/36e4dce69dd2 This confuses busybox ar x (data_extract_all): touch a; ar rD a.ar a ar: creating a.ar busybox ar x a.ar ar: unrecognized file type hexdump -C a.ar 00000000 21 3c 61 72 63 68 3e 0a 61 2f 20 20 20 20 20 20 |!<arch>.a/ | 00000010 20 20 20 20 20 20 20 20 30 20 20 20 20 20 20 20 | 0 | 00000020 20 20 20 20 30 20 20 20 20 20 30 20 20 20 20 20 | 0 0 | 00000030 36 34 34 20 20 20 20 20 30 20 20 20 20 20 20 20 |644 0 | 00000040 20 20 60 0a | `.| As a workaround, force the mode bits to S_IFREG, as nothing else makes sense for ar. function old new delta get_header_ar 539 542 +3 Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2021-10-133-5/+11
|\|
| * tar: prevent malicious archives with enormous long name sizes OOMing the machineDenys Vlasenko2021-10-111-3/+8
| | | | | | | | | | | | | | function old new delta get_header_tar 1707 1752 +45 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * *: add more beneficial NOINLINEsDenys Vlasenko2021-10-102-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta dec_main - 1729 +1729 -41 bytes fallbackQSort3 - 671 +671 -70 bytes verify_sun - 481 +481 -107 bytes verify 1330 742 -588 fallbackSort 1469 728 -741 unpack_xz_stream 2306 536 -1770 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 0/3 up/down: 2881/-3099) Total: -218 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tar: improve comments, add FIXMEs. no code changesDenys Vlasenko2021-10-081-2/+3
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2021-09-211-2/+3
|\|
| * libbb: eliminate a static data array in bb_mode_string()Denys Vlasenko2021-09-171-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta print_stat 861 869 +8 header_verbose_list_ar 73 77 +4 display_single 975 979 +4 header_verbose_list 237 239 +2 bb_mode_string 124 115 -9 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/1 up/down: 18/-9) Total: 9 bytes text data bss dec hex filename 1043136 559 5052 1048747 1000ab busybox_old 1043153 559 5020 1048732 10009c busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2021-08-302-8/+10
|\|
| * bzip: make ftab[] and crc32table[] member arrays of EState, do not allocateDenys Vlasenko2021-08-292-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta mainSort 941 986 +45 fallbackSort 1471 1469 -2 add_pair_to_block 194 188 -6 compressStream 543 515 -28 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/3 up/down: 45/-36) Total: 9 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2021-06-282-2/+6
|\|
| * cpio: fix sscanf on unterminated bufferS Harris2021-06-231-1/+2
| | | | | | | | | | Signed-off-by: S Harris <S.E.Harris@kent.ac.uk> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * unlzma: fix a case where we could read before beginning of bufferDenys Vlasenko2021-06-151-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Testcase: 21 01 01 00 00 00 00 00 e7 01 01 01 ef 00 df b6 00 17 02 10 11 0f ff 00 16 00 00 Unfortunately, the bug is not reliably causing a segfault, the behavior depends on what's in memory before the buffer. function old new delta unpack_lzma_stream 2762 2768 +6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2021-05-141-2/+9
|\|
| * decompress_gunzip: simplify ERR_RET bit clearingDenys Vlasenko2021-05-031-3/+2
| | | | | | | | | | | | My gcc is in fact clever enough to do it itself, but let's be explicit Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * decompress_gunzip: Fix DoS if gzip is corruptSamuel Sapalski2021-03-121-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | On certain corrupt gzip files, huft_build will set the error bit on the result pointer. If afterwards abort_unzip is called huft_free might run into a segmentation fault or an invalid pointer to free(p). In order to mitigate this, we check in huft_free if the error bit is set and clear it before the linked list is freed. Signed-off-by: Samuel Sapalski <samuel.sapalski@nokia.com> Signed-off-by: Peter Kaestle <peter.kaestle@nokia.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: implement symlink(2)Ron Yorston2021-02-121-11/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide an implementation of symlink(2). Calls to symlink(2) will fail in default Windows installations unless running with elevated privileges. Failure to create a symlink when extracting files from an archive is therefore treated as a non-fatal error. There are two ways to permit the creation of symlinks: - Edit security policy to give users the 'Create symbolic links' privilege. Unfortunately this doesn't work for users who are an Administrator. - Enable developer mode, which is available in later versions of Windows 10. The ability to create symlinks is not available in Windows XP or ReactOS.
* | libarchive: allow extraction of hard linksRon Yorston2021-01-191-3/+7
| | | | | | | | | | | | | | | | Allow create_or_remember_link() to create hardlinks. As a result tar and cpio can now extract hard links. Since unzip only supports symlinks it sees no improvement. As before, attempts to extract symlinks result in a warning.
* | Merge branch 'busybox' into mergeRon Yorston2021-01-146-6/+10
|\|
| * tar: add TODO about a bug with non-writable directories on extractDenys Vlasenko2021-01-011-0/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * decrease padding: gcc-9.3.1 slaps 32-byte alignment on arrays willy-nillyDenys Vlasenko2020-11-301-2/+2
| | | | | | | | | | | | | | | | text data bss dec hex filename 1021236 559 5052 1026847 fab1f busybox_old 1021120 559 5052 1026731 faaab busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * decrease paddign: gcc-9.3.1 slaps 32-byte alignment on arrays willy-nillyDenys Vlasenko2020-11-302-2/+2
| | | | | | | | | | | | | | | | text data bss dec hex filename 1021988 559 5052 1027599 fae0f busybox_old 1021236 559 5052 1026847 fab1f busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * archival: avoid std namespace for local includesJoachim Nilsson2020-11-162-2/+2
| | | | | | | | | | | | | | | | Avoid using same include file naming pattern as available in GLIBC. Renamed to match grp_.h et al. Signed-off-by: Joachim Nilsson <troglobit@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2020-11-121-1/+1
|\|
| * tar: fix fallout of last_char_is(NULL) no longer being allowedDenys Vlasenko2020-10-021-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: move code to fork (de)compressor to a functionRon Yorston2020-08-051-15/+1
| | | | | | | | | | | | | | | | Use a new common function, mingw_fork_compressor(), to implement fork_transformer() in open_transformer.c and vfork_compressor() in tar.c. Saves 160 bytes.
* | Merge branch 'busybox' into mergeRon Yorston2020-01-083-54/+79
|\|
| * gunzip: fix incorrect decoding of "fixed" inflate blocksDenys Vlasenko2019-10-261-10/+20
| | | | | | | | | | | | | | | | | | | | function old new delta huft_build 1008 1022 +14 inflate_block 1253 1256 +3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 17/0) Total: 17 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * gunzip: code shrink by using int-, not short-sized struct memberDenys Vlasenko2019-10-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | function old new delta inflate_block 1254 1253 -1 inflate_codes 629 621 -8 huft_build 1054 1008 -46 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-55) Total: -55 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * gzip: code shrinkDenys Vlasenko2019-10-191-29/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | huft_build() still has way too many params function old new delta lit - 94 +94 dist - 94 +94 huft_build 1058 1054 -4 inflate_block 1281 1254 -27 cpdext 30 - -30 cplext 31 - -31 cpdist 60 - -60 cplens 62 - -62 ------------------------------------------------------------------------------ (add/remove: 2/4 grow/shrink: 0/2 up/down: 188/-214) Total: -26 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * gzip: code shrinkDenys Vlasenko2019-10-191-27/+26
| | | | | | | | | | | | | | | | | | | | | | | | huft_build() has way too many params function old new delta inflate_block 1293 1281 -12 huft_build 1085 1058 -27 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-39) Total: -39 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * dpkg-deb: work around bogus error message when working with XZ compressed ↵Denys Vlasenko2019-10-112-2/+20
| | | | | | | | | | | | | | | | | | | | packages function old new delta unpack_xz_stream 2309 2317 +8 bb_full_fd_action 464 472 +8 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2019-08-1612-39/+39
|\|
| * libbb: reduce the overhead of single parameter bb_error_msg() callsJames Byrne2019-07-0212-39/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Back in 2007, commit 0c97c9d43707 ("'simple' error message functions by Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower overhead call to bb_perror_msg() when only a string was being printed with no parameters. This saves space for some CPU architectures because it avoids the overhead of a call to a variadic function. However there has never been a simple version of bb_error_msg(), and since 2007 many new calls to bb_perror_msg() have been added that only take a single parameter and so could have been using bb_simple_perror_message(). This changeset introduces 'simple' versions of bb_info_msg(), bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and bb_herror_msg_and_die(), and replaces all calls that only take a single parameter, or use something like ("%s", arg), with calls to the corresponding 'simple' version. Since it is likely that single parameter calls to the variadic functions may be accidentally reintroduced in the future a new debugging config option WARN_SIMPLE_MSG has been introduced. This uses some macro magic which will cause any such calls to generate a warning, but this is turned off by default to avoid use of the unpleasant macros in normal circumstances. This is a large changeset due to the number of calls that have been replaced. The only files that contain changes other than simple substitution of function calls are libbb.h, libbb/herror_msg.c, libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c, networking/udhcp/common.h and util-linux/mdev.c additonal macros have been added for logging so that single parameter and multiple parameter logging variants exist. The amount of space saved varies considerably by architecture, and was found to be as follows (for 'defconfig' using GCC 7.4): Arm: -92 bytes MIPS: -52 bytes PPC: -1836 bytes x86_64: -938 bytes Note that for the MIPS architecture only an exception had to be made disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h) because it made these files larger on MIPS. Signed-off-by: James Byrne <james.byrne@origamienergy.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2019-05-272-18/+28
|\|
| * comment fixDenys Vlasenko2019-05-261-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libarchive: treat one "FIXME: avoid seek", take 2Denys Vlasenko2019-05-261-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libarchive: treat one "FIXME: avoid seek"Denys Vlasenko2019-05-241-17/+27
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta xmalloc_read_with_initial_buf - 205 +205 setup_transformer_on_fd 154 150 -4 xmalloc_open_zipped_read_close 143 135 -8 xmalloc_read 201 10 -191 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/3 up/down: 205/-203) Total: 2 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * bunzip2: the correct condition is "n < groupCount", not "n <= groupCount". ↵Denys Vlasenko2019-05-231-1/+1
| | | | | | | | | | | | | | | | | | Closes 11896 function old new delta get_next_block 1677 1681 +4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | libarchive: remove more symlink codeRon Yorston2019-02-141-3/+2
| | | | | | | | | | | | | | Since symlinks aren't supported in busybox-w32 remove more of the code that handles them. Saves 64 bytes.
* | Merge branch 'busybox' into mergeRon Yorston2019-01-101-1/+1
|\|
| * randomconfig fixesDenys Vlasenko2018-12-271-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | tar: return correct exit code for empty tar fileRon Yorston2019-01-061-5/+0
| | | | | | | | | | The WIN32 implementation of check_errors_in_children shouldn't have reset bb_got_signal as it's used to signal an error.
* | Merge branch 'busybox' into mergeRon Yorston2018-11-285-15/+52
|\|
| * hush: allow hush to run embedded scriptsRon Yorston2018-11-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Embedded scripts require a shell to be present in the BusyBox binary. Allow either ash or hush to be used for this purpose. If both are enabled ash takes precedence. The size of the binary is unchanged in the default configuration: both ash and hush are present but support for embedded scripts isn't compiled into hush. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>