History log of /netbsd-current/bin/pax/file_subs.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.65 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.


Revision tags: netbsd-10-base netbsd-9-3-RELEASE cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.64 20-Mar-2019 gutteridge

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).


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
# 1.63 29-Jul-2013 christos

branches: 1.63.26;
PR/48095: NAKAJIMA Yoshihiro: remove casts from time_t to long


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.62 07-Apr-2009 perry

branches: 1.62.6; 1.62.12;
Fixes from christos for pr-41167

XXX -X is still broken, but that wasn't part of this PR.


Revision tags: netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.61 10-Jan-2008 tls

branches: 1.61.10; 1.61.12;
Teach set_ftime about symbolic links, because it has to know: on some
Linux systems, when we build as a tool we think we have lutimes but it
doesn't work on some filesystems at runtime. A bit ugly but effective
and without use of AC_TRY_RUN in the tool build. Tidier (than mine)
set_ftime reorganization from christos.


Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base
# 1.60 29-Apr-2007 msaitoh

branches: 1.60.4;
fix typos


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.59 11-Feb-2006 dsl

Change all the 'return(x)' to 'return c'.
Makes some other searches I want to do a bit easier.


# 1.58 04-Jan-2006 yamt

obey umask as it used to be before the "mkstemp and then rename" change.


# 1.57 18-Sep-2005 christos

Check for another race reported by chuq.


# 1.56 16-Sep-2005 christos

Another missing mkdir() race pointed out by chuq. Factor out the mkdir code.


# 1.55 13-Sep-2005 christos

use stat and not lstat to detect if we have a directory. refactor the mkpath()
code.


# 1.54 13-Sep-2005 christos

when creating directories, check if the failure occured because someone
else created the directory before we did to avoid races. From chuq.


# 1.53 24-Apr-2005 christos

For clarity instead of using -1 and -2 use the negative of the archive type.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.52 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.51 22-Aug-2004 tron

Propery handle "cpio" archives where the last hardlink includes the
data of a file. This fixes PR bin/26514.


# 1.50 02-Jul-2004 enami

Salvage the `create parent directories and try again' path which is
removed by the previous commit.


# 1.49 26-Jun-2004 grant

break out of the loop and avoid the infinite loop if attempts to
create, unlink and create all fail.


# 1.48 26-Jun-2004 grant

don't attempt to remove the current directory.


# 1.47 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.46 03-May-2004 christos

Don't exit with 1 on broken archives that mark directories as files for
the benefit of pkgsrc. I would have prefered that people fixed their
archivers instead.


# 1.45 30-Apr-2004 matt

Set the chflags *after* the rename, not before.


# 1.44 27-Apr-2004 christos

PR/25350: Alan Barrett: Treat the sticky bit specially as non-superusers
cannot set it on non-directories (elvis-2.2_0 extraction failed)


# 1.43 25-Apr-2004 christos

PR/25188: Thomas Klausner: pax-as-tar problem with trailing slashes
The problem is with the program that generates the tar file:
-rwxrwxrwx 1 root wheel 0 Feb 8 16:46 faad2/aacDECdrop/
It creates directory nodes without the 'd' bit set, so that pax thinks
they are files and does the temporary name and dance with them. Added
code to detect this condition, warn about it, and work around it.


# 1.42 20-Apr-2004 christos

PR/25207: Hubert Feyrer: tar cores on certain archive contents
Don't forget to cleanup xtmp_name when we fail to create the temporary file.


Revision tags: netbsd-2-0-base
# 1.41 13-Feb-2004 matt

branches: 1.41.2;
When pax catches a signal and cleans up, make sure to remove any temporary
file that was being extracted to. This will prevent pax from leaving
droppings when you hit ^C.


# 1.40 13-Feb-2004 matt

Nuke extra mkstemp. Use name, not tmp_name with chk_path.


# 1.39 13-Feb-2004 matt

Back out last change. Since the name is the entire path, prefixing it
with a '.' will not have the desired effect.


# 1.38 13-Feb-2004 matt

When creating the temporary file, prefix the name with a '.'


# 1.37 12-Feb-2004 matt

When restoring files from an archive, initially restore to a temp-file and
once it has been instantiated correctly, rename it to desired name. This
prevents the problem of partially created files being accessed before they
are complete. If said file is a shared library, that can cause ramdon core
dumps.


# 1.36 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.35 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.34 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.33 23-Jun-2003 grant

no need for HAVE_LCHOWN and HAVE_LCHMOD anymore.


# 1.32 10-Feb-2003 grant

add missing braces.

from HIRATSUKA Kouichirou in PR bin/20276.


# 1.31 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.30 02-Feb-2003 wiz

Fix various spelling, grammar, and punctuation problems in comments, from Sergey Svishchev in PR 20164.


# 1.29 20-Jan-2003 simonb

The Double-Semi-Colon Police.


# 1.28 06-Jan-2003 wiz

writable, not writeable.


Revision tags: fvdl_fs64_base
# 1.27 19-Dec-2002 grant

Fix oops in last, chown() failure should be fatal.

Noted by Charles Hannum.


# 1.26 19-Dec-2002 grant

Don't attempt to chown files if euid != 0, and make chown() non-fatal
if it does fail.

This addresses my PR bin/18912 (running pkg_info as non-root user on a
binary package).


# 1.25 17-Oct-2002 christos

Add proper longlink support. Previously we handled longname support, and
the longlink support was completely wrong.


# 1.24 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.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.23 11-Feb-2002 wiz

branches: 1.23.2;
"doesn't" should have an 's'.


# 1.22 31-Jan-2002 tv

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


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.19 17-Jun-2000 mrg

minor KNF nits.


Revision tags: minoura-xpg4dl-base
# 1.18 13-Mar-2000 soren

branches: 1.18.2;
Fix doubled 'the' in comment.


# 1.17 17-Feb-2000 itohy

Cleanup and fix typos.
Partially from FreeBSD.


# 1.16 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.15 07-Nov-1999 mycroft

branches: 1.15.2;
Completely disable all the chflags(2) support for now. With this enabled, I
can't even get a build to finish over NFS. Not acceptable.


# 1.14 07-Nov-1999 mycroft

Don't try to set file flags for a symlink.


# 1.13 01-Nov-1999 mrg

add a new -p subflag: 'f' to preserve 4.4BSD fileflags. this only
really works for `pax -rw' but that's where it is most useful.


# 1.12 22-Oct-1999 mrg

support ././@LongLink extraction, as created by GNU tar.


# 1.11 22-Oct-1999 mrg

remove some old cruft.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.10 28-Feb-1998 mrg

branches: 1.10.4;
fix typo in a comment


# 1.9 03-Feb-1998 mycroft

Deal with GCC warnings.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.8 19-Oct-1997 mycroft

When copying time stamps, copy the microseconds, too. Also nuke silly
static structure.


# 1.7 08-Oct-1997 enami

Restore owner/group/mode/atime/mtime of symbolic links.


# 1.6 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.5 11-Jan-1997 tls

kill 'register'


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.4 21-Mar-1995 cgd

convert to new RCS id conventions.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 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.64 20-Mar-2019 gutteridge

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).


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
# 1.63 29-Jul-2013 christos

PR/48095: NAKAJIMA Yoshihiro: remove casts from time_t to long


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.62 07-Apr-2009 perry

branches: 1.62.6; 1.62.12;
Fixes from christos for pr-41167

XXX -X is still broken, but that wasn't part of this PR.


Revision tags: netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.61 10-Jan-2008 tls

branches: 1.61.10; 1.61.12;
Teach set_ftime about symbolic links, because it has to know: on some
Linux systems, when we build as a tool we think we have lutimes but it
doesn't work on some filesystems at runtime. A bit ugly but effective
and without use of AC_TRY_RUN in the tool build. Tidier (than mine)
set_ftime reorganization from christos.


Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base
# 1.60 29-Apr-2007 msaitoh

branches: 1.60.4;
fix typos


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.59 11-Feb-2006 dsl

Change all the 'return(x)' to 'return c'.
Makes some other searches I want to do a bit easier.


# 1.58 04-Jan-2006 yamt

obey umask as it used to be before the "mkstemp and then rename" change.


# 1.57 18-Sep-2005 christos

Check for another race reported by chuq.


# 1.56 16-Sep-2005 christos

Another missing mkdir() race pointed out by chuq. Factor out the mkdir code.


# 1.55 13-Sep-2005 christos

use stat and not lstat to detect if we have a directory. refactor the mkpath()
code.


# 1.54 13-Sep-2005 christos

when creating directories, check if the failure occured because someone
else created the directory before we did to avoid races. From chuq.


# 1.53 24-Apr-2005 christos

For clarity instead of using -1 and -2 use the negative of the archive type.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.52 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.51 22-Aug-2004 tron

Propery handle "cpio" archives where the last hardlink includes the
data of a file. This fixes PR bin/26514.


# 1.50 02-Jul-2004 enami

Salvage the `create parent directories and try again' path which is
removed by the previous commit.


# 1.49 26-Jun-2004 grant

break out of the loop and avoid the infinite loop if attempts to
create, unlink and create all fail.


# 1.48 26-Jun-2004 grant

don't attempt to remove the current directory.


# 1.47 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.46 03-May-2004 christos

Don't exit with 1 on broken archives that mark directories as files for
the benefit of pkgsrc. I would have prefered that people fixed their
archivers instead.


# 1.45 30-Apr-2004 matt

Set the chflags *after* the rename, not before.


# 1.44 27-Apr-2004 christos

PR/25350: Alan Barrett: Treat the sticky bit specially as non-superusers
cannot set it on non-directories (elvis-2.2_0 extraction failed)


# 1.43 25-Apr-2004 christos

PR/25188: Thomas Klausner: pax-as-tar problem with trailing slashes
The problem is with the program that generates the tar file:
-rwxrwxrwx 1 root wheel 0 Feb 8 16:46 faad2/aacDECdrop/
It creates directory nodes without the 'd' bit set, so that pax thinks
they are files and does the temporary name and dance with them. Added
code to detect this condition, warn about it, and work around it.


# 1.42 20-Apr-2004 christos

PR/25207: Hubert Feyrer: tar cores on certain archive contents
Don't forget to cleanup xtmp_name when we fail to create the temporary file.


Revision tags: netbsd-2-0-base
# 1.41 13-Feb-2004 matt

branches: 1.41.2;
When pax catches a signal and cleans up, make sure to remove any temporary
file that was being extracted to. This will prevent pax from leaving
droppings when you hit ^C.


# 1.40 13-Feb-2004 matt

Nuke extra mkstemp. Use name, not tmp_name with chk_path.


# 1.39 13-Feb-2004 matt

Back out last change. Since the name is the entire path, prefixing it
with a '.' will not have the desired effect.


# 1.38 13-Feb-2004 matt

When creating the temporary file, prefix the name with a '.'


# 1.37 12-Feb-2004 matt

When restoring files from an archive, initially restore to a temp-file and
once it has been instantiated correctly, rename it to desired name. This
prevents the problem of partially created files being accessed before they
are complete. If said file is a shared library, that can cause ramdon core
dumps.


# 1.36 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.35 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.34 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.33 23-Jun-2003 grant

no need for HAVE_LCHOWN and HAVE_LCHMOD anymore.


# 1.32 10-Feb-2003 grant

add missing braces.

from HIRATSUKA Kouichirou in PR bin/20276.


# 1.31 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.30 02-Feb-2003 wiz

Fix various spelling, grammar, and punctuation problems in comments, from Sergey Svishchev in PR 20164.


# 1.29 20-Jan-2003 simonb

The Double-Semi-Colon Police.


# 1.28 06-Jan-2003 wiz

writable, not writeable.


Revision tags: fvdl_fs64_base
# 1.27 19-Dec-2002 grant

Fix oops in last, chown() failure should be fatal.

Noted by Charles Hannum.


# 1.26 19-Dec-2002 grant

Don't attempt to chown files if euid != 0, and make chown() non-fatal
if it does fail.

This addresses my PR bin/18912 (running pkg_info as non-root user on a
binary package).


# 1.25 17-Oct-2002 christos

Add proper longlink support. Previously we handled longname support, and
the longlink support was completely wrong.


# 1.24 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.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.23 11-Feb-2002 wiz

branches: 1.23.2;
"doesn't" should have an 's'.


# 1.22 31-Jan-2002 tv

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


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.19 17-Jun-2000 mrg

minor KNF nits.


Revision tags: minoura-xpg4dl-base
# 1.18 13-Mar-2000 soren

branches: 1.18.2;
Fix doubled 'the' in comment.


# 1.17 17-Feb-2000 itohy

Cleanup and fix typos.
Partially from FreeBSD.


# 1.16 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.15 07-Nov-1999 mycroft

branches: 1.15.2;
Completely disable all the chflags(2) support for now. With this enabled, I
can't even get a build to finish over NFS. Not acceptable.


# 1.14 07-Nov-1999 mycroft

Don't try to set file flags for a symlink.


# 1.13 01-Nov-1999 mrg

add a new -p subflag: 'f' to preserve 4.4BSD fileflags. this only
really works for `pax -rw' but that's where it is most useful.


# 1.12 22-Oct-1999 mrg

support ././@LongLink extraction, as created by GNU tar.


# 1.11 22-Oct-1999 mrg

remove some old cruft.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.10 28-Feb-1998 mrg

branches: 1.10.4;
fix typo in a comment


# 1.9 03-Feb-1998 mycroft

Deal with GCC warnings.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.8 19-Oct-1997 mycroft

When copying time stamps, copy the microseconds, too. Also nuke silly
static structure.


# 1.7 08-Oct-1997 enami

Restore owner/group/mode/atime/mtime of symbolic links.


# 1.6 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.5 11-Jan-1997 tls

kill 'register'


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.4 21-Mar-1995 cgd

convert to new RCS id conventions.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 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.63 29-Jul-2013 christos

PR/48095: NAKAJIMA Yoshihiro: remove casts from time_t to long


# 1.62 07-Apr-2009 perry

branches: 1.62.6; 1.62.12;
Fixes from christos for pr-41167

XXX -X is still broken, but that wasn't part of this PR.


# 1.61 09-Jan-2008 tls

branches: 1.61.10; 1.61.12;
Teach set_ftime about symbolic links, because it has to know: on some
Linux systems, when we build as a tool we think we have lutimes but it
doesn't work on some filesystems at runtime. A bit ugly but effective
and without use of AC_TRY_RUN in the tool build. Tidier (than mine)
set_ftime reorganization from christos.


# 1.60 29-Apr-2007 msaitoh

branches: 1.60.4;
fix typos


# 1.59 11-Feb-2006 dsl

Change all the 'return(x)' to 'return c'.
Makes some other searches I want to do a bit easier.


# 1.58 04-Jan-2006 yamt

obey umask as it used to be before the "mkstemp and then rename" change.


# 1.57 18-Sep-2005 christos

Check for another race reported by chuq.


# 1.56 15-Sep-2005 christos

Another missing mkdir() race pointed out by chuq. Factor out the mkdir code.


# 1.55 13-Sep-2005 christos

use stat and not lstat to detect if we have a directory. refactor the mkpath()
code.


# 1.54 13-Sep-2005 christos

when creating directories, check if the failure occured because someone
else created the directory before we did to avoid races. From chuq.


# 1.53 23-Apr-2005 christos

For clarity instead of using -1 and -2 use the negative of the archive type.


# 1.52 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.51 21-Aug-2004 tron

Propery handle "cpio" archives where the last hardlink includes the
data of a file. This fixes PR bin/26514.


# 1.50 02-Jul-2004 enami

Salvage the `create parent directories and try again' path which is
removed by the previous commit.


# 1.49 26-Jun-2004 grant

break out of the loop and avoid the infinite loop if attempts to
create, unlink and create all fail.


# 1.48 26-Jun-2004 grant

don't attempt to remove the current directory.


# 1.47 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.46 02-May-2004 christos

Don't exit with 1 on broken archives that mark directories as files for
the benefit of pkgsrc. I would have prefered that people fixed their
archivers instead.


# 1.45 29-Apr-2004 matt

Set the chflags *after* the rename, not before.


# 1.44 27-Apr-2004 christos

PR/25350: Alan Barrett: Treat the sticky bit specially as non-superusers
cannot set it on non-directories (elvis-2.2_0 extraction failed)


# 1.43 24-Apr-2004 christos

PR/25188: Thomas Klausner: pax-as-tar problem with trailing slashes
The problem is with the program that generates the tar file:
-rwxrwxrwx 1 root wheel 0 Feb 8 16:46 faad2/aacDECdrop/
It creates directory nodes without the 'd' bit set, so that pax thinks
they are files and does the temporary name and dance with them. Added
code to detect this condition, warn about it, and work around it.


# 1.42 20-Apr-2004 christos

PR/25207: Hubert Feyrer: tar cores on certain archive contents
Don't forget to cleanup xtmp_name when we fail to create the temporary file.


# 1.41 13-Feb-2004 matt

branches: 1.41.2;
When pax catches a signal and cleans up, make sure to remove any temporary
file that was being extracted to. This will prevent pax from leaving
droppings when you hit ^C.


# 1.40 13-Feb-2004 matt

Nuke extra mkstemp. Use name, not tmp_name with chk_path.


# 1.39 12-Feb-2004 matt

Back out last change. Since the name is the entire path, prefixing it
with a '.' will not have the desired effect.


# 1.38 12-Feb-2004 matt

When creating the temporary file, prefix the name with a '.'


# 1.37 12-Feb-2004 matt

When restoring files from an archive, initially restore to a temp-file and
once it has been instantiated correctly, rename it to desired name. This
prevents the problem of partially created files being accessed before they
are complete. If said file is a shared library, that can cause ramdon core
dumps.


# 1.36 26-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.35 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.34 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.33 23-Jun-2003 grant

no need for HAVE_LCHOWN and HAVE_LCHMOD anymore.


# 1.32 10-Feb-2003 grant

add missing braces.

from HIRATSUKA Kouichirou in PR bin/20276.


# 1.31 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.30 02-Feb-2003 wiz

Fix various spelling, grammar, and punctuation problems in comments, from Sergey Svishchev in PR 20164.


# 1.29 19-Jan-2003 simonb

The Double-Semi-Colon Police.


# 1.28 06-Jan-2003 wiz

writable, not writeable.


# 1.27 19-Dec-2002 grant

Fix oops in last, chown() failure should be fatal.

Noted by Charles Hannum.


# 1.26 19-Dec-2002 grant

Don't attempt to chown files if euid != 0, and make chown() non-fatal
if it does fail.

This addresses my PR bin/18912 (running pkg_info as non-root user on a
binary package).


# 1.25 16-Oct-2002 christos

Add proper longlink support. Previously we handled longname support, and
the longlink support was completely wrong.


# 1.24 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.23 11-Feb-2002 wiz

branches: 1.23.2;
"doesn't" should have an 's'.


# 1.22 31-Jan-2002 tv

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 24-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 17-Jun-2000 mrg

minor KNF nits.


# 1.18 13-Mar-2000 soren

branches: 1.18.2;
Fix doubled 'the' in comment.


# 1.17 16-Feb-2000 itohy

Cleanup and fix typos.
Partially from FreeBSD.


# 1.16 16-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.15 07-Nov-1999 mycroft

branches: 1.15.2;
Completely disable all the chflags(2) support for now. With this enabled, I
can't even get a build to finish over NFS. Not acceptable.


# 1.14 07-Nov-1999 mycroft

Don't try to set file flags for a symlink.


# 1.13 31-Oct-1999 mrg

add a new -p subflag: 'f' to preserve 4.4BSD fileflags. this only
really works for `pax -rw' but that's where it is most useful.


# 1.12 22-Oct-1999 mrg

support ././@LongLink extraction, as created by GNU tar.


# 1.11 22-Oct-1999 mrg

remove some old cruft.


# 1.10 28-Feb-1998 mrg

branches: 1.10.4;
fix typo in a comment


# 1.9 03-Feb-1998 mycroft

Deal with GCC warnings.


# 1.8 19-Oct-1997 mycroft

When copying time stamps, copy the microseconds, too. Also nuke silly
static structure.


# 1.7 08-Oct-1997 enami

Restore owner/group/mode/atime/mtime of symbolic links.


# 1.6 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.5 10-Jan-1997 tls

kill 'register'


# 1.4 21-Mar-1995 cgd

convert to new RCS id conventions.


# 1.3 13-Jun-1994 mycroft

Fix up RCS ids.


# 1.2 12-Jun-1994 jtc

Add RCS ID's


# 1.1 12-Jun-1994 jtc

branches: 1.1.1;
Initial revision


# 1.1.1.1 12-Jun-1994 jtc

From 4.4 lite


# 1.10.4.1 27-Dec-1999 wrstuden

Pull up to last week's -current.


# 1.15.2.2 07-Nov-1999 mycroft

Completely disable all the chflags(2) support for now. With this enabled, I
can't even get a build to finish over NFS. Not acceptable.


# 1.15.2.1 07-Nov-1999 mycroft

file file_subs.c was added on branch comdex-fall-1999 on 1999-11-07 15:48:25 +0000


# 1.18.2.1 22-Jun-2000 minoura

Sync w/ netbsd-1-5-base.


# 1.23.2.3 25-Aug-2004 he

Pull up revisions 1.42-1.46,1.48-1.50 (requested by cube in ticket #1736):
Fix handling of certain archives, fixing core dump (PR#25207).
Fix problem with trailing slashes (PR#15188).
Treat sticky bit specially for non-superuser (PR#25350).
Set chflags after rename, not before.
Don't exit with 1 on broken archives that mark directories as files.
Don't attempt to remove current directory.
Break out of loop and avoid infinite loop in certain error situations.
Salvage the `create parent directories and try again' patch.


# 1.23.2.2 15-Jun-2004 jmc

fix botched pullup from ticket #1021 and make sure this compiles on
non-NetBSD hosts again. Also fixes PR#24481


# 1.23.2.1 07-Apr-2004 jmc

Pullup rev 1.24-1.41 (requested by rafal in ticket #1021)

Pullup pax to current version on trunk. Includes many fixes.


# 1.41.2.8 11-Nov-2004 jmc

branches: 1.41.2.8.2;
Pullup rev 1.52 (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.41.2.7 24-Aug-2004 jmc

Pullup rev 1.51 (requested by tron in ticket #784)

Propery handle "cpio" archives where the last hardlink includes the
data of a file. PR#26514


# 1.41.2.6 12-Aug-2004 jmc

Pullup rev 1.48-1.50 (requested by cube in ticket #754)

Fixes for pax breaking on some archives


# 1.41.2.5 22-Jun-2004 tron

Pull up revision 1.47 (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.41.2.4 05-May-2004 jmc

Pullup rev 1.45-1.46 (requested by snj in ticket #252)

Set the chflags *after* the rename, not before.
Don't exit with 1 on broken archives that mark directories as files for
the benefit of pkgsrc.


# 1.41.2.3 27-Apr-2004 grant

Pull up revision 1.44 (requested by snj in ticket #217):

PR/25350: Alan Barrett: Treat the sticky bit specially as non-superusers
cannot set it on non-directories (elvis-2.2_0 extraction failed)


# 1.41.2.2 27-Apr-2004 grant

Pull up revision 1.43 (requested by snj in ticket #217):

PR/25188: Thomas Klausner: pax-as-tar problem with trailing slashes
The problem is with the program that generates the tar file:
-rwxrwxrwx 1 root wheel 0 Feb 8 16:46 faad2/aacDECdrop/
It creates directory nodes without the 'd' bit set, so that pax thinks
they are files and does the temporary name and dance with them. Added
code to detect this condition, warn about it, and work around it.


# 1.41.2.1 20-Apr-2004 jmc

Pullup rev 1.42 (requested by christos in ticket #170)

Fixes for multiple pax pr's. PR#25200. PR#25207.


# 1.41.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.60.4.1 22-Mar-2008 matt

sync with HEAD


# 1.61.12.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.61.10.1 13-Apr-2009 snj

Pull up following revision(s) (requested by christo in ticket #678):
bin/pax/extern.h: revision 1.56
bin/pax/file_subs.c: revision 1.62
bin/pax/options.c: revision 1.104
bin/pax/pat_rep.c: revision 1.29
bin/pax/pax.h: revision 1.30
Fixes from christos for pr-41167
XXX -X is still broken, but that wasn't part of this PR.


# 1.62.12.1 19-Aug-2014 tls

Rebase to HEAD as of a few days ago.


# 1.62.6.1 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")