aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/cpio.c
AgeCommit message (Collapse)Author
2020-08-21Honor --no-preserve-owner for archive creation, and tidy up header comments.Rob Landley
2020-08-21cpio: fixes for Android kernel build.Elliott Hughes
Allow -pd to work by changing -p from an option that takes an argument to an option that implies there will be an argument (that is, `-pd x` is `-p -d x` with x being the directory for -p, rather than `-p d x` with d being the directory, as we previously interpreted it). Fix -d (aka --make-directories) to not be a no-op. Previously we acted as if this was always on. Accept --quiet and effectively just ignore it, since toybox cpio doesn't seem to produce any output that --quiet would suppress.
2020-04-16cpio: fix tests by removing --trailer.Elliott Hughes
f2866cf58a07c9d681ecd6695ea969ac70e59a3d fixed the cpio --trailer check as it claimed to, but doing so changed our behavior (since it used to be always-on and is now off unless you supply --trailer). This broke one of the cpio tests. Since I can't find any other cpio that has a --trailer option (or its inverse), this patch removes --trailer. This reverts our behavior to our old behavior (always include the trailer). Judging by the fact that the cpio tests pass with TEST_HOST=1, this seems to be the expected behavior.
2020-04-15cpio: fix --trailer flag check, switch to FLAG() macros.Ethan Sommer
2019-03-02Improve help consistency.Elliott Hughes
More consistent tense, capitalization, and punctuation. A few commands were missing an introductory line, so I copied those from the first comment line.
2018-12-04Clean up some --help formatting.Elliott Hughes
Be consistent about upper versus lower case. (Upper seems to have the majority, so I went with that, though I'm happy to provide the opposite patch as long as we're consistent!) Be consistent about using \t. (Though saving a few bytes seems like it might be better done in the code that generates help.h rather than directly in the source, since tabs make careful ASCII art layout hard enough that we regularly have things misaligned.) Remove trailing periods (most of which seem to have been added by me). Always use the US "human readable" rather than my British "human-readable", and be more consistent about declaring whether we're showing multiples of 1000 or 1024. Just say "verbose" rather than adding a useless "mode" or "output".
2018-08-31Convert option style.Rob Landley
2018-04-08Add mkpath() for common case of mkpathat(), and #define magic constants.Rob Landley
2017-06-04Don't add cpio TRAILER!!! entry by default, add new --trailer option if youRob Landley
want that. (This lets you concatenate cpio archives with "cat". Kernel's initramfs extractor doesn't need it.)
2017-01-28Add missing `static`s and remove an unused function.Elliott Hughes
2016-03-02For years the man pages have said to #include <sys/types.h> to getRob Landley
major/minor/makedev, but glibc has vowed to break existing programs (https://sourceware.org/ml/libc-alpha/2015-11/msg00253.html) and replace it with _another_ non-standard header (not in posix or lsb), so let's just add functions to lib/ that do the transform ourselves.
2016-01-05Add error_msg_raw() and friends, replace error_msg("%s", s) uses, enable formatRob Landley
checking, and fix up format checking complaints. Added out(type, value) function to stat to avoid a zillion printf typecasts.
2015-12-21Rich Felker's reading of posix is that fchown() and fchmod() must be allowedRob Landley
on files opened read-only, so revert last commit (force writeable logic).
2015-12-06Attempt at making cpio chown() mode 000 files sanely.Rob Landley
2015-12-06Remove trailing whitespace and wrap lines to 80 chars.Rob Landley
2015-12-06CPIO: Add --no-preserve-owner option.Mike Moreton
2015-12-06Correct setting of guid and uid when extracting from a cpio archive.Mike Moreton
2015-09-29Make defconfig build for nommu.Rob Landley
Adds XVFORK() macro, teaches xpopen_both() to call /proc/self/exe with NULL argv (and converts cpio -p to use that), adds TOYBOX_FORK guards to some unconverted commands.
2014-11-22As long as Android's going to require fortify, fixup the warnings it generates.Rob Landley
2014-09-14Add cpio -pRob Landley
2014-09-09Ignore -m option to cpio, it's what we do anyway so it's not an error.Rob Landley
2014-09-08Fix more memory leaks reported by Ashwini Sharma.Rob Landley
2014-06-01cpio: archive more filesIsaac Dunham
While writing tests for cpio, I found that cpio tries to open empty files if they're regular files, and fails to archive them if unreadable. This can be easily avoided, and is not the usual behavior.
2014-04-29Teach cpio to set uid/gid and timestamp. (Timestamp has year 2100 problem.)Rob Landley
Note that directory timestamps are still sometimes wrong because creating things in a directory can update the timestamp. Also, cp -r has logic to ensure we can write to a directory that doesn't have write permission, cpio does not. This is fixable, but not what existing cpio does.
2014-03-27Fix cpio -it: don't close(fd) unless we opened it.Isaac Dunham
2014-03-26More cpio bugfixes from Isaac Dunham.Rob Landley
Fix FLAG_o to actually be 1 like the comment says, don't try to strlen(name) before reading it, pad TRAILER!!! entry correctly.
2014-03-25Promote cpio out of pending.Rob Landley
After some waffling I put it in "posix", even though it was last specified in susv2 (where it was the obsolete 6 byte header entries predating susv4). LSB specifies it, including the 8 byte header fields, but for the actual command it just references SUSv2. (LSB isn't so much a standard as Red Hat's "notes to self".)