aboutsummaryrefslogtreecommitdiff
path: root/archival/tar.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* build system: avoid full rebuild when EXTRAVERSION changesRon Yorston2024-02-161-0/+3
| | | | | | | | | | The last two commits allow EXTRAVERSION to track the current state of a git repository. The build system was unable to determine which files were affected by changes to EXTRAVERSION and caused a full rebuild when it changed. Alter how the version information is passed to the code so only a handful of files need to be rebuilt when it changes.
* Merge branch 'busybox' into mergeRon Yorston2023-07-131-1/+1
|\
| * libbb: code shrink: introduce and use [_]exit_FAILURE()Denys Vlasenko2023-06-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta exit_FAILURE - 7 +7 _exit_FAILURE - 7 +7 run 198 199 +1 restore_state_and_exit 114 115 +1 xbsd_write_bootstrap 399 397 -2 vfork_compressor 209 207 -2 sig_handler 12 10 -2 serial_ctl 154 152 -2 parse_args 1169 1167 -2 onintr 21 19 -2 make_new_session 493 491 -2 login_main 988 986 -2 gotsig 35 33 -2 do_iplink 1315 1313 -2 addgroup_main 397 395 -2 inetd_main 1911 1908 -3 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 2/12 up/down: 16/-25) Total: -9 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2021-08-221-29/+2
|\|
| * tar,smemcap: commonalyze checksumming code for tar headerDenys Vlasenko2021-08-201-29/+2
| | | | | | | | | | | | | | | | | | | | | | function old new delta chksum_and_xwrite_tar_header - 99 +99 writeheader 280 199 -81 chksum_and_xwrite 102 - -102 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 0/1 up/down: 99/-183) Total: -84 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2021-08-171-11/+12
|\|
| * tar: exclude files before updating hardlink info listHarald van Dijk2021-08-021-5/+5
| | | | | | | | | | | | | | | | | | | | | | When excluding one file, and including another file that is a hardlink of the excluded file, it should be stored as an ordinary file. function old new delta writeFileToTarball 489 493 +4 Signed-off-by: Harald van Dijk <harald@gigawatt.nl> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tar: simplify addition of --exclude=GLOB to the expansion of -X EXCLFILEDenys Vlasenko2021-08-021-6/+7
| | | | | | | | | | | | | | function old new delta tar_main 1115 1105 -10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2021-06-281-1/+1
|\|
| * *: more --help tweaks, mostly expanding ts --helpDenys Vlasenko2021-06-131-1/+1
| | | | | | | | | | | | | | function old new delta packed_usage 33554 33596 +42 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | tar: changes to conditional compilationRon Yorston2021-01-251-4/+6
| | | | | | | | Mostly just cosmetic.
* | Merge branch 'busybox' into mergeRon Yorston2021-01-141-11/+16
|\|
| * tar: expand --helpDenys Vlasenko2020-12-081-11/+16
| | | | | | | | | | | | | | function old new delta packed_usage 33486 33590 +104 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2020-11-121-5/+7
|\|
| * libbb: shrink recursive_action() by reducing memory pressureDenys Vlasenko2020-10-011-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta recursive_action1 - 316 +316 file_action_grep 161 164 +3 add_to_prg_cache_if_socket 202 205 +3 depmod_main 509 511 +2 writeFileToTarball 488 489 +1 parse_module 281 282 +1 fileAction 207 208 +1 act 189 190 +1 add_to_dirlist 65 64 -1 writeTarFile 196 194 -2 uuidcache_init 47 45 -2 uuidcache_check_device 109 107 -2 true_action 8 6 -2 run_parts_main 310 308 -2 netstat_main 534 532 -2 lsusb_main 29 27 -2 lspci_main 45 43 -2 initial_scan 138 136 -2 grep_main 845 843 -2 find_main 482 480 -2 config_file_action 437 435 -2 chmod_main 142 140 -2 dirAction 14 10 -4 diff_main 1544 1540 -4 chown_main 154 148 -6 skip_dir 136 129 -7 dir_act 191 184 -7 recursive_action 453 69 -384 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 7/20 up/down: 328/-439) Total: -111 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * gcc-9.x warning fixesDenys Vlasenko2020-10-011-1/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: move code to fork (de)compressor to a functionRon Yorston2020-08-051-23/+5
| | | | | | | | | | | | | | | | 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-081-1/+1
|\|
| * tar: fix fallout of: change -a from meaning "lzma" to mean "autodetect by ↵Denys Vlasenko2019-10-251-1/+1
| | | | | | | | | | | | extension" Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2019-08-161-38/+63
|\|
| * tar: change -a from meaning "lzma" to mean "autodetect by extension"Denys Vlasenko2019-08-021-18/+42
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta tar_main 1026 1100 +74 packed_usage 33311 33329 +18 tar_longopts 309 325 +16 vfork_compressor 246 210 -36 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 108/-36) Total: 72 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tar: code shrinkDenys Vlasenko2019-08-011-12/+13
| | | | | | | | | | | | | | | | | | | | function old new delta writeLongname 226 228 +2 static.prefilled 48 - -48 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/0 up/down: 2/-48) Total: -46 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: reduce the overhead of single parameter bb_error_msg() callsJames Byrne2019-07-021-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | win32: fix POSIX build (again)Ron Yorston2019-03-121-1/+3
| | | | | | | | | | Some faulty logic with ENABLE_FEATURE_EXTRA_FILE_DATA broke the POSIX build.
* | win32: stat(2) succeeds if fetching extra metadata failsRon Yorston2019-02-191-3/+5
| | | | | | | | | | | | | | | | | | Some files can't be opened to fetch additional metadata. When that happens allow stat(2) to successfully return what data it has. In a few cases where the inode number is used to determine if files are identical ignore invalid inode numbers.
* | win32: make stat(2) fetch additional metadataRon Yorston2019-02-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Modify the WIN32 implementation of stat(2) to fetch inode number, device id and number of hardlinks. This requires opening a handle to the target file so it will be slower. A number of features can be enabled or start to work: - tar can detect if an archive is being stored in itself; - find can support the -inum and -links options; - ls can display inode numbers; - diff can detect attempts to compare a file with itself; - du has better support for hardlinked files; - cp can detect attempts to copy a file over itself.
* | Merge branch 'busybox' into mergeRon Yorston2019-01-101-1/+1
|\|
| * config: update size informationDenys Vlasenko2018-12-281-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: emulate SIGPIPERon Yorston2018-12-111-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code to check whether a write error is due to a broken pipe can now either: - return with error EPIPE; - cause the process to exit with code 128+SIGPIPE. The default is the latter but the behaviour can be changed by issuing signal(SIGPIPE, SIG_IGN) and signal(SIGPIPE, SIG_DFL) calls. No actual signal is involved so kill can't send SIGPIPE and handlers other than SIG_IGN and SIG_DFL aren't supported. This does, however, avoid unsightly 'broken pipe' errors from commands like the example in GitHub issue #99: dd if=/dev/urandom | tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;
* | Merge branch 'busybox' into mergeRon Yorston2018-11-281-0/+8
|\|
| * tar: fix too eager autodetection, closes 11531Denys Vlasenko2018-11-271-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta is_suffixed_with - 54 +54 tar_main 1006 1026 +20 open_transformer 92 79 -13 config_file_action 478 458 -20 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/2 up/down: 74/-33) Total: 41 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2018-09-101-38/+42
|\|
| * tar: fix a thinko in prev commit - we need to copy to _unused_ fdDenys Vlasenko2018-08-041-2/+1
| | | | | | | | | | | | | | function old new delta vfork_compressor 257 246 -11 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tar: handle the case when opened created tarball happens to have fd#0Denys Vlasenko2018-08-041-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | Reproducer: exec 0>&- exec 1>&- tar czf z.tar.gz FILE function old new delta vfork_compressor 229 257 +28 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tar: make source code a bit more terse, no logic changesDenys Vlasenko2018-08-041-32/+25
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox'Ron Yorston2018-07-251-1/+1
|\|
| * tar: fix interaction of delayed symlink and hardlink creationHarald van Dijk2018-05-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta create_or_remember_link - 106 +106 create_links_from_list - 93 +93 find_applet_by_name 124 128 +4 unzip_main 2724 2726 +2 data_extract_all 891 873 -18 create_symlinks_from_list 64 - -64 create_or_remember_symlink 94 - -94 ------------------------------------------------------------------------------ (add/remove: 2/2 grow/shrink: 2/1 up/down: 205/-176) Total: 29 bytes Signed-off-by: Harald van Dijk <harald@gigawatt.nl> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2018-04-091-2/+2
|\|
| * tar: trim help textDenys Vlasenko2018-04-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Usage: tar c|x|t [-ZzJjahmvokO] [-f TARFILE] [-C DIR] [-T FILE] [-X FILE] [--exclude PATTERN]... [FILE]... Create, extract, or list files from a tar file Operation: <============== DELETED c Create x Extract t List -f FILE Name of TARFILE ('-' for stdin/out) -C DIR Change to DIR before operation -v Verbose -O Extract to stdout -m Don't restore mtime -o Don't restore user:group -k Don't replace existing files -Z (De)compress using compress -z (De)compress using gzip -J (De)compress using xz -j (De)compress using bzip2 -a (De)compress using lzma -h Follow symlinks -T FILE File with names to include -X FILE File with glob patterns to exclude --exclude PATTERN Glob pattern to exclude Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2018-04-021-8/+8
|\|
| * tar: add -o and -k to short --help tooDenys Vlasenko2018-03-161-5/+5
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tar: add -k and -o to --helpDenys Vlasenko2018-03-161-3/+3
| | | | | | | | | | | | | | -o Don't restore user:group -k Don't replace existing files Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2018-03-011-0/+2
|\|
| * tar,unzip: postpone creation of symlinks with "suspicious" targetsDenys Vlasenko2018-02-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This mostly reverts commit bc9bbeb2b81001e8731cd2ae501c8fccc8d87cc7 "libarchive: do not extract unsafe symlinks unless $EXTRACT_UNSAFE_SYMLINKS=1" Users report that it is somewhat too restrictive. See https://bugs.busybox.net/show_bug.cgi?id=8411 In particular, this interferes with unpacking of busybox-based filesystems with links like "sbin/applet" -> "../bin/busybox". The change is made smaller by deleting ARCHIVE_EXTRACT_QUIET flag - it is unused since 2010, and removing conditionals on it allows commonalizing some error message codes. function old new delta create_or_remember_symlink - 94 +94 create_symlinks_from_list - 64 +64 tar_main 1002 1006 +4 unzip_main 2732 2724 -8 data_extract_all 984 891 -93 unsafe_symlink_target 147 - -147 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 1/2 up/down: 162/-248) Total: -86 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Remove fake signal-handling codeRon Yorston2018-03-011-0/+2
| | | | | | | | | | | | | | | | | | Microsoft Windows has only limited support for signals. busybox-w32 initially papered over this fact by adding definitions for unsupported signals and signal-handling functions. Remove this fake code and deal with the consequences by excluding anything that fails to compile as a result.
* | tar: don't save file statusRon Yorston2018-02-261-0/+4
| | | | | | | | | | Since we're unable to track the file using its device/inode there's no need to obtain the file's status.
* | Merge branch 'busybox' into mergeRon Yorston2017-12-091-81/+87
|\|
| * tar: code shrinkDenys Vlasenko2017-11-131-20/+19
| | | | | | | | | | | | | | | | | | | | function old new delta packed_usage 31863 31853 -10 tar_main 1013 1002 -11 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-21) Total: -21 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tar: code shrink, better help textDenys Vlasenko2017-11-131-62/+68
| | | | | | | | | | | | | | | | | | | | | | function old new delta tar_main 994 1013 +19 packed_usage 31893 31863 -30 writeTarFile 250 207 -43 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 19/-73) Total: -54 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tar: improve help textDenys Vlasenko2017-11-101-7/+8
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>