Home | History | Annotate | Download | only in pax
History log of /src/bin/pax/tar.c
RevisionDateAuthorComments
 1.76  05-Aug-2024  riastradh pax(1): Nix trailing whitespace.

No functional change intended.
 1.75  20-Mar-2019  gutteridge branches: 1.75.12;
pax: fix typos in comments in file_subs.c & tar.c

Stamp out "greengrocers' apostrophes" in various places (arguably there
are still more present, but style guides vary on that, and my energies
spent corralling wayward punctuation marks could be spent elsewhere).
 1.74  30-Nov-2018  christos Add base-256 decoding support (Micha Gorny)
 1.73  19-Dec-2015  christos branches: 1.73.14; 1.73.16;
PR/50119: Thomas Klausner: Add --timestamp option to tar.
 1.72  16-Jun-2015  christos remove \n from error messages
 1.71  24-Jan-2013  christos Recognize extended attribute headers and warn about them since we are not
currently handling them.
 1.70  09-Aug-2012  christos branches: 1.70.2;
PR/46786: Simon Burge: After conversion to 64 bit time_t, tar/pax/cpio
erroneously think that negative time_t's never fit in 32 bits. Rework
conversion code to always use uintmax_t, and detect negative values.
XXX[1]: Perhaps we should do the same (use a signed conversion) for all
fields not just for time_t
XXX[2]: pullup for 6
 1.69  20-Mar-2012  matt Use C89 function definitions
 1.68  03-Nov-2011  christos Accept -X -
 1.67  14-Feb-2009  lukem branches: 1.67.6;
fix -Wsign-compare issues
 1.66  24-Feb-2008  joerg branches: 1.66.10;
Kill pre-4.4BSD compat code.
 1.65  23-Apr-2007  christos branches: 1.65.4; 1.65.8;
PR/36194: Greg A. Woods: add a '-V' flag to pax for verbose summary without
listing (and other minor fixes)
 1.64  18-Mar-2006  christos Coverity CID 343: Rework code so that we don't write after the end of the
array. The end effect is the same though.
 1.63  11-Feb-2006  dsl Change all the 'return(x)' to 'return c'.
Makes some other searches I want to do a bit easier.
 1.62  24-Apr-2005  christos PR/20071: Perry Metzger: --extract handling is broken. This patch fixes
Perry's example.
 1.61  20-Feb-2005  christos branches: 1.61.2;
The quagga-0.98.2 tar archive is busted. It was created with an old tar
program, and then someone appended to it a ustar record. Detect this and
warn, but don't treat it as an error.
 1.60  17-Oct-2004  dsl Improve error reporting for invalid tar archives.
 1.59  26-Sep-2004  christos In GNU-tar mode, don't split filenames to prefix+name because GNU tar does
not honor it.
 1.58  22-Sep-2004  christos Keep track of the length of the gnu long name/link hack, so that
we can append to it. Modify the code so that file_write is re-entrant,
even in the gnu long name/link hack.

The old code assumed that the buffer already contained the necessary
blocks to satisfy the read file request that contained the long
filename. This is not always the case, specially when we are dealing
with pipes which do shorter reads, thus having more probability
that a long file name will fall across a buffer boundary.

To reproduce, create a tar archive with a lot of gnu-long-names
(pkgsrc/devel/libsigc++2 is a good example), do a tar -tf to get
a list of filenames, compress it and do a tar -tzf to get another
list of the filenames. Notice that the two lists differ.
 1.57  14-Jul-2004  christos - Grr! unterminated buffer string in exclude destination buffer
- fix isfoo() ctype macros to take unsigned char.
 1.56  16-Jun-2004  christos PR/25934: Dieter Baron: hard links with long names still fail.
As mentioned in the previous commit, the switch statement in the longlink()
needed simplification and it was a bit incorrect. Only depend on the passed
type to determine what kind of gnu longlink to produce. Don't try to deduce
it from the archive file type.
 1.55  15-Jun-2004  christos PR/25934: Dieter Baron: tar and hardlinks with long filenames don't work.
- always put the @LongLink tag on the name, not the long-link name.
- pass in what type of long name record we want to create; one for long-name
or long-link name.
XXX: We should get rid of the switch too.
 1.54  15-Jun-2004  christos Restructure the code to make it more readable. No functional changes.
 1.53  11-May-2004  christos Welcome to WARNS=3
 1.52  25-Apr-2004  christos PR/25299: grant beattie: 1.5.3/i386 kernel set archives confuse -current pax
PR/25310: Juan RP: tar can't unpack MS-DOS gzip files correctly
 1.51  20-Apr-2004  christos PR/25207: Hubert Feyrer: tar cores on certain archive contents
- On ustar archives with a specified prefix directory, arcn->nlen was not
computed properly.
- While I am here cast some snprintf's() to void.
 1.50  16-Apr-2004  christos PR/25200: Alan Barrett: bug in pax append mode. This problem was introduced
while trying to fix the tar append mode. Restore the correct 2 null blocks
at the end of file, and disable the old bug compatible mode for gnutar.
 1.49  12-Apr-2004  mrg fix bugs in the previous. use snprintf(). fixes the problem reported
in PR#25131.
 1.48  01-Apr-2004  mrg redo GNU tar --exclude emulation to actually work the same. unfortunately,
because alternation (|) isn't available in "pax -s" RE's, we have to pass
four (yes 4!) different patterns:
.*\/<pattern>$
.*\/<pattern>\/.*
^<pattern>$
^<pattern>\/.*
instead of the more elegant
(^|.*\/)<pattern>($|\/.*)

fixes a problem reported by simonb.
 1.47  30-Jan-2004  christos branches: 1.47.2;
While the comment is not correct anymore, this fixes the problem of tar -rf
where tar would skip backwards too much, corrupting the current tar archive
on append.
 1.46  24-Nov-2003  matt Don't emit any warnings when tar is trying to figure out if the file is
really tar format. valid CPIO files should not trigger a warning from tar.c
 1.45  27-Oct-2003  lukem 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.44  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.43  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.42  24-Jun-2003  grant backout previous; it was a missing prototype elsewhere.

noted by mrg.
 1.41  24-Jun-2003  grant add cast to fix an integer -> pointer warning.
 1.40  23-Jun-2003  grant consistently use "cannot" instead of "can not".
 1.39  20-Apr-2003  christos PR/6195: Matt Watson: Pax fails for paths of exactly 100 characters.
make sure that we don't strlcpy more than the source buffer.
 1.38  31-Mar-2003  christos PR/18959: Xavier HUMBERT: Don't pay attention to sockets in gnu-tar mode.
 1.37  31-Mar-2003  christos RP/8227: Peter Seeback: Emulate old gnu tar better.
 1.36  09-Jan-2003  christos remove debugging printf's I accidentally committed.
 1.35  09-Jan-2003  christos print a bit more info about checksum mismatches.
 1.34  08-Dec-2002  mrg oops, remove a debug statement from the previous.
 1.33  08-Dec-2002  mrg add --exclude support.

XXX: --exclude & --exclude-from are still not 100% compatible, but since
rafal fixed --exclude-from's most annoying bug, they mostly work now.
 1.32  27-Oct-2002  christos PR/18831: Andreas Wrede: Don't exit with an error when we are reading a gnu
tar archive.
 1.31  18-Oct-2002  christos Only warn the user once about gnu extensions. From Eric Gillespie.
 1.30  17-Oct-2002  christos Factor out some more code, and don't expand names in ././@LongLink records.
 1.29  17-Oct-2002  christos Add proper longlink support. Previously we handled longname support, and
the longlink support was completely wrong.
 1.28  16-Oct-2002  christos turn gnu tar off by pax and cpio front ends.
 1.27  16-Oct-2002  christos Warn if we are trying to read a gnu tar archive, if --strict is specified.
 1.26  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.25  13-Oct-2002  christos Fix error in counting the archive's name length. From Eric Gillespie, thanks!
 1.24  13-Oct-2002  mrg make this build on LP64
 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  11-Oct-2002  christos str{n,l}cpy fixes and buffer limit fixes from OpenBSD
 1.21  31-Jan-2002  tv branches: 1.21.2;
Protect __RCSID and __COPYRIGHT from being invoked if not defined.
 1.20  28-Oct-2001  lukem s/u_longlong_t/unsigned long long/ to shut up the parc port
 1.19  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.18  17-Feb-2000  itohy Cleanup and fix typos.
Partially from FreeBSD.
 1.17  19-Jan-2000  mycroft Fix a glitch with handling files larger than 2GB.
 1.16  22-Oct-1999  mrg support ././@LongLink extraction, as created by GNU tar.
 1.15  18-Aug-1999  kleink branches: 1.15.2;
Add the ability to handle estranged V7 tar archives that use USTAR-style
directories; addresses PR bin/8220.
 1.14  21-Jan-1999  mycroft branches: 1.14.2;
Make this build on the Alpha.
 1.13  20-Jan-1999  mrg implement the gnutar -X flag in terms of pax -s. fix some bugs in pax -s handling while i am here...
 1.12  15-Oct-1998  mycroft Reconstruct a split file name correctly.
 1.11  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.10  28-Jul-1998  mycroft Use the uid/gid caching moved into libc. Fixed a memory leak!
 1.9  20-Jul-1997  christos branches: 1.9.2;
- 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.8  25-Jun-1997  kleink Fix OBOB: when reassembling a file name from the header block's `prefix'
and `name' fields, don't overwrite the glueing '/' between them.
 1.7  16-May-1997  kleink Use '0' to front-pad octal strings, not ' '.
 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.2.1  15-Oct-1998  cgd pull up rev 1.12 from trunk (mycroft)
 1.14.2.2  21-Jan-2000  he Pull up revision 1.17 (requested by mycroft):
Fix bugs handling files larger than 2GB.
 1.14.2.1  20-Aug-1999  cgd pull up rev 1.15 from trunk (kleink)
 1.15.2.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.21.2.3  25-Aug-2004  he Pull up revisions 1.49-1.52,1.54-1.57 (via patch, requested by cube in ticket #1737):
Fix bug in --exclude emulation, and use snprintf. (PR#25131)
Fix bug in pax append mode. (PR#25200)
Fix handling of certain archives, fixing core dump. (PR#25207)
Fix problems with 1.5.3/i386 kernel sets (PR#25299) and
MS-DOS gzip files (PR#25310).
Slight code restructuring.
Fix handling of tar with hardlinks to long file names
(PR#25934, PR#25934).
Fix unterminated buffer string in exaclude destination buffer.
Fix isfoo() ctype macros to take unsigned char.
 1.21.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.21.2.1  07-Apr-2004  jmc Pullup rev 1.22-1.48 (requested by rafal in ticket #1021)

Pullup pax to current version on trunk. Includes many fixes.
 1.47.2.8  12-Nov-2004  jmc branches: 1.47.2.8.2;
Pullup rev 1.58 (requested by christos in ticket #921)

Keep track of the length of the gnu long name/link hack, so that
we can append to it. Modify the code so that file_write is re-entrant,
even in the gnu long name/link hack.
 1.47.2.7  12-Nov-2004  jmc Pullup rev 1.59 (requested by christos in ticket #920)

In GNU-tar mode, dontt split filenames to prefix+name because GNU tar does
not honor it.
 1.47.2.6  15-Jul-2004  tron Pull up revision 1.57 (requested by hubertf in ticket #654):
- Grr! unterminated buffer string in exclude destination buffer
- fix isfoo() ctype macros to take unsigned char.
 1.47.2.5  18-Jun-2004  tron Pull up revision 1.54-1.56 via patch (requested by dillo in ticket #507):
Restructure the code to make it more readable. No functional changes.
PR/25934: Dieter Baron: tar and hardlinks with long filenames don't work.
- always put the @LongLink tag on the name, not the long-link name.
- pass in what type of long name record we want to create; one for long-name
or long-link name.
XXX: We should get rid of the switch too.
PR/25934: Dieter Baron: hard links with long names still fail.
As mentioned in the previous commit, the switch statement in the longlink()
needed simplification and it was a bit incorrect. Only depend on the passed
type to determine what kind of gnu longlink to produce. Don't try to deduce
it from the archive file type.
 1.47.2.4  28-Apr-2004  grant Pull up revision 1.52 (requested by snj in ticket #217):

PR/25299: grant beattie: 1.5.3/i386 kernel set archives confuse -current pax
PR/25310: Juan RP: tar can't unpack MS-DOS gzip files correctly
 1.47.2.3  21-Apr-2004  jmc Pullup rev 1.50-1.51 (requested by christos in ticket #170)

Fixes for multiple pax pr's. PR#25200. PR#25207.
 1.47.2.2  19-Apr-2004  jmc Pullup rev 1.49 (requested by mrg in ticket #145)

Fix bugs in the previous. use snprintf(). PR#25131
 1.47.2.1  19-Apr-2004  jmc Pullup rev 1.48 (requested by mrg in ticket #155)

Redo GNU tar --exclude emulation to actually work the same.
 1.47.2.8.2.1  23-Jul-2005  snj Apply patch (requested by riz in ticket #5512):
Sync pax with HEAD of 2005-07-22.
 1.61.2.1  09-Nov-2005  tron Pull up following revision(s) (requested by christos in ticket #946):
bin/pax/tar.c: revision 1.62
PR/20071: Perry Metzger: --extract handling is broken. This patch fixes
Perry's example.
 1.65.8.1  24-Mar-2008  keiichi sync with head.
 1.65.4.1  23-Mar-2008  matt sync with HEAD
 1.66.10.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.67.6.4  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.67.6.3  30-Oct-2012  yamt sync with head
 1.67.6.2  17-Apr-2012  yamt sync with head
 1.67.6.1  10-Nov-2011  yamt sync with head
 1.70.2.1  25-Feb-2013  tls resync with head
 1.73.16.3  21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.73.16.2  21-Apr-2020  martin Sync with HEAD
 1.73.16.1  10-Jun-2019  christos Sync with HEAD
 1.73.14.1  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.75.12.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed