summaryrefslogtreecommitdiff
path: root/bin
AgeCommit message (Collapse)Author
2024-05-10pax: make list file handle line-buffered unless it is stderr.Todd C. Miller
This fixes a problem where the file list output was fully-buffered when used as part of a pipeline. With this change, files are listed as they are extracted in verbose mode. OK deraadt@ guenther@
2024-04-28gmtime(3) / locatime(3) can fail when timestamps are way off.Florian Obser
Add missing error checks to all calls under bin/ Input & OK millert
2024-04-27Use propper knf.Florian Obser
Spotted by kettenis.
2024-04-27localtime(3) can fail if time_t is very far in the future or past.Florian Obser
found using afl++ OK millert
2024-04-23correct indentation; no functional changeJonathan Gray
ok tb@
2024-04-17Provide a pax format specific option handlerJeremie Courreges-Anglas
The existing tar_opt() implements support for -o write_opt=nodir for the old tar and ustar formats. We don't really want to support it for the pax format, and we want to be able to implement pax format specific options (even if there are none right now). ok millert@
2024-04-17Fold long lineJeremie Courreges-Anglas
2024-04-17Fixup commentJeremie Courreges-Anglas
Spotted by caspar@ earlier
2024-04-16Switch tar(1) write default format to 'pax'Jeremie Courreges-Anglas
Lets us store longer file names, link names, finer grained timestamps, larger archive member files, etc; at the expense of larger uncompressed archives and less widespread support across the ecosystem. If you're unhappy with the new defaults, you can use -F ustar. Or you can help fix bugs / find a better middle ground. Prodding from various including job@ and deraadt@ ok sthen@ caspar@ millert@
2024-04-16Fix reading large pax extended recordsJeremie Courreges-Anglas
512 bytes isn't enough if you want to store rather large but still useful long file names or symbolic links destinations. The best way to size the buffer to read those records is based upon the largest paths pax(1) can handle, and that is PAXPATHLEN. Reported by caspar@, input and ok millert@
2024-04-16Fix pasto: broken storage of symbolic link long destinations in pax formatJeremie Courreges-Anglas
2024-04-16Revert wip patch, not intended for commitJeremie Courreges-Anglas
2024-04-16Add tar(1) -F option to select write formatJeremie Courreges-Anglas
We want to move towards 'pax' as the default format for writing, this option lets users downgrade to -F ustar where the 'pax' format isn't convenient/usable (same as -x <format> in pax(1)). -F <format> is more generic than -o/-O. -H (GNU tar) was already used and we don't want long options so --format (NetBSD/FreeBSD) is excluded too. ok sthen@ caspar@ millert@
2024-04-16Correctly detect 'pax' format archives in append modeJeremie Courreges-Anglas
We expect that existing pax archives start with a global or extended header. If they don't, append operations will be done using ustar format. Fixes append mode on pax archives where pax(1) would bail out when appending to pax archives, falsely detecting a mismatch. Reading was unaffected. Reported by caspar@, ok caspar@ millert@
2024-04-15Amend previous: improve commentCaspar Schutijser
2024-04-15Switch pax(1) to write archives using the 'pax' format by defaultJeremie Courreges-Anglas
ramdisk versions will keep using ustar for writing. ok millert@
2024-03-27printtime: use the Unix epoch if the file's timestamp is invalidTodd C. Miller
Fixes a crash in "ls -l" for files with bogus timestamp values. OK miod@ denis@
2024-03-06add missing Ev macro; from mail at lukasneukom chJason McIntyre
2024-02-03Remove Softdep.Bob Beck
Softdep has been a no-op for some time now, this removes it to get it out of the way. Flensing mostly done in Talinn, with some help from krw@ ok deraadt@
2024-01-28Remove the 'l' and 'L' flag printing in 'STAT' column. These were addedTheo de Raadt
to provide visibility of the internal behaviour of pinsyscalls(2) during introduction. These flags remain (less) visible in the "-o procflags" option, as 0x08000000 (PS_PIN) and 0x10000000 (PS_LIBCPIN). That's good enough.
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@
2024-01-16print flag 'l' for base program or ld.so being under pinsyscalls enforcement,Theo de Raadt
and 'L' for libc.so. This flag printing may be deleted once we are entirely confident this is working correctly. ok kettenis
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-10accept numerical user IDsKlemens Nanni
Turn [-U username] into [-U user] to match top(1)/pgrep(1)/fstat(1) -U/-u taking both "root" and "0". Feedback OK millert
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-31cksum: better describe the -c (checklist) optionTodd C. Miller
The -c option can handle entries in normal (BSD) and reverse (GNU) format. Both hex and base64 entries are supported. OK jmc@
2023-10-31cksum -c: support checking base64 digests in reverse mode too.Todd C. Miller
In reverse mode, the entry does not include the digest algorithm so the specified algorithm (or the default) is used when checking. OK deraadt@
2023-10-20Improve markup in some cases where .Li was abused.Ingo Schwarze
Triggered by a smaller diff from jan@. OK jmc@ jan@
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-10-07Simplify the display() function by getting rid of a useless bufferIngo Schwarze
on the stack. No functional change, +8 -15 LOC. Suggested by and OK millert@.
2023-10-07Improve horizontal alignment in long format when printing minorIngo Schwarze
device numbers greater than 999 by measuring the two widths needed for device numbers just like it is already done for other numbers. In the output, this only changes whitespace, but not the text. Ugly formatting reported by Crystal Kolipe <kolipe dot c at exoticsilicon dot com>. OK millert. Also tested by Crystal Kolipe.
2023-09-14sh(1), ksh(1): reimplement p_tv() with p_ts()Scott Soule Cheloha
p_tv() is identical to p_ts(). Better to not have two copies: in p_tv(), convert the timeval to a timespec and pass it to p_ts(). With input from tb@ and millert@. Thread: https://marc.info/?l=openbsd-tech&m=169448818503541&w=2 ok tb@ 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-18use imperative tense consistently; OK jmcKlemens Nanni
2023-08-08Replace use of the old BSD st_*timensec members in struct stat withPhilip Guenther
the POSIX-standard st_*tim.tv_nsec members. 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-23avoid MAIL* environment variables to save a few bytes in install mediaKlemens Nanni
ksh(1) MAIL, MAILCHECK, MAILPATH mbox handling is useless in the installer. OK miod deraadt
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-06Document PS_CHROOT, and upcoming PS_NOBTCFI flagsTheo de Raadt
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-06-21ksh: escape control chars when displaying file name completions.Todd C. Miller
If there are multiple matches when using autocomplete, the list of matching file names was output as-is. However, for a single match, control characters are escaped before the file name is displayed. This makes the behavior more consistent by escaping control chars in the list of matches too. Discussed with deraadt@, OK op@