aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/tar.c
AgeCommit message (Collapse)Author
2023-06-10Fix two uses of strdup() instead of xstrdup().Rob Landley
2023-05-08Add tar --one-file-systemRob Landley
2023-04-18Wait for compression program to exit, and pass on error result.Rob Landley
2023-04-06The non-anchored --wildcards logic broke full-string matching.Rob Landley
(It matched after every / but when there was one it didn't check start of string. Oops.)
2023-03-03Change FLAG(x) macros to always return 0 or 1. Treewide audit of FLAG()Rob Landley
users to make sure nobody NEEDED FLAG(x) to return the masked bit value, and to remove now-redundant !!, with a number of in-passing cleanups while I was there. I think I fixed an actual bug in patch.c (-R depended on the flag value but commit 6f6b7614e463 changed it, so "+-"[FLAG(R)] was comparing against the NUL terminator when measuring fuzz) but we didn't have a test for "fuzz autodetection". And there was another bug in tar.c where DIRTREE_BREADTH was assigned to a local variable... and then not used. But the test passed? (Not sure the flag's needed at the top level, added a comment to the test suite to remind me to revisit that.) While I was there, capitalize TODO comments so they're easier to grep for.
2023-02-07Don't kill archiver now we're listening for its exit code,Rob Landley
shut it up by draining the trailing zeroes instead. Note: cpio lets you concatenate archives, but tar ignores everything after two zero blocks.
2023-02-06Fix a couple tar --sort leaks.Rob Landley
2023-01-29Add tar -s --sortRob Landley
Always does alphabetical sort, ignores optional --sort=argument.
2023-01-26Implement tar --wildcards and friends (filter options).Rob Landley
Also some pending portability.h comments, and wait for archiver exit.
2023-01-06Rename/move xmemcmp() (which doesn't exit) to smemcmp(), and add x prefixRob Landley
to notstdio() while there.
2022-12-26Placate ASAN by replacing memcmp() with xmemcmp().Rob Landley
2022-10-18Tar --xform extract side.Rob Landley
Note: we accept --show-transformed as a NOP, it's always on. (Happy to disable it if someone can explain why?)
2022-10-16Make --xform work on archive creation side, with some tests.Rob Landley
2022-10-10Have tar handle / and .. at / as ./ and let -P retain ..Rob Landley
2022-09-29Change tar/sed protocol to include file type. (Doesn't use it yet.)Rob Landley
2022-09-28Add sed --tarxform mode to wrap a simple protocol around transforms,Rob Landley
and have tar --xform use it.
2022-08-27Make all the tar tests look at archivers in the same order so people readingRob Landley
the code aren't confused by seemingly different tests. (This is the order they were historically added. Some were in alphabetical order but bzcat/xzcat/zcat vs bzip2/gzip/xz aren't consistent.)
2022-08-27Tar compression autodetect wasn't falling back to gzip -d without zcatRob Landley
because fallback compressor name selection happened before autodetect.
2022-07-15tar: implement --null.Elliott Hughes
No --no-null because it requires new infrastructure, and doesn't (yet) have a user.
2022-06-29Add same_file() and same_def_ino() convenience functions, plus minor cleanups.Rob Landley
2022-05-22Remove unnecessary test.Rob Landley
2022-05-21Add tar --xform.Rob Landley
Adds xrunread() to lib and makes mount use it instead of a local function.
2022-04-02Add tar --strip-components.Rob Landley
Also in lib/ add bufget name variants for password and group.
2022-03-31Make tar tests more portable, and add --owner :UID and --group :GIDRob Landley
2022-03-19The ".." removal logic was looping on file/dir names starting with "..",Rob Landley
reported by hg42 on github.
2021-09-16The Linux errno from unlink(dir) defies posix and this bothers someRob Landley
people, so don't depend on it.
2021-09-03Silence "fortify" warning, add "had errors" message at end, minor cleanups.Rob Landley
2021-08-23Avoid race condition where child process complains about nothing.Rob Landley
Two NUL headers indicate end of archive, but some implementations add lots of extra NUL padding (because 1970s reel to reel tape). If we exit before the archiver child process has managed to write all that extra NUL padding into the pipe buffer it complains to stderr, so kill it before exiting.
2021-08-23First guess at implementing tar --selinux, passes regression tests butRob Landley
haven't got a test environment for the new stuff yet. Note: this implementation does not require libselinux, the labels are just xattr data to us.
2021-08-07Change xabspath() to more granular (flag based) control interface.Rob Landley
2021-03-09Minor tweaks: #define -> inlineable function, while() -> for(;;)Rob Landley
2021-03-09tar: fix base-256 output.Elliott Hughes
A tar file created by toybox tar with values large enough to need base-256 rather than ASCII octal caused a tar reader to crash, and caused GNU tar to complain. I note from the docs at https://github.com/libarchive/libarchive/blob/master/libarchive/tar.5#L326 that they imply that only the top *bit* should be set to indicate this format, not the whole top byte, to give a 95-bit or 63-bit field. But I don't think we can hit that in practice? Bug: http://issuetracker.google.com/181683612
2021-02-28Tar should remove empty directories where it wants to put a non-directory.Rob Landley
2020-08-24tar: add -I (--use-compress-program) support.Elliott Hughes
This also changes the other compression options (such as -j) so that we pass no arguments for compression and just -d for decompression, which is what -I does to its filter and which appears sufficient. (I think I used -dc before just out of habit, since that's what I've been typing on the command line for decades.)
2020-08-19Cleanup symlink handling.Rob Landley
2020-08-19Patch out memory leak in tar.cChris Sarra
2020-06-23William Djupström reported tar --exclude wasn't working. Fix and add test.Rob Landley
(Also fix -v output going to stderr when it shouldn't.)
2020-06-09tar: fix bugs with adding hardlinks to archiveWilliam Djupström via Toybox
2020-06-08tar: fix extracting long file pathsWilliam Djupström
2020-03-23tar: implement --absolute-names.Elliott Hughes
Used by the Linux kernel build when copying kernel headers to kernel-headers.tar.gz. Bug: http://b/152244851
2020-03-18Fix WARN_ONLY (and the one caller feeding it in the field it was checking).Rob Landley
2020-03-13Fix various typos.Elliott Hughes
In case I'm not yet in the running for the most pedantic change of this release, I think the "days of the week are written with initial capitals in English" subset of this patch is a strong contender. (Found via `toybox help -a | ispell -l | sort | uniq`.)
2020-02-02Canonicalize the usage: lines for the POSIX toys.Elliott Hughes
This only touches 24 of the 68 toys/posix/ files --- the others were already canonical. Potentially contentious, so worth stating explicitly, is that there were 8 matches for "COMMAND..." amongst all existing help output, with 7 matches for various inconsistent variants involving something with "ARG", so I resolved that in favor of using "COMMAND..." (which is also shorter overall, and avoids nested []s).
2019-12-28Change variable type to avoid typecast.Rob Landley
2019-12-28tar: fix memory write errorEmmanuel Nicolet
Clear the last byte of the allocated buffer.
2019-11-13Pedantic constant annotations to shut up older toolchains.Rob Landley
2019-10-27Tar extract should delete files or symlinks where it's making a directory,Rob Landley
but --restrict checking should run on the path up to the last component before unlinking so tar can't be tricked into deleting random files off the system.
2019-10-04Fix extracting old tarballs, not just -tv of them.Rob Landley
2019-10-03Improve support for extracting older tarball formats.Rob Landley
2019-09-18Fix tar creation with hole at end.Rob Landley
The "gratuitous extra entry" is only gratuitous when there isn't a hole. (Which we can detect and not include but then we wouldn't match other implementations.)