summaryrefslogtreecommitdiff
path: root/bin/pax
AgeCommit message (Collapse)Author
2024-01-20Better formatting for pax extended header timesJeremie Courreges-Anglas
As specified, don't include the subsecond part if zero and drop trailing zeros in the subsecond part. ok millert@
2023-12-27'pax' format support for mtime and atimeJeremie Courreges-Anglas
Access time can't be represented by ustar, so always include it when using the pax format. Also include an extended header record for mtime if the file modification time can't be fully represented by ustar (eg subsecond resolution). Input & ok millert@
2023-12-22Zap useless newline added in previousJeremie Courreges-Anglas
2023-12-22'pax' format support for files over 8GBJeremie Courreges-Anglas
ok millert@
2023-12-21Print the proper file name in case we fail to allocate a "path" extended headerJeremie Courreges-Anglas
Use name, not ln_name. Pasto introduced in previous.
2023-12-09Add basic write support for 'pax' format archivesJeremie Courreges-Anglas
Keep writing archives in ustar format by default. People can test the posix 'pax' format using pax(1) -w -x pax ... or cpio -o -H pax ...; tar(1) can't exercise this code yet. Only long names file and link names are supported for now. With input and tests from caspar@, ok millert@
2023-11-26mark functions as static when they're unused elsewhere, makes theMarc Espie
code slightly easier to understand. okay and tweak kn@
2023-11-09Tighten pledge in List and Append mode:Klemens Nanni
Drop "wpath cpath fattr dpath" in read-only: - cpio -i -t < test.tar - pax < test.tar - tar -t -f test.tar Drop "cpath fattr dpath" in read-write: - echo foo | cpio -o -A -H ustar -O test.tar - tar -r -f test.tar foo - pax -w -a -f test.tar foo Other modes remain unchanged and thus can create or modify files. Feedback OK millert
2023-10-15Pledge once with or without "proc exec", not twiceKlemens Nanni
Spotted while comparing ktraces between 'tar -z' and 'gzcat | tar -f-'. Only the former runs, e.g. gzip(1), but the latter also pledges theses promises just to pledge again immediately afterwards without them. Make the calls mutually exclusive so 'tar -f-' et al. skip the first pledge and thus never have "proc exec" to begin wth. "looks good to me" mbuhl OK millert
2023-09-04Zap #ifndef SMALL around pax format read supportJeremie Courreges-Anglas
-DSMALL has never been used to build the ramdisks, thus the support for reading pax format archives has always been there. This is misleading, so just zap the ifdef since we want to keep read support. Went through a make release Just In Case(tm). Spotted by caspar@, ok millert@ sthen@ caspar@
2023-08-19Copy entire st_*tim structs at once, rather than copyingPhilip Guenther
the st_*time and (obsolete) st_*timensec members separately. ok millert@
2023-08-03add extract example and reorder flags on other examplesaisha
comments sthen@ and Peter J. Philipp <pjp AT delphinusdns DOT org> ok jmc@
2023-07-10Don't open files that will be skippedJeremy Evans
Previously, when creating an archive file with pax(1), pax will attempt to open a file even if the file will be skipped due to an -s replacement with the empty string. With this change, pax will not attempt to open files that it knows will be skipped. When doing direct copies to a directory (-rw), pax already skips the file before attempting to open it. So this makes the behavior more consistent. This can measurably speed up pax when skipping a large number of files. OK tb@
2023-07-05It isn't portable to use stderr (or std{in,out}) in file-scopePhilip Guenther
initializers as they are not required to be compile-time constants. So, intialize these global variables at the top of main(). ok miod@ deraadt@ yasuoka@ millert@
2023-06-26pax: truncate times to MAX_TIME_T, not INT_MAXTodd C. Miller
If the mtime in the file header is larger than MAX_TIME_T, trucate it to MAX_TIME_T, not INT_MAX. OK otto@
2023-06-26pax: use safe_print() to display messages which may include file names.Todd C. Miller
Reported by David Leadbeater. OK op@
2023-06-26fix grammar of the comment describing pat_chk(); ok millert@Omar Polo
2023-01-17pax: Switch a function definition from K&R to ANSI.Theo Buehler
2022-12-04userspace: remove vestigial '?' cases from top-level getopt(3) loopsScott Soule Cheloha
getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@
2022-03-31man pages: add missing commas between subordinate and main clausesChristian Weisgerber
jmc@ dislikes a comma before "then" in a conditional, so leave those untouched. ok jmc@
2022-03-01Support mtime/atime/ctime extended headers in !SMALL builds.Stuart Henderson
These are becoming quite common in distributed software (including tars produced by Python and Go) and often standard timestamps are not set, resulting in extracted files dated as the epoch. Lots of help from tb@, ok tb@ millert@
2022-01-28When it's the possessive of 'it', it's spelled "its", without thePhilip Guenther
apostrophe.
2021-10-24For open/openat, if the flags parameter does not contain O_CREAT, theTheo de Raadt
3rd (variadic) mode_t parameter is irrelevant. Many developers in the past have passed mode_t (0, 044, 0644, or such), which might lead future people to copy this broken idiom, and perhaps even believe this parameter has some meaning or implication or application. Delete them all. This comes out of a conversation where tb@ noticed that a strange (but intentional) pledge behaviour is to always knock-out high-bits from mode_t on a number of system calls as a safety factor, and his bewilderment that this appeared to be happening against valid modes (at least visually), but no sorry, they are all irrelevant junk. They could all be 0xdeafbeef. ok millert
2021-06-1432-bit systems incorrectly parse the (64-bit) length of ustar extendedTheo de Raadt
headers (hd->size) using a 32-bit operation. from Samanta Navarro ok guenther
2020-10-05-f - can respresent both stdin and stdout; rework the text a littleJason McIntyre
to make it read better; reported by roderick ok millert
2020-03-23in case we can't create intermediate directories because of permissions,Marc Espie
show a less confusing track okay millert@ (with a small tweak to the error message by millert@)
2020-01-16Usually, -width Fl (which is 10n) is too wide and hence ugly.Ingo Schwarze
Change several instances, most of them to the usual -width Ds.
2019-11-15In cpio mode, when processing the -o switch, only set the archive formatChristian Weisgerber
if not already set. This makes "cpio -Hustar -o" behave the same as "cpio -o -Hustar". ok guenther@
2019-06-28When system calls indicate an error they return -1, not some arbitraryTheo de Raadt
value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
2019-06-28mkstemp() returns -1 on failureTheo de Raadt
2019-06-24uid_from_user() and gid_from_user() return -1 when indicating error,Theo de Raadt
not arbitrary values < 0.
2018-09-13Use the new libc uid_from_user() and gid_from_group() instead ofTodd C. Miller
the pax-specific functions in cache.c. OK guenther@
2018-07-23Point to glob in section 7 for the actual list of special characters insteadkn
the C API in section 3. OK millert jmc nicm, "the right idea" deraadt
2017-12-08Convert snprintf+write into dprintf. It is simply easier to read, andTheo de Raadt
provides retry on short-write file descriptors. ok florian, previous versions seen by millert
2017-10-09Better document what the -v flag actually does and that you canTodd C. Miller
specify it more than once. Adapted from a diff by and OK schwarze@
2017-09-16Carefully add casts to silence clang sign-compare warnings. ok millert@Otto Moerbeek
2017-09-12there is no offical way to get the max value of time_t, but this one worksOtto Moerbeek
on any sensible posix system (in which time_t must be an integer type) ok deraadt@ millert@
2017-09-10Backslash escapes the next character in filename patterns.Philip Guenther
ok millert@
2017-09-08Avoid clang warning and make code better by using a signed long;Otto Moerbeek
with hint from millert@; ok millert@ guenther@
2017-09-06intvar < sizeof(...) does not catch negative values since an int -> unsignedOtto Moerbeek
conversion is involved. Cast the sizeof to int to get a signed compare; ok deraadt@ bluhm@
2017-03-16buffer increase factor belongs in the nmemb field of reallocarray()Theo de Raadt
ok guenther
2017-03-11switch pax to using pledge tape instead of ioctl.Theo Buehler
ok kettenis
2017-01-23Slow down the churn and continue using old pledge name "ioctl" insteadTheo de Raadt
of "tape" for a week or so.
2017-01-23Split pledge "ioctl" into "tape" and "bpf", and allow SIOCGIFGROUP onlyTheo de Raadt
upon "inet". Adjust the 4 programs that care about this.
2017-01-21Nuke whitespace foolish enough to expose itself during the greatKenneth R Westerback
"warning:" rectification.
2016-12-26Put some variable declarations under appropriate #if/#endif protectionKenneth R Westerback
so gcc doesn't complain about defining but not using them. typo correction & ok jca@
2016-12-20Fix a bug where archives smaller than 512 bytes would trigger a next volumeMark Kettenis
prompt. From NetBSD. ok millert@, deraadt@
2016-08-26Need <time.h> for time() and others. Pulled in by coincidence previouslyPhilip Guenther
noted by tb@
2016-08-26-E NONE has *never* worked; it was always -E none. It's a dubious optionPhilip Guenther
value that merits a warning in the manpage and using 2 billion will get you practically the same effect, so delete the -E none support
2016-08-26options.h is only used by options.c; merge it into the .c filePhilip Guenther
reduce and sort #includes