Home | History | Annotate | Download | only in pax
History log of /src/bin/pax/ar_io.c
RevisionDateAuthorComments
 1.60  20-Jul-2023  lukem pax: fix -Wformat for host tool
 1.59  04-Feb-2019  mrg - bump buffer sizes to avoid potential truncation issues
 1.58  02-Oct-2017  joerg branches: 1.58.4;
Include time.h for time(2). Sort.
 1.57  31-May-2016  dholland Don't use the length return from snprintf to write out the result
buffer. If snprintf truncated the output, the length returned will be
greater and we'll write trash. Just call strlen instead. (And since
what we're doing is writing progress messages to the user, checking
carefully for truncation isn't really worthwhile either.)

Spotted when attending to PR 50998 from David Binderman; the issue
there (computation of an unused value) popped up because one of the
prints was already calling strlen.
 1.56  09-Mar-2015  sevan From OpenBSD r1.49
Fix comment grammar
 1.55  08-Aug-2014  joerg Fix RCS ID.
 1.54  20-Mar-2012  matt branches: 1.54.2; 1.54.10;
Use C89 function definitions
 1.53  31-Aug-2011  plunky branches: 1.53.2;
NULL does not need a cast
 1.52  31-Aug-2010  enami Backout previous; it was wrong fix.
 1.51  31-Aug-2010  enami Fix build as tools.
 1.50  31-Aug-2010  enami - Raise an error rather than silently creating broken archive
if user don't specify --force-local but opened file is actually
a local file.
- Make cpio to accept -F option as described in manpage.
- Make pax to set forcelocal flag if requested to do so.
- Add missing break statement.
 1.49  03-Feb-2009  dbj do not require sys/mtio.h for a tools build of pax
 1.48  23-Apr-2007  christos branches: 1.48.18; 1.48.20; 1.48.22;
PR/36194: Greg A. Woods: add a '-V' flag to pax for verbose summary without
listing (and other minor fixes)
 1.47  11-Feb-2006  dsl Change all the 'return(x)' to 'return c'.
Makes some other searches I want to do a bit easier.
 1.46  01-May-2005  christos PR/29005: Jesse Off: nbpax requires sys/mtio.h which doesn't exist on Interix
I added an ifdef called HAVE_MTIO_H and fixed the code to use it. It is
always defined now, but you can change this for Interix.
 1.45  24-Apr-2005  christos PR/18759: FUKAUMI Naoki: pax/tar dot-dot handling broken
PR/18840: Frederick Bruckman: Fix for PR/18663 incomplete pax symlink handling

This patch makes ``--insecure'' do something. Now if ``--insecure''
is not set (the default) we do a realpath(3) in all the pathnames
that we are trying to create and if either realpath fails, or the
path is outside our working directory, we print a warning and die.
This maybe too strict and might fail on valid archives that create
symlinks and directories in the wrong order.
 1.44  02-Aug-2004  yamt indent fix for the previous (ar_io.c rev.1.43)
 1.43  18-Jul-2004  yamt for copy mode, show more meaningful infomation on SIGINFO.
 1.42  21-Jun-2004  christos don't keep going if -C failed to chdir(); from OpenBSD
 1.41  20-Jun-2004  jmc Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
 1.40  11-May-2004  christos Welcome to WARNS=3
 1.39  27-Oct-2003  lukem branches: 1.39.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.38  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.37  18-Sep-2003  grant wait for compression program to finish before exiting.

fix races condition resulting in a zero length archive after pax
exits.

patch from OpenBSD, provided by Joerg Sonnenberger in PR bin/22740.
 1.36  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.35  31-Mar-2003  christos Detect and report end of archive properly ala' gnu tar.
 1.34  31-Mar-2003  christos RP/8227: Peter Seeback: Emulate old gnu tar better.
 1.33  25-Feb-2003  wiz Add support for '-j' to create (and extract, but -z already did that)
bzip2 compressed tar files, for GNU tar compatibility.
Patch from Soren Jacobsen in PR 19467, okayed by christos.
Sync usage with options while here.
 1.32  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.31  02-Feb-2003  wiz Fix various spelling, grammar, and punctuation problems in comments, from Sergey Svishchev in PR 20164.
 1.30  12-Dec-2002  christos fix horrible side effect introduced by changing the append mode into archive.
The append mode already did that, so we always ended up overwriting the archive.
 1.29  10-Dec-2002  christos PR/19339: Martin Weber: Tar fails to append on empty files and exits with
0. Revert previous change for PR/18689. We always want to exit with
an error if we could not determine the archive format. Instead,
treat empty files specially. On list/extract we turn into no/op.
On append, we turn into archive.
 1.28  05-Dec-2002  grant don't print archive summary twice.
 1.27  16-Oct-2002  christos Support gnu long filename extensions by default for tar on create, list, and
extract. We now generate GNU tar archives by default ("ustar ^@" instead of
"ustar^@00"). GNU extensions can be disabled with --strict.

XXX: long symlinks untested.
 1.26  13-Oct-2002  christos If the archive refers to stdin, the archive's name is null. Check for
null when we see if it refers to a remote file. From Eric Gillespie, thanks!
 1.25  12-Oct-2002  thorpej Only include <rmt.h> if SUPPORT_RMT.
 1.24  12-Oct-2002  thorpej It doesn't help much to skip linking librmt if HOSTPROG but leave
all the librmt calls in the program. So, make librmt support conditional
on #ifdef SUPPORT_RMT, and define that when NOT building as a HOSTPROG.
 1.23  12-Oct-2002  christos merge OpenBSD changes:
- correct -C processing
- add ability to read filenames and flags from a file
- don't print dangerous escape sequences to the terminal
- use strlcpy/strncpy properly.
- handle tmpfile creation better.
- improve documentation of options.
- handle stdout/stderr list selection correctly.
- kill gzip when we get interrupted.
- simplify gzip setup.
- add more flags to programs.

additional changes:
- librmt processing.
- set POSIXLY_CORRECT in options parsing.
- prevent more string overruns.
- support -T

we don't turn the switch on to replace tar and cpio yet.
 1.22  31-Jan-2002  tv branches: 1.22.2;
Protect __RCSID and __COPYRIGHT from being invoked if not defined.
 1.21  29-Jan-2002  tv Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
 1.20  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.19  16-Sep-2001  wiz Spell 'occurred' with two 'r's.
 1.18  30-Mar-2000  thorpej Add a -O option: force one volume. This causes pax to not prompt for
a new volume upon premature end-of-volume (e.g. broken pipe). This is
especially useful in automated environments where error recovery cannot
be performed by a human.
 1.17  17-Feb-2000  itohy Cleanup and fix typos.
Partially from FreeBSD.
 1.16  17-Feb-2000  itohy Use lseek(2) on devices if not tape drives.
This makes listing on raw disk device much faster.
Reviewed and discussed in tech-kern and tech-userlevel lists.
 1.15  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.14  22-Oct-1999  is Implement positional -C argument to tar.
 1.13  03-Mar-1999  christos branches: 1.13.4;
Add SIGINFO support.
 1.12  04-Nov-1998  christos Fix problem compiling when NET2_STAT is defined.
 1.11  04-Nov-1998  christos make printf formats conservative
 1.10  10-Aug-1998  tv Transparently handle old-style GNU tar archives that may have garbage in
the trailing block and do not have an end-of-archive marker. (Does this
handling based on whether the ustar id is "ustar" or "ustar ".)
 1.9  27-Jul-1998  mycroft __AUDIT__ cleanup.
 1.8  06-Mar-1998  mrg - implement -C and -l for pax-as-tar, as inspried by GNU tar.
- minor cleanups to the options parsing code.
- add a cpio frontend.

note: a few GNU/svr4 cpio options are not supported yet (#ifdef
notyet), however all x/open ones are.
 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  26-Mar-1996  mrg impliment -z (gzip) in pax and tar, and -Z (compress) in tar.
 1.4  21-Mar-1995  cgd convert to new RCS id conventions.
 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.13.4.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.22.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.22.2.1  07-Apr-2004  jmc Pullup rev 1.23-1.39 (requested by rafal in ticket #1021)

Pullup pax to current version on trunk. Includes many fixes.
 1.39.2.1  22-Jun-2004  tron branches: 1.39.2.1.2;
Pull up revision 1.41 (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
 1.39.2.1.2.1  23-Jul-2005  snj Apply patch (requested by riz in ticket #5512):
Sync pax with HEAD of 2005-07-22.
 1.48.22.2  18-Dec-2009  matt Make this compile on snow leopard.
 1.48.22.1  15-Dec-2009  matt Allow tools to build on OSX 10.6 (Snow Leopard).
 1.48.20.1  03-Oct-2009  snj Pull up following revision(s) (requested by apb in ticket #1020):
bin/pax/Makefile: revision 1.38
bin/pax/ar_io.c: revision 1.49
tools/compat/configure: revision 1.69
tools/compat/configure.ac: revision 1.69
do not require sys/mtio.h for a tools build of pax
 1.48.18.1  03-Oct-2009  snj Pull up following revision(s) (requested by apb in ticket #1020):
bin/pax/Makefile: revision 1.38
bin/pax/ar_io.c: revision 1.49
tools/compat/configure: revision 1.69
tools/compat/configure.ac: revision 1.69
do not require sys/mtio.h for a tools build of pax
 1.53.2.1  17-Apr-2012  yamt sync with head
 1.54.10.1  10-Aug-2014  tls Rebase.
 1.54.2.1  19-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.58.4.3  21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.58.4.2  21-Apr-2020  martin Sync with HEAD
 1.58.4.1  10-Jun-2019  christos Sync with HEAD

RSS XML Feed