Home | History | Annotate | Download | only in pax
History log of /src/bin/pax/buf_subs.c
RevisionDateAuthorComments
 1.32  08-Sep-2024  rillig fix a/an grammar in obvious cases
 1.31  28-May-2023  lukem pax: don't overwrite destination if -r -w copy fails

Add more error handling to pax -r -w so that any failure
during the copy to the temporary file (including a failed flush)
prevents any existing destination file from being replaced
with the partial (including possibly empty) temporary file.
The partial temporary file is removed. pax still exists non-zero.

Thanks to Michael van Elst (mlelstv@) for the analysis
of the problem in the PR.

Should fix PR misc/33753.
 1.30  28-May-2022  andvar branches: 1.30.2;
fix various typos, mainly in comments.
 1.29  19-Mar-2018  msaitoh branches: 1.29.2; 1.29.4;
s/copy copy/copy/ in comment.
 1.28  29-Apr-2007  msaitoh branches: 1.28.76;
fix typos
 1.27  11-Feb-2006  dsl Change all the 'return(x)' to 'return c'.
Makes some other searches I want to do a bit easier.
 1.26  24-Apr-2005  christos PR/20228: Simon Burge: pax has problems reading a particular cpio archive
The problem here is that the archive is too short (< 512 bytes). The
buffer routines, try to read at least 512 bytes, even when we try to determine
what format file we have, which is wrong.
 1.25  22-Sep-2004  christos fd can be -1 or -2 for the gnu long name/link hack. So check for >= 0
instead of -1 if we need to flush.
 1.24  15-Jun-2004  christos do the special symlink treatment with all negative fd's.
 1.23  27-Oct-2003  lukem branches: 1.23.2;
Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.22  13-Oct-2003  agc Move Keith Muller's code from a 4-clause to a 3-clause licence by removing
the advertising clause. Diffs provided in PR 22397 by Joel Baker, confirmed
to the board by Keith Muller.
 1.21  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.20  21-Feb-2003  lukem When writing (-w) or copying (-rw), and using -M (stdin file list is
mtree(8) specfile), compare the "post write/copy" mtime against the
actual "pre write/copy" mtime instead of the mtime from the specfile.

This prevents warnings such as:
pax: File ./foo was modified during copy to archive
if the file's mtime in the file system is different to what's in the specfile.
(The resultant file will still get the specfile mtime ...)
 1.19  09-Feb-2003  grant cosmetic error condition improvements.
- sprinkle some fflush() to print filenames correctly.
- print a \n to stdout to fix formatting.
- English, consistently use "Cannot" in error messages.

some whitespace cleanup.
 1.18  02-Feb-2003  wiz Fix various spelling, grammar, and punctuation problems in comments, from Sergey Svishchev in PR 20164.
 1.17  31-Jan-2002  tv branches: 1.17.2;
Protect __RCSID and __COPYRIGHT from being invoked if not defined.
 1.16  25-Oct-2001  lukem - ansi KNF (just remove all the #ifndef __STDC__ prototype junk,
leaving the ansi stuff)
- use longlong_t instead of quad_t (etc), and rename *uqd*() -> *ull*()
- clean up the NET2_STAT stuff similar to ftpd; provide #defines and
macros which select which cast to use, etc
- clean up the NET2_FTS and NET2_REGEX #define use
 1.15  07-Oct-2001  wiz Fix typo.
 1.14  16-Sep-2001  wiz Spell 'occurred' with two 'r's.
 1.13  17-Feb-2000  itohy Cleanup and fix typos.
Partially from FreeBSD.
 1.12  17-Feb-2000  itohy Fix SIGINFO botch (PR #8868).
Continue partial write(2) on signals (xwrite()).
Partial read(2) at a few places are also continued (xread()).

Add {read,write}_with_restart() hooks for porting on systems
which don't restart interrupted read()/write() calls.

Reviewed and discussed in tech-kern and tech-userlevel lists.
 1.11  22-Oct-1999  mrg support ././@LongLink extraction, as created by GNU tar.
 1.10  22-Oct-1999  mrg remove some old cruft.
 1.9  03-Feb-1998  mycroft branches: 1.9.4;
Deal with GCC warnings.
 1.8  25-Jul-1997  scottr #if __GNUC__, work around bogus initialization warning that occurs on
at least the m68k-based ports.
 1.7  20-Jul-1997  christos - Rename local warn so tty_warn that we can include <err.h> since this program
uses err() and errx().
- Fix printf format strings.
- Added WARNS=1; note
- Added missing prototypes.
- Split overloaded trail function into trail() and subtrail().
 1.6  11-Jan-1997  tls kill 'register'
 1.5  21-Mar-1995  cgd convert to new RCS id conventions.
 1.4  23-Sep-1994  mycroft Eliminate uses of some obsolete functions.
 1.3  14-Jun-1994  mycroft Fix up RCS ids.
 1.2  13-Jun-1994  jtc Add RCS ID's
 1.1  13-Jun-1994  jtc branches: 1.1.1;
Initial revision
 1.1.1.1  13-Jun-1994  jtc From 4.4 lite
 1.9.4.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.17.2.3  25-Aug-2004  he Pull up revision 1.24 (requested by cube in ticket #1733):
Do the special symlink treatment with all negative fd's.
 1.17.2.2  16-Jun-2004  jmc fix botched pullup from ticket #1021 and make sure this compiles on
non-NetBSD hosts again. Also fixes PR#24481
 1.17.2.1  07-Apr-2004  jmc Pullup rev 1.18-1.23 (requested by rafal in ticket #1021)

Pullup pax to current version on trunk. Includes many fixes.
 1.23.2.2  12-Nov-2004  jmc branches: 1.23.2.2.2;
Pullup rev 1.25 (requested by christos in ticket #922)

fd can be -1 or -2 for the gnu long name/link hack. So check for >= 0
instead of -1 if we need to flush.
 1.23.2.1  18-Jun-2004  tron Pull up revision 1.24 (requested by dillo in ticket #507):
do the special symlink treatment with all negative fd's.
 1.23.2.2.2.1  23-Jul-2005  snj Apply patch (requested by riz in ticket #5512):
Sync pax with HEAD of 2005-07-22.
 1.28.76.1  22-Mar-2018  pgoyette Synch with HEAD, resolve conflicts
 1.29.4.1  07-Aug-2024  martin Pull up following revision(s) (requested by riastradh in ticket #1863):

bin/pax/buf_subs.c: revision 1.31
tests/bin/pax/t_pax.sh: revision 1.3
tests/bin/pax/t_pax.sh: revision 1.4
tests/bin/pax/t_pax.sh: revision 1.5
tests/bin/pax/t_pax.sh: revision 1.6
tests/bin/pax/t_pax.sh: revision 1.7
bin/pax/extern.h: revision 1.61
bin/pax/pax.c: revision 1.50
bin/pax/pax.c: revision 1.51
bin/pax/file_subs.c: revision 1.65
bin/pax/ftree.c: revision 1.43
bin/pax/ar_subs.c: revision 1.58

pax: exit 0 if stdin filelist is used and empty

If copying a list of files from stdin, exit zero instead of non-zero
if there are no files supplied.

AFAICT, POSIX doesn't require a non-zero an error in this situation,
since there are no files to not match.

Fix from PR bin/41736 by Lloyd Parkes.

pax: don't overwrite destination if -r -w copy fails

Add more error handling to pax -r -w so that any failure
during the copy to the temporary file (including a failed flush)
prevents any existing destination file from being replaced
with the partial (including possibly empty) temporary file.

The partial temporary file is removed. pax still exists non-zero.
Thanks to Michael van Elst (mlelstv@) for the analysis
of the problem in the PR.
Should fix PR misc/33753.

tests/bin/pax: Add test for pax list in an ungettable cwd.
The list operation has no need to touch the file system, so it should
have no need for open(".") or getcwd() to succeed.

PR bin/44498: tar(1) unnecessarily demands that getcwd() work
(The PR was filed about tar(1), which is now bsdtar by default, but
the issue applies to pax(1) too and would continue to apply to tar(1)
if you set MKBSDTAR=no.)
pax(1): Don't require open(".") or getcwd to work for list operation.

PR 44498: tar(1) unnecessarily demands that getcwd() work
tests/bin/pax: Test pax(1) succeeds with empty file list on stdin.

PR bin/41736: pax reports an error when copying zero files
tests/bin/pax: Add some more cwd-related test cases.

PR bin/44498: tar(1) unnecessarily demands that getcwd() work
pax(1): Only require getcwd if we're reading without --insecure.

No other paths use the result of getcwd.

PR bin/44498: tar(1) unnecessarily demands that getcwd() work
 1.29.2.2  21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.29.2.1  21-Apr-2020  martin Sync with HEAD
 1.30.2.1  07-Aug-2024  martin Pull up following revision(s) (requested by riastradh in ticket #776):

bin/pax/buf_subs.c: revision 1.31
tests/bin/pax/t_pax.sh: revision 1.3
tests/bin/pax/t_pax.sh: revision 1.4
tests/bin/pax/t_pax.sh: revision 1.5
tests/bin/pax/t_pax.sh: revision 1.6
tests/bin/pax/t_pax.sh: revision 1.7
bin/pax/extern.h: revision 1.61
bin/pax/pax.c: revision 1.50
bin/pax/pax.c: revision 1.51
bin/pax/file_subs.c: revision 1.65
bin/pax/ftree.c: revision 1.43
bin/pax/ar_subs.c: revision 1.58

pax: exit 0 if stdin filelist is used and empty

If copying a list of files from stdin, exit zero instead of non-zero
if there are no files supplied.

AFAICT, POSIX doesn't require a non-zero an error in this situation,
since there are no files to not match.

Fix from PR bin/41736 by Lloyd Parkes.

pax: don't overwrite destination if -r -w copy fails

Add more error handling to pax -r -w so that any failure
during the copy to the temporary file (including a failed flush)
prevents any existing destination file from being replaced
with the partial (including possibly empty) temporary file.

The partial temporary file is removed. pax still exists non-zero.
Thanks to Michael van Elst (mlelstv@) for the analysis
of the problem in the PR.
Should fix PR misc/33753.

tests/bin/pax: Add test for pax list in an ungettable cwd.
The list operation has no need to touch the file system, so it should
have no need for open(".") or getcwd() to succeed.

PR bin/44498: tar(1) unnecessarily demands that getcwd() work
(The PR was filed about tar(1), which is now bsdtar by default, but
the issue applies to pax(1) too and would continue to apply to tar(1)
if you set MKBSDTAR=no.)
pax(1): Don't require open(".") or getcwd to work for list operation.

PR 44498: tar(1) unnecessarily demands that getcwd() work
tests/bin/pax: Test pax(1) succeeds with empty file list on stdin.

PR bin/41736: pax reports an error when copying zero files
tests/bin/pax: Add some more cwd-related test cases.

PR bin/44498: tar(1) unnecessarily demands that getcwd() work
pax(1): Only require getcwd if we're reading without --insecure.

No other paths use the result of getcwd.

PR bin/44498: tar(1) unnecessarily demands that getcwd() work

RSS XML Feed