summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2007-11-30 21:25:12 +0000
committerjoerg <joerg@pkgsrc.org>2007-11-30 21:25:12 +0000
commit716563bc0c4cdde2939f9371a03b69812faff736 (patch)
tree6284abded80386144223aeefe15714543d8bde6c
parentc77b5954fc480db1fbe9a03d0d785116a2dad001 (diff)
downloadpkgsrc-716563bc0c4cdde2939f9371a03b69812faff736.tar.gz
Import libarchive-2.4.0
-rw-r--r--archivers/libarchive/files/Makefile.am155
-rw-r--r--archivers/libarchive/files/Makefile.in669
-rw-r--r--archivers/libarchive/files/NEWS51
-rw-r--r--archivers/libarchive/files/README32
-rw-r--r--archivers/libarchive/files/config.h.in12
-rwxr-xr-xarchivers/libarchive/files/configure229
-rw-r--r--archivers/libarchive/files/configure.ac75
-rw-r--r--archivers/libarchive/files/contrib/README32
-rw-r--r--archivers/libarchive/files/contrib/libarchive.1aix53.spec163
-rw-r--r--archivers/libarchive/files/contrib/libarchive.spec150
-rw-r--r--archivers/libarchive/files/contrib/libarchive_autodetect-st_lib_archive.m4154
-rw-r--r--archivers/libarchive/files/cpio/bsdcpio.1362
-rw-r--r--archivers/libarchive/files/cpio/cmdline.c245
-rw-r--r--archivers/libarchive/files/cpio/cpio.c416
-rw-r--r--archivers/libarchive/files/cpio/cpio.h27
-rw-r--r--archivers/libarchive/files/cpio/cpio_platform.h3
-rw-r--r--archivers/libarchive/files/cpio/err.c73
-rw-r--r--archivers/libarchive/files/cpio/match.c87
-rw-r--r--archivers/libarchive/files/cpio/test/list.h11
-rw-r--r--archivers/libarchive/files/cpio/test/main.c692
-rw-r--r--archivers/libarchive/files/cpio/test/test.h146
-rw-r--r--archivers/libarchive/files/cpio/test/test_basic.c159
-rw-r--r--archivers/libarchive/files/cpio/test/test_gcpio_compat.c126
-rw-r--r--archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.binbin0 -> 512 bytes
-rw-r--r--archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.crcbin0 -> 1024 bytes
-rw-r--r--archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.newcbin0 -> 1024 bytes
-rw-r--r--archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.ustarbin0 -> 3584 bytes
-rw-r--r--archivers/libarchive/files/cpio/test/test_help.c66
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_B.c54
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_d.c68
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_m.c68
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_m.cpiobin0 -> 512 bytes
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_t.c44
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_t.cpiobin0 -> 512 bytes
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_t.stdout1
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_tv.stdout1
-rw-r--r--archivers/libarchive/files/cpio/test/test_owner_parse.c68
-rw-r--r--archivers/libarchive/files/cpio/test/test_pathmatch.c108
-rw-r--r--archivers/libarchive/files/cpio/test/test_version.c73
-rw-r--r--archivers/libarchive/files/cpio/test/test_write_odc.c186
-rw-r--r--archivers/libarchive/files/doc/man/archive_entry.3382
-rw-r--r--archivers/libarchive/files/doc/man/archive_read.3524
-rw-r--r--archivers/libarchive/files/doc/man/archive_util.3146
-rw-r--r--archivers/libarchive/files/doc/man/archive_write.3524
-rw-r--r--archivers/libarchive/files/doc/man/archive_write_disk.3358
-rw-r--r--archivers/libarchive/files/doc/man/bsdcpio.1362
-rw-r--r--archivers/libarchive/files/doc/man/bsdtar.1769
-rw-r--r--archivers/libarchive/files/doc/man/cpio.5325
-rw-r--r--archivers/libarchive/files/doc/man/libarchive-formats.5272
-rw-r--r--archivers/libarchive/files/doc/man/libarchive.3331
-rw-r--r--archivers/libarchive/files/doc/man/libarchive_internals.3366
-rw-r--r--archivers/libarchive/files/doc/man/mtree.5270
-rw-r--r--archivers/libarchive/files/doc/man/tar.5730
-rw-r--r--archivers/libarchive/files/doc/text/archive_entry.3.txt350
-rw-r--r--archivers/libarchive/files/doc/text/archive_read.3.txt395
-rw-r--r--archivers/libarchive/files/doc/text/archive_util.3.txt91
-rw-r--r--archivers/libarchive/files/doc/text/archive_write.3.txt420
-rw-r--r--archivers/libarchive/files/doc/text/archive_write_disk.3.txt253
-rw-r--r--archivers/libarchive/files/doc/text/bsdcpio.1.txt199
-rw-r--r--archivers/libarchive/files/doc/text/bsdtar.1.txt450
-rw-r--r--archivers/libarchive/files/doc/text/cpio.5.txt235
-rw-r--r--archivers/libarchive/files/doc/text/libarchive-formats.5.txt180
-rw-r--r--archivers/libarchive/files/doc/text/libarchive.3.txt185
-rw-r--r--archivers/libarchive/files/doc/text/libarchive_internals.3.txt248
-rw-r--r--archivers/libarchive/files/doc/text/mtree.5.txt158
-rw-r--r--archivers/libarchive/files/doc/text/tar.5.txt534
-rw-r--r--archivers/libarchive/files/libarchive/archive.h.in54
-rw-r--r--archivers/libarchive/files/libarchive/archive_entry.h34
-rw-r--r--archivers/libarchive/files/libarchive/archive_entry_link_resolver.c222
-rw-r--r--archivers/libarchive/files/libarchive/archive_entry_private.h2
-rw-r--r--archivers/libarchive/files/libarchive/archive_entry_strmode.c83
-rw-r--r--archivers/libarchive/files/libarchive/archive_platform.h3
-rw-r--r--archivers/libarchive/files/libarchive/archive_read.34
-rw-r--r--archivers/libarchive/files/libarchive/archive_read.c18
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_compression_none.c109
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_ar.c8
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_cpio.c179
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c17
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c19
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_tar.c89
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_zip.c30
-rw-r--r--archivers/libarchive/files/libarchive/archive_util.c2
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_disk.c21
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_compression_none.c43
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_format_cpio.c10
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_format_cpio_newc.c9
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_format_pax.c13
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c13
-rw-r--r--archivers/libarchive/files/libarchive/config_windows.h3
-rw-r--r--archivers/libarchive/files/libarchive/cpio.5325
-rw-r--r--archivers/libarchive/files/libarchive/libarchive-formats.532
-rw-r--r--archivers/libarchive/files/libarchive/libarchive_internals.322
-rw-r--r--archivers/libarchive/files/libarchive/mtree.5270
-rw-r--r--archivers/libarchive/files/libarchive/test/list.h4
-rw-r--r--archivers/libarchive/files/libarchive/test/main.c288
-rw-r--r--archivers/libarchive/files/libarchive/test/read_open_memory.c2
-rw-r--r--archivers/libarchive/files/libarchive/test/test.h90
-rw-r--r--archivers/libarchive/files/libarchive/test/test_entry_strmode.c48
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_cpio_odc.c2
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse.c57
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_isorr_bz2.c3
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_zip.c6
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_pax_truncated.c4
-rw-r--r--archivers/libarchive/files/libarchive/test/test_tar_filenames.c2
-rw-r--r--archivers/libarchive/files/libarchive/test/test_tar_large.c307
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_disk.c79
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_format_cpio.c96
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_format_cpio_newc.c172
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_format_cpio_odc.c224
-rw-r--r--archivers/libarchive/files/tar/bsdtar.12
-rw-r--r--archivers/libarchive/files/tar/bsdtar.c4
-rw-r--r--archivers/libarchive/files/tar/bsdtar.h1
-rw-r--r--archivers/libarchive/files/tar/bsdtar_platform.h3
-rw-r--r--archivers/libarchive/files/tar/read.c5
-rwxr-xr-xarchivers/libarchive/files/tar/test/config.sh1
-rwxr-xr-xarchivers/libarchive/files/tar/test/test-basic.sh40
-rw-r--r--archivers/libarchive/files/tar/util.c50
-rw-r--r--archivers/libarchive/files/version2
118 files changed, 16139 insertions, 850 deletions
diff --git a/archivers/libarchive/files/Makefile.am b/archivers/libarchive/files/Makefile.am
index 1e9e8506ddb..c4cea7af690 100644
--- a/archivers/libarchive/files/Makefile.am
+++ b/archivers/libarchive/files/Makefile.am
@@ -1,18 +1,37 @@
## Process this file with automake to produce Makefile.in
-AUTOMAKE_OPTIONS = foreign subdir-objects
+AUTOMAKE_OPTIONS= foreign subdir-objects
-BUILT_SOURCES = libarchive/test/list.h libarchive/archive.h
+#
+# What to build and install
+#
+lib_LTLIBRARIES= libarchive.la
+bin_PROGRAMS= $(bsdtar_programs) $(bsdcpio_programs)
+man_MANS= $(libarchive_man_MANS) $(bsdtar_man_MANS) $(bsdcpio_man_MANS)
+BUILT_SOURCES= libarchive/test/list.h cpio/test/list.h
+
+#
+# What to test
+#
+check_PROGRAMS= libarchive_test $(bsdcpio_test_programs)
+TESTS= libarchive_test $(bsdcpio_test_programs)
+TESTS_ENVIRONMENT= $(bsdcpio_TESTS_ENVIRONMENT)
+# Always build and test bsdcpio as part of 'distcheck'
+DISTCHECK_CONFIGURE_FLAGS = --enable-bsdcpio
-EXTRA_DIST= version \
- config.h.in \
- examples \
- libarchive/test/list.h \
- tar/test \
- tar/getdate.c
+#
+# What to include in the distribution
+#
+EXTRA_DIST= version \
+ contrib \
+ examples \
+ $(libarchive_EXTRA_DIST) \
+ $(bsdtar_EXTRA_DIST) \
+ $(bsdcpio_EXTRA_DIST) \
+ $(bsdcpio_test_EXTRA_DIST)
-# Clean out some unneeded files and directories
-# that get picked up as part of the directories in EXTRA_DIST above.
+# a) Clean out some unneeded files and directories
+# b) Collect all documentation and format it for distribution.
dist-hook:
rm -rf `find $(distdir) -name CVS -type d`
rm -rf `find $(distdir) -name .svn -type d`
@@ -20,20 +39,20 @@ dist-hook:
rm -f `find $(distdir) -name '*.out'`
rm -f `find $(distdir) -name '*.core'`
rm -f $(distdir)/*/Makefile
+ mkdir -p $(distdir)/doc/man
+ cp $(distdir)/libarchive/*.[135] $(distdir)/doc/man
+ cp $(distdir)/tar/*.[135] $(distdir)/doc/man
+ cp $(distdir)/cpio/*.[135] $(distdir)/doc/man
+ mkdir -p $(distdir)/doc/text
+ cd $(distdir)/doc/man; for f in *.[135]; do nroff -mdoc $$f | col -b > ../text/`basename $$f`.txt; done
distclean-local:
-rm -f tar/getdate.c tar/getdate.h
-rm -f libarchive/test/list.h
+ -rm -f cpio/test/list.h
-rm -rf autom4te.cache/
-rm -f *~
-# Always build libarchive, regardless
-lib_LTLIBRARIES= libarchive.la
-bin_PROGRAMS= $(bsdtar_programs) $(bsdcpio_programs)
-check_PROGRAMS= libarchive_test
-dist_man_MANS=$(libarchive_dist_man_MANS) $(bsdtar_dist_man_MANS) $(bsdcpio_dist_man_MANS)
-TESTS= libarchive_test
-
#
# Libarchive headers, source, etc.
#
@@ -49,8 +68,10 @@ libarchive_la_SOURCES= \
libarchive/archive_entry.c \
libarchive/archive_entry.h \
libarchive/archive_entry_copy_stat.c \
+ libarchive/archive_entry_link_resolver.c \
libarchive/archive_entry_private.h \
libarchive/archive_entry_stat.c \
+ libarchive/archive_entry_strmode.c \
libarchive/archive_platform.h \
libarchive/archive_private.h \
libarchive/archive_read.c \
@@ -107,20 +128,28 @@ libarchive_la_SOURCES= \
libarchive/filter_fork.h
# archive.h ends up in the build directory, so make sure we can find it.
-libarchive_la_CPPFLAGS=-I$(top_builddir)/libarchive
+libarchive_la_CPPFLAGS= -I$(top_builddir)/libarchive
libarchive_la_LDFLAGS= -version-info $(ARCHIVE_LIBTOOL_VERSION)
-libarchive_dist_man_MANS= \
+# Manpages to install
+libarchive_man_MANS= \
libarchive/archive_entry.3 \
libarchive/archive_read.3 \
libarchive/archive_util.3 \
libarchive/archive_write.3 \
libarchive/archive_write_disk.3 \
+ libarchive/cpio.5 \
libarchive/libarchive.3 \
libarchive/libarchive_internals.3 \
libarchive/libarchive-formats.5 \
+ libarchive/mtree.5 \
libarchive/tar.5
+# Additional libarchive files to include in the distribution
+libarchive_EXTRA_DIST= \
+ libarchive/test/list.h \
+ $(libarchive_man_MANS)
+
#
#
# libarchive_test program
@@ -136,6 +165,7 @@ libarchive_test_SOURCES= \
libarchive/test/test_archive_api_feature.c \
libarchive/test/test_bad_fd.c \
libarchive/test/test_entry.c \
+ libarchive/test/test_entry_strmode.c \
libarchive/test/test_read_compress_program.c \
libarchive/test/test_read_data_large.c \
libarchive/test/test_read_extract.c \
@@ -164,6 +194,7 @@ libarchive_test_SOURCES= \
libarchive/test/test_read_position.c \
libarchive/test/test_read_truncated.c \
libarchive/test/test_tar_filenames.c \
+ libarchive/test/test_tar_large.c \
libarchive/test/test_write_compress_program.c \
libarchive/test/test_write_disk.c \
libarchive/test/test_write_disk_perms.c \
@@ -171,12 +202,14 @@ libarchive_test_SOURCES= \
libarchive/test/test_write_format_ar.c \
libarchive/test/test_write_format_cpio.c \
libarchive/test/test_write_format_cpio_empty.c \
+ libarchive/test/test_write_format_cpio_odc.c \
+ libarchive/test/test_write_format_cpio_newc.c \
libarchive/test/test_write_format_shar_empty.c \
libarchive/test/test_write_format_tar.c \
libarchive/test/test_write_format_tar_empty.c \
libarchive/test/test_write_open_memory.c
-libarchive_test_CPPFLAGS=-I$(top_builddir)/libarchive -I$(top_builddir)/libarchive/test
+libarchive_test_CPPFLAGS= -I$(top_builddir)/libarchive -I$(top_builddir)/libarchive/test
# The "list.h" file just lists all of the tests defined in all of the sources.
# Building it automatically provides a sanity-check on libarchive_test_SOURCES
@@ -202,25 +235,28 @@ bsdtar_SOURCES= \
tar/util.c \
tar/write.c
-bsdtar_DEPENDENCIES = libarchive.la \
+bsdtar_DEPENDENCIES= libarchive.la \
libarchive/archive_entry.h \
libarchive/archive.h
if STATIC_BSDTAR
-bsdtar_static=-static
+bsdtar_static= -static
else
bsdtar_static=
endif
bsdtar_LDADD= libarchive.la
-bsdtar_CPPFLAGS=-I$(top_builddir)/libarchive -I$(top_srcdir)/libarchive
+bsdtar_CPPFLAGS= -I$(top_builddir)/libarchive -I$(top_srcdir)/libarchive
bsdtar_LDFLAGS= $(bsdtar_static)
+bsdtar_EXTRA_DIST= \
+ tar/test \
+ tar/bsdtar.1
if BUILD_BSDTAR
-bsdtar_dist_man_MANS= tar/bsdtar.1
-bsdtar_programs=bsdtar
+bsdtar_man_MANS= tar/bsdtar.1
+bsdtar_programs= bsdtar
else
-bsdtar_dist_man_MANS=
+bsdtar_man_MANS=
bsdtar_programs=
endif
@@ -232,25 +268,82 @@ endif
#
bsdcpio_SOURCES= \
+ cpio/cmdline.c \
cpio/cpio.c \
cpio/cpio.h \
cpio/cpio_platform.h \
- cpio/util.c
+ cpio/err.c \
+ cpio/match.c
bsdcpio_DEPENDENCIES = libarchive.la \
libarchive/archive_entry.h \
libarchive/archive.h
+
+if STATIC_BSDCPIO
bsdcpio_static= -static
+else
+bsdcpio_static=
+endif
+
bsdcpio_LDADD= libarchive.la
-bsdcpio_CPPFLAGS=-I$(top_builddir)/libarchive -I$(top_srcdir)/libarchive
+bsdcpio_CPPFLAGS= -I$(top_builddir)/libarchive -I$(top_srcdir)/libarchive
bsdcpio_LDFLAGS= $(bsdcpio_static)
+bsdcpio_EXTRA_DIST= \
+ cpio/test/list.h \
+ cpio/bsdcpio.1
if BUILD_BSDCPIO
-bsdcpio_dist_man_MANS= cpio/bsdcpio.1
-bsdcpio_programs=bsdcpio
+# Manpages to install
+bsdcpio_man_MANS= cpio/bsdcpio.1
+bsdcpio_programs= bsdcpio
else
-bsdcpio_dist_man_MANS=
+bsdcpio_man_MANS=
bsdcpio_programs=
endif
+#
+# bsdcpio_test
+#
+
+bsdcpio_test_SOURCES= \
+ cpio/cmdline.c \
+ cpio/err.c \
+ cpio/match.c \
+ cpio/test/main.c \
+ cpio/test/test.h \
+ cpio/test/test_basic.c \
+ cpio/test/test_gcpio_compat.c \
+ cpio/test/test_help.c \
+ cpio/test/test_option_B.c \
+ cpio/test/test_option_d.c \
+ cpio/test/test_option_m.c \
+ cpio/test/test_option_t.c \
+ cpio/test/test_owner_parse.c \
+ cpio/test/test_pathmatch.c \
+ cpio/test/test_version.c \
+ cpio/test/test_write_odc.c
+
+bsdcpio_test_EXTRA_DIST= \
+ cpio/test/test_gcpio_compat_ref.bin \
+ cpio/test/test_gcpio_compat_ref.crc \
+ cpio/test/test_gcpio_compat_ref.newc \
+ cpio/test/test_gcpio_compat_ref.ustar \
+ cpio/test/test_option_m.cpio \
+ cpio/test/test_option_t.cpio \
+ cpio/test/test_option_t.stdout \
+ cpio/test/test_option_tv.stdout
+
+bsdcpio_test_CPPFLAGS= -I$(top_builddir)/cpio/test
+
+cpio/test/list.h: Makefile
+ cat $(top_srcdir)/cpio/test/test_*.c | grep DEFINE_TEST > cpio/test/list.h
+
+if BUILD_BSDCPIO
+bsdcpio_test_programs= bsdcpio_test
+bsdcpio_TESTS_ENVIRONMENT= BSDCPIO=`cd $(top_builddir);/bin/pwd`/bsdcpio BSDCPIO_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/cpio/test
+else
+bsdcpio_test_programs=
+bsdcpio_TESTS_ENVIRONMENT=
+endif
+
diff --git a/archivers/libarchive/files/Makefile.in b/archivers/libarchive/files/Makefile.in
index 573483dc7b6..453debc0a5c 100644
--- a/archivers/libarchive/files/Makefile.in
+++ b/archivers/libarchive/files/Makefile.in
@@ -35,11 +35,11 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2)
-check_PROGRAMS = libarchive_test$(EXEEXT)
-TESTS = libarchive_test$(EXEEXT)
+check_PROGRAMS = libarchive_test$(EXEEXT) $(am__EXEEXT_3)
+TESTS = libarchive_test$(EXEEXT) $(am__EXEEXT_3)
subdir = .
-DIST_COMMON = README $(am__configure_deps) $(dist_man_MANS) \
- $(include_HEADERS) $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+DIST_COMMON = README $(am__configure_deps) $(include_HEADERS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/config.h.in $(top_srcdir)/configure \
$(top_srcdir)/libarchive/archive.h.in COPYING INSTALL NEWS \
config.aux/compile config.aux/config.guess \
@@ -73,7 +73,9 @@ am_libarchive_la_OBJECTS = \
libarchive/libarchive_la-archive_check_magic.lo \
libarchive/libarchive_la-archive_entry.lo \
libarchive/libarchive_la-archive_entry_copy_stat.lo \
+ libarchive/libarchive_la-archive_entry_link_resolver.lo \
libarchive/libarchive_la-archive_entry_stat.lo \
+ libarchive/libarchive_la-archive_entry_strmode.lo \
libarchive/libarchive_la-archive_read.lo \
libarchive/libarchive_la-archive_read_data_into_fd.lo \
libarchive/libarchive_la-archive_read_extract.lo \
@@ -126,13 +128,32 @@ libarchive_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
@BUILD_BSDTAR_TRUE@am__EXEEXT_1 = bsdtar$(EXEEXT)
@BUILD_BSDCPIO_TRUE@am__EXEEXT_2 = bsdcpio$(EXEEXT)
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+@BUILD_BSDCPIO_TRUE@am__EXEEXT_3 = bsdcpio_test$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS)
-am_bsdcpio_OBJECTS = cpio/bsdcpio-cpio.$(OBJEXT) \
- cpio/bsdcpio-util.$(OBJEXT)
+am_bsdcpio_OBJECTS = cpio/bsdcpio-cmdline.$(OBJEXT) \
+ cpio/bsdcpio-cpio.$(OBJEXT) cpio/bsdcpio-err.$(OBJEXT) \
+ cpio/bsdcpio-match.$(OBJEXT)
bsdcpio_OBJECTS = $(am_bsdcpio_OBJECTS)
bsdcpio_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(bsdcpio_LDFLAGS) \
$(LDFLAGS) -o $@
+am_bsdcpio_test_OBJECTS = cpio/bsdcpio_test-cmdline.$(OBJEXT) \
+ cpio/bsdcpio_test-err.$(OBJEXT) \
+ cpio/bsdcpio_test-match.$(OBJEXT) \
+ cpio/test/bsdcpio_test-main.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_basic.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_gcpio_compat.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_help.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_B.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_d.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_m.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_t.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_owner_parse.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_pathmatch.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_version.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_write_odc.$(OBJEXT)
+bsdcpio_test_OBJECTS = $(am_bsdcpio_test_OBJECTS)
+bsdcpio_test_LDADD = $(LDADD)
am_bsdtar_OBJECTS = tar/bsdtar-bsdtar.$(OBJEXT) \
tar/bsdtar-getdate.$(OBJEXT) tar/bsdtar-matching.$(OBJEXT) \
tar/bsdtar-read.$(OBJEXT) tar/bsdtar-tree.$(OBJEXT) \
@@ -145,7 +166,9 @@ am__objects_1 = \
libarchive/libarchive_test-archive_check_magic.$(OBJEXT) \
libarchive/libarchive_test-archive_entry.$(OBJEXT) \
libarchive/libarchive_test-archive_entry_copy_stat.$(OBJEXT) \
+ libarchive/libarchive_test-archive_entry_link_resolver.$(OBJEXT) \
libarchive/libarchive_test-archive_entry_stat.$(OBJEXT) \
+ libarchive/libarchive_test-archive_entry_strmode.$(OBJEXT) \
libarchive/libarchive_test-archive_read.$(OBJEXT) \
libarchive/libarchive_test-archive_read_data_into_fd.$(OBJEXT) \
libarchive/libarchive_test-archive_read_extract.$(OBJEXT) \
@@ -199,6 +222,7 @@ am_libarchive_test_OBJECTS = $(am__objects_1) \
libarchive/test/libarchive_test-test_archive_api_feature.$(OBJEXT) \
libarchive/test/libarchive_test-test_bad_fd.$(OBJEXT) \
libarchive/test/libarchive_test-test_entry.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_entry_strmode.$(OBJEXT) \
libarchive/test/libarchive_test-test_read_compress_program.$(OBJEXT) \
libarchive/test/libarchive_test-test_read_data_large.$(OBJEXT) \
libarchive/test/libarchive_test-test_read_extract.$(OBJEXT) \
@@ -227,6 +251,7 @@ am_libarchive_test_OBJECTS = $(am__objects_1) \
libarchive/test/libarchive_test-test_read_position.$(OBJEXT) \
libarchive/test/libarchive_test-test_read_truncated.$(OBJEXT) \
libarchive/test/libarchive_test-test_tar_filenames.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_tar_large.$(OBJEXT) \
libarchive/test/libarchive_test-test_write_compress_program.$(OBJEXT) \
libarchive/test/libarchive_test-test_write_disk.$(OBJEXT) \
libarchive/test/libarchive_test-test_write_disk_perms.$(OBJEXT) \
@@ -234,6 +259,8 @@ am_libarchive_test_OBJECTS = $(am__objects_1) \
libarchive/test/libarchive_test-test_write_format_ar.$(OBJEXT) \
libarchive/test/libarchive_test-test_write_format_cpio.$(OBJEXT) \
libarchive/test/libarchive_test-test_write_format_cpio_empty.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_format_cpio_odc.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_format_cpio_newc.$(OBJEXT) \
libarchive/test/libarchive_test-test_write_format_shar_empty.$(OBJEXT) \
libarchive/test/libarchive_test-test_write_format_tar.$(OBJEXT) \
libarchive/test/libarchive_test-test_write_format_tar_empty.$(OBJEXT) \
@@ -257,14 +284,16 @@ LTYACCCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(YACC) $(YFLAGS) $(AM_YFLAGS)
YLWRAP = $(top_srcdir)/config.aux/ylwrap
SOURCES = $(libarchive_la_SOURCES) $(bsdcpio_SOURCES) \
- $(bsdtar_SOURCES) $(libarchive_test_SOURCES)
+ $(bsdcpio_test_SOURCES) $(bsdtar_SOURCES) \
+ $(libarchive_test_SOURCES)
DIST_SOURCES = $(libarchive_la_SOURCES) $(bsdcpio_SOURCES) \
- $(bsdtar_SOURCES) $(libarchive_test_SOURCES)
+ $(bsdcpio_test_SOURCES) $(bsdtar_SOURCES) \
+ $(libarchive_test_SOURCES)
man1dir = $(mandir)/man1
man3dir = $(mandir)/man3
man5dir = $(mandir)/man5
NROFF = nroff
-MANS = $(dist_man_MANS)
+MANS = $(man_MANS)
includeHEADERS_INSTALL = $(INSTALL_HEADER)
nodist_includeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(include_HEADERS) $(nodist_include_HEADERS)
@@ -284,19 +313,14 @@ distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
-ARCHIVE_API_MAJOR = @ARCHIVE_API_MAJOR@
-ARCHIVE_API_MINOR = @ARCHIVE_API_MINOR@
ARCHIVE_H_INCLUDE_INTTYPES_H = @ARCHIVE_H_INCLUDE_INTTYPES_H@
ARCHIVE_LIBTOOL_VERSION = @ARCHIVE_LIBTOOL_VERSION@
-ARCHIVE_MAJOR = @ARCHIVE_MAJOR@
-ARCHIVE_MINOR = @ARCHIVE_MINOR@
-ARCHIVE_REVISION = @ARCHIVE_REVISION@
-ARCHIVE_VERSION = @ARCHIVE_VERSION@
-ARCHIVE_VERSION_STAMP = @ARCHIVE_VERSION_STAMP@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BSDCPIO_VERSION_STRING = @BSDCPIO_VERSION_STRING@
+BSDTAR_VERSION_STRING = @BSDTAR_VERSION_STRING@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -324,6 +348,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBARCHIVE_VERSION = @LIBARCHIVE_VERSION@
+LIBARCHIVE_VERSION_STRING = @LIBARCHIVE_VERSION_STRING@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
@@ -398,18 +424,28 @@ target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = foreign subdir-objects
-BUILT_SOURCES = libarchive/test/list.h libarchive/archive.h
-EXTRA_DIST = version \
- config.h.in \
- examples \
- libarchive/test/list.h \
- tar/test \
- tar/getdate.c
-
-# Always build libarchive, regardless
+#
+# What to build and install
+#
lib_LTLIBRARIES = libarchive.la
-dist_man_MANS = $(libarchive_dist_man_MANS) $(bsdtar_dist_man_MANS) $(bsdcpio_dist_man_MANS)
+man_MANS = $(libarchive_man_MANS) $(bsdtar_man_MANS) $(bsdcpio_man_MANS)
+BUILT_SOURCES = libarchive/test/list.h cpio/test/list.h
+TESTS_ENVIRONMENT = $(bsdcpio_TESTS_ENVIRONMENT)
+# Always build and test bsdcpio as part of 'distcheck'
+DISTCHECK_CONFIGURE_FLAGS = --enable-bsdcpio
+
+#
+# What to include in the distribution
+#
+EXTRA_DIST = version \
+ contrib \
+ examples \
+ $(libarchive_EXTRA_DIST) \
+ $(bsdtar_EXTRA_DIST) \
+ $(bsdcpio_EXTRA_DIST) \
+ $(bsdcpio_test_EXTRA_DIST)
+
#
# Libarchive headers, source, etc.
@@ -424,8 +460,10 @@ libarchive_la_SOURCES = \
libarchive/archive_entry.c \
libarchive/archive_entry.h \
libarchive/archive_entry_copy_stat.c \
+ libarchive/archive_entry_link_resolver.c \
libarchive/archive_entry_private.h \
libarchive/archive_entry_stat.c \
+ libarchive/archive_entry_strmode.c \
libarchive/archive_platform.h \
libarchive/archive_private.h \
libarchive/archive_read.c \
@@ -485,18 +523,28 @@ libarchive_la_SOURCES = \
# archive.h ends up in the build directory, so make sure we can find it.
libarchive_la_CPPFLAGS = -I$(top_builddir)/libarchive
libarchive_la_LDFLAGS = -version-info $(ARCHIVE_LIBTOOL_VERSION)
-libarchive_dist_man_MANS = \
+
+# Manpages to install
+libarchive_man_MANS = \
libarchive/archive_entry.3 \
libarchive/archive_read.3 \
libarchive/archive_util.3 \
libarchive/archive_write.3 \
libarchive/archive_write_disk.3 \
+ libarchive/cpio.5 \
libarchive/libarchive.3 \
libarchive/libarchive_internals.3 \
libarchive/libarchive-formats.5 \
+ libarchive/mtree.5 \
libarchive/tar.5
+# Additional libarchive files to include in the distribution
+libarchive_EXTRA_DIST = \
+ libarchive/test/list.h \
+ $(libarchive_man_MANS)
+
+
#
#
# libarchive_test program
@@ -512,6 +560,7 @@ libarchive_test_SOURCES = \
libarchive/test/test_archive_api_feature.c \
libarchive/test/test_bad_fd.c \
libarchive/test/test_entry.c \
+ libarchive/test/test_entry_strmode.c \
libarchive/test/test_read_compress_program.c \
libarchive/test/test_read_data_large.c \
libarchive/test/test_read_extract.c \
@@ -540,6 +589,7 @@ libarchive_test_SOURCES = \
libarchive/test/test_read_position.c \
libarchive/test/test_read_truncated.c \
libarchive/test/test_tar_filenames.c \
+ libarchive/test/test_tar_large.c \
libarchive/test/test_write_compress_program.c \
libarchive/test/test_write_disk.c \
libarchive/test/test_write_disk_perms.c \
@@ -547,6 +597,8 @@ libarchive_test_SOURCES = \
libarchive/test/test_write_format_ar.c \
libarchive/test/test_write_format_cpio.c \
libarchive/test/test_write_format_cpio_empty.c \
+ libarchive/test/test_write_format_cpio_odc.c \
+ libarchive/test/test_write_format_cpio_newc.c \
libarchive/test/test_write_format_shar_empty.c \
libarchive/test/test_write_format_tar.c \
libarchive/test/test_write_format_tar_empty.c \
@@ -580,8 +632,12 @@ bsdtar_DEPENDENCIES = libarchive.la \
bsdtar_LDADD = libarchive.la
bsdtar_CPPFLAGS = -I$(top_builddir)/libarchive -I$(top_srcdir)/libarchive
bsdtar_LDFLAGS = $(bsdtar_static)
-@BUILD_BSDTAR_FALSE@bsdtar_dist_man_MANS =
-@BUILD_BSDTAR_TRUE@bsdtar_dist_man_MANS = tar/bsdtar.1
+bsdtar_EXTRA_DIST = \
+ tar/test \
+ tar/bsdtar.1
+
+@BUILD_BSDTAR_FALSE@bsdtar_man_MANS =
+@BUILD_BSDTAR_TRUE@bsdtar_man_MANS = tar/bsdtar.1
@BUILD_BSDTAR_FALSE@bsdtar_programs =
@BUILD_BSDTAR_TRUE@bsdtar_programs = bsdtar
@@ -591,23 +647,69 @@ bsdtar_LDFLAGS = $(bsdtar_static)
#
#
bsdcpio_SOURCES = \
+ cpio/cmdline.c \
cpio/cpio.c \
cpio/cpio.h \
cpio/cpio_platform.h \
- cpio/util.c
+ cpio/err.c \
+ cpio/match.c
bsdcpio_DEPENDENCIES = libarchive.la \
libarchive/archive_entry.h \
libarchive/archive.h
-bsdcpio_static = -static
+@STATIC_BSDCPIO_FALSE@bsdcpio_static =
+@STATIC_BSDCPIO_TRUE@bsdcpio_static = -static
bsdcpio_LDADD = libarchive.la
bsdcpio_CPPFLAGS = -I$(top_builddir)/libarchive -I$(top_srcdir)/libarchive
bsdcpio_LDFLAGS = $(bsdcpio_static)
-@BUILD_BSDCPIO_FALSE@bsdcpio_dist_man_MANS =
-@BUILD_BSDCPIO_TRUE@bsdcpio_dist_man_MANS = cpio/bsdcpio.1
+bsdcpio_EXTRA_DIST = \
+ cpio/test/list.h \
+ cpio/bsdcpio.1
+
+@BUILD_BSDCPIO_FALSE@bsdcpio_man_MANS =
+
+# Manpages to install
+@BUILD_BSDCPIO_TRUE@bsdcpio_man_MANS = cpio/bsdcpio.1
@BUILD_BSDCPIO_FALSE@bsdcpio_programs =
@BUILD_BSDCPIO_TRUE@bsdcpio_programs = bsdcpio
+
+#
+# bsdcpio_test
+#
+bsdcpio_test_SOURCES = \
+ cpio/cmdline.c \
+ cpio/err.c \
+ cpio/match.c \
+ cpio/test/main.c \
+ cpio/test/test.h \
+ cpio/test/test_basic.c \
+ cpio/test/test_gcpio_compat.c \
+ cpio/test/test_help.c \
+ cpio/test/test_option_B.c \
+ cpio/test/test_option_d.c \
+ cpio/test/test_option_m.c \
+ cpio/test/test_option_t.c \
+ cpio/test/test_owner_parse.c \
+ cpio/test/test_pathmatch.c \
+ cpio/test/test_version.c \
+ cpio/test/test_write_odc.c
+
+bsdcpio_test_EXTRA_DIST = \
+ cpio/test/test_gcpio_compat_ref.bin \
+ cpio/test/test_gcpio_compat_ref.crc \
+ cpio/test/test_gcpio_compat_ref.newc \
+ cpio/test/test_gcpio_compat_ref.ustar \
+ cpio/test/test_option_m.cpio \
+ cpio/test/test_option_t.cpio \
+ cpio/test/test_option_t.stdout \
+ cpio/test/test_option_tv.stdout
+
+bsdcpio_test_CPPFLAGS = -I$(top_builddir)/cpio/test
+@BUILD_BSDCPIO_FALSE@bsdcpio_test_programs =
+@BUILD_BSDCPIO_TRUE@bsdcpio_test_programs = bsdcpio_test
+@BUILD_BSDCPIO_FALSE@bsdcpio_TESTS_ENVIRONMENT =
+@BUILD_BSDCPIO_TRUE@bsdcpio_TESTS_ENVIRONMENT = BSDCPIO=`cd $(top_builddir);/bin/pwd`/bsdcpio BSDCPIO_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/cpio/test
all: $(BUILT_SOURCES) config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -706,9 +808,15 @@ libarchive/libarchive_la-archive_entry.lo: libarchive/$(am__dirstamp) \
libarchive/libarchive_la-archive_entry_copy_stat.lo: \
libarchive/$(am__dirstamp) \
libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_la-archive_entry_link_resolver.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
libarchive/libarchive_la-archive_entry_stat.lo: \
libarchive/$(am__dirstamp) \
libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_la-archive_entry_strmode.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
libarchive/libarchive_la-archive_read.lo: libarchive/$(am__dirstamp) \
libarchive/$(DEPDIR)/$(am__dirstamp)
libarchive/libarchive_la-archive_read_data_into_fd.lo: \
@@ -883,13 +991,56 @@ cpio/$(am__dirstamp):
cpio/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) cpio/$(DEPDIR)
@: > cpio/$(DEPDIR)/$(am__dirstamp)
+cpio/bsdcpio-cmdline.$(OBJEXT): cpio/$(am__dirstamp) \
+ cpio/$(DEPDIR)/$(am__dirstamp)
cpio/bsdcpio-cpio.$(OBJEXT): cpio/$(am__dirstamp) \
cpio/$(DEPDIR)/$(am__dirstamp)
-cpio/bsdcpio-util.$(OBJEXT): cpio/$(am__dirstamp) \
+cpio/bsdcpio-err.$(OBJEXT): cpio/$(am__dirstamp) \
+ cpio/$(DEPDIR)/$(am__dirstamp)
+cpio/bsdcpio-match.$(OBJEXT): cpio/$(am__dirstamp) \
cpio/$(DEPDIR)/$(am__dirstamp)
bsdcpio$(EXEEXT): $(bsdcpio_OBJECTS) $(bsdcpio_DEPENDENCIES)
@rm -f bsdcpio$(EXEEXT)
$(bsdcpio_LINK) $(bsdcpio_OBJECTS) $(bsdcpio_LDADD) $(LIBS)
+cpio/bsdcpio_test-cmdline.$(OBJEXT): cpio/$(am__dirstamp) \
+ cpio/$(DEPDIR)/$(am__dirstamp)
+cpio/bsdcpio_test-err.$(OBJEXT): cpio/$(am__dirstamp) \
+ cpio/$(DEPDIR)/$(am__dirstamp)
+cpio/bsdcpio_test-match.$(OBJEXT): cpio/$(am__dirstamp) \
+ cpio/$(DEPDIR)/$(am__dirstamp)
+cpio/test/$(am__dirstamp):
+ @$(MKDIR_P) cpio/test
+ @: > cpio/test/$(am__dirstamp)
+cpio/test/$(DEPDIR)/$(am__dirstamp):
+ @$(MKDIR_P) cpio/test/$(DEPDIR)
+ @: > cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-main.$(OBJEXT): cpio/test/$(am__dirstamp) \
+ cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_basic.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_gcpio_compat.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_help.$(OBJEXT): cpio/test/$(am__dirstamp) \
+ cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_B.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_d.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_m.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_t.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_owner_parse.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_pathmatch.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_version.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_write_odc.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+bsdcpio_test$(EXEEXT): $(bsdcpio_test_OBJECTS) $(bsdcpio_test_DEPENDENCIES)
+ @rm -f bsdcpio_test$(EXEEXT)
+ $(LINK) $(bsdcpio_test_OBJECTS) $(bsdcpio_test_LDADD) $(LIBS)
tar/$(am__dirstamp):
@$(MKDIR_P) tar
@: > tar/$(am__dirstamp)
@@ -922,9 +1073,15 @@ libarchive/libarchive_test-archive_entry.$(OBJEXT): \
libarchive/libarchive_test-archive_entry_copy_stat.$(OBJEXT): \
libarchive/$(am__dirstamp) \
libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_entry_link_resolver.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
libarchive/libarchive_test-archive_entry_stat.$(OBJEXT): \
libarchive/$(am__dirstamp) \
libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_entry_strmode.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
libarchive/libarchive_test-archive_read.$(OBJEXT): \
libarchive/$(am__dirstamp) \
libarchive/$(DEPDIR)/$(am__dirstamp)
@@ -1087,6 +1244,9 @@ libarchive/test/libarchive_test-test_bad_fd.$(OBJEXT): \
libarchive/test/libarchive_test-test_entry.$(OBJEXT): \
libarchive/test/$(am__dirstamp) \
libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_entry_strmode.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
libarchive/test/libarchive_test-test_read_compress_program.$(OBJEXT): \
libarchive/test/$(am__dirstamp) \
libarchive/test/$(DEPDIR)/$(am__dirstamp)
@@ -1171,6 +1331,9 @@ libarchive/test/libarchive_test-test_read_truncated.$(OBJEXT): \
libarchive/test/libarchive_test-test_tar_filenames.$(OBJEXT): \
libarchive/test/$(am__dirstamp) \
libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_tar_large.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
libarchive/test/libarchive_test-test_write_compress_program.$(OBJEXT): \
libarchive/test/$(am__dirstamp) \
libarchive/test/$(DEPDIR)/$(am__dirstamp)
@@ -1192,6 +1355,12 @@ libarchive/test/libarchive_test-test_write_format_cpio.$(OBJEXT): \
libarchive/test/libarchive_test-test_write_format_cpio_empty.$(OBJEXT): \
libarchive/test/$(am__dirstamp) \
libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_format_cpio_odc.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_format_cpio_newc.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
libarchive/test/libarchive_test-test_write_format_shar_empty.$(OBJEXT): \
libarchive/test/$(am__dirstamp) \
libarchive/test/$(DEPDIR)/$(am__dirstamp)
@@ -1210,16 +1379,37 @@ libarchive_test$(EXEEXT): $(libarchive_test_OBJECTS) $(libarchive_test_DEPENDENC
mostlyclean-compile:
-rm -f *.$(OBJEXT)
+ -rm -f cpio/bsdcpio-cmdline.$(OBJEXT)
-rm -f cpio/bsdcpio-cpio.$(OBJEXT)
- -rm -f cpio/bsdcpio-util.$(OBJEXT)
+ -rm -f cpio/bsdcpio-err.$(OBJEXT)
+ -rm -f cpio/bsdcpio-match.$(OBJEXT)
+ -rm -f cpio/bsdcpio_test-cmdline.$(OBJEXT)
+ -rm -f cpio/bsdcpio_test-err.$(OBJEXT)
+ -rm -f cpio/bsdcpio_test-match.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-main.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_basic.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_gcpio_compat.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_help.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_B.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_d.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_m.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_t.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_owner_parse.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_pathmatch.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_version.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_write_odc.$(OBJEXT)
-rm -f libarchive/libarchive_la-archive_check_magic.$(OBJEXT)
-rm -f libarchive/libarchive_la-archive_check_magic.lo
-rm -f libarchive/libarchive_la-archive_entry.$(OBJEXT)
-rm -f libarchive/libarchive_la-archive_entry.lo
-rm -f libarchive/libarchive_la-archive_entry_copy_stat.$(OBJEXT)
-rm -f libarchive/libarchive_la-archive_entry_copy_stat.lo
+ -rm -f libarchive/libarchive_la-archive_entry_link_resolver.$(OBJEXT)
+ -rm -f libarchive/libarchive_la-archive_entry_link_resolver.lo
-rm -f libarchive/libarchive_la-archive_entry_stat.$(OBJEXT)
-rm -f libarchive/libarchive_la-archive_entry_stat.lo
+ -rm -f libarchive/libarchive_la-archive_entry_strmode.$(OBJEXT)
+ -rm -f libarchive/libarchive_la-archive_entry_strmode.lo
-rm -f libarchive/libarchive_la-archive_read.$(OBJEXT)
-rm -f libarchive/libarchive_la-archive_read.lo
-rm -f libarchive/libarchive_la-archive_read_data_into_fd.$(OBJEXT)
@@ -1313,7 +1503,9 @@ mostlyclean-compile:
-rm -f libarchive/libarchive_test-archive_check_magic.$(OBJEXT)
-rm -f libarchive/libarchive_test-archive_entry.$(OBJEXT)
-rm -f libarchive/libarchive_test-archive_entry_copy_stat.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_entry_link_resolver.$(OBJEXT)
-rm -f libarchive/libarchive_test-archive_entry_stat.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_entry_strmode.$(OBJEXT)
-rm -f libarchive/libarchive_test-archive_read.$(OBJEXT)
-rm -f libarchive/libarchive_test-archive_read_data_into_fd.$(OBJEXT)
-rm -f libarchive/libarchive_test-archive_read_extract.$(OBJEXT)
@@ -1366,6 +1558,7 @@ mostlyclean-compile:
-rm -f libarchive/test/libarchive_test-test_archive_api_feature.$(OBJEXT)
-rm -f libarchive/test/libarchive_test-test_bad_fd.$(OBJEXT)
-rm -f libarchive/test/libarchive_test-test_entry.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_entry_strmode.$(OBJEXT)
-rm -f libarchive/test/libarchive_test-test_read_compress_program.$(OBJEXT)
-rm -f libarchive/test/libarchive_test-test_read_data_large.$(OBJEXT)
-rm -f libarchive/test/libarchive_test-test_read_extract.$(OBJEXT)
@@ -1394,6 +1587,7 @@ mostlyclean-compile:
-rm -f libarchive/test/libarchive_test-test_read_position.$(OBJEXT)
-rm -f libarchive/test/libarchive_test-test_read_truncated.$(OBJEXT)
-rm -f libarchive/test/libarchive_test-test_tar_filenames.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_tar_large.$(OBJEXT)
-rm -f libarchive/test/libarchive_test-test_write_compress_program.$(OBJEXT)
-rm -f libarchive/test/libarchive_test-test_write_disk.$(OBJEXT)
-rm -f libarchive/test/libarchive_test-test_write_disk_perms.$(OBJEXT)
@@ -1401,6 +1595,8 @@ mostlyclean-compile:
-rm -f libarchive/test/libarchive_test-test_write_format_ar.$(OBJEXT)
-rm -f libarchive/test/libarchive_test-test_write_format_cpio.$(OBJEXT)
-rm -f libarchive/test/libarchive_test-test_write_format_cpio_empty.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_format_cpio_newc.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_format_cpio_odc.$(OBJEXT)
-rm -f libarchive/test/libarchive_test-test_write_format_shar_empty.$(OBJEXT)
-rm -f libarchive/test/libarchive_test-test_write_format_tar.$(OBJEXT)
-rm -f libarchive/test/libarchive_test-test_write_format_tar_empty.$(OBJEXT)
@@ -1416,12 +1612,31 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/$(DEPDIR)/bsdcpio-cmdline.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@cpio/$(DEPDIR)/bsdcpio-cpio.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@cpio/$(DEPDIR)/bsdcpio-util.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/$(DEPDIR)/bsdcpio-err.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/$(DEPDIR)/bsdcpio-match.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/$(DEPDIR)/bsdcpio_test-cmdline.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/$(DEPDIR)/bsdcpio_test-err.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/$(DEPDIR)/bsdcpio_test-match.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-main.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_basic.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_gcpio_compat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_help.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_B.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_d.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_m.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_t.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_owner_parse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_pathmatch.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_version.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_write_odc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_la-archive_check_magic.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_la-archive_entry.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_la-archive_entry_copy_stat.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_la-archive_entry_link_resolver.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_la-archive_entry_stat.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_la-archive_entry_strmode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_la-archive_read.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_la-archive_read_data_into_fd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_la-archive_read_extract.Plo@am__quote@
@@ -1470,7 +1685,9 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_check_magic.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_entry.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_entry_copy_stat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_entry_link_resolver.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_entry_stat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_entry_strmode.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_data_into_fd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_extract.Po@am__quote@
@@ -1523,6 +1740,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_archive_api_feature.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_bad_fd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_entry.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_entry_strmode.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_compress_program.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_data_large.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_extract.Po@am__quote@
@@ -1551,6 +1769,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_position.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_truncated.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_tar_filenames.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_tar_large.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_program.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_perms.Po@am__quote@
@@ -1558,6 +1777,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_ar.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_empty.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_newc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_odc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_shar_empty.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar_empty.Po@am__quote@
@@ -1615,6 +1836,13 @@ libarchive/libarchive_la-archive_entry_copy_stat.lo: libarchive/archive_entry_co
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_la-archive_entry_copy_stat.lo `test -f 'libarchive/archive_entry_copy_stat.c' || echo '$(srcdir)/'`libarchive/archive_entry_copy_stat.c
+libarchive/libarchive_la-archive_entry_link_resolver.lo: libarchive/archive_entry_link_resolver.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_la-archive_entry_link_resolver.lo -MD -MP -MF libarchive/$(DEPDIR)/libarchive_la-archive_entry_link_resolver.Tpo -c -o libarchive/libarchive_la-archive_entry_link_resolver.lo `test -f 'libarchive/archive_entry_link_resolver.c' || echo '$(srcdir)/'`libarchive/archive_entry_link_resolver.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_la-archive_entry_link_resolver.Tpo libarchive/$(DEPDIR)/libarchive_la-archive_entry_link_resolver.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_entry_link_resolver.c' object='libarchive/libarchive_la-archive_entry_link_resolver.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_la-archive_entry_link_resolver.lo `test -f 'libarchive/archive_entry_link_resolver.c' || echo '$(srcdir)/'`libarchive/archive_entry_link_resolver.c
+
libarchive/libarchive_la-archive_entry_stat.lo: libarchive/archive_entry_stat.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_la-archive_entry_stat.lo -MD -MP -MF libarchive/$(DEPDIR)/libarchive_la-archive_entry_stat.Tpo -c -o libarchive/libarchive_la-archive_entry_stat.lo `test -f 'libarchive/archive_entry_stat.c' || echo '$(srcdir)/'`libarchive/archive_entry_stat.c
@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_la-archive_entry_stat.Tpo libarchive/$(DEPDIR)/libarchive_la-archive_entry_stat.Plo
@@ -1622,6 +1850,13 @@ libarchive/libarchive_la-archive_entry_stat.lo: libarchive/archive_entry_stat.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_la-archive_entry_stat.lo `test -f 'libarchive/archive_entry_stat.c' || echo '$(srcdir)/'`libarchive/archive_entry_stat.c
+libarchive/libarchive_la-archive_entry_strmode.lo: libarchive/archive_entry_strmode.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_la-archive_entry_strmode.lo -MD -MP -MF libarchive/$(DEPDIR)/libarchive_la-archive_entry_strmode.Tpo -c -o libarchive/libarchive_la-archive_entry_strmode.lo `test -f 'libarchive/archive_entry_strmode.c' || echo '$(srcdir)/'`libarchive/archive_entry_strmode.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_la-archive_entry_strmode.Tpo libarchive/$(DEPDIR)/libarchive_la-archive_entry_strmode.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_entry_strmode.c' object='libarchive/libarchive_la-archive_entry_strmode.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_la-archive_entry_strmode.lo `test -f 'libarchive/archive_entry_strmode.c' || echo '$(srcdir)/'`libarchive/archive_entry_strmode.c
+
libarchive/libarchive_la-archive_read.lo: libarchive/archive_read.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_la-archive_read.lo -MD -MP -MF libarchive/$(DEPDIR)/libarchive_la-archive_read.Tpo -c -o libarchive/libarchive_la-archive_read.lo `test -f 'libarchive/archive_read.c' || echo '$(srcdir)/'`libarchive/archive_read.c
@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_la-archive_read.Tpo libarchive/$(DEPDIR)/libarchive_la-archive_read.Plo
@@ -1937,6 +2172,20 @@ libarchive/libarchive_la-filter_fork.lo: libarchive/filter_fork.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_la-filter_fork.lo `test -f 'libarchive/filter_fork.c' || echo '$(srcdir)/'`libarchive/filter_fork.c
+cpio/bsdcpio-cmdline.o: cpio/cmdline.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio-cmdline.o -MD -MP -MF cpio/$(DEPDIR)/bsdcpio-cmdline.Tpo -c -o cpio/bsdcpio-cmdline.o `test -f 'cpio/cmdline.c' || echo '$(srcdir)/'`cpio/cmdline.c
+@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio-cmdline.Tpo cpio/$(DEPDIR)/bsdcpio-cmdline.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/cmdline.c' object='cpio/bsdcpio-cmdline.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio-cmdline.o `test -f 'cpio/cmdline.c' || echo '$(srcdir)/'`cpio/cmdline.c
+
+cpio/bsdcpio-cmdline.obj: cpio/cmdline.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio-cmdline.obj -MD -MP -MF cpio/$(DEPDIR)/bsdcpio-cmdline.Tpo -c -o cpio/bsdcpio-cmdline.obj `if test -f 'cpio/cmdline.c'; then $(CYGPATH_W) 'cpio/cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cpio/cmdline.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio-cmdline.Tpo cpio/$(DEPDIR)/bsdcpio-cmdline.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/cmdline.c' object='cpio/bsdcpio-cmdline.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio-cmdline.obj `if test -f 'cpio/cmdline.c'; then $(CYGPATH_W) 'cpio/cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cpio/cmdline.c'; fi`
+
cpio/bsdcpio-cpio.o: cpio/cpio.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio-cpio.o -MD -MP -MF cpio/$(DEPDIR)/bsdcpio-cpio.Tpo -c -o cpio/bsdcpio-cpio.o `test -f 'cpio/cpio.c' || echo '$(srcdir)/'`cpio/cpio.c
@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio-cpio.Tpo cpio/$(DEPDIR)/bsdcpio-cpio.Po
@@ -1951,19 +2200,243 @@ cpio/bsdcpio-cpio.obj: cpio/cpio.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio-cpio.obj `if test -f 'cpio/cpio.c'; then $(CYGPATH_W) 'cpio/cpio.c'; else $(CYGPATH_W) '$(srcdir)/cpio/cpio.c'; fi`
-cpio/bsdcpio-util.o: cpio/util.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio-util.o -MD -MP -MF cpio/$(DEPDIR)/bsdcpio-util.Tpo -c -o cpio/bsdcpio-util.o `test -f 'cpio/util.c' || echo '$(srcdir)/'`cpio/util.c
-@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio-util.Tpo cpio/$(DEPDIR)/bsdcpio-util.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/util.c' object='cpio/bsdcpio-util.o' libtool=no @AMDEPBACKSLASH@
+cpio/bsdcpio-err.o: cpio/err.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio-err.o -MD -MP -MF cpio/$(DEPDIR)/bsdcpio-err.Tpo -c -o cpio/bsdcpio-err.o `test -f 'cpio/err.c' || echo '$(srcdir)/'`cpio/err.c
+@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio-err.Tpo cpio/$(DEPDIR)/bsdcpio-err.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/err.c' object='cpio/bsdcpio-err.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio-err.o `test -f 'cpio/err.c' || echo '$(srcdir)/'`cpio/err.c
+
+cpio/bsdcpio-err.obj: cpio/err.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio-err.obj -MD -MP -MF cpio/$(DEPDIR)/bsdcpio-err.Tpo -c -o cpio/bsdcpio-err.obj `if test -f 'cpio/err.c'; then $(CYGPATH_W) 'cpio/err.c'; else $(CYGPATH_W) '$(srcdir)/cpio/err.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio-err.Tpo cpio/$(DEPDIR)/bsdcpio-err.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/err.c' object='cpio/bsdcpio-err.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio-err.obj `if test -f 'cpio/err.c'; then $(CYGPATH_W) 'cpio/err.c'; else $(CYGPATH_W) '$(srcdir)/cpio/err.c'; fi`
+
+cpio/bsdcpio-match.o: cpio/match.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio-match.o -MD -MP -MF cpio/$(DEPDIR)/bsdcpio-match.Tpo -c -o cpio/bsdcpio-match.o `test -f 'cpio/match.c' || echo '$(srcdir)/'`cpio/match.c
+@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio-match.Tpo cpio/$(DEPDIR)/bsdcpio-match.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/match.c' object='cpio/bsdcpio-match.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio-match.o `test -f 'cpio/match.c' || echo '$(srcdir)/'`cpio/match.c
+
+cpio/bsdcpio-match.obj: cpio/match.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio-match.obj -MD -MP -MF cpio/$(DEPDIR)/bsdcpio-match.Tpo -c -o cpio/bsdcpio-match.obj `if test -f 'cpio/match.c'; then $(CYGPATH_W) 'cpio/match.c'; else $(CYGPATH_W) '$(srcdir)/cpio/match.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio-match.Tpo cpio/$(DEPDIR)/bsdcpio-match.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/match.c' object='cpio/bsdcpio-match.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio-match.obj `if test -f 'cpio/match.c'; then $(CYGPATH_W) 'cpio/match.c'; else $(CYGPATH_W) '$(srcdir)/cpio/match.c'; fi`
+
+cpio/bsdcpio_test-cmdline.o: cpio/cmdline.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio_test-cmdline.o -MD -MP -MF cpio/$(DEPDIR)/bsdcpio_test-cmdline.Tpo -c -o cpio/bsdcpio_test-cmdline.o `test -f 'cpio/cmdline.c' || echo '$(srcdir)/'`cpio/cmdline.c
+@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio_test-cmdline.Tpo cpio/$(DEPDIR)/bsdcpio_test-cmdline.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/cmdline.c' object='cpio/bsdcpio_test-cmdline.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio_test-cmdline.o `test -f 'cpio/cmdline.c' || echo '$(srcdir)/'`cpio/cmdline.c
+
+cpio/bsdcpio_test-cmdline.obj: cpio/cmdline.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio_test-cmdline.obj -MD -MP -MF cpio/$(DEPDIR)/bsdcpio_test-cmdline.Tpo -c -o cpio/bsdcpio_test-cmdline.obj `if test -f 'cpio/cmdline.c'; then $(CYGPATH_W) 'cpio/cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cpio/cmdline.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio_test-cmdline.Tpo cpio/$(DEPDIR)/bsdcpio_test-cmdline.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/cmdline.c' object='cpio/bsdcpio_test-cmdline.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio_test-cmdline.obj `if test -f 'cpio/cmdline.c'; then $(CYGPATH_W) 'cpio/cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cpio/cmdline.c'; fi`
+
+cpio/bsdcpio_test-err.o: cpio/err.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio_test-err.o -MD -MP -MF cpio/$(DEPDIR)/bsdcpio_test-err.Tpo -c -o cpio/bsdcpio_test-err.o `test -f 'cpio/err.c' || echo '$(srcdir)/'`cpio/err.c
+@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio_test-err.Tpo cpio/$(DEPDIR)/bsdcpio_test-err.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/err.c' object='cpio/bsdcpio_test-err.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio_test-err.o `test -f 'cpio/err.c' || echo '$(srcdir)/'`cpio/err.c
+
+cpio/bsdcpio_test-err.obj: cpio/err.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio_test-err.obj -MD -MP -MF cpio/$(DEPDIR)/bsdcpio_test-err.Tpo -c -o cpio/bsdcpio_test-err.obj `if test -f 'cpio/err.c'; then $(CYGPATH_W) 'cpio/err.c'; else $(CYGPATH_W) '$(srcdir)/cpio/err.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio_test-err.Tpo cpio/$(DEPDIR)/bsdcpio_test-err.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/err.c' object='cpio/bsdcpio_test-err.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio_test-err.obj `if test -f 'cpio/err.c'; then $(CYGPATH_W) 'cpio/err.c'; else $(CYGPATH_W) '$(srcdir)/cpio/err.c'; fi`
+
+cpio/bsdcpio_test-match.o: cpio/match.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio_test-match.o -MD -MP -MF cpio/$(DEPDIR)/bsdcpio_test-match.Tpo -c -o cpio/bsdcpio_test-match.o `test -f 'cpio/match.c' || echo '$(srcdir)/'`cpio/match.c
+@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio_test-match.Tpo cpio/$(DEPDIR)/bsdcpio_test-match.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/match.c' object='cpio/bsdcpio_test-match.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio_test-match.o `test -f 'cpio/match.c' || echo '$(srcdir)/'`cpio/match.c
+
+cpio/bsdcpio_test-match.obj: cpio/match.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio_test-match.obj -MD -MP -MF cpio/$(DEPDIR)/bsdcpio_test-match.Tpo -c -o cpio/bsdcpio_test-match.obj `if test -f 'cpio/match.c'; then $(CYGPATH_W) 'cpio/match.c'; else $(CYGPATH_W) '$(srcdir)/cpio/match.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio_test-match.Tpo cpio/$(DEPDIR)/bsdcpio_test-match.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/match.c' object='cpio/bsdcpio_test-match.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio_test-match.obj `if test -f 'cpio/match.c'; then $(CYGPATH_W) 'cpio/match.c'; else $(CYGPATH_W) '$(srcdir)/cpio/match.c'; fi`
+
+cpio/test/bsdcpio_test-main.o: cpio/test/main.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-main.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-main.Tpo -c -o cpio/test/bsdcpio_test-main.o `test -f 'cpio/test/main.c' || echo '$(srcdir)/'`cpio/test/main.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-main.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-main.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/main.c' object='cpio/test/bsdcpio_test-main.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-main.o `test -f 'cpio/test/main.c' || echo '$(srcdir)/'`cpio/test/main.c
+
+cpio/test/bsdcpio_test-main.obj: cpio/test/main.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-main.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-main.Tpo -c -o cpio/test/bsdcpio_test-main.obj `if test -f 'cpio/test/main.c'; then $(CYGPATH_W) 'cpio/test/main.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/main.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-main.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-main.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/main.c' object='cpio/test/bsdcpio_test-main.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio-util.o `test -f 'cpio/util.c' || echo '$(srcdir)/'`cpio/util.c
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-main.obj `if test -f 'cpio/test/main.c'; then $(CYGPATH_W) 'cpio/test/main.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/main.c'; fi`
-cpio/bsdcpio-util.obj: cpio/util.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio-util.obj -MD -MP -MF cpio/$(DEPDIR)/bsdcpio-util.Tpo -c -o cpio/bsdcpio-util.obj `if test -f 'cpio/util.c'; then $(CYGPATH_W) 'cpio/util.c'; else $(CYGPATH_W) '$(srcdir)/cpio/util.c'; fi`
-@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio-util.Tpo cpio/$(DEPDIR)/bsdcpio-util.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/util.c' object='cpio/bsdcpio-util.obj' libtool=no @AMDEPBACKSLASH@
+cpio/test/bsdcpio_test-test_basic.o: cpio/test/test_basic.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_basic.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_basic.Tpo -c -o cpio/test/bsdcpio_test-test_basic.o `test -f 'cpio/test/test_basic.c' || echo '$(srcdir)/'`cpio/test/test_basic.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_basic.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_basic.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_basic.c' object='cpio/test/bsdcpio_test-test_basic.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio-util.obj `if test -f 'cpio/util.c'; then $(CYGPATH_W) 'cpio/util.c'; else $(CYGPATH_W) '$(srcdir)/cpio/util.c'; fi`
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_basic.o `test -f 'cpio/test/test_basic.c' || echo '$(srcdir)/'`cpio/test/test_basic.c
+
+cpio/test/bsdcpio_test-test_basic.obj: cpio/test/test_basic.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_basic.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_basic.Tpo -c -o cpio/test/bsdcpio_test-test_basic.obj `if test -f 'cpio/test/test_basic.c'; then $(CYGPATH_W) 'cpio/test/test_basic.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_basic.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_basic.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_basic.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_basic.c' object='cpio/test/bsdcpio_test-test_basic.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_basic.obj `if test -f 'cpio/test/test_basic.c'; then $(CYGPATH_W) 'cpio/test/test_basic.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_basic.c'; fi`
+
+cpio/test/bsdcpio_test-test_gcpio_compat.o: cpio/test/test_gcpio_compat.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_gcpio_compat.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_gcpio_compat.Tpo -c -o cpio/test/bsdcpio_test-test_gcpio_compat.o `test -f 'cpio/test/test_gcpio_compat.c' || echo '$(srcdir)/'`cpio/test/test_gcpio_compat.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_gcpio_compat.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_gcpio_compat.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_gcpio_compat.c' object='cpio/test/bsdcpio_test-test_gcpio_compat.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_gcpio_compat.o `test -f 'cpio/test/test_gcpio_compat.c' || echo '$(srcdir)/'`cpio/test/test_gcpio_compat.c
+
+cpio/test/bsdcpio_test-test_gcpio_compat.obj: cpio/test/test_gcpio_compat.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_gcpio_compat.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_gcpio_compat.Tpo -c -o cpio/test/bsdcpio_test-test_gcpio_compat.obj `if test -f 'cpio/test/test_gcpio_compat.c'; then $(CYGPATH_W) 'cpio/test/test_gcpio_compat.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_gcpio_compat.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_gcpio_compat.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_gcpio_compat.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_gcpio_compat.c' object='cpio/test/bsdcpio_test-test_gcpio_compat.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_gcpio_compat.obj `if test -f 'cpio/test/test_gcpio_compat.c'; then $(CYGPATH_W) 'cpio/test/test_gcpio_compat.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_gcpio_compat.c'; fi`
+
+cpio/test/bsdcpio_test-test_help.o: cpio/test/test_help.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_help.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_help.Tpo -c -o cpio/test/bsdcpio_test-test_help.o `test -f 'cpio/test/test_help.c' || echo '$(srcdir)/'`cpio/test/test_help.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_help.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_help.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_help.c' object='cpio/test/bsdcpio_test-test_help.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_help.o `test -f 'cpio/test/test_help.c' || echo '$(srcdir)/'`cpio/test/test_help.c
+
+cpio/test/bsdcpio_test-test_help.obj: cpio/test/test_help.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_help.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_help.Tpo -c -o cpio/test/bsdcpio_test-test_help.obj `if test -f 'cpio/test/test_help.c'; then $(CYGPATH_W) 'cpio/test/test_help.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_help.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_help.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_help.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_help.c' object='cpio/test/bsdcpio_test-test_help.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_help.obj `if test -f 'cpio/test/test_help.c'; then $(CYGPATH_W) 'cpio/test/test_help.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_help.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_B.o: cpio/test/test_option_B.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_B.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_B.Tpo -c -o cpio/test/bsdcpio_test-test_option_B.o `test -f 'cpio/test/test_option_B.c' || echo '$(srcdir)/'`cpio/test/test_option_B.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_B.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_B.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_B.c' object='cpio/test/bsdcpio_test-test_option_B.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_B.o `test -f 'cpio/test/test_option_B.c' || echo '$(srcdir)/'`cpio/test/test_option_B.c
+
+cpio/test/bsdcpio_test-test_option_B.obj: cpio/test/test_option_B.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_B.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_B.Tpo -c -o cpio/test/bsdcpio_test-test_option_B.obj `if test -f 'cpio/test/test_option_B.c'; then $(CYGPATH_W) 'cpio/test/test_option_B.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_B.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_B.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_B.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_B.c' object='cpio/test/bsdcpio_test-test_option_B.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_B.obj `if test -f 'cpio/test/test_option_B.c'; then $(CYGPATH_W) 'cpio/test/test_option_B.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_B.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_d.o: cpio/test/test_option_d.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_d.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_d.Tpo -c -o cpio/test/bsdcpio_test-test_option_d.o `test -f 'cpio/test/test_option_d.c' || echo '$(srcdir)/'`cpio/test/test_option_d.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_d.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_d.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_d.c' object='cpio/test/bsdcpio_test-test_option_d.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_d.o `test -f 'cpio/test/test_option_d.c' || echo '$(srcdir)/'`cpio/test/test_option_d.c
+
+cpio/test/bsdcpio_test-test_option_d.obj: cpio/test/test_option_d.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_d.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_d.Tpo -c -o cpio/test/bsdcpio_test-test_option_d.obj `if test -f 'cpio/test/test_option_d.c'; then $(CYGPATH_W) 'cpio/test/test_option_d.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_d.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_d.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_d.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_d.c' object='cpio/test/bsdcpio_test-test_option_d.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_d.obj `if test -f 'cpio/test/test_option_d.c'; then $(CYGPATH_W) 'cpio/test/test_option_d.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_d.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_m.o: cpio/test/test_option_m.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_m.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_m.Tpo -c -o cpio/test/bsdcpio_test-test_option_m.o `test -f 'cpio/test/test_option_m.c' || echo '$(srcdir)/'`cpio/test/test_option_m.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_m.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_m.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_m.c' object='cpio/test/bsdcpio_test-test_option_m.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_m.o `test -f 'cpio/test/test_option_m.c' || echo '$(srcdir)/'`cpio/test/test_option_m.c
+
+cpio/test/bsdcpio_test-test_option_m.obj: cpio/test/test_option_m.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_m.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_m.Tpo -c -o cpio/test/bsdcpio_test-test_option_m.obj `if test -f 'cpio/test/test_option_m.c'; then $(CYGPATH_W) 'cpio/test/test_option_m.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_m.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_m.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_m.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_m.c' object='cpio/test/bsdcpio_test-test_option_m.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_m.obj `if test -f 'cpio/test/test_option_m.c'; then $(CYGPATH_W) 'cpio/test/test_option_m.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_m.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_t.o: cpio/test/test_option_t.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_t.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_t.Tpo -c -o cpio/test/bsdcpio_test-test_option_t.o `test -f 'cpio/test/test_option_t.c' || echo '$(srcdir)/'`cpio/test/test_option_t.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_t.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_t.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_t.c' object='cpio/test/bsdcpio_test-test_option_t.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_t.o `test -f 'cpio/test/test_option_t.c' || echo '$(srcdir)/'`cpio/test/test_option_t.c
+
+cpio/test/bsdcpio_test-test_option_t.obj: cpio/test/test_option_t.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_t.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_t.Tpo -c -o cpio/test/bsdcpio_test-test_option_t.obj `if test -f 'cpio/test/test_option_t.c'; then $(CYGPATH_W) 'cpio/test/test_option_t.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_t.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_t.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_t.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_t.c' object='cpio/test/bsdcpio_test-test_option_t.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_t.obj `if test -f 'cpio/test/test_option_t.c'; then $(CYGPATH_W) 'cpio/test/test_option_t.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_t.c'; fi`
+
+cpio/test/bsdcpio_test-test_owner_parse.o: cpio/test/test_owner_parse.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_owner_parse.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_owner_parse.Tpo -c -o cpio/test/bsdcpio_test-test_owner_parse.o `test -f 'cpio/test/test_owner_parse.c' || echo '$(srcdir)/'`cpio/test/test_owner_parse.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_owner_parse.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_owner_parse.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_owner_parse.c' object='cpio/test/bsdcpio_test-test_owner_parse.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_owner_parse.o `test -f 'cpio/test/test_owner_parse.c' || echo '$(srcdir)/'`cpio/test/test_owner_parse.c
+
+cpio/test/bsdcpio_test-test_owner_parse.obj: cpio/test/test_owner_parse.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_owner_parse.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_owner_parse.Tpo -c -o cpio/test/bsdcpio_test-test_owner_parse.obj `if test -f 'cpio/test/test_owner_parse.c'; then $(CYGPATH_W) 'cpio/test/test_owner_parse.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_owner_parse.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_owner_parse.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_owner_parse.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_owner_parse.c' object='cpio/test/bsdcpio_test-test_owner_parse.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_owner_parse.obj `if test -f 'cpio/test/test_owner_parse.c'; then $(CYGPATH_W) 'cpio/test/test_owner_parse.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_owner_parse.c'; fi`
+
+cpio/test/bsdcpio_test-test_pathmatch.o: cpio/test/test_pathmatch.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_pathmatch.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_pathmatch.Tpo -c -o cpio/test/bsdcpio_test-test_pathmatch.o `test -f 'cpio/test/test_pathmatch.c' || echo '$(srcdir)/'`cpio/test/test_pathmatch.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_pathmatch.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_pathmatch.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_pathmatch.c' object='cpio/test/bsdcpio_test-test_pathmatch.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_pathmatch.o `test -f 'cpio/test/test_pathmatch.c' || echo '$(srcdir)/'`cpio/test/test_pathmatch.c
+
+cpio/test/bsdcpio_test-test_pathmatch.obj: cpio/test/test_pathmatch.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_pathmatch.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_pathmatch.Tpo -c -o cpio/test/bsdcpio_test-test_pathmatch.obj `if test -f 'cpio/test/test_pathmatch.c'; then $(CYGPATH_W) 'cpio/test/test_pathmatch.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_pathmatch.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_pathmatch.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_pathmatch.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_pathmatch.c' object='cpio/test/bsdcpio_test-test_pathmatch.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_pathmatch.obj `if test -f 'cpio/test/test_pathmatch.c'; then $(CYGPATH_W) 'cpio/test/test_pathmatch.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_pathmatch.c'; fi`
+
+cpio/test/bsdcpio_test-test_version.o: cpio/test/test_version.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_version.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_version.Tpo -c -o cpio/test/bsdcpio_test-test_version.o `test -f 'cpio/test/test_version.c' || echo '$(srcdir)/'`cpio/test/test_version.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_version.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_version.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_version.c' object='cpio/test/bsdcpio_test-test_version.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_version.o `test -f 'cpio/test/test_version.c' || echo '$(srcdir)/'`cpio/test/test_version.c
+
+cpio/test/bsdcpio_test-test_version.obj: cpio/test/test_version.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_version.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_version.Tpo -c -o cpio/test/bsdcpio_test-test_version.obj `if test -f 'cpio/test/test_version.c'; then $(CYGPATH_W) 'cpio/test/test_version.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_version.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_version.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_version.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_version.c' object='cpio/test/bsdcpio_test-test_version.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_version.obj `if test -f 'cpio/test/test_version.c'; then $(CYGPATH_W) 'cpio/test/test_version.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_version.c'; fi`
+
+cpio/test/bsdcpio_test-test_write_odc.o: cpio/test/test_write_odc.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_write_odc.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_write_odc.Tpo -c -o cpio/test/bsdcpio_test-test_write_odc.o `test -f 'cpio/test/test_write_odc.c' || echo '$(srcdir)/'`cpio/test/test_write_odc.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_write_odc.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_write_odc.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_write_odc.c' object='cpio/test/bsdcpio_test-test_write_odc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_write_odc.o `test -f 'cpio/test/test_write_odc.c' || echo '$(srcdir)/'`cpio/test/test_write_odc.c
+
+cpio/test/bsdcpio_test-test_write_odc.obj: cpio/test/test_write_odc.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_write_odc.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_write_odc.Tpo -c -o cpio/test/bsdcpio_test-test_write_odc.obj `if test -f 'cpio/test/test_write_odc.c'; then $(CYGPATH_W) 'cpio/test/test_write_odc.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_write_odc.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_write_odc.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_write_odc.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_write_odc.c' object='cpio/test/bsdcpio_test-test_write_odc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_write_odc.obj `if test -f 'cpio/test/test_write_odc.c'; then $(CYGPATH_W) 'cpio/test/test_write_odc.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_write_odc.c'; fi`
tar/bsdtar-bsdtar.o: tar/bsdtar.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar-bsdtar.o -MD -MP -MF tar/$(DEPDIR)/bsdtar-bsdtar.Tpo -c -o tar/bsdtar-bsdtar.o `test -f 'tar/bsdtar.c' || echo '$(srcdir)/'`tar/bsdtar.c
@@ -2105,6 +2578,20 @@ libarchive/libarchive_test-archive_entry_copy_stat.obj: libarchive/archive_entry
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_entry_copy_stat.obj `if test -f 'libarchive/archive_entry_copy_stat.c'; then $(CYGPATH_W) 'libarchive/archive_entry_copy_stat.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_entry_copy_stat.c'; fi`
+libarchive/libarchive_test-archive_entry_link_resolver.o: libarchive/archive_entry_link_resolver.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_entry_link_resolver.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_entry_link_resolver.Tpo -c -o libarchive/libarchive_test-archive_entry_link_resolver.o `test -f 'libarchive/archive_entry_link_resolver.c' || echo '$(srcdir)/'`libarchive/archive_entry_link_resolver.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_entry_link_resolver.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_entry_link_resolver.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_entry_link_resolver.c' object='libarchive/libarchive_test-archive_entry_link_resolver.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_entry_link_resolver.o `test -f 'libarchive/archive_entry_link_resolver.c' || echo '$(srcdir)/'`libarchive/archive_entry_link_resolver.c
+
+libarchive/libarchive_test-archive_entry_link_resolver.obj: libarchive/archive_entry_link_resolver.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_entry_link_resolver.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_entry_link_resolver.Tpo -c -o libarchive/libarchive_test-archive_entry_link_resolver.obj `if test -f 'libarchive/archive_entry_link_resolver.c'; then $(CYGPATH_W) 'libarchive/archive_entry_link_resolver.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_entry_link_resolver.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_entry_link_resolver.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_entry_link_resolver.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_entry_link_resolver.c' object='libarchive/libarchive_test-archive_entry_link_resolver.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_entry_link_resolver.obj `if test -f 'libarchive/archive_entry_link_resolver.c'; then $(CYGPATH_W) 'libarchive/archive_entry_link_resolver.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_entry_link_resolver.c'; fi`
+
libarchive/libarchive_test-archive_entry_stat.o: libarchive/archive_entry_stat.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_entry_stat.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_entry_stat.Tpo -c -o libarchive/libarchive_test-archive_entry_stat.o `test -f 'libarchive/archive_entry_stat.c' || echo '$(srcdir)/'`libarchive/archive_entry_stat.c
@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_entry_stat.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_entry_stat.Po
@@ -2119,6 +2606,20 @@ libarchive/libarchive_test-archive_entry_stat.obj: libarchive/archive_entry_stat
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_entry_stat.obj `if test -f 'libarchive/archive_entry_stat.c'; then $(CYGPATH_W) 'libarchive/archive_entry_stat.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_entry_stat.c'; fi`
+libarchive/libarchive_test-archive_entry_strmode.o: libarchive/archive_entry_strmode.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_entry_strmode.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_entry_strmode.Tpo -c -o libarchive/libarchive_test-archive_entry_strmode.o `test -f 'libarchive/archive_entry_strmode.c' || echo '$(srcdir)/'`libarchive/archive_entry_strmode.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_entry_strmode.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_entry_strmode.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_entry_strmode.c' object='libarchive/libarchive_test-archive_entry_strmode.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_entry_strmode.o `test -f 'libarchive/archive_entry_strmode.c' || echo '$(srcdir)/'`libarchive/archive_entry_strmode.c
+
+libarchive/libarchive_test-archive_entry_strmode.obj: libarchive/archive_entry_strmode.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_entry_strmode.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_entry_strmode.Tpo -c -o libarchive/libarchive_test-archive_entry_strmode.obj `if test -f 'libarchive/archive_entry_strmode.c'; then $(CYGPATH_W) 'libarchive/archive_entry_strmode.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_entry_strmode.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_entry_strmode.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_entry_strmode.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_entry_strmode.c' object='libarchive/libarchive_test-archive_entry_strmode.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_entry_strmode.obj `if test -f 'libarchive/archive_entry_strmode.c'; then $(CYGPATH_W) 'libarchive/archive_entry_strmode.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_entry_strmode.c'; fi`
+
libarchive/libarchive_test-archive_read.o: libarchive/archive_read.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read.Tpo -c -o libarchive/libarchive_test-archive_read.o `test -f 'libarchive/archive_read.c' || echo '$(srcdir)/'`libarchive/archive_read.c
@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read.Po
@@ -2847,6 +3348,20 @@ libarchive/test/libarchive_test-test_entry.obj: libarchive/test/test_entry.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_entry.obj `if test -f 'libarchive/test/test_entry.c'; then $(CYGPATH_W) 'libarchive/test/test_entry.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_entry.c'; fi`
+libarchive/test/libarchive_test-test_entry_strmode.o: libarchive/test/test_entry_strmode.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_entry_strmode.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_entry_strmode.Tpo -c -o libarchive/test/libarchive_test-test_entry_strmode.o `test -f 'libarchive/test/test_entry_strmode.c' || echo '$(srcdir)/'`libarchive/test/test_entry_strmode.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_entry_strmode.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_entry_strmode.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_entry_strmode.c' object='libarchive/test/libarchive_test-test_entry_strmode.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_entry_strmode.o `test -f 'libarchive/test/test_entry_strmode.c' || echo '$(srcdir)/'`libarchive/test/test_entry_strmode.c
+
+libarchive/test/libarchive_test-test_entry_strmode.obj: libarchive/test/test_entry_strmode.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_entry_strmode.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_entry_strmode.Tpo -c -o libarchive/test/libarchive_test-test_entry_strmode.obj `if test -f 'libarchive/test/test_entry_strmode.c'; then $(CYGPATH_W) 'libarchive/test/test_entry_strmode.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_entry_strmode.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_entry_strmode.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_entry_strmode.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_entry_strmode.c' object='libarchive/test/libarchive_test-test_entry_strmode.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_entry_strmode.obj `if test -f 'libarchive/test/test_entry_strmode.c'; then $(CYGPATH_W) 'libarchive/test/test_entry_strmode.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_entry_strmode.c'; fi`
+
libarchive/test/libarchive_test-test_read_compress_program.o: libarchive/test/test_read_compress_program.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_compress_program.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_compress_program.Tpo -c -o libarchive/test/libarchive_test-test_read_compress_program.o `test -f 'libarchive/test/test_read_compress_program.c' || echo '$(srcdir)/'`libarchive/test/test_read_compress_program.c
@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_compress_program.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_compress_program.Po
@@ -3239,6 +3754,20 @@ libarchive/test/libarchive_test-test_tar_filenames.obj: libarchive/test/test_tar
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_tar_filenames.obj `if test -f 'libarchive/test/test_tar_filenames.c'; then $(CYGPATH_W) 'libarchive/test/test_tar_filenames.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_tar_filenames.c'; fi`
+libarchive/test/libarchive_test-test_tar_large.o: libarchive/test/test_tar_large.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_tar_large.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_tar_large.Tpo -c -o libarchive/test/libarchive_test-test_tar_large.o `test -f 'libarchive/test/test_tar_large.c' || echo '$(srcdir)/'`libarchive/test/test_tar_large.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_tar_large.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_tar_large.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_tar_large.c' object='libarchive/test/libarchive_test-test_tar_large.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_tar_large.o `test -f 'libarchive/test/test_tar_large.c' || echo '$(srcdir)/'`libarchive/test/test_tar_large.c
+
+libarchive/test/libarchive_test-test_tar_large.obj: libarchive/test/test_tar_large.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_tar_large.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_tar_large.Tpo -c -o libarchive/test/libarchive_test-test_tar_large.obj `if test -f 'libarchive/test/test_tar_large.c'; then $(CYGPATH_W) 'libarchive/test/test_tar_large.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_tar_large.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_tar_large.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_tar_large.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_tar_large.c' object='libarchive/test/libarchive_test-test_tar_large.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_tar_large.obj `if test -f 'libarchive/test/test_tar_large.c'; then $(CYGPATH_W) 'libarchive/test/test_tar_large.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_tar_large.c'; fi`
+
libarchive/test/libarchive_test-test_write_compress_program.o: libarchive/test/test_write_compress_program.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_compress_program.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_program.Tpo -c -o libarchive/test/libarchive_test-test_write_compress_program.o `test -f 'libarchive/test/test_write_compress_program.c' || echo '$(srcdir)/'`libarchive/test/test_write_compress_program.c
@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_program.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_program.Po
@@ -3337,6 +3866,34 @@ libarchive/test/libarchive_test-test_write_format_cpio_empty.obj: libarchive/tes
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_cpio_empty.obj `if test -f 'libarchive/test/test_write_format_cpio_empty.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_cpio_empty.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_cpio_empty.c'; fi`
+libarchive/test/libarchive_test-test_write_format_cpio_odc.o: libarchive/test/test_write_format_cpio_odc.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_cpio_odc.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_odc.Tpo -c -o libarchive/test/libarchive_test-test_write_format_cpio_odc.o `test -f 'libarchive/test/test_write_format_cpio_odc.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_cpio_odc.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_odc.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_odc.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_cpio_odc.c' object='libarchive/test/libarchive_test-test_write_format_cpio_odc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_cpio_odc.o `test -f 'libarchive/test/test_write_format_cpio_odc.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_cpio_odc.c
+
+libarchive/test/libarchive_test-test_write_format_cpio_odc.obj: libarchive/test/test_write_format_cpio_odc.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_cpio_odc.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_odc.Tpo -c -o libarchive/test/libarchive_test-test_write_format_cpio_odc.obj `if test -f 'libarchive/test/test_write_format_cpio_odc.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_cpio_odc.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_cpio_odc.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_odc.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_odc.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_cpio_odc.c' object='libarchive/test/libarchive_test-test_write_format_cpio_odc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_cpio_odc.obj `if test -f 'libarchive/test/test_write_format_cpio_odc.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_cpio_odc.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_cpio_odc.c'; fi`
+
+libarchive/test/libarchive_test-test_write_format_cpio_newc.o: libarchive/test/test_write_format_cpio_newc.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_cpio_newc.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_newc.Tpo -c -o libarchive/test/libarchive_test-test_write_format_cpio_newc.o `test -f 'libarchive/test/test_write_format_cpio_newc.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_cpio_newc.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_newc.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_newc.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_cpio_newc.c' object='libarchive/test/libarchive_test-test_write_format_cpio_newc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_cpio_newc.o `test -f 'libarchive/test/test_write_format_cpio_newc.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_cpio_newc.c
+
+libarchive/test/libarchive_test-test_write_format_cpio_newc.obj: libarchive/test/test_write_format_cpio_newc.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_cpio_newc.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_newc.Tpo -c -o libarchive/test/libarchive_test-test_write_format_cpio_newc.obj `if test -f 'libarchive/test/test_write_format_cpio_newc.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_cpio_newc.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_cpio_newc.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_newc.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_newc.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_cpio_newc.c' object='libarchive/test/libarchive_test-test_write_format_cpio_newc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_cpio_newc.obj `if test -f 'libarchive/test/test_write_format_cpio_newc.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_cpio_newc.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_cpio_newc.c'; fi`
+
libarchive/test/libarchive_test-test_write_format_shar_empty.o: libarchive/test/test_write_format_shar_empty.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_shar_empty.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_shar_empty.Tpo -c -o libarchive/test/libarchive_test-test_write_format_shar_empty.o `test -f 'libarchive/test/test_write_format_shar_empty.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_shar_empty.c
@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_shar_empty.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_shar_empty.Po
@@ -3860,6 +4417,8 @@ distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-rm -f cpio/$(DEPDIR)/$(am__dirstamp)
-rm -f cpio/$(am__dirstamp)
+ -rm -f cpio/test/$(DEPDIR)/$(am__dirstamp)
+ -rm -f cpio/test/$(am__dirstamp)
-rm -f libarchive/$(DEPDIR)/$(am__dirstamp)
-rm -f libarchive/$(am__dirstamp)
-rm -f libarchive/test/$(DEPDIR)/$(am__dirstamp)
@@ -3879,7 +4438,7 @@ clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
distclean: distclean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
- -rm -rf cpio/$(DEPDIR) libarchive/$(DEPDIR) libarchive/test/$(DEPDIR) tar/$(DEPDIR)
+ -rm -rf cpio/$(DEPDIR) cpio/test/$(DEPDIR) libarchive/$(DEPDIR) libarchive/test/$(DEPDIR) tar/$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-hdr distclean-libtool distclean-local distclean-tags
@@ -3916,7 +4475,7 @@ installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
- -rm -rf cpio/$(DEPDIR) libarchive/$(DEPDIR) libarchive/test/$(DEPDIR) tar/$(DEPDIR)
+ -rm -rf cpio/$(DEPDIR) cpio/test/$(DEPDIR) libarchive/$(DEPDIR) libarchive/test/$(DEPDIR) tar/$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
@@ -3964,8 +4523,8 @@ uninstall-man: uninstall-man1 uninstall-man3 uninstall-man5
uninstall-nodist_includeHEADERS
-# Clean out some unneeded files and directories
-# that get picked up as part of the directories in EXTRA_DIST above.
+# a) Clean out some unneeded files and directories
+# b) Collect all documentation and format it for distribution.
dist-hook:
rm -rf `find $(distdir) -name CVS -type d`
rm -rf `find $(distdir) -name .svn -type d`
@@ -3973,10 +4532,17 @@ dist-hook:
rm -f `find $(distdir) -name '*.out'`
rm -f `find $(distdir) -name '*.core'`
rm -f $(distdir)/*/Makefile
+ mkdir -p $(distdir)/doc/man
+ cp $(distdir)/libarchive/*.[135] $(distdir)/doc/man
+ cp $(distdir)/tar/*.[135] $(distdir)/doc/man
+ cp $(distdir)/cpio/*.[135] $(distdir)/doc/man
+ mkdir -p $(distdir)/doc/text
+ cd $(distdir)/doc/man; for f in *.[135]; do nroff -mdoc $$f | col -b > ../text/`basename $$f`.txt; done
distclean-local:
-rm -f tar/getdate.c tar/getdate.h
-rm -f libarchive/test/list.h
+ -rm -f cpio/test/list.h
-rm -rf autom4te.cache/
-rm -f *~
@@ -3985,6 +4551,9 @@ distclean-local:
# above.
libarchive/test/list.h: Makefile
cat $(top_srcdir)/libarchive/test/test_*.c | grep DEFINE_TEST > libarchive/test/list.h
+
+cpio/test/list.h: Makefile
+ cat $(top_srcdir)/cpio/test/test_*.c | grep DEFINE_TEST > cpio/test/list.h
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/archivers/libarchive/files/NEWS b/archivers/libarchive/files/NEWS
index e68ed4d050e..d6de37483f5 100644
--- a/archivers/libarchive/files/NEWS
+++ b/archivers/libarchive/files/NEWS
@@ -1,5 +1,52 @@
-Sep 11, 2007: libarchive 2.2.8 released
+Oct 30, 2007: libarchive 2.4.0 released
+Oct 30, 2007: Minor compile fix thanks to Joerg Schilling.
+Oct 30, 2007: Only run the format auction once at the beginning of the
+ archive. This is simpler and supports better error recovery.
+Oct 29, 2007: Test support for very large entries in tar archives:
+ libarchive_test now exercises entries from 2GB up to 1TB.
+
+Oct 27, 2007: libarchive 2.3.5 released
+Oct 27, 2007: Correct some unnecessary internal data copying in the
+ "compression none" reader and writer; this reduces user time
+ by up to 2/3 in some tests. (Thanks to Jan Psota for
+ publishing his performance test results to GNU tar's bug-tar
+ mailing list; those results pointed me towards this problem.)
+Oct 27, 2007: Fix for skipping archive entries that are exactly
+ a multiple of 4G on 32-bit platforms.
+Oct 25, 2007: Fix for reading very large (>8G) tar archives; this was
+ broken when I put in support for new GNU tar sparse formats.
+Oct 20, 2007: Initial work on new pattern-matching code for cpio; I
+ hope this eventually replaces the code currently in bsdtar.
+
+Oct 08, 2007: libarchive 2.3.4 released
+Oct 05, 2007: Continuing work on bsdcpio test suite.
+Oct 05, 2007: New cpio.5 manpage, updates to "History" of bsdcpio.1 and
+ bsdtar.1 manpages.
+Oct 05, 2007: Fix zip reader to immediately return EOF if you try
+ to read body of non-regular file. In particular, this fixes
+ bsdtar extraction of zip archives.
+
+Sep 30, 2007: libarchive 2.3.3 released
+Sep 26, 2007: Rework Makefile.am so that the enable/disable options
+ actually do the right things.
+Sep 26, 2007: cpio-odc and cpio-newc archives no longer write bodies
+ for non-regular files.
+Sep 26, 2007: Test harness for bsdcpio is in place, needs more tests written.
+ This is much nicer than the ragtag collection of test scripts
+ that bsdtar has.
+
+Sep 20, 2007: libarchive 2.3.2 released
+Sep 20, 2007: libarchive 2.3.1 broke bsdtar because the archive_write_data()
+ fix was implemented incorrectly.
+
+Sep 16, 2007: libarchive 2.3.1 released
+Sep 16, 2007: Many fixes to bsdcpio 0.3: handle hardlinks with -p, recognize
+ block size on writing, fix a couple of segfaults.
+Sep 16, 2007: Fixed return value from archive_write_data() when used
+ with archive_write_disk() to match the documentation and other
+ instances of this same function.
+Sep 15, 2007: Add archive_entry_link_resolver, archive_entry_strmode
Sep 11, 2007: libarchive 2.2.8 released
Sep 09, 2007: bsdcpio 0.2 supports most (not yet all) of the old POSIX spec.
@@ -12,10 +59,8 @@ Aug 13, 2007: Refined suid/sgid restore handling; it is no longer
an error if suid/sgid bits are dropped when you request
perm restore but don't request owner restore.
Aug 06, 2007: Use --enable-bsdcpio if you want to try bsdcpio
- (Still very incomplete!)
Aug 05, 2007: libarchive 2.2.6 released
-
Aug 05, 2007: New configure option --disable-bsdtar, thanks to Joerg
Sonnenberger.
Aug 05, 2007: Several bug fixes from FreeBSD CVS repo.
diff --git a/archivers/libarchive/files/README b/archivers/libarchive/files/README
index bcc4143d023..3652503ddfa 100644
--- a/archivers/libarchive/files/README
+++ b/archivers/libarchive/files/README
@@ -5,7 +5,14 @@ This distribution bundle includes the following components:
* libarchive: a library for reading and writing streaming archives
* tar: the 'bsdtar' program is a full-featured 'tar'
replacement built on libarchive
- * minitar: a compact sample demonstrating use of libarchive
+ * cpio: the 'bsdcpio' program is a different interface to
+ essentially the same functionality
+ * examples: Some small example programs that you may find useful.
+ * examples/minitar: a compact sample demonstrating use of libarchive.
+ I use this for testing link pollution; it should produce a very
+ small executable file on most systems.
+ * contrib: Various items sent to me by third parties;
+ please contact the authors with any questions.
The top-level directory contains the following information files:
* NEWS - highlights of recent changes
@@ -25,13 +32,17 @@ The following files in the top-level directory are used by the
Guide to Documentation installed by this system:
* bsdtar.1 explains the use of the bsdtar program
+ * bsdcpio.1 explains the use of the bsdcpio program
* libarchive.3 gives an overview of the library as a whole
* archive_read.3, archive_write.3, and archive_write_disk.3 provide
detailed calling sequences for the read and write APIs
* archive_entry.3 details the "struct archive_entry" utility class
+ * archive_internals.3 provides some insight into libarchive's
+ internal structure and operation.
* libarchive-formats.5 documents the file formats supported by the library
- * tar.5 provides some detailed information about a variety of different
- "tar" formats.
+ * cpio.5, mtree.5, and tar.5 provide detailed information about a
+ variety of different archive formats, including hard-to-find details
+ about modern cpio and tar variants.
You should also read the copious comments in "archive.h" and the source
code for the sample "bsdtar" program for more details. Please let me know
@@ -53,6 +64,7 @@ Currently, the library automatically detects and reads the following:
* ISO9660 CD-ROM images (with optional Rockridge extensions)
* ZIP archives (with uncompressed or "deflate" compressed entries)
* GNU and BSD 'ar' archives
+ * 'mtree' format
The library can write:
* gzip compression
@@ -62,6 +74,7 @@ The library can write:
* "restricted" pax format, which will create ustar archives except for
entries that require pax extensions (for long filenames, ACLs, etc).
* POSIX octet-oriented cpio
+ * SVR4 "newc" cpio
* shar archives
* GNU and BSD 'ar' archives
@@ -89,10 +102,9 @@ Notes about the library architecture:
environments where that matters.
* On read, the library accepts whatever blocks you hand it.
- Your read callback is free to pass the library a byte at a time
+ Your read callback is free to pass the library a byte at a time[1]
or mmap the entire archive and give it to the library at once.
- On write, the library always produces correctly-blocked
- output.
+ On write, the library always produces correctly-blocked output.
* The object-style approach allows you to have multiple archive streams
open at once. bsdtar uses this in its "@archive" extension.
@@ -112,3 +124,11 @@ Notes about the library architecture:
* Note: "pax interchange format" is really an extended tar format,
despite what the name says.
+
+[1] Gzip and compress formats are identical in the first byte.
+For that reason, the first block must be at least two bytes if
+you have both of these formats enabled at read time. This is
+currently the only restriction on block size. (This restriction
+could be lifted by buffering the initial blocks prior to the
+compression tasting step, but it doesn't really seem worth the
+effort.)
diff --git a/archivers/libarchive/files/config.h.in b/archivers/libarchive/files/config.h.in
index bf2a058feba..4006d5b3318 100644
--- a/archivers/libarchive/files/config.h.in
+++ b/archivers/libarchive/files/config.h.in
@@ -1,5 +1,11 @@
/* config.h.in. Generated from configure.ac by autoheader. */
+/* Version number of bsdcpio */
+#undef BSDCPIO_VERSION_STRING
+
+/* Version number of bsdtar */
+#undef BSDTAR_VERSION_STRING
+
/* Define to 1 if you have the `acl_create_entry' function. */
#undef HAVE_ACL_CREATE_ENTRY
@@ -370,6 +376,12 @@
/* Define to 1 if you have the <zlib.h> header file. */
#undef HAVE_ZLIB_H
+/* Version number of libarchive as a single integer */
+#undef LIBARCHIVE_VERSION
+
+/* Version number of libarchive */
+#undef LIBARCHIVE_VERSION_STRING
+
/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
slash. */
#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
diff --git a/archivers/libarchive/files/configure b/archivers/libarchive/files/configure
index 70acf3eb518..9c7318d9a5e 100755
--- a/archivers/libarchive/files/configure
+++ b/archivers/libarchive/files/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for libarchive 2.2.8.
+# Generated by GNU Autoconf 2.61 for libarchive 2.4.0.
#
# Report bugs to <kientzle@freebsd.org>.
#
@@ -728,8 +728,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='libarchive'
PACKAGE_TARNAME='libarchive'
-PACKAGE_VERSION='2.2.8'
-PACKAGE_STRING='libarchive 2.2.8'
+PACKAGE_VERSION='2.4.0'
+PACKAGE_STRING='libarchive 2.4.0'
PACKAGE_BUGREPORT='kientzle@freebsd.org'
ac_unique_file="libarchive"
@@ -828,14 +828,11 @@ am__leading_dot
AMTAR
am__tar
am__untar
-ARCHIVE_VERSION
-ARCHIVE_MAJOR
-ARCHIVE_MINOR
-ARCHIVE_REVISION
-ARCHIVE_API_MAJOR
-ARCHIVE_API_MINOR
-ARCHIVE_VERSION_STAMP
ARCHIVE_LIBTOOL_VERSION
+BSDCPIO_VERSION_STRING
+BSDTAR_VERSION_STRING
+LIBARCHIVE_VERSION_STRING
+LIBARCHIVE_VERSION
CC
CFLAGS
LDFLAGS
@@ -882,10 +879,12 @@ ac_ct_F77
LIBTOOL
BUILD_BSDTAR_TRUE
BUILD_BSDTAR_FALSE
-BUILD_BSDCPIO_TRUE
-BUILD_BSDCPIO_FALSE
STATIC_BSDTAR_TRUE
STATIC_BSDTAR_FALSE
+BUILD_BSDCPIO_TRUE
+BUILD_BSDCPIO_FALSE
+STATIC_BSDCPIO_TRUE
+STATIC_BSDCPIO_FALSE
ARCHIVE_H_INCLUDE_INTTYPES_H
LIBOBJS
LTLIBOBJS'
@@ -1409,7 +1408,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures libarchive 2.2.8 to adapt to many kinds of systems.
+\`configure' configures libarchive 2.4.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1479,7 +1478,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libarchive 2.2.8:";;
+ short | recursive ) echo "Configuration of libarchive 2.4.0:";;
esac
cat <<\_ACEOF
@@ -1498,6 +1497,8 @@ Optional Features:
--enable-bsdtar=shared force dynamic build of bsdtar
--disable-bsdtar disable build of bsdtar
--enable-bsdcpio enable build of bsdcpio
+ --enable-bsdcpio=static static build of bsdcpio
+ --enable-bsdcpio=shared dynamic build of bsdcpio
--disable-bsdcpio disable build of bsdcpio (default)
--disable-largefile omit support for large files
@@ -1593,7 +1594,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libarchive configure 2.2.8
+libarchive configure 2.4.0
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1607,7 +1608,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libarchive $as_me 2.2.8, which was
+It was created by libarchive $as_me 2.4.0, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -2301,7 +2302,7 @@ fi
# Define the identity of the package.
PACKAGE='libarchive'
- VERSION='2.2.8'
+ VERSION='2.4.0'
cat >>confdefs.h <<_ACEOF
@@ -2459,9 +2460,6 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
-
-
-
ac_config_headers="$ac_config_headers config.h"
ac_config_files="$ac_config_files Makefile"
@@ -4524,7 +4522,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 4527 "configure"' > conftest.$ac_ext
+ echo '#line 4525 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -7255,11 +7253,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7258: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7256: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7262: \$? = $ac_status" >&5
+ echo "$as_me:7260: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -7523,11 +7521,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7526: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7524: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7530: \$? = $ac_status" >&5
+ echo "$as_me:7528: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -7627,11 +7625,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7630: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7628: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:7634: \$? = $ac_status" >&5
+ echo "$as_me:7632: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -9935,7 +9933,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 9938 "configure"
+#line 9936 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10035,7 +10033,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 10038 "configure"
+#line 10036 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12371,11 +12369,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:12374: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:12372: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:12378: \$? = $ac_status" >&5
+ echo "$as_me:12376: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -12475,11 +12473,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:12478: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:12476: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:12482: \$? = $ac_status" >&5
+ echo "$as_me:12480: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -14045,11 +14043,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14048: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14046: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:14052: \$? = $ac_status" >&5
+ echo "$as_me:14050: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -14149,11 +14147,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14152: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14150: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:14156: \$? = $ac_status" >&5
+ echo "$as_me:14154: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -16347,11 +16345,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16350: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16348: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:16354: \$? = $ac_status" >&5
+ echo "$as_me:16352: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -16615,11 +16613,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16618: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16616: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:16622: \$? = $ac_status" >&5
+ echo "$as_me:16620: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -16719,11 +16717,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16722: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16720: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:16726: \$? = $ac_status" >&5
+ echo "$as_me:16724: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -19478,7 +19476,11 @@ else
fi
+#
+# Options for building bsdtar.
+#
# Default is to build bsdtar, but allow people to override that.
+#
# Check whether --enable-bsdtar was given.
if test "${enable_bsdtar+set}" = set; then
enableval=$enable_bsdtar;
@@ -19495,7 +19497,6 @@ yes)
static_bsdtar=yes
fi
build_bsdtar=yes
-
;;
dynamic|shared)
if test "$enable_shared" = "no"; then
@@ -19525,7 +19526,28 @@ See \`config.log' for more details." >&2;}
;;
esac
-# Default is not to build bsdcpio
+ if test "$build_bsdtar" = yes ; then
+ BUILD_BSDTAR_TRUE=
+ BUILD_BSDTAR_FALSE='#'
+else
+ BUILD_BSDTAR_TRUE='#'
+ BUILD_BSDTAR_FALSE=
+fi
+
+ if test "$static_bsdtar" = yes ; then
+ STATIC_BSDTAR_TRUE=
+ STATIC_BSDTAR_FALSE='#'
+else
+ STATIC_BSDTAR_TRUE='#'
+ STATIC_BSDTAR_FALSE=
+fi
+
+
+#
+# Options for building bsdcpio.
+#
+# Default is not to build bsdcpio, but that can be overridden.
+#
# Check whether --enable-bsdcpio was given.
if test "${enable_bsdcpio+set}" = set; then
enableval=$enable_bsdcpio;
@@ -19536,10 +19558,30 @@ fi
case "$enable_bsdcpio" in
yes)
+ if test "$enable_static" = "no"; then
+ static_bsdcpio=no
+ else
+ static_bsdcpio=yes
+ fi
build_bsdcpio=yes
;;
+dynamic|shared)
+ if test "$enabled_shared" = "no"; then
+ { { echo "$as_me:$LINENO: error: Shared linking of bsdcpio requires shared libarchive
+See \`config.log' for more details." >&5
+echo "$as_me: error: Shared linking of bsdcpio requires shared libarchive
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ build_bsdcpio=yes
+ ;;
+static)
+ build_bsdcpio=yes
+ static_bsdcpio=yes
+ ;;
no)
build_bsdcpio=no
+ static_bsdcpio=no
;;
*)
{ { echo "$as_me:$LINENO: error: Unsupported value for --enable-bsdcpio
@@ -19550,14 +19592,6 @@ See \`config.log' for more details." >&2;}
;;
esac
- if test "$build_bsdtar" = yes ; then
- BUILD_BSDTAR_TRUE=
- BUILD_BSDTAR_FALSE='#'
-else
- BUILD_BSDTAR_TRUE='#'
- BUILD_BSDTAR_FALSE=
-fi
-
if test "$build_bsdcpio" = yes ; then
BUILD_BSDCPIO_TRUE=
BUILD_BSDCPIO_FALSE='#'
@@ -19566,12 +19600,12 @@ else
BUILD_BSDCPIO_FALSE=
fi
- if test "$static_bsdtar" = yes ; then
- STATIC_BSDTAR_TRUE=
- STATIC_BSDTAR_FALSE='#'
+ if test "$static_bsdcpio" = yes ; then
+ STATIC_BSDCPIO_TRUE=
+ STATIC_BSDCPIO_FALSE='#'
else
- STATIC_BSDTAR_TRUE='#'
- STATIC_BSDTAR_FALSE=
+ STATIC_BSDCPIO_TRUE='#'
+ STATIC_BSDCPIO_FALSE=
fi
@@ -27313,16 +27347,17 @@ LTLIBOBJS=$ac_ltlibobjs
# Autoconf assigns the version above to PACKAGE_VERSION
-ARCHIVE_VERSION=$PACKAGE_VERSION
+LIBARCHIVE_VERSION_STRING=$PACKAGE_VERSION
+BSDTAR_VERSION_STRING=$PACKAGE_VERSION
+# For a little while longer, cpio is considered immature
+BSDCPIO_VERSION_STRING=0.3.0
# Peel off first three numbers major.minor.revision
-ARCHIVE_MAJOR=`echo $ARCHIVE_VERSION | sed -e 's/[^0-9]/./g' -e 's/\..*//'`
-ARCHIVE_MINOR=`echo $ARCHIVE_VERSION | sed -e 's/[^0-9]/./g' -e 's/^[0-9]*\.//' -e 's/\..*//'`
-ARCHIVE_REVISION=`echo $ARCHIVE_VERSION | sed -e 's/[^0-9]/./g' -e 's/^[0-9]*\.[0-9]*\.//' -e 's/\..*//'`
+ARCHIVE_MAJOR=`echo $LIBARCHIVE_VERSION_STRING | sed -e 's/[^0-9]/./g' -e 's/\..*//'`
+ARCHIVE_MINOR=`echo $LIBARCHIVE_VERSION_STRING | sed -e 's/[^0-9]/./g' -e 's/^[0-9]*\.//' -e 's/\..*//'`
+ARCHIVE_REVISION=`echo $LIBARCHIVE_VERSION_STRING | sed -e 's/[^0-9]/./g' -e 's/^[0-9]*\.[0-9]*\.//' -e 's/\..*//'`
# Major/minor indicate the API version
-ARCHIVE_API_MAJOR=$ARCHIVE_MAJOR
-ARCHIVE_API_MINOR=$ARCHIVE_MINOR
-ARCHIVE_VERSION_STAMP=`printf "%d%03d%03d" ${ARCHIVE_MAJOR} ${ARCHIVE_MINOR} ${ARCHIVE_REVISION}`
+LIBARCHIVE_VERSION=`printf "%d%03d%03d" ${ARCHIVE_MAJOR} ${ARCHIVE_MINOR} ${ARCHIVE_REVISION}`
# Libtool versioning uses different conventions on different platforms.
# FreeBSD libtool still uses this old (and very dumb) convention,
# which doesn't match FreeBSD system conventions, nor anything else
@@ -27330,6 +27365,28 @@ ARCHIVE_VERSION_STAMP=`printf "%d%03d%03d" ${ARCHIVE_MAJOR} ${ARCHIVE_MINOR} ${A
ARCHIVE_LIBTOOL_MAJOR=`echo $((${ARCHIVE_MAJOR} + ${ARCHIVE_MINOR}))`
ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_LIBTOOL_MAJOR:$ARCHIVE_REVISION:$ARCHIVE_MINOR
+# Make sure the following get defined in config.h properly
+
+cat >>confdefs.h <<_ACEOF
+#define LIBARCHIVE_VERSION_STRING "$LIBARCHIVE_VERSION_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define LIBARCHIVE_VERSION "$LIBARCHIVE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define BSDCPIO_VERSION_STRING "$BSDCPIO_VERSION_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define BSDTAR_VERSION_STRING "$BSDTAR_VERSION_STRING"
+_ACEOF
+
+
if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -27358,6 +27415,13 @@ echo "$as_me: error: conditional \"BUILD_BSDTAR\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${STATIC_BSDTAR_TRUE}" && test -z "${STATIC_BSDTAR_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"STATIC_BSDTAR\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"STATIC_BSDTAR\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
if test -z "${BUILD_BSDCPIO_TRUE}" && test -z "${BUILD_BSDCPIO_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"BUILD_BSDCPIO\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -27365,10 +27429,10 @@ echo "$as_me: error: conditional \"BUILD_BSDCPIO\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
-if test -z "${STATIC_BSDTAR_TRUE}" && test -z "${STATIC_BSDTAR_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"STATIC_BSDTAR\" was never defined.
+if test -z "${STATIC_BSDCPIO_TRUE}" && test -z "${STATIC_BSDCPIO_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"STATIC_BSDCPIO\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"STATIC_BSDTAR\" was never defined.
+echo "$as_me: error: conditional \"STATIC_BSDCPIO\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
@@ -27672,7 +27736,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libarchive $as_me 2.2.8, which was
+This file was extended by libarchive $as_me 2.4.0, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -27725,7 +27789,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-libarchive config.status 2.2.8
+libarchive config.status 2.4.0
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
@@ -27964,14 +28028,11 @@ am__leading_dot!$am__leading_dot$ac_delim
AMTAR!$AMTAR$ac_delim
am__tar!$am__tar$ac_delim
am__untar!$am__untar$ac_delim
-ARCHIVE_VERSION!$ARCHIVE_VERSION$ac_delim
-ARCHIVE_MAJOR!$ARCHIVE_MAJOR$ac_delim
-ARCHIVE_MINOR!$ARCHIVE_MINOR$ac_delim
-ARCHIVE_REVISION!$ARCHIVE_REVISION$ac_delim
-ARCHIVE_API_MAJOR!$ARCHIVE_API_MAJOR$ac_delim
-ARCHIVE_API_MINOR!$ARCHIVE_API_MINOR$ac_delim
-ARCHIVE_VERSION_STAMP!$ARCHIVE_VERSION_STAMP$ac_delim
ARCHIVE_LIBTOOL_VERSION!$ARCHIVE_LIBTOOL_VERSION$ac_delim
+BSDCPIO_VERSION_STRING!$BSDCPIO_VERSION_STRING$ac_delim
+BSDTAR_VERSION_STRING!$BSDTAR_VERSION_STRING$ac_delim
+LIBARCHIVE_VERSION_STRING!$LIBARCHIVE_VERSION_STRING$ac_delim
+LIBARCHIVE_VERSION!$LIBARCHIVE_VERSION$ac_delim
CC!$CC$ac_delim
CFLAGS!$CFLAGS$ac_delim
LDFLAGS!$LDFLAGS$ac_delim
@@ -28002,6 +28063,9 @@ GREP!$GREP$ac_delim
EGREP!$EGREP$ac_delim
LN_S!$LN_S$ac_delim
ECHO!$ECHO$ac_delim
+AR!$AR$ac_delim
+RANLIB!$RANLIB$ac_delim
+CPP!$CPP$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -28043,9 +28107,6 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
-AR!$AR$ac_delim
-RANLIB!$RANLIB$ac_delim
-CPP!$CPP$ac_delim
CXX!$CXX$ac_delim
CXXFLAGS!$CXXFLAGS$ac_delim
ac_ct_CXX!$ac_ct_CXX$ac_delim
@@ -28059,16 +28120,18 @@ ac_ct_F77!$ac_ct_F77$ac_delim
LIBTOOL!$LIBTOOL$ac_delim
BUILD_BSDTAR_TRUE!$BUILD_BSDTAR_TRUE$ac_delim
BUILD_BSDTAR_FALSE!$BUILD_BSDTAR_FALSE$ac_delim
-BUILD_BSDCPIO_TRUE!$BUILD_BSDCPIO_TRUE$ac_delim
-BUILD_BSDCPIO_FALSE!$BUILD_BSDCPIO_FALSE$ac_delim
STATIC_BSDTAR_TRUE!$STATIC_BSDTAR_TRUE$ac_delim
STATIC_BSDTAR_FALSE!$STATIC_BSDTAR_FALSE$ac_delim
+BUILD_BSDCPIO_TRUE!$BUILD_BSDCPIO_TRUE$ac_delim
+BUILD_BSDCPIO_FALSE!$BUILD_BSDCPIO_FALSE$ac_delim
+STATIC_BSDCPIO_TRUE!$STATIC_BSDCPIO_TRUE$ac_delim
+STATIC_BSDCPIO_FALSE!$STATIC_BSDCPIO_FALSE$ac_delim
ARCHIVE_H_INCLUDE_INTTYPES_H!$ARCHIVE_H_INCLUDE_INTTYPES_H$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 23; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 22; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff --git a/archivers/libarchive/files/configure.ac b/archivers/libarchive/files/configure.ac
index 3ff1a353597..c1dd928eb43 100644
--- a/archivers/libarchive/files/configure.ac
+++ b/archivers/libarchive/files/configure.ac
@@ -16,33 +16,45 @@ AM_INIT_AUTOMAKE()
# This gets a little hairy...
AC_CONFIG_COMMANDS_PRE([
# Autoconf assigns the version above to PACKAGE_VERSION
-ARCHIVE_VERSION=$PACKAGE_VERSION
+LIBARCHIVE_VERSION_STRING=$PACKAGE_VERSION
+BSDTAR_VERSION_STRING=$PACKAGE_VERSION
+# For a little while longer, cpio is considered immature
+BSDCPIO_VERSION_STRING=0.3.0
# Peel off first three numbers major.minor.revision
-ARCHIVE_MAJOR=`echo $ARCHIVE_VERSION | sed -e 's/[[^0-9]]/./g' -e 's/\..*//'`
-ARCHIVE_MINOR=`echo $ARCHIVE_VERSION | sed -e 's/[[^0-9]]/./g' -e 's/^[[0-9]]*\.//' -e 's/\..*//'`
-ARCHIVE_REVISION=`echo $ARCHIVE_VERSION | sed -e 's/[[^0-9]]/./g' -e 's/^[[0-9]]*\.[[0-9]]*\.//' -e 's/\..*//'`
+ARCHIVE_MAJOR=`echo $LIBARCHIVE_VERSION_STRING | sed -e 's/[[^0-9]]/./g' -e 's/\..*//'`
+ARCHIVE_MINOR=`echo $LIBARCHIVE_VERSION_STRING | sed -e 's/[[^0-9]]/./g' -e 's/^[[0-9]]*\.//' -e 's/\..*//'`
+ARCHIVE_REVISION=`echo $LIBARCHIVE_VERSION_STRING | sed -e 's/[[^0-9]]/./g' -e 's/^[[0-9]]*\.[[0-9]]*\.//' -e 's/\..*//'`
# Major/minor indicate the API version
-ARCHIVE_API_MAJOR=$ARCHIVE_MAJOR
-ARCHIVE_API_MINOR=$ARCHIVE_MINOR
-ARCHIVE_VERSION_STAMP=`printf "%d%03d%03d" ${ARCHIVE_MAJOR} ${ARCHIVE_MINOR} ${ARCHIVE_REVISION}`
+LIBARCHIVE_VERSION=`printf "%d%03d%03d" ${ARCHIVE_MAJOR} ${ARCHIVE_MINOR} ${ARCHIVE_REVISION}`
# Libtool versioning uses different conventions on different platforms.
# FreeBSD libtool still uses this old (and very dumb) convention,
# which doesn't match FreeBSD system conventions, nor anything else
# I'm familiar with.
ARCHIVE_LIBTOOL_MAJOR=`echo $((${ARCHIVE_MAJOR} + ${ARCHIVE_MINOR}))`
ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_LIBTOOL_MAJOR:$ARCHIVE_REVISION:$ARCHIVE_MINOR
+
+# Make sure the following get defined in config.h properly
+AC_DEFINE_UNQUOTED([LIBARCHIVE_VERSION_STRING],
+ "$LIBARCHIVE_VERSION_STRING",
+ [Version number of libarchive])
+AC_DEFINE_UNQUOTED([LIBARCHIVE_VERSION],
+ "$LIBARCHIVE_VERSION",
+ [Version number of libarchive as a single integer])
+AC_DEFINE_UNQUOTED([BSDCPIO_VERSION_STRING],
+ "$BSDCPIO_VERSION_STRING",
+ [Version number of bsdcpio])
+AC_DEFINE_UNQUOTED([BSDTAR_VERSION_STRING],
+ "$BSDTAR_VERSION_STRING",
+ [Version number of bsdtar])
])
# Substitute the above version numbers into the various files below.
-AC_SUBST(ARCHIVE_VERSION)
-AC_SUBST(ARCHIVE_MAJOR)
-AC_SUBST(ARCHIVE_MINOR)
-AC_SUBST(ARCHIVE_REVISION)
-AC_SUBST(ARCHIVE_API_MAJOR)
-AC_SUBST(ARCHIVE_API_MINOR)
-AC_SUBST(ARCHIVE_VERSION_STAMP)
AC_SUBST(ARCHIVE_LIBTOOL_VERSION)
+AC_SUBST(BSDCPIO_VERSION_STRING)
+AC_SUBST(BSDTAR_VERSION_STRING)
+AC_SUBST(LIBARCHIVE_VERSION_STRING)
+AC_SUBST(LIBARCHIVE_VERSION)
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])
@@ -55,7 +67,11 @@ AC_PROG_YACC
AC_PROG_LIBTOOL
AC_CHECK_TOOL([STRIP],[strip])
+#
+# Options for building bsdtar.
+#
# Default is to build bsdtar, but allow people to override that.
+#
AC_ARG_ENABLE([bsdtar],
[AS_HELP_STRING([--enable-bsdtar], [enable build of bsdtar (default)])
AS_HELP_STRING([--enable-bsdtar=static], [force static build of bsdtar])
@@ -71,7 +87,6 @@ yes)
static_bsdtar=yes
fi
build_bsdtar=yes
-
;;
dynamic|shared)
if test "$enable_shared" = "no"; then
@@ -93,27 +108,51 @@ no)
;;
esac
-# Default is not to build bsdcpio
+AM_CONDITIONAL([BUILD_BSDTAR], [ test "$build_bsdtar" = yes ])
+AM_CONDITIONAL([STATIC_BSDTAR], [ test "$static_bsdtar" = yes ])
+
+#
+# Options for building bsdcpio.
+#
+# Default is not to build bsdcpio, but that can be overridden.
+#
AC_ARG_ENABLE([bsdcpio],
[AS_HELP_STRING([--enable-bsdcpio], [enable build of bsdcpio])
+ AS_HELP_STRING([--enable-bsdcpio=static], [static build of bsdcpio])
+ AS_HELP_STRING([--enable-bsdcpio=shared], [dynamic build of bsdcpio])
AS_HELP_STRING([--disable-bsdcpio], [disable build of bsdcpio (default)])],
[], [enable_bsdcpio=no])
case "$enable_bsdcpio" in
yes)
+ if test "$enable_static" = "no"; then
+ static_bsdcpio=no
+ else
+ static_bsdcpio=yes
+ fi
+ build_bsdcpio=yes
+ ;;
+dynamic|shared)
+ if test "$enabled_shared" = "no"; then
+ AC_MSG_FAILURE([Shared linking of bsdcpio requires shared libarchive])
+ fi
build_bsdcpio=yes
;;
+static)
+ build_bsdcpio=yes
+ static_bsdcpio=yes
+ ;;
no)
build_bsdcpio=no
+ static_bsdcpio=no
;;
*)
AC_MSG_FAILURE([Unsupported value for --enable-bsdcpio])
;;
esac
-AM_CONDITIONAL([BUILD_BSDTAR], [ test "$build_bsdtar" = yes ])
AM_CONDITIONAL([BUILD_BSDCPIO], [ test "$build_bsdcpio" = yes ])
-AM_CONDITIONAL([STATIC_BSDTAR], [ test "$static_bsdtar" = yes ])
+AM_CONDITIONAL([STATIC_BSDCPIO], [ test "$static_bsdcpio" = yes ])
# Checks for header files.
AC_HEADER_STDC
diff --git a/archivers/libarchive/files/contrib/README b/archivers/libarchive/files/contrib/README
new file mode 100644
index 00000000000..2eb0114ff56
--- /dev/null
+++ b/archivers/libarchive/files/contrib/README
@@ -0,0 +1,32 @@
+Many people have graciously sent me configuration
+files and other useful tidbits for use with libarchive.
+
+I do not support or use any of these; but if you can use them, enjoy!
+
+======================================================================
+
+From: Andre Stechert <andre@splunk.com>
+
+libarchive_autodetect-st_lib_archive.m4
+
+M4 macros for use with autoconf to detect whether a suitable
+version of libarchive is installed on this system.
+
+
+======================================================================
+
+libarchive.spec
+
+An RPM ".spec" file for building libarchive on most systems.
+This apparently was originally developed by a group at pld-linux.org.
+Several people have sent me different versions of this file.
+
+======================================================================
+
+From: Robert Meier <rm1023@dcx.com>
+
+libarchive.1aix53.spec
+
+As above, for use on AIX5.3.
+
+======================================================================
diff --git a/archivers/libarchive/files/contrib/libarchive.1aix53.spec b/archivers/libarchive/files/contrib/libarchive.1aix53.spec
new file mode 100644
index 00000000000..78718852f86
--- /dev/null
+++ b/archivers/libarchive/files/contrib/libarchive.1aix53.spec
@@ -0,0 +1,163 @@
+# $Revision: 1.1.1.1 $, $Date: 2007/11/30 21:25:32 $
+Summary: Library to create and read several different archive formats
+Summary(pl): Biblioteka do tworzenia i odczytu ró¿nych formatów archiwów
+Name: libarchive
+Version: 2.0a3
+Release: 1aix53
+License: BSD
+Group: Libraries
+Source0: http://people.freebsd.org/~kientzle/libarchive/src/%{name}-%{version}.tar.gz
+Patch: %{name}-0123457890.patch
+URL: http://people.freebsd.org/~kientzle/libarchive/
+Requires: glibc
+Requires: zlib
+Requires: bzip2
+BuildRequires: gcc
+BuildRequires: gcc-c++
+BuildRequires: gawk
+BuildRequires: zlib-devel
+BuildRequires: bzip2
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+
+%description
+Libarchive is a programming library that can create and read several
+different streaming archive formats, including most popular TAR
+variants and several CPIO formats. It can also write SHAR archives.
+
+%description -l pl
+Libarchive jest bibliotek± s³u¿ac± to tworzenia i odczytu wielu
+ró¿nych strumieniowych formatów archiwów, w³±czaj±c w to popularne
+odmiany TAR oraz wiele formatów CPIO. Biblioteka ta potrafi tak¿e
+zapisywaæ archiwa SHAR.
+
+%package devel
+Summary: Header files for libarchive library
+Summary(pl): Pliki nag³ówkowe biblioteki libarchive
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+Header files for libarchive library.
+
+%description devel -l pl
+Pliki nag³ówkowe biblioteki libarchive.
+
+%package static
+Summary: Static libarchive library
+Summary(pl): Statyczna biblioteka libarchive
+Group: Development/Libraries
+Requires: %{name}-devel = %{version}-%{release}
+
+%description static
+Static libarchive library.
+
+%description static -l pl
+Statyczna biblioteka libarchive.
+
+%package -n bsdtar
+Summary: bsdtar - tar(1) implementation based on libarchive
+Summary(pl): bsdtar - implementacja programu tar(1) oparta na libarchive
+Group: Applications/Archiving
+Requires: %{name} = %{version}-%{release}
+
+%description -n bsdtar
+bsdtar - tar(1) implementation based on libarchive.
+
+%description -n bsdtar -l pl
+bsdtar - implementacja programu tar(1), oparta na libarchive.
+
+%prep
+%setup -q
+%patch0 -p1
+
+%build
+# Specify paths to avoid use of vacpp
+# -maix64 - required to use large files with aix-5.3
+# -static - required for interoperability without copying libraries
+# -D_BSD - required to include definition of makedev
+# -X64 - required to assemble 64-bit COFF files
+mkdir -p %{buildroot}
+PATH=/opt/freeware/libexec:/opt/freeware/bin:/usr/local/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:. \
+CPATH=/opt/freeware/include:/usr/local/include \
+LIBPATH=/opt/freeware/lib:/usr/local/lib:/usr/share/lib \
+LD_LIBRARY_PATH=/opt/freeware/lib:/usr/local/lib:/usr/share/lib \
+CFLAGS="$RPM_OPT_FLAGS -maix64 -static -D_BSD" \
+CXXFLAGS="$RPM_OPT_FLAGS -maix64 -static -D_BSD" \
+AR="ar -X64" \
+./configure \
+--prefix=%{_prefix} \
+--libexecdir=%{_libexecdir} \
+--mandir=%{_mandir} \
+--infodir=%{_infodir} \
+--enable-shared=yes \
+--enable-static=yes \
+| tee %{buildroot}/config.log
+make | tee %{buildroot}/make.log
+
+%install
+[ "%buildroot" != "/" ] && [ -d %buildroot ] && rm -rf %buildroot;
+make DESTDIR=%buildroot install
+# original install builds, but does install bsdtar
+cp .libs/%{name}.a %{buildroot}%{_libdir}
+cp bsdtar %{buildroot}%{_bindir}
+cp tar/bsdtar.1 %{buildroot}%{_mandir}/man1
+
+%clean
+rm -fr %buildroot
+
+%files
+%defattr(644,root,root,755)
+%{_libdir}/libarchive.a
+
+%files devel
+%defattr(644,root,root,755)
+%{_libdir}/libarchive.la
+%{_includedir}/*.h
+%doc %{_mandir}/man3/*
+%doc %{_mandir}/man5/*
+
+%files -n bsdtar
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/bsdtar
+%doc %{_mandir}/man1/bsdtar.1*
+
+%define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`)
+%changelog
+* %{date} PLD Team <feedback@pld-linux.org>
+All persons listed below can be reached at <cvs_login>@pld-linux.org
+
+$Log: libarchive.1aix53.spec,v $
+Revision 1.1.1.1 2007/11/30 21:25:32 joerg
+Import libarchive-2.4.0
+
+Release 1aix53 2006/12/12 rm1023@dcx.com
+- tweak for aix-5.3
+- added libarchive-0123457890.patch for "0123457890" error
+- replaced libarchive-1.3.1.tar.gz with libarchive-2.0a3.tar.gz
+- removed obsolete -CVE-2006-5680.patch and -man_progname.patch
+
+Revision 1.6 2006/11/15 10:41:28 qboosh
+- BR: acl-devel,attr-devel
+- devel deps
+
+Revision 1.5 2006/11/08 22:22:25 twittner
+- up to 1.3.1
+- added BR: e2fsprogs-devel
+- added -CVE-2006-5680.patch agains entering in infinite
+loop in corrupt archives
+- added bsdtar package (bsdtar is included now in libarchive
+sources)
+- rel. 0.1 for testing
+
+Revision 1.4 2005/12/15 18:26:36 twittner
+- up to 1.2.37
+- removed -shared.patch (no longer needed)
+
+Revision 1.3 2005/10/05 17:00:12 arekm
+- up to 1.02.034
+
+Revision 1.2 2005/07/27 20:17:21 qboosh
+- typo
+
+Revision 1.1 2005/07/27 08:36:03 adamg
+- new
diff --git a/archivers/libarchive/files/contrib/libarchive.spec b/archivers/libarchive/files/contrib/libarchive.spec
new file mode 100644
index 00000000000..caa5ebc02d7
--- /dev/null
+++ b/archivers/libarchive/files/contrib/libarchive.spec
@@ -0,0 +1,150 @@
+# $Revision: 1.1.1.1 $, $Date: 2007/11/30 21:25:32 $
+Summary: Library to create and read several different archive formats
+Summary(pl): Biblioteka do tworzenia i odczytu ró¿nych formatów archiwów
+Name: libarchive
+Version: 2.0a3
+Release: 1
+License: BSD
+Group: Libraries
+Source0: http://people.freebsd.org/~kientzle/libarchive/src/%{name}-%{version}.tar.gz
+Patch: %{name}-0123457890.patch
+URL: http://people.freebsd.org/~kientzle/libarchive/
+Requires: glibc
+Requires: zlib
+Requires: bzip2
+BuildRequires: gcc
+BuildRequires: gcc-c++
+BuildRequires: gawk
+BuildRequires: zlib-devel
+BuildRequires: bzip2
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+
+%description
+Libarchive is a programming library that can create and read several
+different streaming archive formats, including most popular TAR
+variants and several CPIO formats. It can also write SHAR archives.
+
+%description -l pl
+Libarchive jest bibliotek± s³u¿ac± to tworzenia i odczytu wielu
+ró¿nych strumieniowych formatów archiwów, w³±czaj±c w to popularne
+odmiany TAR oraz wiele formatów CPIO. Biblioteka ta potrafi tak¿e
+zapisywaæ archiwa SHAR.
+
+%package devel
+Summary: Header files for libarchive library
+Summary(pl): Pliki nag³ówkowe biblioteki libarchive
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+Header files for libarchive library.
+
+%description devel -l pl
+Pliki nag³ówkowe biblioteki libarchive.
+
+%package static
+Summary: Static libarchive library
+Summary(pl): Statyczna biblioteka libarchive
+Group: Development/Libraries
+Requires: %{name}-devel = %{version}-%{release}
+
+%description static
+Static libarchive library.
+
+%description static -l pl
+Statyczna biblioteka libarchive.
+
+%package -n bsdtar
+Summary: bsdtar - tar(1) implementation based on libarchive
+Summary(pl): bsdtar - implementacja programu tar(1) oparta na libarchive
+Group: Applications/Archiving
+Requires: %{name} = %{version}-%{release}
+
+%description -n bsdtar
+bsdtar - tar(1) implementation based on libarchive.
+
+%description -n bsdtar -l pl
+bsdtar - implementacja programu tar(1), oparta na libarchive.
+
+%prep
+%setup -q
+%patch0 -p1
+
+%build
+mkdir -p %{buildroot}
+./configure \
+--prefix=%{_prefix} \
+--libexecdir=%{_libexecdir} \
+--mandir=%{_mandir} \
+--infodir=%{_infodir} \
+--enable-shared=yes \
+--enable-static=yes \
+| tee %{buildroot}/config.log
+make | tee %{buildroot}/make.log
+
+%install
+[ "%buildroot" != "/" ] && [ -d %buildroot ] && rm -rf %buildroot;
+make DESTDIR=%buildroot install
+# original install builds, but does install bsdtar
+cp .libs/%{name}.a %{buildroot}%{_libdir}
+cp bsdtar %{buildroot}%{_bindir}
+cp tar/bsdtar.1 %{buildroot}%{_mandir}/man1
+
+%clean
+rm -fr %buildroot
+
+%files
+%defattr(644,root,root,755)
+%{_libdir}/libarchive.a
+
+%files devel
+%defattr(644,root,root,755)
+%{_libdir}/libarchive.la
+%{_includedir}/*.h
+%doc %{_mandir}/man3/*
+%doc %{_mandir}/man5/*
+
+%files -n bsdtar
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/bsdtar
+%doc %{_mandir}/man1/bsdtar.1*
+
+%define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`)
+%changelog
+* %{date} PLD Team <feedback@pld-linux.org>
+All persons listed below can be reached at <cvs_login>@pld-linux.org
+
+$Log: libarchive.spec,v $
+Revision 1.1.1.1 2007/11/30 21:25:32 joerg
+Import libarchive-2.4.0
+
+Release 1 2006/12/12 rm1023@dcx.com
+- added libarchive-0123457890.patch for "0123457890" error
+- replaced libarchive-1.3.1.tar.gz with libarchive-2.0a3.tar.gz
+- removed obsolete -CVE-2006-5680.patch and -man_progname.patch
+
+Revision 1.6 2006/11/15 10:41:28 qboosh
+- BR: acl-devel,attr-devel
+- devel deps
+
+Revision 1.5 2006/11/08 22:22:25 twittner
+- up to 1.3.1
+- added BR: e2fsprogs-devel
+- added -CVE-2006-5680.patch agains entering in infinite
+loop in corrupt archives
+- added bsdtar package (bsdtar is included now in libarchive
+sources)
+- rel. 0.1 for testing
+
+Revision 1.4 2005/12/15 18:26:36 twittner
+- up to 1.2.37
+- removed -shared.patch (no longer needed)
+
+Revision 1.3 2005/10/05 17:00:12 arekm
+- up to 1.02.034
+
+Revision 1.2 2005/07/27 20:17:21 qboosh
+- typo
+
+Revision 1.1 2005/07/27 08:36:03 adamg
+- new
diff --git a/archivers/libarchive/files/contrib/libarchive_autodetect-st_lib_archive.m4 b/archivers/libarchive/files/contrib/libarchive_autodetect-st_lib_archive.m4
new file mode 100644
index 00000000000..4419e888f24
--- /dev/null
+++ b/archivers/libarchive/files/contrib/libarchive_autodetect-st_lib_archive.m4
@@ -0,0 +1,154 @@
+dnl
+dnl @synopsis ST_LIB_ARCHIVE([ENABLED-DEFAULT])
+dnl
+dnl This macro figures out what's necessary to link a program against an
+dnl instance of the BSD libarchive package by Tim Kientzle.
+dnl
+dnl See http://people.freebsd.org/~kientzle/libarchive/ for more info.
+dnl
+dnl It exports and substitutes the variables LIBARCHIVE_LIBS, LIBARCHIVE_LDFLAGS,
+dnl and LIBARCHIVE_CPPFLAGS to appropriate values for the identified instance of
+dnl libarchive. The values are AC_SUBST'd, so a user could, for example, simply
+dnl include @LIBARCHIVE_CPPFLAGS@ in the definition of AM_CPPFLAGS in a Makefile.am.
+dnl
+dnl ENABLED-DEFAULT is either "yes" or "no" and determines whether the default value
+dnl is --with-libarchive or --without-libarchive. It is not possible to specify a
+dnl default directory. More simply, any reasonable choice for a default should just
+dnl go into the auto-detect list.
+dnl
+dnl The macro defines the symbol HAVE_LIBARCHIVE if the library is found. You
+dnl should use autoheader to include a definition for this symbol in a config.h
+dnl file. Sample usage in a C/C++ source is as follows:
+dnl
+dnl #ifdef HAVE_LIBARCHIVE
+dnl #include <archive.h>
+dnl #endif /* HAVE_LIBARCHIVE */
+dnl
+dnl @category InstalledPackages
+dnl @author Andre Stechert <andre@splunk.com>
+dnl @version 2006-04-20
+dnl @license GPLWithACException
+
+AC_DEFUN([ST_LIB_ARCHIVE],
+[
+#
+# Handle input from the configurer and blend with the requirements from the maintainer.
+# We go through the trouble of creating a second set of variables other than the with_foo
+# variables in order to be sure that error/corner cases have been cleaned up.
+#
+# After this statement, three trusted variable are defined.
+#
+# st_lib_archive_ENABLED will be either "yes" or "no". its value determines whether
+# or not we bother with the rest of the checks and whether or not we export a
+# bunch of variables.
+#
+# st_lib_archive_LOCATION will be either "auto" or "defined". if it is "auto", then
+# we try a bunch of standard locations. if it is "defined", then we just try the value
+# provided in st_lib_archive_DIR.
+#
+# st_lib_archive_DIR will contain the string provided by the user, provided that it's
+# actually a directory.
+#
+AC_MSG_CHECKING([if libarchive is wanted])
+AC_ARG_WITH([libarchive],
+ AS_HELP_STRING([--with-libarchive=DIR], [libarchive installation directory]),
+ [if test "x$with_libarchive" = "xno" ; then
+ st_lib_archive_ENABLED=no
+ elif test "x$with_libarchive" = "xyes" ; then
+ st_lib_archive_ENABLED=yes
+ st_lib_archive_LOCATION=auto
+ else
+ st_lib_archive_ENABLED=yes
+ st_lib_archive_LOCATION=defined
+ if test -d "$with_libarchive" ; then
+ st_lib_archive_DIR="$with_libarchive"
+ else
+ AC_MSG_ERROR([$with_libarchive is not a directory])
+ fi
+ fi],
+ [if test "x$1" = "xno" ; then
+ st_lib_archive_ENABLED=no
+ elif test "x$1" = "xyes" ; then
+ st_lib_archive_ENABLED=yes
+ else
+ st_lib_archive_ENABLED=yes
+ fi])
+
+if test "$st_lib_archive_ENABLED" = "yes" ; then
+ AC_MSG_RESULT([yes])
+#
+# After this statement, one trusted variable is defined.
+#
+# st_lib_archive_LIB will be either "lib" or "lib64", depending on whether the configurer
+# specified 32, 64. The default is "lib".
+#
+ AC_MSG_CHECKING([whether to use lib or lib64])
+ AC_ARG_WITH([libarchive-bits],
+ AS_HELP_STRING([--with-libarchive-bits=32/64], [if 64, look in /lib64 on hybrid systems]),
+ [if test "x$with_libarchive_bits" = "x32" ; then
+ st_lib_archive_LIB=lib
+ elif test "x$with_libarchive_bits" = "x64" ; then
+ st_lib_archive_LIB=lib64
+ else
+ AC_MSG_ERROR([the argument must be either 32 or 64])
+ fi],
+ [st_lib_archive_LIB=lib])
+ AC_MSG_RESULT($st_lib_archive_LIB)
+#
+# Save the environment before verifying libarchive availability
+#
+ st_lib_archive_SAVECPPFLAGS="$CPPFLAGS"
+ st_lib_archive_SAVELDFLAGS="$LDFLAGS"
+ AC_LANG_SAVE
+ AC_LANG_C
+
+ if test "x$st_lib_archive_LOCATION" = "xdefined" ; then
+ CPPFLAGS="-I$st_lib_archive_DIR/include $st_lib_archive_SAVECPPFLAGS"
+ LDFLAGS="-L$st_lib_archive_DIR/$st_lib_archive_LIB $st_lib_archive_SAVELDFLAGS"
+ AC_CHECK_LIB(archive, archive_read_new, [st_lib_archive_found_lib=yes], [st_lib_archive_found_lib=no])
+ AC_CHECK_HEADER(archive.h, [st_lib_archive_found_hdr=yes], [st_lib_archive_found_hdr=no])
+ if test "x$st_lib_archive_found_lib" = "xyes" && test "x$st_lib_archive_found_hdr" = "xyes"; then
+ LIBARCHIVE_CPPFLAGS="-I$dir/include"
+ LIBARCHIVE_LDFLAGS="-L$dir/$st_lib_archive_LIB"
+ else
+ AC_MSG_ERROR([could not find libarchive in the requested location])
+ fi
+ else
+ #
+ # These are the common install directories for Linux, FreeBSD, Solaris, and Mac.
+ #
+ for dir in /usr /usr/local /usr/sfw /opt/csw /opt/local /sw
+ do
+ if test -d "$dir" ; then
+ CPPFLAGS="-I$dir/include $st_lib_archive_SAVECPPFLAGS"
+ LDFLAGS="-L$dir/$st_lib_archive_LIB $st_lib_archive_SAVELDFLAGS"
+ AC_CHECK_LIB(archive, archive_read_new, [st_lib_archive_found_lib=yes], [st_lib_archive_found_lib=no])
+ AC_CHECK_HEADER(archive.h, [st_lib_archive_found_hdr=yes], [st_lib_archive_found_hdr=no])
+ if test "x$st_lib_archive_found_lib" = "xyes" && test "x$st_lib_archive_found_hdr" = "xyes"; then
+ LIBARCHIVE_CPPFLAGS="-I$dir/include"
+ LIBARCHIVE_LDFLAGS="-L$dir/$st_lib_archive_LIB"
+ break
+ fi
+ fi
+ done
+ fi
+
+ if test "x$st_lib_archive_found_hdr" = "xyes" && test "x$st_lib_archive_found_lib" = "xyes" ; then
+ LIBARCHIVE_LIBS="-larchive"
+ AC_DEFINE([HAVE_LIBARCHIVE], [1], [Defined to 1 if libarchive is available for use.])
+ AC_SUBST(LIBARCHIVE_LIBS)
+ AC_SUBST(LIBARCHIVE_CPPFLAGS)
+ AC_SUBST(LIBARCHIVE_LDFLAGS)
+ fi
+
+#
+# Restore the environment now that we're done.
+#
+ AC_LANG_RESTORE
+ CPPFLAGS="$st_lib_archive_SAVECPPFLAGS"
+ LDFLAGS="$st_lib_archive_SAVELDFLAGS"
+else
+ AC_MSG_RESULT([no])
+fi
+AM_CONDITIONAL(LIBARCHIVE, test "x$st_lib_archive_found_lib" = "xyes" && test "x$st_lib_archive_found_hdr" = "xyes")
+])
diff --git a/archivers/libarchive/files/cpio/bsdcpio.1 b/archivers/libarchive/files/cpio/bsdcpio.1
new file mode 100644
index 00000000000..58fc9bf5c1f
--- /dev/null
+++ b/archivers/libarchive/files/cpio/bsdcpio.1
@@ -0,0 +1,362 @@
+.\" Copyright (c) 2003-2007 Tim Kientzle
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 05, 2007
+.Dt BSDCPIO 1
+.Os
+.Sh NAME
+.Nm cpio
+.Nd copy files to and from archives
+.Sh SYNOPSIS
+.Nm
+.Brq Fl i
+.Op Ar options
+.Op Ar pattern ...
+.Op Ar < archive
+.Nm
+.Brq Fl o
+.Op Ar options
+.Ar < name-list
+.Op Ar > archive
+.Nm
+.Brq Fl p
+.Op Ar options
+.Ar dest-dir
+.Ar < name-list
+.Sh DESCRIPTION
+.Nm
+copies files between archives and directories.
+This implementation can extract from tar, pax, cpio, zip, jar, ar,
+and ISO 9660 cdrom images and can create tar, pax, cpio, ar,
+and shar archives.
+.Pp
+The first option to
+.Nm
+is a mode indicator from the following list:
+.Bl -tag -compact -width indent
+.It Fl i
+Input.
+Read an archive from standard input and extract the contents to disk or
+(if the
+.Fl t
+option is specified)
+list the contents to standard output.
+.It Fl o
+Output.
+Read a list of filenames from standard input and produce a new archive
+on standard output containing the specified items.
+If one or more file patterns are specified, only files matching
+one of the patterns will be extracted.
+.It Fl p
+Pass-through.
+Read a list of filenames from standard input and copy the files to the
+specified directory.
+.El
+.Pp
+.Sh OPTIONS
+Unless specifically stated otherwise, options are applicable in
+all operating modes.
+.Bl -tag -width indent
+.It Fl a
+(o and p modes)
+Reset access times on files after they are read.
+(Not yet implemented)
+.It Fl B
+(o mode only)
+Block output to records of 5120 bytes.
+.It Fl c
+(o mode only)
+Use the old POSIX portable character format.
+Equivalent to
+.Fl -format Ar odc .
+.It Fl d
+(i and p modes)
+Create directories as necessary.
+.It Fl f Ar pattern
+(i mode only)
+Ignore files that match
+.Ar pattern .
+(Not yet implemented.)
+.It Fl -format Ar format
+(o mode only)
+Produce the output archive in the specified format.
+Supported formats include:
+.Pp
+.Bl -tag -width "iso9660" -compact
+.It Ar cpio
+Synonym for
+.Ar odc .
+.It Ar newc
+The SVR4 portable cpio format.
+.It Ar odc
+The old POSIX.1 portable octet-oriented cpio format.
+.It Ar pax
+The POSIX.1 pax format, an extension of the ustar format.
+.It Ar ustar
+The POSIX.1 tar format.
+.El
+.Pp
+The default format is
+.Ar odc .
+See
+.Xr libarchive_formats 5
+for more complete information about the
+formats currently supported by the underlying
+.Xr libarchive 3
+library.
+.It Fl i
+Input mode.
+See above for description.
+.It Fl L
+(o and p modes)
+All symbolic links will be followed.
+Normally, symbolic links are archived and copied as symbolic links.
+With this option, the target of the link will be archived or copied instead.
+(Not yet implemented.)
+.It Fl l
+(p mode only)
+Create links from the target directory to the original files,
+instead of copying.
+.It Fl m
+(i and p modes)
+Set file modification time on created files to match
+those in the source.
+.It Fl o
+Output mode.
+See above for description.
+.It Fl p
+Pass-through mode.
+See above for description.
+.It Fl -quiet
+(Not yet implemented.)
+.It Fl R Oo user Oc Ns Oo : Oc Ns Oo group Oc
+Set the owner and/or group on files in the output.
+If group is specified with no user
+(for example,
+.Fl R Ar :wheel )
+then the group will be set but not the user.
+If the user is specified with a trailing colon and no group
+(for example,
+.Fl R Ar root: )
+then the group will be set to the user's default group.
+If the user is specified with no trailing colon, then
+the user will be set but not the group.
+In
+.Fl i
+and
+.Fl p
+modes, this option can only be used by the super-user.
+(For compatibility, a period can be used in place of the colon.)
+.It Fl r
+(All modes.)
+Rename files interactively.
+For each file, a prompt is written to
+.Pa /dev/tty
+containing the name of the file and a line is read from
+.Pa /dev/tty .
+If the line read is blank, the file is skipped.
+If the line contains a single period, the file is processed normally.
+Otherwise, the line is taken to be the new name of the file.
+.It Fl t
+(i mode only)
+List the contents of the archive to stdout;
+do not restore the contents to disk.
+.It Fl u
+(i and p modes)
+Unconditionally overwrite existing files.
+Ordinarily, an older file will not overwrite a newer file on disk.
+.It Fl v
+Print the name of each file to stderr as it is processed.
+With
+.Fl t ,
+provide a detailed listing of each file.
+.It Fl -version
+Print the program version information and exit.
+.It Fl y
+(o mode only)
+Compress the archive with bzip2-compatible compression before
+writing to stdout.
+In input mode, this option is ignored;
+bzip2 compression is recognized automatically on input.
+.It Fl z
+(o mode only)
+Compress the archive with gzip-compatible compression before writing
+it to stdout.
+In input mode, this option is ignored;
+gzip compression is recognized automatically on input.
+.El
+.Sh ENVIRONMENT
+The following environment variables affect the execution of
+.Nm :
+.Bl -tag -width ".Ev BLOCKSIZE"
+.It Ev LANG
+The locale to use.
+See
+.Xr environ 7
+for more information.
+.It Ev TZ
+The timezone to use when displaying dates.
+See
+.Xr environ 7
+for more information.
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+The
+.Nm
+command is traditionally used to copy file heirarchies in conjunction
+with the
+.Xr find 1
+command.
+The first example here simply copies all files from
+.Pa src
+to
+.Pa dest :
+.Dl Nm find Pa src | Nm Fl pmud Pa dest
+.Pp
+By carefully selecting options to the
+.Xr find 1
+command and combining it with other standard utilities,
+it is possible to exercise very fine control over which files are copied.
+This next example copies files from
+.Pa src
+to
+.Pa dest
+that are more than 2 days old and whose names match a particular pattern:
+.Dl Nm find Pa src Fl mtime Ar +2 | Nm grep foo[bar] | Nm Fl pdmu Pa dest
+.Pp
+This example copies files from
+.Pa src
+to
+.Pa dest
+that are more than 2 days old and which contain the word
+.Do foobar Dc :
+.Dl Nm find Pa src Fl mtime Ar +2 | Nm xargs Nm grep -l foobar | Nm Fl pdmu Pa dest
+.Sh COMPATIBILITY
+The mode options i, o, and p and the options
+a, B, c, d, f, l, m, r, t, u, and v comply with SUSv2.
+.Pp
+The old POSIX.1 standard specified that only
+.Fl i ,
+.Fl o ,
+and
+.Fl p
+were interpreted as command-line options.
+Each took a single argument of a list of modifier
+characters.
+For example, the standard syntax allows
+.Fl imu
+but does not support
+.Fl miu
+or
+.Fl i Fl m Fl u ,
+since
+.Ar m
+and
+.Ar u
+are only modifiers to
+.Fl i ,
+they are not command-line options in their own right.
+The syntax supported by this implementation is backwards-compatible
+with the standard.
+For best compatibility, scripts should limit themselves to the
+standard syntax.
+.Sh SEE ALSO
+.Xr bzip2 1 ,
+.Xr tar 1 ,
+.Xr gzip 1 ,
+.Xr mt 1 ,
+.Xr pax 1 ,
+.Xr libarchive 3 ,
+.Xr cpio 5 ,
+.Xr libarchive-formats 5 ,
+.Xr tar 5
+.Sh STANDARDS
+There is no current POSIX standard for the cpio command; it appeared
+in
+.St -p1003.1-96
+but was dropped from
+.St -p1003.1-2001 .
+.Pp
+The cpio, ustar, and pax interchange file formats are defined by
+.St -p1003.1-2001
+for the pax command.
+.Sh HISTORY
+The original
+.Nm cpio
+and
+.Nm find
+utilities were written by Dick Haight
+while working in AT&T's Unix Support Group.
+They first appeared in PWB/UNIX 1.0, the
+.Dq Programmer's Work Bench
+system developed for use within AT&T and released in 1977.
+XXX It was first released outside of AT&T
+as part of System III Unix in 1981. XXX
+XXX Need to verify the previous statement. XXX
+As a result,
+.Nm cpio
+actually predates
+.Nm tar ,
+even though it was not well-known outside of AT&T
+until some time later.
+XXX When did cpio first appear in BSD? XXX
+.Pp
+This is a complete re-implementation based on the
+.Xr libarchive 3
+library.
+.Sh BUGS
+The cpio archive format has several basic limitations:
+It does not store user and group names, only numbers.
+As a result, it cannot be reliably used to transfer
+files between systems with dissimilar user and group numbering.
+Older cpio formats limit the user and group numbers to
+16 or 18 bits, which is insufficient for modern systems.
+The cpio archive formats cannot support files over 4 gigabytes,
+except for the
+.Dq odc
+variant, which can support files up to 8 gigabytes.
+.Pp
+This is an early alpha version of
+.Nm .
+The underlying
+.Nm libarchive
+library is quite mature, so the archive format support
+and creation of objects on disk should be robust.
+However, the cpio-specific options and features
+are still very new.
+Known issues that will be fixed soon:
+.Bl -bullet -offset indent -compact
+.It
+Options documented above as
+.Do Not yet implemented Dc .
+.It
+Filter arguments to
+.Fl i ,
+and
+.Fl it .
+.El
diff --git a/archivers/libarchive/files/cpio/cmdline.c b/archivers/libarchive/files/cpio/cmdline.c
new file mode 100644
index 00000000000..6c92b5dcd60
--- /dev/null
+++ b/archivers/libarchive/files/cpio/cmdline.c
@@ -0,0 +1,245 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "cpio_platform.h"
+__FBSDID("$FreeBSD$");
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_GETOPT_LONG
+#include <getopt.h>
+#else
+struct option {
+ const char *name;
+ int has_arg;
+ int *flag;
+ int val;
+};
+#define no_argument 0
+#define required_argument 1
+#endif
+#ifdef HAVE_GRP_H
+#include <grp.h>
+#endif
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "cpio.h"
+
+/*
+ *
+ * Option parsing routines for bsdcpio.
+ *
+ */
+
+
+static const char *cpio_opts = "aBcdf:H:hijlmopR:rtuvW:yz";
+
+/*
+ * On systems that lack getopt_long, long options can be specified
+ * using -W longopt and -W longopt=value, e.g. "-W version" is the
+ * same as "--version" and "-W format=ustar" is the same as "--format
+ * ustar". This does not rely the GNU getopt() "W;" extension, so
+ * should work correctly on any system with a POSIX-compliant
+ * getopt().
+ */
+
+/*
+ * If you add anything, be very careful to keep this list properly
+ * sorted, as the -W logic below relies on it.
+ */
+static const struct option cpio_longopts[] = {
+ { "format", required_argument, NULL, 'H' },
+ { "help", no_argument, NULL, 'h' },
+ { "owner", required_argument, NULL, 'R' },
+ { "quiet", no_argument, NULL, OPTION_QUIET },
+ { "verbose", no_argument, NULL, 'v' },
+ { "version", no_argument, NULL, OPTION_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+/*
+ * Parse command-line options using system-provided getopt() or getopt_long().
+ * If option is -W, then parse argument as a long option.
+ */
+int
+cpio_getopt(struct cpio *cpio)
+{
+ char *p, *q;
+ const struct option *option, *option2;
+ int opt;
+ int option_index;
+ size_t option_length;
+
+ option_index = -1;
+
+#ifdef HAVE_GETOPT_LONG
+ opt = getopt_long(cpio->argc, cpio->argv, cpio_opts,
+ cpio_longopts, &option_index);
+#else
+ opt = getopt(cpio->argc, cpio->argv, optstring);
+#endif
+
+ /* Support long options through -W longopt=value */
+ if (opt == 'W') {
+ p = optarg;
+ q = strchr(optarg, '=');
+ if (q != NULL) {
+ option_length = (size_t)(q - p);
+ optarg = q + 1;
+ } else {
+ option_length = strlen(p);
+ optarg = NULL;
+ }
+ option = cpio_longopts;
+ while (option->name != NULL &&
+ (strlen(option->name) < option_length ||
+ strncmp(p, option->name, option_length) != 0 )) {
+ option++;
+ }
+
+ if (option->name != NULL) {
+ option2 = option;
+ opt = option->val;
+
+ /* If the first match was exact, we're done. */
+ if (strncmp(p, option->name, strlen(option->name)) == 0) {
+ while (option->name != NULL)
+ option++;
+ } else {
+ /* Check if there's another match. */
+ option++;
+ while (option->name != NULL &&
+ (strlen(option->name) < option_length ||
+ strncmp(p, option->name, option_length) != 0)) {
+ option++;
+ }
+ }
+ if (option->name != NULL)
+ cpio_errc(1, 0,
+ "Ambiguous option %s "
+ "(matches both %s and %s)",
+ p, option2->name, option->name);
+
+ if (option2->has_arg == required_argument
+ && optarg == NULL)
+ cpio_errc(1, 0,
+ "Option \"%s\" requires argument", p);
+ } else {
+ opt = '?';
+ }
+ }
+
+ return (opt);
+}
+
+
+/*
+ * Parse the argument to the -R or --owner flag.
+ *
+ * The format is one of the following:
+ * <user> - Override user but not group
+ * <user>: - Override both, group is user's default group
+ * <user>:<group> - Override both
+ * :<group> - Override group but not user
+ *
+ * A period can be used instead of the colon.
+ *
+ * Sets uid/gid as appropriate, -1 indicates uid/gid not specified.
+ *
+ */
+int
+owner_parse(const char *spec, int *uid, int *gid)
+{
+ const char *u, *ue, *g;
+
+ *uid = -1;
+ *gid = -1;
+
+ /*
+ * Split spec into [user][:.][group]
+ * u -> first char of username, NULL if no username
+ * ue -> first char after username (colon, period, or \0)
+ * g -> first char of group name
+ */
+ if (*spec == ':' || *spec == '.') {
+ /* If spec starts with ':' or '.', then just group. */
+ ue = u = NULL;
+ g = spec + 1;
+ } else {
+ /* Otherwise, [user] or [user][:] or [user][:][group] */
+ ue = u = spec;
+ while (*ue != ':' && *ue != '.' && *ue != '\0')
+ ++ue;
+ g = ue;
+ if (*g != '\0') /* Skip : or . to find first char of group. */
+ ++g;
+ }
+
+ if (u != NULL) {
+ /* Look up user: ue is first char after end of user. */
+ char *user;
+ struct passwd *pwent;
+
+ user = (char *)malloc(ue - u + 1);
+ if (user == NULL) {
+ cpio_warnc(errno, "Couldn't allocate memory");
+ return (1);
+ }
+ memcpy(user, u, ue - u);
+ user[ue - u] = '\0';
+ pwent = getpwnam(user);
+ if (pwent == NULL) {
+ cpio_warnc(errno, "Couldn't lookup user ``%s''", user);
+ return (1);
+ }
+ free(user);
+ *uid = pwent->pw_uid;
+ if (*ue != '\0' && *g == '\0')
+ *gid = pwent->pw_gid;
+ }
+ if (*g != '\0') {
+ struct group *grp;
+ grp = getgrnam(g);
+ if (grp != NULL)
+ *gid = grp->gr_gid;
+ else {
+ cpio_warnc(errno, "Couldn't look up group ``%s''", g);
+ return (1);
+ }
+ }
+ return (0);
+}
diff --git a/archivers/libarchive/files/cpio/cpio.c b/archivers/libarchive/files/cpio/cpio.c
index e9131c4608e..6a74431d007 100644
--- a/archivers/libarchive/files/cpio/cpio.c
+++ b/archivers/libarchive/files/cpio/cpio.c
@@ -41,17 +41,8 @@ __FBSDID("$FreeBSD$");
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
-#ifdef HAVE_GETOPT_LONG
-#include <getopt.h>
-#else
-struct option {
- const char *name;
- int has_arg;
- int *flag;
- int val;
-};
-#define no_argument 0
-#define required_argument 1
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
#endif
#include <stdio.h>
#ifdef HAVE_STDLIB_H
@@ -66,82 +57,58 @@ struct option {
#include "cpio.h"
-static int copy_data(struct cpio *, struct archive *, struct archive *);
-static int cpio_getopt(struct cpio *cpio, const char *optstring,
- const struct option **poption);
+static int copy_data(struct archive *, struct archive *);
static const char *cpio_rename(const char *name);
static int file_to_archive(struct cpio *, const char *, const char *);
-static void long_help(struct cpio *cpio);
+static void long_help(void);
static void mode_in(struct cpio *);
static void mode_list(struct cpio *);
static void mode_out(struct cpio *);
static void mode_pass(struct cpio *, const char *);
static int out_file(struct cpio *, const char *pathname);
-static void usage(struct cpio *);
-static void version(void);
-
-static const char *cpio_opts = "aBcdf:hijlmoprtuvyz";
-
-/*
- * On systems that lack getopt_long, long options can be specified
- * using -W longopt and -W longopt=value, e.g. "-W version" is the
- * same as "--version" and "-W format=ustar" is the same as "--format
- * ustar". This does not rely the GNU getopt() "W;" extension, so
- * should work correctly on any system with a POSIX-compliant
- * getopt().
- */
-
-/* Fake short equivalents for long options that otherwise lack them. */
-enum {
- OPTION_FORMAT = 1,
- OPTION_VERSION
-};
-
-/*
- * If you add anything, be very careful to keep this list properly
- * sorted, as the -W logic relies on it.
- */
-static const struct option cpio_longopts[] = {
- { "format", required_argument, NULL, OPTION_FORMAT },
- { "help", no_argument, NULL, 'h' },
- { "verbose", no_argument, NULL, 'v' },
- { "version", no_argument, NULL, OPTION_VERSION },
- { NULL, 0, NULL, 0 }
-};
+static int process_lines(struct cpio *cpio, const char *pathname,
+ int (*process)(struct cpio *, const char *));
+static void usage(void);
+static void version(FILE *);
int
main(int argc, char *argv[])
{
struct cpio _cpio; /* Allocated on stack. */
struct cpio *cpio;
- const struct option *option;
+ int uid, gid;
char opt;
cpio = &_cpio;
memset(cpio, 0, sizeof(*cpio));
- /* Need cpio->progname before calling cpio_warnc. */
+ /* Need cpio_progname before calling cpio_warnc. */
if (*argv == NULL)
- cpio->progname = "cpio";
+ cpio_progname = "cpio";
else {
- cpio->progname = strrchr(*argv, '/');
- if (cpio->progname != NULL)
- cpio->progname++;
+ cpio_progname = strrchr(*argv, '/');
+ if (cpio_progname != NULL)
+ cpio_progname++;
else
- cpio->progname = *argv;
+ cpio_progname = *argv;
}
+ cpio->uid_override = -1;
+ cpio->gid_override = -1;
cpio->argv = argv;
cpio->argc = argc;
cpio->mode = '\0';
cpio->verbose = 0;
cpio->compress = '\0';
+ /* TODO: Implement old binary format in libarchive, use that here. */
+ cpio->format = "odc"; /* Default format */
cpio->extract_flags = ARCHIVE_EXTRACT_NO_AUTODIR;
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
+ /* TODO: If run by root, set owner as well. */
cpio->bytes_per_block = 512;
cpio->filename = NULL;
- while ((opt = cpio_getopt(cpio, cpio_opts, &option)) != -1) {
+ while ((opt = cpio_getopt(cpio)) != -1) {
switch (opt) {
case 'a': /* POSIX 1997 */
cpio->option_atime_restore = 1;
@@ -158,15 +125,18 @@ main(int argc, char *argv[])
case 'f': /* POSIX 1997 */
/* TODO */
break;
- case OPTION_FORMAT: /* GNU cpio */
+ case 'H': /* GNU cpio, also --format */
cpio->format = optarg;
break;
case 'h':
- long_help(cpio);
+ long_help();
break;
case 'i': /* POSIX 1997 */
cpio->mode = opt;
break;
+ case 'L': /* GNU cpio, BSD convention */
+ /* TODO: Implement this */
+ break;
case 'l': /* POSIX 1997 */
cpio->option_link = 1;
break;
@@ -179,6 +149,17 @@ main(int argc, char *argv[])
case 'p': /* POSIX 1997 */
cpio->mode = opt;
break;
+ case OPTION_QUIET: /* GNU cpio */
+ cpio->quiet = 1;
+ break;
+ case 'R': /* GNU cpio, also --owner */
+ if (owner_parse(optarg, &uid, &gid))
+ usage();
+ if (uid != -1)
+ cpio->uid_override = uid;
+ if (gid != -1)
+ cpio->gid_override = gid;
+ break;
case 'r': /* POSIX 1997 */
cpio->option_rename = 1;
break;
@@ -193,7 +174,7 @@ main(int argc, char *argv[])
cpio->verbose++;
break;
case OPTION_VERSION: /* GNU convention */
- version();
+ version(stderr);
break;
#if 0
/*
@@ -210,13 +191,12 @@ main(int argc, char *argv[])
cpio->compress = opt;
break;
default:
- usage(cpio);
+ usage();
}
}
/* TODO: Sanity-check args, error out on nonsensical combinations. */
-
cpio->argc -= optind;
cpio->argv += optind;
@@ -225,6 +205,7 @@ main(int argc, char *argv[])
mode_out(cpio);
break;
case 'i':
+ /* TODO: parse patterns on command line. */
if (cpio->option_list)
mode_list(cpio);
else
@@ -232,12 +213,12 @@ main(int argc, char *argv[])
break;
case 'p':
if (*cpio->argv == NULL || **cpio->argv == '\0')
- cpio_errc(cpio, 1, 0,
+ cpio_errc(1, 0,
"-p mode requires a target directory");
mode_pass(cpio, *cpio->argv);
break;
default:
- cpio_errc(cpio, 1, 0,
+ cpio_errc(1, 0,
"Must specify at least one of -i, -o, or -p");
}
@@ -245,11 +226,11 @@ main(int argc, char *argv[])
}
void
-usage(struct cpio *cpio)
+usage(void)
{
const char *p;
- p = cpio->progname;
+ p = cpio_progname;
fprintf(stderr, "Brief Usage:\n");
fprintf(stderr, " List: %s -it < archive\n", p);
@@ -270,7 +251,7 @@ static const char *long_help_msg =
" -v Verbose\n"
"Create: %p -o [options] < [list of files] > [archive]\n"
" -z, -y Compress archive with gzip/bzip2\n"
- " --format {ustar|pax|cpio|shar} Select archive format\n"
+ " --format {odc|newc|ustar} Select archive format\n"
"List: %p -it < [archive]\n"
"Extract: %p -i [options] < [archive]\n";
@@ -286,12 +267,12 @@ static const char *long_help_msg =
* echo bsdcpio; else echo not bsdcpio; fi
*/
static void
-long_help(struct cpio *cpio)
+long_help(void)
{
const char *prog;
const char *p;
- prog = cpio->progname;
+ prog = cpio_progname;
fflush(stderr);
@@ -308,13 +289,15 @@ long_help(struct cpio *cpio)
} else
putchar(*p);
}
- version();
+ version(stdout);
}
-static void version(void)
+static void
+version(FILE *out)
{
- fprintf(stderr,"bsdcpio %s -- %s\n",
- PACKAGE_VERSION, archive_version());
+ fprintf(out,"bsdcpio %s -- %s\n",
+ BSDCPIO_VERSION_STRING,
+ archive_version());
exit(1);
}
@@ -325,7 +308,7 @@ mode_out(struct cpio *cpio)
cpio->archive = archive_write_new();
if (cpio->archive == NULL)
- cpio_errc(cpio, 1, 0, "Failed to allocate archive object");
+ cpio_errc(1, 0, "Failed to allocate archive object");
switch (cpio->compress) {
case 'j': case 'y':
archive_write_set_compression_bzip2(cpio->archive);
@@ -339,15 +322,18 @@ mode_out(struct cpio *cpio)
}
r = archive_write_set_format_by_name(cpio->archive, cpio->format);
if (r != ARCHIVE_OK)
- cpio_errc(cpio, 1, 0, archive_error_string(cpio->archive));
+ cpio_errc(1, 0, archive_error_string(cpio->archive));
+ archive_write_set_bytes_per_block(cpio->archive, cpio->bytes_per_block);
+ cpio->linkresolver = archive_entry_linkresolver_new();
+
r = archive_write_open_file(cpio->archive, cpio->filename);
if (r != ARCHIVE_OK)
- cpio_errc(cpio, 1, 0, archive_error_string(cpio->archive));
+ cpio_errc(1, 0, archive_error_string(cpio->archive));
process_lines(cpio, "-", out_file);
r = archive_write_close(cpio->archive);
if (r != ARCHIVE_OK)
- cpio_errc(cpio, 1, 0, archive_error_string(cpio->archive));
+ cpio_errc(1, 0, archive_error_string(cpio->archive));
archive_write_finish(cpio->archive);
}
@@ -376,7 +362,8 @@ file_to_archive(struct cpio *cpio, const char *srcpath, const char *destpath)
static char buff[16384];
struct stat st;
struct archive_entry *entry;
- int fd;
+ const char *linkname;
+ int fd = -1;
ssize_t len;
int r;
@@ -385,11 +372,43 @@ file_to_archive(struct cpio *cpio, const char *srcpath, const char *destpath)
entry = archive_entry_new();
if (entry == NULL)
- cpio_errc(cpio, 1, 0, "Couldn't allocate entry");
- stat(srcpath, &st);
- archive_entry_copy_stat(entry, &st);
+ cpio_errc(1, 0, "Couldn't allocate entry");
archive_entry_set_pathname(entry, destpath);
+ /* TODO: pathname editing. */
+
+ if (lstat(srcpath, &st) != 0) {
+ cpio_warnc(errno, "Couldn't stat");
+ goto cleanup;
+ }
+
+ /* If we're trying to preserve hardlinks, match them here. */
+ if (cpio->linkresolver != NULL
+ && st.st_nlink > 1
+ && !S_ISDIR(st.st_mode)) {
+ linkname = archive_entry_linkresolve(cpio->linkresolver, entry);
+ archive_entry_set_hardlink(entry, linkname);
+ }
+
+ if (S_ISLNK(st.st_mode)) {
+ int lnklen;
+
+ lnklen = readlink(srcpath, buff, sizeof(buff));
+ if (lnklen < 0) {
+ cpio_warnc(errno,
+ "%s: Couldn't read symbolic link", srcpath);
+ goto cleanup;
+ }
+ buff[lnklen] = 0;
+ archive_entry_set_symlink(entry, buff);
+ }
+
+ if (cpio->uid_override >= 0)
+ st.st_uid = cpio->uid_override;
+ if (cpio->gid_override >= 0)
+ st.st_gid = cpio->uid_override;
+ archive_entry_copy_stat(entry, &st);
+
/* Obviously, this only gets invoked in pass mode. */
if (cpio->option_link) {
/* Note: link(2) doesn't create parent directories. */
@@ -397,38 +416,68 @@ file_to_archive(struct cpio *cpio, const char *srcpath, const char *destpath)
r = archive_write_header(cpio->archive, entry);
if (r == ARCHIVE_OK)
return (0);
- cpio_warnc(cpio, archive_errno(cpio->archive),
+ cpio_warnc(archive_errno(cpio->archive),
archive_error_string(cpio->archive));
if (r == ARCHIVE_FATAL)
exit(1);
return (0);
}
+
+ /*
+ * Make sure we can open the file (if necessary) before
+ * trying to write the header.
+ */
+ if (S_ISREG(st.st_mode) && st.st_size > 0) {
+ fd = open(srcpath, O_RDONLY);
+ if (fd < 0) {
+ cpio_warnc(errno,
+ "%s: could not open file", srcpath);
+ goto cleanup;
+ }
+ }
+
+ if (!S_ISREG(st.st_mode))
+ archive_entry_set_size(entry, 0);
+
r = archive_write_header(cpio->archive, entry);
+
if (r != ARCHIVE_OK)
- cpio_warnc(cpio, archive_errno(cpio->archive),
+ cpio_warnc(archive_errno(cpio->archive),
"%s: %s",
destpath,
archive_error_string(cpio->archive));
+
if (r == ARCHIVE_FATAL)
exit(1);
- if (r == ARCHIVE_OK && S_ISREG(st.st_mode)) {
+
+ if (r >= ARCHIVE_WARN && fd >= 0 && archive_entry_size(entry) > 0) {
fd = open(srcpath, O_RDONLY);
len = read(fd, buff, sizeof(buff));
while (len > 0) {
r = archive_write_data(cpio->archive, buff, len);
- if (r != ARCHIVE_OK)
- cpio_errc(cpio, 1, 0,
+ if (r < 0)
+ cpio_errc(1, archive_errno(cpio->archive),
archive_error_string(cpio->archive));
+ if (r < len) {
+ cpio_warnc(0,
+ "Truncated write; file may have grown while being archived.");
+ }
len = read(fd, buff, sizeof(buff));
}
- close(fd);
}
- archive_entry_free(entry);
+
if (cpio->option_atime_restore) {
/* TODO: invoke utimes() ?? */
}
+
+cleanup:
if (cpio->verbose)
fprintf(stderr,"\n");
+ if (fd >= 0)
+ close(fd);
+ if (entry != NULL)
+ archive_entry_free(entry);
+
return (0);
}
@@ -444,25 +493,25 @@ mode_in(struct cpio *cpio)
ext = archive_write_disk_new();
if (ext == NULL)
- cpio_errc(cpio, 1, 0, "Couldn't allocate restore object");
+ cpio_errc(1, 0, "Couldn't allocate restore object");
r = archive_write_disk_set_options(ext, cpio->extract_flags);
if (r != ARCHIVE_OK)
- cpio_errc(cpio, 1, 0, archive_error_string(ext));
+ cpio_errc(1, 0, archive_error_string(ext));
a = archive_read_new();
if (a == NULL)
- cpio_errc(cpio, 1, 0, "Couldn't allocate archive object");
+ cpio_errc(1, 0, "Couldn't allocate archive object");
archive_read_support_compression_all(a);
archive_read_support_format_all(a);
if (archive_read_open_file(a, cpio->filename, cpio->bytes_per_block))
- cpio_errc(cpio, 1, archive_errno(a),
+ cpio_errc(1, archive_errno(a),
archive_error_string(a));
for (;;) {
r = archive_read_next_header(a, &entry);
if (r == ARCHIVE_EOF)
break;
if (r != ARCHIVE_OK) {
- cpio_errc(cpio, 1, archive_errno(a),
+ cpio_errc(1, archive_errno(a),
archive_error_string(a));
}
if (cpio->option_rename) {
@@ -474,28 +523,32 @@ mode_in(struct cpio *cpio)
continue;
if (cpio->verbose)
fprintf(stdout, "%s\n", destpath);
+ if (cpio->uid_override >= 0)
+ archive_entry_set_uid(entry, cpio->uid_override);
+ if (cpio->gid_override >= 0)
+ archive_entry_set_gid(entry, cpio->gid_override);
r = archive_write_header(ext, entry);
if (r != ARCHIVE_OK) {
fprintf(stderr, "%s: %s\n",
archive_entry_pathname(entry),
archive_error_string(ext));
- } else {
- r = copy_data(cpio, a, ext);
+ } else if (archive_entry_size(entry) > 0) {
+ r = copy_data(a, ext);
}
}
r = archive_read_close(a);
if (r != ARCHIVE_OK)
- cpio_errc(cpio, 1, 0, archive_error_string(a));
+ cpio_errc(1, 0, archive_error_string(a));
archive_read_finish(a);
r = archive_write_close(ext);
if (r != ARCHIVE_OK)
- cpio_errc(cpio, 1, 0, archive_error_string(ext));
+ cpio_errc(1, 0, archive_error_string(ext));
archive_write_finish(ext);
exit(0);
}
static int
-copy_data(struct cpio *cpio, struct archive *ar, struct archive *aw)
+copy_data(struct archive *ar, struct archive *aw)
{
int r;
size_t size;
@@ -507,13 +560,13 @@ copy_data(struct cpio *cpio, struct archive *ar, struct archive *aw)
if (r == ARCHIVE_EOF)
return (ARCHIVE_OK);
if (r != ARCHIVE_OK) {
- cpio_warnc(cpio, archive_errno(ar),
+ cpio_warnc(archive_errno(ar),
"%s", archive_error_string(ar));
return (r);
}
r = archive_write_data_block(aw, block, size, offset);
if (r != ARCHIVE_OK) {
- cpio_warnc(cpio, archive_errno(aw),
+ cpio_warnc(archive_errno(aw),
archive_error_string(aw));
return (r);
}
@@ -523,35 +576,33 @@ copy_data(struct cpio *cpio, struct archive *ar, struct archive *aw)
static void
mode_list(struct cpio *cpio)
{
- char mode[12];
struct archive *a;
struct archive_entry *entry;
int r;
a = archive_read_new();
if (a == NULL)
- cpio_errc(cpio, 1, 0, "Couldn't allocate archive object");
+ cpio_errc(1, 0, "Couldn't allocate archive object");
archive_read_support_compression_all(a);
archive_read_support_format_all(a);
if (archive_read_open_file(a, cpio->filename, cpio->bytes_per_block))
- cpio_errc(cpio, 1, archive_errno(a),
+ cpio_errc(1, archive_errno(a),
archive_error_string(a));
for (;;) {
r = archive_read_next_header(a, &entry);
if (r == ARCHIVE_EOF)
break;
if (r != ARCHIVE_OK) {
- cpio_errc(cpio, 1, archive_errno(a),
+ cpio_errc(1, archive_errno(a),
archive_error_string(a));
}
if (cpio->verbose) {
- cpio_strmode(entry, mode);
/* TODO: uname/gname lookups */
/* TODO: Clean this up. */
fprintf(stdout,
"%s%3d %8s%8s " CPIO_FILESIZE_PRINTF " %s\n",
- mode,
+ archive_entry_strmode(entry),
archive_entry_nlink(entry),
archive_entry_uname(entry),
archive_entry_gname(entry),
@@ -562,17 +613,13 @@ mode_list(struct cpio *cpio)
}
r = archive_read_close(a);
if (r != ARCHIVE_OK)
- cpio_errc(cpio, 1, 0, archive_error_string(a));
+ cpio_errc(1, 0, archive_error_string(a));
archive_read_finish(a);
exit(0);
}
/*
- * TODO: Fix hardlink handling; hardlinked source files won't
- * be hardlinked in the destination. Not clear whether existing
- * libarchive machinery can easily generalize to this case, or whether
- * I've finally found the use case that will force me to create
- * archive_read_disk.
+ * TODO: Fix hardlink handling.
*/
static int
pass_file(struct cpio *cpio, const char *pathname)
@@ -589,7 +636,7 @@ pass_file(struct cpio *cpio, const char *pathname)
free(cpio->pass_destpath);
cpio->pass_destpath = malloc(cpio->pass_destpath_alloc);
if (cpio->pass_destpath == NULL)
- cpio_errc(cpio, 1, ENOMEM,
+ cpio_errc(1, ENOMEM,
"Can't allocate path buffer");
}
if (pathname[0] == '/')
@@ -617,16 +664,18 @@ mode_pass(struct cpio *cpio, const char *destdir)
cpio->archive = archive_write_disk_new();
if (cpio->archive == NULL)
- cpio_errc(cpio, 1, 0, "Failed to allocate archive object");
+ cpio_errc(1, 0, "Failed to allocate archive object");
r = archive_write_disk_set_options(cpio->archive, cpio->extract_flags);
if (r != ARCHIVE_OK)
- cpio_errc(cpio, 1, 0, archive_error_string(cpio->archive));
+ cpio_errc(1, 0, archive_error_string(cpio->archive));
+ cpio->linkresolver = archive_entry_linkresolver_new();
archive_write_disk_set_standard_lookup(cpio->archive);
process_lines(cpio, "-", pass_file);
+ archive_entry_linkresolver_free(cpio->linkresolver);
r = archive_write_close(cpio->archive);
if (r != ARCHIVE_OK)
- cpio_errc(cpio, 1, 0, archive_error_string(cpio->archive));
+ cpio_errc(1, 0, archive_error_string(cpio->archive));
archive_write_finish(cpio->archive);
}
@@ -676,79 +725,86 @@ cpio_rename(const char *name)
return (ret);
}
+
+/*
+ * Read lines from file and do something with each one. If option_null
+ * is set, lines are terminated with zero bytes; otherwise, they're
+ * terminated with newlines.
+ *
+ * This uses a self-sizing buffer to handle arbitrarily-long lines.
+ * If the "process" function returns non-zero for any line, this
+ * function will return non-zero after attempting to process all
+ * remaining lines.
+ */
static int
-cpio_getopt(struct cpio *cpio, const char *optstring,
- const struct option **poption)
+process_lines(struct cpio *cpio, const char *pathname,
+ int (*process)(struct cpio *, const char *))
{
- char *p, *q;
- const struct option *option;
- int opt;
- int option_index;
- size_t option_length;
+ FILE *f;
+ char *buff, *buff_end, *line_start, *line_end, *p;
+ size_t buff_length, bytes_read, bytes_wanted;
+ int separator;
+ int ret;
- option_index = -1;
- *poption = NULL;
+ separator = cpio->option_null ? '\0' : '\n';
+ ret = 0;
-#ifdef HAVE_GETOPT_LONG
- opt = getopt_long(cpio->argc, cpio->argv, optstring,
- cpio_longopts, &option_index);
- if (option_index > -1)
- *poption = cpio_longopts + option_index;
-#else
- opt = getopt(cpio->argc, cpio->argv, optstring);
-#endif
-
- /* Support long options through -W longopt=value */
- if (opt == 'W') {
- p = optarg;
- q = strchr(optarg, '=');
- if (q != NULL) {
- option_length = (size_t)(q - p);
- optarg = q + 1;
- } else {
- option_length = strlen(p);
- optarg = NULL;
- }
- option = cpio_longopts;
- while (option->name != NULL &&
- (strlen(option->name) < option_length ||
- strncmp(p, option->name, option_length) != 0 )) {
- option++;
+ if (strcmp(pathname, "-") == 0)
+ f = stdin;
+ else
+ f = fopen(pathname, "r");
+ if (f == NULL)
+ cpio_errc(1, errno, "Couldn't open %s", pathname);
+ buff_length = 8192;
+ buff = malloc(buff_length);
+ if (buff == NULL)
+ cpio_errc(1, ENOMEM, "Can't read %s", pathname);
+ line_start = line_end = buff_end = buff;
+ for (;;) {
+ /* Get some more data into the buffer. */
+ bytes_wanted = buff + buff_length - buff_end;
+ bytes_read = fread(buff_end, 1, bytes_wanted, f);
+ buff_end += bytes_read;
+ /* Process all complete lines in the buffer. */
+ while (line_end < buff_end) {
+ if (*line_end == separator) {
+ *line_end = '\0';
+ if ((*process)(cpio, line_start) != 0)
+ ret = -1;
+ line_start = line_end + 1;
+ line_end = line_start;
+ } else
+ line_end++;
}
-
- if (option->name != NULL) {
- *poption = option;
- opt = option->val;
-
- /* If the first match was exact, we're done. */
- if (strncmp(p, option->name, strlen(option->name)) == 0) {
- while (option->name != NULL)
- option++;
- } else {
- /* Check if there's another match. */
- option++;
- while (option->name != NULL &&
- (strlen(option->name) < option_length ||
- strncmp(p, option->name, option_length) != 0)) {
- option++;
- }
- }
- if (option->name != NULL)
- cpio_errc(cpio, 1, 0,
- "Ambiguous option %s "
- "(matches both %s and %s)",
- p, (*poption)->name, option->name);
-
- if ((*poption)->has_arg == required_argument
- && optarg == NULL)
- cpio_errc(cpio, 1, 0,
- "Option \"%s\" requires argument", p);
+ if (feof(f))
+ break;
+ if (ferror(f))
+ cpio_errc(1, errno, "Can't read %s", pathname);
+ if (line_start > buff) {
+ /* Move a leftover fractional line to the beginning. */
+ memmove(buff, line_start, buff_end - line_start);
+ buff_end -= line_start - buff;
+ line_end -= line_start - buff;
+ line_start = buff;
} else {
- opt = '?';
- /* TODO: Set up a fake 'struct option' for
- * error reporting... ? ? ? */
+ /* Line is too big; enlarge the buffer. */
+ p = realloc(buff, buff_length *= 2);
+ if (p == NULL)
+ cpio_errc(1, ENOMEM,
+ "Line too long in %s", pathname);
+ buff_end = p + (buff_end - buff);
+ line_end = p + (line_end - buff);
+ line_start = buff = p;
}
}
-
- return (opt);
+ /* At end-of-file, handle the final line. */
+ if (line_end > line_start) {
+ *line_end = '\0';
+ if ((*process)(cpio, line_start) != 0)
+ ret = -1;
+ }
+ free(buff);
+ if (f != stdin)
+ fclose(f);
+ return (ret);
}
diff --git a/archivers/libarchive/files/cpio/cpio.h b/archivers/libarchive/files/cpio/cpio.h
index f8a1afd5f2e..624c13babae 100644
--- a/archivers/libarchive/files/cpio/cpio.h
+++ b/archivers/libarchive/files/cpio/cpio.h
@@ -46,6 +46,7 @@ struct cpio {
const char *format; /* -H format */
int bytes_per_block; /* -b block_size */
int verbose; /* -v */
+ int quiet; /* --quiet */
int extract_flags; /* Flags for extract operation */
char symlink_mode; /* H or L, per BSD conventions */
const char *compress_program;
@@ -57,22 +58,34 @@ struct cpio {
char *pass_destdir;
size_t pass_destpath_alloc;
char *pass_destpath;
+ int uid_override;
+ int gid_override;
/* If >= 0, then close this when done. */
int fd;
/* Miscellaneous state information */
struct archive *archive;
- const char *progname;
int argc;
char **argv;
int return_value; /* Value returned by main() */
+ struct archive_entry_linkresolver *linkresolver;
};
-void cpio_errc(struct cpio *, int _eval, int _code,
- const char *fmt, ...);
-void cpio_warnc(struct cpio *, int _code, const char *fmt, ...);
-void cpio_strmode(struct archive_entry *, char *);
-int process_lines(struct cpio *cpio, const char *pathname,
- int (*process)(struct cpio *, const char *));
+/* Name of this program; used in error reporting, initialized in main(). */
+const char *cpio_progname;
+void cpio_errc(int _eval, int _code, const char *fmt, ...);
+void cpio_warnc(int _code, const char *fmt, ...);
+
+int owner_parse(const char *, int *, int *);
+
+
+/* Fake short equivalents for long options that otherwise lack them. */
+enum {
+ OPTION_QUIET = 1,
+ OPTION_VERSION
+};
+
+int cpio_getopt(struct cpio *cpio);
+int pathmatch(const char *pattern, const char *s);
diff --git a/archivers/libarchive/files/cpio/cpio_platform.h b/archivers/libarchive/files/cpio/cpio_platform.h
index 42c0a6777a5..31451982982 100644
--- a/archivers/libarchive/files/cpio/cpio_platform.h
+++ b/archivers/libarchive/files/cpio/cpio_platform.h
@@ -49,7 +49,8 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h> /* For __FBSDID */
#else
-#define __FBSDID(a) /* null */
+/* Just leaving this macro replacement empty leads to a dangling semicolon. */
+#define __FBSDID(a) struct _undefined_hack
#endif
#ifdef HAVE_LIBARCHIVE
diff --git a/archivers/libarchive/files/cpio/err.c b/archivers/libarchive/files/cpio/err.c
new file mode 100644
index 00000000000..ad9c0e193e1
--- /dev/null
+++ b/archivers/libarchive/files/cpio/err.c
@@ -0,0 +1,73 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "cpio_platform.h"
+__FBSDID("$FreeBSD$");
+
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "cpio.h"
+
+static void
+cpio_vwarnc(int code, const char *fmt, va_list ap)
+{
+ fprintf(stderr, "%s: ", cpio_progname);
+ vfprintf(stderr, fmt, ap);
+ if (code != 0)
+ fprintf(stderr, ": %s", strerror(code));
+ fprintf(stderr, "\n");
+}
+
+void
+cpio_warnc(int code, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ cpio_vwarnc(code, fmt, ap);
+ va_end(ap);
+}
+
+void
+cpio_errc(int eval, int code, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ cpio_vwarnc(code, fmt, ap);
+ va_end(ap);
+ exit(eval);
+}
diff --git a/archivers/libarchive/files/cpio/match.c b/archivers/libarchive/files/cpio/match.c
new file mode 100644
index 00000000000..0e647c9cbab
--- /dev/null
+++ b/archivers/libarchive/files/cpio/match.c
@@ -0,0 +1,87 @@
+#include "cpio.h"
+
+int
+pathmatch(const char *p, const char *s)
+{
+ int r;
+ int matched;
+ const char *end;
+
+ for (;;) {
+ switch (*p) {
+ case '[':
+ ++p;
+ end = p;
+ /* Leading ']' is non-special. */
+ if (*end == ']')
+ ++end;
+ while (*end != '\0' && *end != ']')
+ ++end;
+ if (*end == '\0') { /* Unmatched '[' is plain char */
+ if (*s != '[')
+ return (0);
+ ++s;
+ break;
+ }
+ matched = 0;
+ while (!matched) {
+ switch (*p) {
+ case ']':
+ if (p == end)
+ return (0);
+ else if (*s == ']') {
+ p = end + 1;
+ matched = 1;
+ ++s;
+ } else
+ ++p;
+ break;
+ default:
+ /* Trailing - is not special. */
+ if (p[1] == '-' && p + 2 < end) {
+ if (p[0] <= *s && *s <= p[2]) {
+ p = end + 1;
+ matched = 1;
+ ++s;
+ } else
+ p += 3;
+ } else {
+ if (*p == *s) {
+ p = end + 1;
+ matched = 1;
+ ++s;
+ } else
+ ++p;
+ }
+ }
+ }
+ break;
+ case '*':
+ while (*p == '*')
+ ++p;
+ if (*p == '\0')
+ return (1);
+ while (*s) {
+ r = pathmatch(p, s);
+ if (r)
+ return (r);
+ ++s;
+ }
+ return (0);
+ break;
+ case '?':
+ ++p;
+ ++s;
+ break;
+ case '\0':
+ return (*s == '\0');
+ break;
+ default:
+ if (*p != *s)
+ return (0);
+ ++p;
+ ++s;
+ break;
+ }
+ }
+}
diff --git a/archivers/libarchive/files/cpio/test/list.h b/archivers/libarchive/files/cpio/test/list.h
new file mode 100644
index 00000000000..f0620311681
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/list.h
@@ -0,0 +1,11 @@
+DEFINE_TEST(test_basic)
+DEFINE_TEST(test_gcpio_compat)
+DEFINE_TEST(test_help)
+DEFINE_TEST(test_option_B)
+DEFINE_TEST(test_option_d)
+DEFINE_TEST(test_option_m)
+DEFINE_TEST(test_option_t)
+DEFINE_TEST(test_owner_parse)
+DEFINE_TEST(test_pathmatch)
+DEFINE_TEST(test_version)
+DEFINE_TEST(test_write_odc)
diff --git a/archivers/libarchive/files/cpio/test/main.c b/archivers/libarchive/files/cpio/test/main.c
new file mode 100644
index 00000000000..6eb7b5d5e57
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/main.c
@@ -0,0 +1,692 @@
+/*
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Various utility routines useful for test programs.
+ * Each test program is linked against this file.
+ */
+#include <errno.h>
+#include <stdarg.h>
+#include <time.h>
+
+#include "test.h"
+__FBSDID("$FreeBSD: src/lib/libarchive/test/main.c,v 1.8 2007/07/31 05:03:27 kientzle Exp $");
+
+/*
+ * "list.h" is simply created by "grep DEFINE_TEST"; it has
+ * a line like
+ * DEFINE_TEST(test_function)
+ * for each test.
+ * Include it here with a suitable DEFINE_TEST to declare all of the
+ * test functions.
+ */
+#undef DEFINE_TEST
+#define DEFINE_TEST(name) void name(void);
+#include "list.h"
+
+/* Interix doesn't define these in a standard header. */
+#if __INTERIX__
+extern char *optarg;
+extern int optind;
+#endif
+
+/* Default is to crash and try to force a core dump on failure. */
+static int dump_on_failure = 1;
+/* Default is to print some basic information about each test. */
+static int quiet_flag = 0;
+/* Cumulative count of component failures. */
+static int failures = 0;
+/* Cumulative count of skipped component tests. */
+static int skips = 0;
+
+/*
+ * My own implementation of the standard assert() macro emits the
+ * message in the same format as GCC (file:line: message).
+ * It also includes some additional useful information.
+ * This makes it a lot easier to skim through test failures in
+ * Emacs. ;-)
+ *
+ * It also supports a few special features specifically to simplify
+ * test harnesses:
+ * failure(fmt, args) -- Stores a text string that gets
+ * printed if the following assertion fails, good for
+ * explaining subtle tests.
+ */
+static char msg[4096];
+
+/*
+ * For each test source file, we remember how many times each
+ * failure was reported.
+ */
+static const char *failed_filename;
+static struct line {
+ int line;
+ int count;
+} failed_lines[1000];
+
+/*
+ * Count this failure; return the number of previous failures.
+ */
+static int
+previous_failures(const char *filename, int line)
+{
+ unsigned int i;
+ int count;
+
+ if (failed_filename == NULL || strcmp(failed_filename, filename) != 0)
+ memset(failed_lines, 0, sizeof(failed_lines));
+ failed_filename = filename;
+
+ for (i = 0; i < sizeof(failed_lines)/sizeof(failed_lines[0]); i++) {
+ if (failed_lines[i].line == line) {
+ count = failed_lines[i].count;
+ failed_lines[i].count++;
+ return (count);
+ }
+ if (failed_lines[i].line == 0) {
+ failed_lines[i].line = line;
+ failed_lines[i].count = 1;
+ return (0);
+ }
+ }
+ return (0);
+}
+
+/*
+ * Inform user that we're skipping a test.
+ */
+void
+test_skipping(const char *fmt, ...)
+{
+ va_list ap;
+
+ if (previous_failures(test_filename, test_line))
+ return;
+
+ va_start(ap, fmt);
+ fprintf(stderr, " *** SKIPPING: ");
+ vfprintf(stderr, fmt, ap);
+ fprintf(stderr, "\n");
+ va_end(ap);
+ ++skips;
+}
+
+/* Common handling of failed tests. */
+static void
+report_failure(void *extra)
+{
+ if (msg[0] != '\0') {
+ fprintf(stderr, " Description: %s\n", msg);
+ msg[0] = '\0';
+ }
+
+ (void)extra; /* UNUSED */
+
+ if (dump_on_failure) {
+ fprintf(stderr,
+ " *** forcing core dump so failure can be debugged ***\n");
+ *(char *)(NULL) = 0;
+ exit(1);
+ }
+}
+
+/*
+ * Summarize repeated failures in the just-completed test file.
+ * The reports above suppress multiple failures from the same source
+ * line; this reports on any tests that did fail multiple times.
+ */
+static int
+summarize_comparator(const void *a0, const void *b0)
+{
+ const struct line *a = a0, *b = b0;
+ if (a->line == 0 && b->line == 0)
+ return (0);
+ if (a->line == 0)
+ return (1);
+ if (b->line == 0)
+ return (-1);
+ return (a->line - b->line);
+}
+
+static void
+summarize(void)
+{
+ unsigned int i;
+
+ qsort(failed_lines, sizeof(failed_lines)/sizeof(failed_lines[0]),
+ sizeof(failed_lines[0]), summarize_comparator);
+ for (i = 0; i < sizeof(failed_lines)/sizeof(failed_lines[0]); i++) {
+ if (failed_lines[i].line == 0)
+ break;
+ if (failed_lines[i].count > 1)
+ fprintf(stderr, "%s:%d: Failed %d times\n",
+ failed_filename, failed_lines[i].line,
+ failed_lines[i].count);
+ }
+ /* Clear the failure history for the next file. */
+ memset(failed_lines, 0, sizeof(failed_lines));
+}
+
+/* Set up a message to display only after a test fails. */
+void
+failure(const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ vsprintf(msg, fmt, ap);
+ va_end(ap);
+}
+
+/* Generic assert() just displays the failed condition. */
+void
+test_assert(const char *file, int line, int value, const char *condition, void *extra)
+{
+ if (value) {
+ msg[0] = '\0';
+ return;
+ }
+ failures ++;
+ if (previous_failures(file, line))
+ return;
+ fprintf(stderr, "%s:%d: Assertion failed\n", file, line);
+ fprintf(stderr, " Condition: %s\n", condition);
+ report_failure(extra);
+}
+
+/* assertEqualInt() displays the values of the two integers. */
+void
+test_assert_equal_int(const char *file, int line,
+ int v1, const char *e1, int v2, const char *e2, void *extra)
+{
+ if (v1 == v2) {
+ msg[0] = '\0';
+ return;
+ }
+ failures ++;
+ if (previous_failures(file, line))
+ return;
+ fprintf(stderr, "%s:%d: Assertion failed: Ints not equal\n",
+ file, line);
+ fprintf(stderr, " %s=%d\n", e1, v1);
+ fprintf(stderr, " %s=%d\n", e2, v2);
+ report_failure(extra);
+}
+
+/* assertEqualString() displays the values of the two strings. */
+void
+test_assert_equal_string(const char *file, int line,
+ const char *v1, const char *e1,
+ const char *v2, const char *e2,
+ void *extra)
+{
+ if (v1 == NULL || v2 == NULL) {
+ if (v1 == v2) {
+ msg[0] = '\0';
+ return;
+ }
+ } else if (strcmp(v1, v2) == 0) {
+ msg[0] = '\0';
+ return;
+ }
+ failures ++;
+ if (previous_failures(file, line))
+ return;
+ fprintf(stderr, "%s:%d: Assertion failed: Strings not equal\n",
+ file, line);
+ fprintf(stderr, " %s = \"%s\"\n", e1, v1);
+ fprintf(stderr, " %s = \"%s\"\n", e2, v2);
+ report_failure(extra);
+}
+
+/* assertEqualWString() displays the values of the two strings. */
+void
+test_assert_equal_wstring(const char *file, int line,
+ const wchar_t *v1, const char *e1,
+ const wchar_t *v2, const char *e2,
+ void *extra)
+{
+ if (wcscmp(v1, v2) == 0) {
+ msg[0] = '\0';
+ return;
+ }
+ failures ++;
+ if (previous_failures(file, line))
+ return;
+ fprintf(stderr, "%s:%d: Assertion failed: Unicode strings not equal\n",
+ file, line);
+ fwprintf(stderr, L" %s = \"%ls\"\n", e1, v1);
+ fwprintf(stderr, L" %s = \"%ls\"\n", e2, v2);
+ report_failure(extra);
+}
+
+/*
+ * Pretty standard hexdump routine. As a bonus, if ref != NULL, then
+ * any bytes in p that differ from ref will be highlighted with '_'
+ * before and after the hex value.
+ */
+static void
+hexdump(const char *p, const char *ref, size_t l, size_t offset)
+{
+ size_t i, j;
+ char sep;
+
+ for(i=0; i < l; i+=16) {
+ fprintf(stderr, "%04x", i + offset);
+ sep = ' ';
+ for (j = 0; j < 16 && i + j < l; j++) {
+ if (ref != NULL && p[i + j] != ref[i + j])
+ sep = '_';
+ fprintf(stderr, "%c%02x", sep, p[i+j]);
+ if (ref != NULL && p[i + j] == ref[i + j])
+ sep = ' ';
+ }
+ for (; j < 16; j++) {
+ fprintf(stderr, "%c ", sep);
+ sep = ' ';
+ }
+ fprintf(stderr, "%c", sep);
+ for (j=0; j < 16 && i + j < l; j++) {
+ int c = p[i + j];
+ if (c >= ' ' && c <= 126)
+ fprintf(stderr, "%c", c);
+ else
+ fprintf(stderr, ".");
+ }
+ fprintf(stderr, "\n");
+ }
+}
+
+/* assertEqualMem() displays the values of the two memory blocks. */
+/* TODO: For long blocks, hexdump the first bytes that actually differ. */
+void
+test_assert_equal_mem(const char *file, int line,
+ const char *v1, const char *e1,
+ const char *v2, const char *e2,
+ size_t l, const char *ld, void *extra)
+{
+ if (v1 == NULL || v2 == NULL) {
+ if (v1 == v2) {
+ msg[0] = '\0';
+ return;
+ }
+ } else if (memcmp(v1, v2, l) == 0) {
+ msg[0] = '\0';
+ return;
+ }
+ failures ++;
+ if (previous_failures(file, line))
+ return;
+ fprintf(stderr, "%s:%d: Assertion failed: memory not equal\n",
+ file, line);
+ fprintf(stderr, " size %s = %d\n", ld, (int)l);
+ fprintf(stderr, " Dump of %s\n", e1);
+ hexdump(v1, v2, l < 32 ? l : 32, 0);
+ fprintf(stderr, " Dump of %s\n", e2);
+ hexdump(v2, v1, l < 32 ? l : 32, 0);
+ fprintf(stderr, "\n");
+ report_failure(extra);
+}
+
+void
+test_assert_empty_file(const char *f1fmt, ...)
+{
+ char f1[1024];
+ struct stat st;
+ va_list ap;
+
+ va_start(ap, f1fmt);
+ vsprintf(f1, f1fmt, ap);
+ va_end(ap);
+
+ if (stat(f1, &st) != 0) {
+ fprintf(stderr, "%s:%d: Could not stat: %s\n", test_filename, test_line, f1);
+ report_failure(NULL);
+ } else if (st.st_size > 0) {
+ fprintf(stderr, "%s:%d: File not empty: %s\n", test_filename, test_line, f1);
+ fprintf(stderr, " File size: %d\n", (int)st.st_size);
+ report_failure(NULL);
+ }
+}
+
+/* assertEqualFile() asserts that two files have the same contents. */
+/* TODO: hexdump the first bytes that actually differ. */
+void
+test_assert_equal_file(const char *f1, const char *f2pattern, ...)
+{
+ char f2[1024];
+ va_list ap;
+ char buff1[1024];
+ char buff2[1024];
+ int fd1, fd2;
+ int n1, n2;
+
+ va_start(ap, f2pattern);
+ vsprintf(f2, f2pattern, ap);
+ va_end(ap);
+
+ fd1 = open(f1, O_RDONLY);
+ fd2 = open(f2, O_RDONLY);
+ for (;;) {
+ n1 = read(fd1, buff1, sizeof(buff1));
+ n2 = read(fd2, buff2, sizeof(buff2));
+ if (n1 != n2)
+ break;
+ if (n1 == 0 && n2 == 0)
+ return;
+ if (memcmp(buff1, buff2, n1) != 0)
+ break;
+ }
+ fprintf(stderr, "%s:%d: Files are not identical\n", test_filename, test_line);
+ fprintf(stderr, " file1=\"%s\"\n", f1);
+ fprintf(stderr, " file2=\"%s\"\n", f2);
+ report_failure(test_extra);
+}
+
+
+/*
+ * Call standard system() call, but build up the command line using
+ * sprintf() conventions.
+ */
+int
+systemf(const char *fmt, ...)
+{
+ char buff[8192];
+ va_list ap;
+ int r;
+
+ va_start(ap, fmt);
+ vsprintf(buff, fmt, ap);
+ r = system(buff);
+ va_end(ap);
+ return (r);
+}
+
+/*
+ * Slurp a file into memory for ease of comparison and testing.
+ * Returns size of file in 'sizep' if non-NULL, null-terminates
+ * data in memory for ease of use.
+ */
+char *
+slurpfile(size_t * sizep, const char *fmt, ...)
+{
+ char filename[8192];
+ struct stat st;
+ va_list ap;
+ char *p;
+ ssize_t bytes_read;
+ int fd;
+ int r;
+
+ va_start(ap, fmt);
+ vsprintf(filename, fmt, ap);
+ va_end(ap);
+
+ fd = open(filename, O_RDONLY);
+ if (fd < 0) {
+ /* Note: No error; non-existent file is okay here. */
+ return (NULL);
+ }
+ r = fstat(fd, &st);
+ if (r != 0) {
+ fprintf(stderr, "Can't stat file %s\n", filename);
+ close(fd);
+ return (NULL);
+ }
+ p = malloc(st.st_size + 1);
+ if (p == NULL) {
+ fprintf(stderr, "Can't allocate %ld bytes of memory to read file %s\n", (long int)st.st_size, filename);
+ close(fd);
+ return (NULL);
+ }
+ bytes_read = read(fd, p, st.st_size);
+ if (bytes_read < st.st_size) {
+ fprintf(stderr, "Can't read file %s\n", filename);
+ close(fd);
+ free(p);
+ return (NULL);
+ }
+ p[st.st_size] = '\0';
+ if (sizep != NULL)
+ *sizep = (size_t)st.st_size;
+ close(fd);
+ return (p);
+}
+
+/*
+ * "list.h" is automatically generated; it just has a lot of lines like:
+ * DEFINE_TEST(function_name)
+ * It's used above to declare all of the test functions.
+ * We reuse it here to define a list of all tests (functions and names).
+ */
+#undef DEFINE_TEST
+#define DEFINE_TEST(n) { n, #n },
+struct { void (*func)(void); const char *name; } tests[] = {
+ #include "list.h"
+};
+
+/*
+ * Each test is run in a private work dir. Those work dirs
+ * do have consistent and predictable names, in case a group
+ * of tests need to collaborate. However, there is no provision
+ * for requiring that tests run in a certain order.
+ */
+static int test_run(int i, const char *tmpdir)
+{
+ int failures_before = failures;
+
+ if (!quiet_flag)
+ printf("%d: %s\n", i, tests[i].name);
+ /*
+ * Always explicitly chdir() in case the last test moved us to
+ * a strange place.
+ */
+ if (chdir(tmpdir)) {
+ fprintf(stderr,
+ "ERROR: Couldn't chdir to temp dir %s\n",
+ tmpdir);
+ exit(1);
+ }
+ /* Create a temp directory for this specific test. */
+ if (mkdir(tests[i].name, 0755)) {
+ fprintf(stderr,
+ "ERROR: Couldn't create temp dir ``%s''\n",
+ tests[i].name);
+ exit(1);
+ }
+ /* Chdir() to that work directory. */
+ if (chdir(tests[i].name)) {
+ fprintf(stderr,
+ "ERROR: Couldn't chdir to temp dir ``%s''\n",
+ tests[i].name);
+ exit(1);
+ }
+ /* Run the actual test. */
+ (*tests[i].func)();
+ /* Summarize the results of this test. */
+ summarize();
+ /* Return appropriate status. */
+ return (failures == failures_before ? 0 : 1);
+}
+
+static void usage(const char *program)
+{
+ static const int limit = sizeof(tests) / sizeof(tests[0]);
+ int i;
+
+ printf("Usage: %s [options] <test> <test> ...\n", program);
+ printf("Default is to run all tests.\n");
+ printf("Otherwise, specify the numbers of the tests you wish to run.\n");
+ printf("Options:\n");
+ printf(" -k Keep running after failures.\n");
+ printf(" Default: Core dump after any failure.\n");
+ printf(" -p <path> Path to executable to be tested.\n");
+ printf(" Default: path taken from BSDCPIO environment variable.\n");
+ printf(" -q Quiet.\n");
+ printf(" -r <dir> Path to dir containing reference files.\n");
+ printf(" Default: Current directory.\n");
+ printf("Available tests:\n");
+ for (i = 0; i < limit; i++)
+ printf(" %d: %s\n", i, tests[i].name);
+ exit(1);
+}
+
+int main(int argc, char **argv)
+{
+ static const int limit = sizeof(tests) / sizeof(tests[0]);
+ int i, tests_run = 0, tests_failed = 0, opt;
+ time_t now;
+ char *progname, *p;
+ char tmpdir[256];
+ char tmpdir_timestamp[256];
+
+ /*
+ * Name of this program, used to build root of our temp directory
+ * tree.
+ */
+ progname = p = argv[0];
+ while (*p != '\0') {
+ if (*p == '/')
+ progname = p + 1;
+ ++p;
+ }
+
+ /* Get the target program from environment, if available. */
+ testprog = getenv("BSDCPIO");
+
+ /* Get the directory holding test files from environment. */
+ refdir = getenv("BSDCPIO_TEST_FILES");
+
+ /*
+ * Parse options.
+ */
+ while ((opt = getopt(argc, argv, "kp:qr:")) != -1) {
+ switch (opt) {
+ case 'k':
+ dump_on_failure = 0;
+ break;
+ case 'p':
+ testprog = optarg;
+ break;
+ case 'q':
+ quiet_flag++;
+ break;
+ case 'r':
+ refdir = optarg;
+ break;
+ case '?':
+ default:
+ usage(progname);
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ /*
+ * Sanity-check that our options make sense.
+ */
+ if (testprog == NULL)
+ usage(progname);
+
+
+ /*
+ * Create a temp directory for the following tests.
+ * Include the time the tests started as part of the name,
+ * to make it easier to track the results of multiple tests.
+ */
+ now = time(NULL);
+ for (i = 0; i < 1000; i++) {
+ strftime(tmpdir_timestamp, sizeof(tmpdir_timestamp),
+ "%Y-%m-%dT%H.%M.%S",
+ localtime(&now));
+ sprintf(tmpdir, "/tmp/%s.%s-%03d", progname, tmpdir_timestamp, i);
+ if (mkdir(tmpdir,0755) == 0)
+ break;
+ if (errno == EEXIST)
+ continue;
+ fprintf(stderr, "ERROR: Unable to create temp directory %s\n",
+ tmpdir);
+ exit(1);
+ }
+
+ /*
+ * If the user didn't specify a directory for locating
+ * reference files, use the current directory for that.
+ */
+ if (refdir == NULL) {
+ systemf("/bin/pwd > %s/refdir", tmpdir);
+ refdir = slurpfile(NULL, "%s/refdir", tmpdir);
+ p = refdir + strlen(refdir);
+ while (p[-1] == '\n') {
+ --p;
+ *p = '\0';
+ }
+ }
+
+ /*
+ * Banner with basic information.
+ */
+ if (!quiet_flag) {
+ printf("Running tests in: %s\n", tmpdir);
+ printf("Reference files will be read from: %s\n", refdir);
+ printf("Running tests on: %s\n", testprog);
+ }
+
+ /*
+ * Run some or all of the individual tests.
+ */
+ if (argc == 0) {
+ /* Default: Run all tests. */
+ for (i = 0; i < limit; i++) {
+ if (test_run(i, tmpdir))
+ tests_failed++;
+ tests_run++;
+ }
+ } else {
+ while (*(argv) != NULL) {
+ i = atoi(*argv);
+ if (**argv < '0' || **argv > '9' || i < 0 || i >= limit) {
+ printf("*** INVALID Test %s\n", *argv);
+ usage(progname);
+ } else {
+ if (test_run(i, tmpdir))
+ tests_failed++;
+ tests_run++;
+ }
+ argv++;
+ }
+ }
+
+ /*
+ * Report summary statistics.
+ */
+ if (!quiet_flag) {
+ printf("\n");
+ printf("%d of %d test groups reported failures\n",
+ tests_failed, tests_run);
+ printf(" Total of %d individual tests failed.\n", failures);
+ printf(" Total of %d individual tests were skipped.\n", skips);
+ }
+ return (tests_failed);
+}
diff --git a/archivers/libarchive/files/cpio/test/test.h b/archivers/libarchive/files/cpio/test/test.h
new file mode 100644
index 00000000000..77205550465
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test.h
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2003-2006 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD: src/lib/libarchive/test/test.h,v 1.6 2007/07/14 17:52:01 kientzle Exp $
+ */
+
+/* Every test program should #include "test.h" as the first thing. */
+
+/*
+ * The goal of this file (and the matching test.c) is to
+ * simplify the very repetitive test-*.c test programs.
+ */
+
+#define _FILE_OFFSET_BITS 64
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <wchar.h>
+
+#ifdef USE_DMALLOC
+#include <dmalloc.h>
+#endif
+
+#if defined(HAVE_CONFIG_H)
+/* Most POSIX platforms use the 'configure' script to build config.h */
+#include "../../config.h"
+#elif defined(__FreeBSD__)
+/* Building as part of FreeBSD system requires a pre-built config.h. */
+#include "../config_freebsd.h"
+#elif defined(_WIN32)
+/* Win32 can't run the 'configure' script. */
+#include "../config_windows.h"
+#else
+/* Warn if the library hasn't been (automatically or manually) configured. */
+#error Oops: No config.h and no pre-built configuration in test.h.
+#endif
+
+/* No non-FreeBSD platform will have __FBSDID, so just define it here. */
+#ifdef __FreeBSD__
+#include <sys/cdefs.h> /* For __FBSDID */
+#else
+#define __FBSDID(a) /* null */
+#endif
+
+/*
+ * Redefine DEFINE_TEST for use in defining the test functions.
+ */
+#undef DEFINE_TEST
+#define DEFINE_TEST(name) void name(void); void name(void)
+
+/* An implementation of the standard assert() macro */
+#define assert(e) test_assert(__FILE__, __LINE__, (e), #e, NULL)
+
+/* Assert two integers are the same. Reports value of each one if not. */
+#define assertEqualInt(v1,v2) \
+ test_assert_equal_int(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
+
+/* Assert two strings are the same. Reports value of each one if not. */
+#define assertEqualString(v1,v2) \
+ test_assert_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
+/* As above, but v1 and v2 are wchar_t * */
+#define assertEqualWString(v1,v2) \
+ test_assert_equal_wstring(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
+/* As above, but raw blocks of bytes. */
+#define assertEqualMem(v1, v2, l) \
+ test_assert_equal_mem(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (l), #l, NULL)
+/* Assert two files are the same; allow printf-style expansion of second name.
+ * See below for comments about variable arguments here...
+ */
+#define assertEqualFile \
+ test_extra=NULL;test_filename=__FILE__;test_line=__LINE__;test_assert_equal_file
+/* Assert that a file is empty; supports printf-style arguments. */
+#define assertEmptyFile \
+ test_extra=NULL;test_filename=__FILE__;test_line=__LINE__;test_assert_empty_file
+
+/*
+ * This would be simple with C99 variadic macros, but I don't want to
+ * require that. Instead, I just assign the file/line values here and
+ * then replace the function call without trying to pass the variable
+ * arguments through the macro. Crude, but effective.
+ */
+#define skipping \
+ test_extra=NULL;test_filename=__FILE__;test_line=__LINE__;test_skipping
+
+/* Function declarations. These are defined in test_utility.c. */
+void failure(const char *fmt, ...);
+void test_skipping(const char *fmt, ...);
+void test_assert(const char *, int, int, const char *, void *);
+void test_assert_empty_file(const char *, ...);
+void test_assert_equal_file(const char *, const char *, ...);
+void test_assert_equal_int(const char *, int, int, const char *, int, const char *, void *);
+void test_assert_equal_string(const char *, int, const char *v1, const char *, const char *v2, const char *, void *);
+void test_assert_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *);
+void test_assert_equal_mem(const char *, int, const char *, const char *, const char *, const char *, size_t, const char *, void *);
+
+/* Like sprintf, then system() */
+int systemf(const char * fmt, ...);
+
+/* Suck file into string allocated via malloc(). Call free() when done. */
+/* Supports printf-style args: slurpfile(NULL, "%s/myfile", refdir); */
+char *slurpfile(size_t *, const char *fmt, ...);
+
+/*
+ * Global vars
+ */
+
+/* Directory holding reference files. */
+char *refdir;
+/* Filename, line number, pointer to extra data for failure reports. */
+const char *test_filename;
+int test_line;
+void *test_extra;
+
+/*
+ * Special interfaces for bsdcpio test harness.
+ */
+
+/* Pathname of exe to be tested. */
+char *testprog;
+
diff --git a/archivers/libarchive/files/cpio/test/test_basic.c b/archivers/libarchive/files/cpio/test/test_basic.c
new file mode 100644
index 00000000000..492861e0673
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_basic.c
@@ -0,0 +1,159 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD$");
+
+
+static void
+basic_cpio(const char *target, const char *pack_options, const char *unpack_options)
+{
+ struct stat st, st2;
+ char buff[128];
+ int r;
+
+ assertEqualInt(0, mkdir(target, 0775));
+
+ /* Use the cpio program to create an archive. */
+ r = systemf("%s -o %s < filelist >%s/archive 2>%s/pack.err", testprog, pack_options, target, target);
+ failure("Error invoking %s -o %s", testprog, pack_options);
+ assertEqualInt(r, 0);
+
+ chdir(target);
+
+ /* Verify that nothing went to stderr. */
+ assertEmptyFile("pack.err");
+
+ /*
+ * Use cpio to unpack the archive into another directory.
+ */
+ r = systemf("%s -i %s< archive >unpack.out 2>unpack.err", testprog, unpack_options);
+ failure("Error invoking %s -i %s", testprog, unpack_options);
+ assertEqualInt(r, 0);
+
+ /* Verify that nothing went to stderr. */
+ assertEmptyFile("unpack.err");
+
+ /*
+ * Verify unpacked files.
+ */
+
+ /* Regular file with 2 links. */
+ r = lstat("file", &st);
+ failure("Failed to stat file %s/file, errno=%d", target, errno);
+ assertEqualInt(r, 0);
+ if (r == 0) {
+ assert(S_ISREG(st.st_mode));
+ assertEqualInt(0644, st.st_mode & 0777);
+ assertEqualInt(10, st.st_size);
+ failure("file %s/file", target);
+ assertEqualInt(2, st.st_nlink);
+ }
+
+ /* Another name for the same file. */
+ r = lstat("linkfile", &st2);
+ failure("Failed to stat file %s/linkfile, errno=%d", target, errno);
+ assertEqualInt(r, 0);
+ if (r == 0) {
+ assert(S_ISREG(st2.st_mode));
+ assertEqualInt(0644, st2.st_mode & 0777);
+ assertEqualInt(10, st2.st_size);
+ failure("file %s/linkfile", target);
+ assertEqualInt(2, st2.st_nlink);
+ /* Verify that the two are really hardlinked. */
+ assertEqualInt(st.st_dev, st2.st_dev);
+ failure("%s/linkfile and %s/file aren't really hardlinks", target, target);
+ assertEqualInt(st.st_ino, st2.st_ino);
+ }
+
+ /* Symlink */
+ r = lstat("symlink", &st);
+ failure("Failed to stat file %s/symlink, errno=%d", target, errno);
+ assertEqualInt(r, 0);
+ if (r == 0) {
+ failure("symlink should be a symlink; actual mode is %o",
+ st.st_mode);
+ assert(S_ISLNK(st.st_mode));
+ if (S_ISLNK(st.st_mode)) {
+ r = readlink("symlink", buff, sizeof(buff));
+ assertEqualInt(r, 4);
+ buff[r] = '\0';
+ assertEqualString(buff, "file");
+ }
+ }
+
+ /* dir */
+ r = lstat("dir", &st);
+ if (r == 0) {
+ assertEqualInt(r, 0);
+ assert(S_ISDIR(st.st_mode));
+ assertEqualInt(0775, st.st_mode & 0777);
+ }
+
+ chdir("..");
+}
+
+DEFINE_TEST(test_basic)
+{
+ int fd;
+ int filelist;
+ int oldumask;
+
+ oldumask = umask(0);
+
+ /*
+ * Create an assortment of files on disk.
+ */
+ filelist = open("filelist", O_CREAT | O_WRONLY, 0644);
+
+ /* File with 10 bytes content. */
+ fd = open("file", O_CREAT | O_WRONLY, 0644);
+ assert(fd >= 0);
+ assertEqualInt(10, write(fd, "123456789", 10));
+ close(fd);
+ write(filelist, "file\n", 5);
+
+ /* hardlink to above file. */
+ assertEqualInt(0, link("file", "linkfile"));
+ write(filelist, "linkfile\n", 9);
+
+ /* Symlink to above file. */
+ assertEqualInt(0, symlink("file", "symlink"));
+ write(filelist, "symlink\n", 8);
+
+ /* Directory. */
+ assertEqualInt(0, mkdir("dir", 0775));
+ write(filelist, "dir\n", 4);
+ /* All done. */
+ close(filelist);
+
+ /* Archive/dearchive with a variety of options. */
+ basic_cpio("copy", "", "");
+ basic_cpio("copy_odc", "--format=odc", "");
+ basic_cpio("copy_newc", "-H newc", "");
+ basic_cpio("copy_cpio", "-H cpio", "");
+ basic_cpio("copy_ustar", "-H ustar", "");
+
+ umask(oldumask);
+}
diff --git a/archivers/libarchive/files/cpio/test/test_gcpio_compat.c b/archivers/libarchive/files/cpio/test/test_gcpio_compat.c
new file mode 100644
index 00000000000..ebc53575f66
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_gcpio_compat.c
@@ -0,0 +1,126 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD$");
+
+
+static void
+unpack_test(const char *from, const char *options)
+{
+ struct stat st, st2;
+ char buff[128];
+ int r;
+
+ /* Create a work dir named after the file we're unpacking. */
+ assertEqualInt(0, mkdir(from, 0775));
+ chdir(from);
+
+ /*
+ * Use cpio to unpack the sample archive
+ */
+ r = systemf("%s -i %s < %s/%s >unpack.out 2>unpack.err",
+ testprog, options, refdir, from);
+ failure("Error invoking %s -i %s < %s/%s", testprog, options, refdir, from);
+ assertEqualInt(r, 0);
+
+ /* Verify that nothing went to stderr. */
+ assertEmptyFile("unpack.err");
+
+ /*
+ * Verify unpacked files.
+ */
+
+ /* Regular file with 2 links. */
+ r = lstat("file", &st);
+ failure("Failed to stat file %s/file, errno=%d", from, errno);
+ assertEqualInt(r, 0);
+ if (r == 0) {
+ assert(S_ISREG(st.st_mode));
+ assertEqualInt(0644, st.st_mode & 0777);
+ failure("file %s/file", from);
+ assertEqualInt(10, st.st_size);
+ failure("file %s/file", from);
+ assertEqualInt(2, st.st_nlink);
+ }
+
+ /* Another name for the same file. */
+ r = lstat("linkfile", &st2);
+ failure("Failed to stat file %s/linkfile, errno=%d", from, errno);
+ assertEqualInt(r, 0);
+ if (r == 0) {
+ assert(S_ISREG(st2.st_mode));
+ assertEqualInt(0644, st2.st_mode & 0777);
+ failure("file %s/file", from);
+ assertEqualInt(10, st2.st_size);
+ failure("file %s/file", from);
+ assertEqualInt(2, st2.st_nlink);
+ /* Verify that the two are really hardlinked. */
+ assertEqualInt(st.st_dev, st2.st_dev);
+ failure("file %s/file", from);
+ assertEqualInt(st.st_ino, st2.st_ino);
+ }
+
+ /* Symlink */
+ r = lstat("symlink", &st);
+ failure("Failed to stat file %s/symlink, errno=%d", from, errno);
+ assertEqualInt(r, 0);
+ if (r == 0) {
+ failure("symlink should be a symlink; actual mode is %o",
+ st.st_mode);
+ assert(S_ISLNK(st.st_mode));
+ if (S_ISLNK(st.st_mode)) {
+ r = readlink("symlink", buff, sizeof(buff));
+ assertEqualInt(r, 4);
+ buff[r] = '\0';
+ assertEqualString(buff, "file");
+ }
+ }
+
+ /* dir */
+ r = lstat("dir", &st);
+ if (r == 0) {
+ assertEqualInt(r, 0);
+ assert(S_ISDIR(st.st_mode));
+ assertEqualInt(0775, st.st_mode & 0777);
+ }
+
+ chdir("..");
+}
+
+DEFINE_TEST(test_gcpio_compat)
+{
+ int oldumask;
+
+ oldumask = umask(0);
+
+ /* Dearchive sample files with a variety of options. */
+ unpack_test("test_gcpio_compat_ref.bin", "");
+ /* TODO: Fix the next two. */
+ /* unpack_test("test_gcpio_compat_ref.crc", ""); */
+ /* unpack_test("test_gcpio_compat_ref.newc", ""); */
+ unpack_test("test_gcpio_compat_ref.ustar", "");
+
+ umask(oldumask);
+}
diff --git a/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.bin b/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.bin
new file mode 100644
index 00000000000..4fbd9b5270d
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.bin
Binary files differ
diff --git a/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.crc b/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.crc
new file mode 100644
index 00000000000..7125f82119f
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.crc
Binary files differ
diff --git a/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.newc b/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.newc
new file mode 100644
index 00000000000..22bf2c413cb
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.newc
Binary files differ
diff --git a/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.ustar b/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.ustar
new file mode 100644
index 00000000000..bb1fba943f7
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.ustar
Binary files differ
diff --git a/archivers/libarchive/files/cpio/test/test_help.c b/archivers/libarchive/files/cpio/test/test_help.c
new file mode 100644
index 00000000000..0aedfd3e9b1
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_help.c
@@ -0,0 +1,66 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD$");
+
+/*
+ * Test that "--help", "-h", and "-W help" options all work and
+ * generate reasonable output.
+ */
+
+DEFINE_TEST(test_help)
+{
+ int r;
+ char *p;
+ size_t plen;
+
+ /* Exercise --help option. */
+ r = systemf("%s --help >help.stdout 2>help.stderr", testprog);
+ /* --help should generate nothing to stderr. */
+ assertEmptyFile("help.stderr");
+ /* Help message should start with name of program. */
+ p = slurpfile(&plen, "help.stdout");
+ assert(plen > 6);
+ assert(strncmp(p, "bsdcpio", 6) == 0);
+ /*
+ * TODO: Extend this check to further verify that --help output
+ * looks approximately right.
+ */
+ free(p);
+
+ /* -h option should generate the same output. */
+ r = systemf("%s -h >h.stdout 2>h.stderr", testprog);
+ /* -h should generate nothing to stderr. */
+ assertEmptyFile("h.stderr");
+ /* stdout should be same for -h and --help */
+ assertEqualFile("h.stdout", "help.stdout");
+
+ /* -W help should be another synonym. */
+ r = systemf("%s -W help >Whelp.stdout 2>Whelp.stderr", testprog);
+ /* -W help should generate nothing to stderr. */
+ assertEmptyFile("Whelp.stderr");
+ /* stdout should be same for -W help and --help */
+ assertEqualFile("Whelp.stdout", "help.stdout");
+}
diff --git a/archivers/libarchive/files/cpio/test/test_option_B.c b/archivers/libarchive/files/cpio/test/test_option_B.c
new file mode 100644
index 00000000000..59c491ecfcc
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_B.c
@@ -0,0 +1,54 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD$");
+
+
+DEFINE_TEST(test_option_B)
+{
+ struct stat st;
+ int r, fd;
+
+ /*
+ * Create a file on disk.
+ */
+ fd = open("file", O_CREAT | O_WRONLY, 0644);
+ assert(fd >= 0);
+ close(fd);
+
+ /* Create an archive without -B; this should be 512 bytes. */
+ r = systemf("echo file | %s -o > small.cpio 2>small.err", testprog);
+ assertEqualInt(r, 0);
+ assertEmptyFile("small.err");
+ assertEqualInt(0, stat("small.cpio", &st));
+ assertEqualInt(512, st.st_size);
+
+ /* Create an archive with -B; this should be 5120 bytes. */
+ r = systemf("echo file | %s -oB > large.cpio 2>large.err", testprog);
+ assertEqualInt(r, 0);
+ assertEmptyFile("large.err");
+ assertEqualInt(0, stat("large.cpio", &st));
+ assertEqualInt(5120, st.st_size);
+}
diff --git a/archivers/libarchive/files/cpio/test/test_option_d.c b/archivers/libarchive/files/cpio/test/test_option_d.c
new file mode 100644
index 00000000000..a0139879518
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_d.c
@@ -0,0 +1,68 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD$");
+
+
+DEFINE_TEST(test_option_d)
+{
+ struct stat st;
+ int r, fd;
+
+ /*
+ * Create a file in a directory.
+ */
+ assertEqualInt(0, mkdir("dir", 0755));
+ fd = open("dir/file", O_CREAT | O_WRONLY, 0644);
+ assert(fd >= 0);
+ close(fd);
+
+ /* Create an archive. */
+ r = systemf("echo dir/file | %s -o > archive.cpio 2>archive.err", testprog);
+ assertEqualInt(r, 0);
+ assertEmptyFile("archive.err");
+ assertEqualInt(0, stat("archive.cpio", &st));
+ assertEqualInt(512, st.st_size);
+
+ /* Dearchive without -d, this should fail. */
+ assertEqualInt(0, mkdir("without-d", 0755));
+ assertEqualInt(0, chdir("without-d"));
+ r = systemf("%s -i < ../archive.cpio >out 2>err", testprog);
+ assertEqualInt(r, 0);
+ assertEmptyFile("out");
+ /* And the file should not be restored. */
+ assert(0 != stat("dir/file", &st));
+
+ /* Dearchive with -d, this should succeed. */
+ assertEqualInt(0, chdir(".."));
+ assertEqualInt(0, mkdir("with-d", 0755));
+ assertEqualInt(0, chdir("with-d"));
+ r = systemf("%s -id < ../archive.cpio >out 2>err", testprog);
+ assertEqualInt(r, 0);
+ assertEmptyFile("out");
+ assertEmptyFile("err");
+ /* And the file should be restored. */
+ assertEqualInt(0, stat("dir/file", &st));
+}
diff --git a/archivers/libarchive/files/cpio/test/test_option_m.c b/archivers/libarchive/files/cpio/test/test_option_m.c
new file mode 100644
index 00000000000..1781719ae27
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_m.c
@@ -0,0 +1,68 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD$");
+
+
+DEFINE_TEST(test_option_m)
+{
+ struct stat st;
+ int r;
+ time_t now;
+
+ /*
+ * The reference archive has one file with an mtime in 1970, 1
+ * second after the start of the epoch.
+ */
+
+ /* Restored without -m, the result should have a current mtime. */
+ assertEqualInt(0, mkdir("without-m", 0755));
+ assertEqualInt(0, chdir("without-m"));
+ r = systemf("%s -i < %s/test_option_m.cpio >out 2>err", testprog, refdir);
+ now = time(NULL);
+ assertEqualInt(r, 0);
+ assertEmptyFile("out");
+ assertEmptyFile("err");
+ assertEqualInt(0, stat("file", &st));
+ /* Should have been created within the last few seconds. */
+ assert(st.st_mtime <= now);
+ assert(st.st_mtime > now - 5);
+
+ /* With -m, it should have an mtime in 1970. */
+ assertEqualInt(0, chdir(".."));
+ assertEqualInt(0, mkdir("with-m", 0755));
+ assertEqualInt(0, chdir("with-m"));
+ r = systemf("%s -im < %s/test_option_m.cpio >out 2>err", testprog, refdir);
+ now = time(NULL);
+ assertEqualInt(r, 0);
+ assertEmptyFile("out");
+ assertEmptyFile("err");
+ assertEqualInt(0, stat("file", &st));
+ /*
+ * mtime in reference archive is '1' == 1 second after
+ * midnight Jan 1, 1970 UTC.
+ */
+ assertEqualInt(1, st.st_mtime);
+}
diff --git a/archivers/libarchive/files/cpio/test/test_option_m.cpio b/archivers/libarchive/files/cpio/test/test_option_m.cpio
new file mode 100644
index 00000000000..2f05266abad
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_m.cpio
Binary files differ
diff --git a/archivers/libarchive/files/cpio/test/test_option_t.c b/archivers/libarchive/files/cpio/test/test_option_t.c
new file mode 100644
index 00000000000..ad229e0db63
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_t.c
@@ -0,0 +1,44 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD$");
+
+
+DEFINE_TEST(test_option_t)
+{
+ int r;
+
+ /* List reference archive, make sure the TOC is correct. */
+ r = systemf("%s -it < %s/test_option_t.cpio >t.out 2>t.err", testprog, refdir);
+ assertEqualInt(r, 0);
+ assertEmptyFile("t.err");
+ assertEqualFile("t.out", "%s/test_option_t.stdout", refdir);
+
+ /* List reference archive verbosely, make sure the TOC is correct. */
+ r = systemf("%s -itv < %s/test_option_t.cpio >tv.out 2>tv.err", testprog, refdir);
+ assertEqualInt(r, 0);
+ assertEmptyFile("tv.err");
+ assertEqualFile("tv.out", "%s/test_option_tv.stdout", refdir);
+}
diff --git a/archivers/libarchive/files/cpio/test/test_option_t.cpio b/archivers/libarchive/files/cpio/test/test_option_t.cpio
new file mode 100644
index 00000000000..2f05266abad
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_t.cpio
Binary files differ
diff --git a/archivers/libarchive/files/cpio/test/test_option_t.stdout b/archivers/libarchive/files/cpio/test/test_option_t.stdout
new file mode 100644
index 00000000000..f73f3093ff8
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_t.stdout
@@ -0,0 +1 @@
+file
diff --git a/archivers/libarchive/files/cpio/test/test_option_tv.stdout b/archivers/libarchive/files/cpio/test/test_option_tv.stdout
new file mode 100644
index 00000000000..420f15d715c
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_tv.stdout
@@ -0,0 +1 @@
+-rw-r--r-- 1 (null) (null) 0 file
diff --git a/archivers/libarchive/files/cpio/test/test_owner_parse.c b/archivers/libarchive/files/cpio/test/test_owner_parse.c
new file mode 100644
index 00000000000..1adbce4a9fc
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_owner_parse.c
@@ -0,0 +1,68 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD$");
+
+#include "../cpio.h"
+
+DEFINE_TEST(test_owner_parse)
+{
+ int uid, gid;
+
+ cpio_progname = "Ignore this message";
+
+ assertEqualInt(0, owner_parse("root", &uid, &gid));
+ assertEqualInt(0, uid);
+ assertEqualInt(-1, gid);
+
+
+ assertEqualInt(0, owner_parse("root:", &uid, &gid));
+ assertEqualInt(0, uid);
+ assertEqualInt(0, gid);
+
+ assertEqualInt(0, owner_parse("root.", &uid, &gid));
+ assertEqualInt(0, uid);
+ assertEqualInt(0, gid);
+
+ /*
+ * TODO: Lookup current user/group name, build strings and
+ * use those to verify username/groupname lookups for ordinary
+ * users.
+ */
+
+ /*
+ * TODO: Rework owner_parse to either return a char * pointing
+ * to an error message or accept a function pointer to an
+ * error-reporting routine so that the following tests don't
+ * generate any output.
+ *
+ * Alternatively, redirect stderr temporarily to suppress the output.
+ */
+
+ assertEqualInt(1, owner_parse(":nonexistentgroup", &uid, &gid));
+ assertEqualInt(1, owner_parse("root:nonexistentgroup", &uid, &gid));
+ assertEqualInt(1,
+ owner_parse("nonexistentuser:nonexistentgroup", &uid, &gid));
+}
diff --git a/archivers/libarchive/files/cpio/test/test_pathmatch.c b/archivers/libarchive/files/cpio/test/test_pathmatch.c
new file mode 100644
index 00000000000..ad56fba963c
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_pathmatch.c
@@ -0,0 +1,108 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD$");
+
+#include "../cpio.h"
+
+/*
+ * Verify that the pattern matcher implements the wildcard logic specified
+ * in SUSv2 for the cpio command. This is essentially the
+ * shell glob syntax:
+ * * - matches any sequence of chars, including '/'
+ * ? - matches any single char, including '/'
+ * [...] - matches any of a set of chars, '-' specifies a range,
+ * initial '!' is undefined
+ *
+ * The specification in SUSv2 is a bit incomplete, I assume the following:
+ * Trailing '-' in [...] is not special.
+ * Leading ']' in [...] is not special.
+ */
+
+DEFINE_TEST(test_pathmatch)
+{
+ assertEqualInt(1, pathmatch("*",""));
+ assertEqualInt(1, pathmatch("*","a"));
+ assertEqualInt(1, pathmatch("*","abcd"));
+ /* SUSv2: * matches / */
+ assertEqualInt(1, pathmatch("*","abcd/efgh/ijkl"));
+ assertEqualInt(1, pathmatch("abcd*efgh/ijkl","abcd/efgh/ijkl"));
+ assertEqualInt(1, pathmatch("abcd***efgh/ijkl","abcd/efgh/ijkl"));
+ assertEqualInt(1, pathmatch("abcd***/efgh/ijkl","abcd/efgh/ijkl"));
+ assertEqualInt(0, pathmatch("?", ""));
+ assertEqualInt(1, pathmatch("?", "a"));
+ assertEqualInt(0, pathmatch("?", "ab"));
+ assertEqualInt(1, pathmatch("?", "."));
+ assertEqualInt(1, pathmatch("?", "?"));
+ assertEqualInt(1, pathmatch("a", "a"));
+ assertEqualInt(0, pathmatch("a", "ab"));
+ assertEqualInt(0, pathmatch("a", "ab"));
+ assertEqualInt(1, pathmatch("a?c", "abc"));
+ /* SUSv2: ? matches / */
+ assertEqualInt(1, pathmatch("a?c", "a/c"));
+ assertEqualInt(1, pathmatch("a?*c*", "a/c"));
+ assertEqualInt(1, pathmatch("*a*", "a/c"));
+ assertEqualInt(1, pathmatch("*a*", "/a/c"));
+ assertEqualInt(1, pathmatch("*a*", "defaaaaaaa"));
+ assertEqualInt(0, pathmatch("*a*", "defghi"));
+ assertEqualInt(1, pathmatch("abc[def", "abc[def"));
+ assertEqualInt(0, pathmatch("abc[def]", "abc[def"));
+ assertEqualInt(0, pathmatch("abc[def", "abcd"));
+ assertEqualInt(1, pathmatch("abc[def]", "abcd"));
+ assertEqualInt(1, pathmatch("abc[def]", "abce"));
+ assertEqualInt(1, pathmatch("abc[def]", "abcf"));
+ assertEqualInt(0, pathmatch("abc[def]", "abcg"));
+ assertEqualInt(1, pathmatch("abc[d*f]", "abcd"));
+ assertEqualInt(1, pathmatch("abc[d*f]", "abc*"));
+ assertEqualInt(0, pathmatch("abc[d*f]", "abcdefghi"));
+ assertEqualInt(0, pathmatch("abc[d*", "abcdefghi"));
+ assertEqualInt(1, pathmatch("abc[d*", "abc[defghi"));
+ assertEqualInt(1, pathmatch("abc[d-f]", "abcd"));
+ assertEqualInt(1, pathmatch("abc[d-f]", "abce"));
+ assertEqualInt(1, pathmatch("abc[d-f]", "abcf"));
+ assertEqualInt(0, pathmatch("abc[d-f]", "abcg"));
+ assertEqualInt(1, pathmatch("abc[d-fh-k]", "abcd"));
+ assertEqualInt(1, pathmatch("abc[d-fh-k]", "abce"));
+ assertEqualInt(1, pathmatch("abc[d-fh-k]", "abcf"));
+ assertEqualInt(0, pathmatch("abc[d-fh-k]", "abcg"));
+ assertEqualInt(1, pathmatch("abc[d-fh-k]", "abch"));
+ assertEqualInt(1, pathmatch("abc[d-fh-k]", "abci"));
+ assertEqualInt(1, pathmatch("abc[d-fh-k]", "abcj"));
+ assertEqualInt(1, pathmatch("abc[d-fh-k]", "abck"));
+ assertEqualInt(0, pathmatch("abc[d-fh-k]", "abcl"));
+ assertEqualInt(0, pathmatch("abc[d-fh-k]", "abc-"));
+ assertEqualInt(0, pathmatch("abc[d-fh-]", "abcl"));
+ assertEqualInt(1, pathmatch("abc[d-fh-]", "abch"));
+ assertEqualInt(1, pathmatch("abc[d-fh-]", "abc-"));
+ assertEqualInt(1, pathmatch("abc[d-fh-]", "abc-"));
+ /* I assume: initial ']' is non-special. */
+ assertEqualInt(1, pathmatch("abc[]]", "abc]"));
+ assertEqualInt(1, pathmatch("abc[]d]", "abc]"));
+ assertEqualInt(1, pathmatch("abc[]d]", "abcd"));
+ assertEqualInt(1, pathmatch("abc[d]e]", "abcde]"));
+ assertEqualInt(0, pathmatch("abc[d]e]", "abc]"));
+
+ /* TODO: Implement leading '!' as negation character. */
+}
diff --git a/archivers/libarchive/files/cpio/test/test_version.c b/archivers/libarchive/files/cpio/test/test_version.c
new file mode 100644
index 00000000000..973d9ff3cb8
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_version.c
@@ -0,0 +1,73 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD$");
+
+/*
+ * Test that --version option works and generates reasonable output.
+ */
+
+DEFINE_TEST(test_version)
+{
+ int r;
+ char *p, *q;
+ size_t s;
+
+
+ r = systemf("%s --version >version.stdout 2>version.stderr", testprog);
+ /* --version should generate nothing to stdout. */
+ assertEmptyFile("version.stdout");
+ /* Verify format of version message. */
+ q = p = slurpfile(&s, "version.stderr");
+ /* Version message should start with name of program, then space. */
+ assert(s > 6);
+ assertEqualMem(q, "bsdcpio ", 8);
+ q += 8; s -= 8;
+ /* Version number is a series of digits and periods. */
+ while (s > 0 && (*q == '.' || (*q >= '0' && *q <= '9'))) {
+ ++q;
+ --s;
+ }
+ /* Version number terminated by space. */
+ assert(s > 1);
+ assert(*q == ' ');
+ ++q; --s;
+ /* Separator. */
+ assertEqualMem(q, "-- ", 3);
+ q += 3; s -= 3;
+ /* libarchive name and version number */
+ assert(s > 11);
+ assertEqualMem(q, "libarchive ", 11);
+ q += 11; s -= 11;
+ /* Version number is a series of digits and periods. */
+ while (s > 0 && (*q == '.' || (*q >= '0' && *q <= '9'))) {
+ ++q;
+ --s;
+ }
+ /* All terminated by a newline. */
+ assert(s >= 1);
+ assertEqualMem(q, "\n", 1);
+ free(p);
+}
diff --git a/archivers/libarchive/files/cpio/test/test_write_odc.c b/archivers/libarchive/files/cpio/test/test_write_odc.c
new file mode 100644
index 00000000000..50c97f71515
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_write_odc.c
@@ -0,0 +1,186 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD$");
+
+static int
+is_octal(const char *p, size_t l)
+{
+ while (l > 0) {
+ if (*p < '0' || *p > '7')
+ return (0);
+ --l;
+ ++p;
+ }
+ return (1);
+}
+
+static int
+from_octal(const char *p, size_t l)
+{
+ int r = 0;
+
+ while (l > 0) {
+ r *= 8;
+ r += *p - '0';
+ --l;
+ ++p;
+ }
+ return (r);
+}
+
+DEFINE_TEST(test_write_odc)
+{
+ int fd, filelist;
+ int r;
+ int dev, ino, gid;
+ time_t t, now;
+ char *p, *e;
+ size_t s;
+
+ /*
+ * Create an assortment of files.
+ * TODO: Extend this to cover more filetypes.
+ */
+ filelist = open("filelist", O_CREAT | O_WRONLY, 0644);
+
+ /* "file" */
+ fd = open("file", O_CREAT | O_WRONLY, 0644);
+ assert(fd >= 0);
+ assertEqualInt(10, write(fd, "123456789", 10));
+ close(fd);
+ assertEqualInt(5, write(filelist, "file\n", 5));
+
+ /* "symlink" */
+ assertEqualInt(0, symlink("file", "symlink"));
+ assertEqualInt(8, write(filelist, "symlink\n", 8));
+
+ /* "dir" */
+ assertEqualInt(0, mkdir("dir", 0775));
+ /* Record some facts about what we just created: */
+ now = time(NULL); /* They were all created w/in last two seconds. */
+ assertEqualInt(4, write(filelist, "dir\n", 4));
+
+ /* Use the cpio program to create an archive. */
+ close(filelist);
+ r = systemf("%s -o <filelist >basic.out 2>basic.err", testprog);
+ assertEqualInt(r, 0);
+
+ /* Verify that nothing went to stderr. */
+ assertEmptyFile("basic.err");
+
+ /* Verify that stdout is a well-formed cpio file in "odc" format. */
+ p = slurpfile(&s, "basic.out");
+ assertEqualInt(s, 512);
+ e = p;
+
+ /*
+ * Some of these assertions could be stronger, but it's
+ * a little tricky because they depend on the local environment.
+ */
+
+ /* First entry is "file" */
+ assert(is_octal(e, 76)); /* Entire header is octal digits. */
+ assertEqualMem(e + 0, "070707", 6); /* Magic */
+ assert(is_octal(e + 6, 6)); /* dev */
+ dev = from_octal(e + 6, 6);
+ assert(is_octal(e + 12, 6)); /* ino */
+ ino = from_octal(e + 12, 6);
+ assertEqualMem(e + 18, "100644", 6); /* Mode */
+ assertEqualInt(from_octal(e + 24, 6), getuid()); /* uid */
+ assert(is_octal(e + 30, 6)); /* gid */
+ gid = from_octal(e + 30, 6);
+ assertEqualMem(e + 36, "000001", 6); /* nlink */
+ assertEqualMem(e + 42, "000000", 6); /* rdev */
+ t = from_octal(e + 48, 11); /* mtime */
+ assert(t <= now); /* File wasn't created in future. */
+ assert(t >= now - 2); /* File was created w/in last 2 secs. */
+ assertEqualMem(e + 59, "000005", 6); /* Name size */
+ assertEqualMem(e + 65, "00000000012", 11); /* File size */
+ assertEqualMem(e + 76, "file\0", 5); /* Name contents */
+ assertEqualMem(e + 81, "123456789\0", 10); /* File contents */
+ e += 91;
+
+ /* Second entry is "symlink" pointing to "file" */
+ assert(is_octal(e, 76)); /* Entire header is octal digits. */
+ assertEqualMem(e + 0, "070707", 6); /* Magic */
+ assertEqualInt(dev, from_octal(e + 6, 6)); /* dev */
+ assert(dev != from_octal(e + 12, 6)); /* ino */
+ assertEqualMem(e + 18, "120755", 6); /* Mode */
+ assertEqualInt(from_octal(e + 24, 6), getuid()); /* uid */
+ assertEqualInt(gid, from_octal(e + 30, 6)); /* gid */
+ assertEqualMem(e + 36, "000001", 6); /* nlink */
+ assertEqualMem(e + 42, "000000", 6); /* rdev */
+ t = from_octal(e + 48, 11); /* mtime */
+ assert(t <= now); /* File wasn't created in future. */
+ assert(t >= now - 2); /* File was created w/in last 2 secs. */
+ assertEqualMem(e + 59, "000010", 6); /* Name size */
+ assertEqualMem(e + 65, "00000000004", 11); /* File size */
+ assertEqualMem(e + 76, "symlink\0", 8); /* Name contents */
+ assertEqualMem(e + 84, "file", 4); /* Symlink target. */
+ e += 88;
+
+ /* Second entry is "dir" */
+ assert(is_octal(e, 76));
+ assertEqualMem(e + 0, "070707", 6); /* Magic */
+ /* Dev should be same as first entry. */
+ assert(is_octal(e + 6, 6)); /* dev */
+ assertEqualInt(dev, from_octal(e + 6, 6));
+ /* Ino must be different from first entry. */
+ assert(is_octal(e + 12, 6)); /* ino */
+ assert(dev != from_octal(e + 12, 6));
+ assertEqualMem(e + 18, "040755", 6); /* Mode */
+ assertEqualInt(from_octal(e + 24, 6), getuid()); /* uid */
+ /* Gid should be same as first entry. */
+ assert(is_octal(e + 30, 6)); /* gid */
+ assertEqualInt(gid, from_octal(e + 30, 6));
+ assertEqualMem(e + 36, "000002", 6); /* Nlink */
+ t = from_octal(e + 48, 11); /* mtime */
+ assert(t <= now); /* File wasn't created in future. */
+ assert(t >= now - 2); /* File was created w/in last 2 secs. */
+ assertEqualMem(e + 59, "000004", 6); /* Name size */
+ assertEqualMem(e + 65, "00000000000", 11); /* File size */
+ assertEqualMem(e + 76, "dir\0", 4); /* name */
+ e += 80;
+
+ /* TODO: Verify other types of entries. */
+
+ /* Last entry is end-of-archive marker. */
+ assert(is_octal(e, 76));
+ assertEqualMem(e + 0, "070707", 6); /* Magic */
+ assertEqualMem(e + 6, "000000", 6); /* dev */
+ assertEqualMem(e + 12, "000000", 6); /* ino */
+ assertEqualMem(e + 18, "000000", 6); /* Mode */
+ assertEqualMem(e + 24, "000000", 6); /* uid */
+ assertEqualMem(e + 30, "000000", 6); /* gid */
+ assertEqualMem(e + 36, "000001", 6); /* Nlink */
+ assertEqualMem(e + 42, "000000", 6); /* rdev */
+ assertEqualMem(e + 48, "00000000000", 11); /* mtime */
+ assertEqualMem(e + 59, "000013", 6); /* Name size */
+ assertEqualMem(e + 65, "00000000000", 11); /* File size */
+ assertEqualMem(e + 76, "TRAILER!!!\0", 11); /* Name */
+
+ free(p);
+}
diff --git a/archivers/libarchive/files/doc/man/archive_entry.3 b/archivers/libarchive/files/doc/man/archive_entry.3
new file mode 100644
index 00000000000..6b1b270f1a5
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/archive_entry.3
@@ -0,0 +1,382 @@
+.\" Copyright (c) 2003-2007 Tim Kientzle
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD: src/lib/libarchive/archive_entry.3,v 1.15 2007/07/15 19:10:34 kientzle Exp $
+.\"
+.Dd December 15, 2003
+.Dt archive_entry 3
+.Os
+.Sh NAME
+.Nm archive_entry_acl_add_entry ,
+.Nm archive_entry_acl_add_entry_w ,
+.Nm archive_entry_acl_clear ,
+.Nm archive_entry_acl_count ,
+.Nm archive_entry_acl_next ,
+.Nm archive_entry_acl_next_w ,
+.Nm archive_entry_acl_reset ,
+.Nm archive_entry_acl_text_w ,
+.Nm archive_entry_atime ,
+.Nm archive_entry_atime_nsec ,
+.Nm archive_entry_clear ,
+.Nm archive_entry_clone ,
+.Nm archive_entry_copy_fflags_text_w ,
+.Nm archive_entry_copy_gname ,
+.Nm archive_entry_copy_gname_w ,
+.Nm archive_entry_copy_hardlink ,
+.Nm archive_entry_copy_hardlink_w ,
+.Nm archive_entry_copy_pathname_w ,
+.Nm archive_entry_copy_stat ,
+.Nm archive_entry_copy_symlink ,
+.Nm archive_entry_copy_symlink_w ,
+.Nm archive_entry_copy_uname ,
+.Nm archive_entry_copy_uname_w ,
+.Nm archive_entry_dev ,
+.Nm archive_entry_devmajor ,
+.Nm archive_entry_devminor ,
+.Nm archive_entry_filetype ,
+.Nm archive_entry_fflags ,
+.Nm archive_entry_fflags_text ,
+.Nm archive_entry_free ,
+.Nm archive_entry_gid ,
+.Nm archive_entry_gname ,
+.Nm archive_entry_hardlink ,
+.Nm archive_entry_ino ,
+.Nm archive_entry_mode ,
+.Nm archive_entry_mtime ,
+.Nm archive_entry_mtime_nsec ,
+.Nm archive_entry_nlink ,
+.Nm archive_entry_new ,
+.Nm archive_entry_pathname ,
+.Nm archive_entry_pathname_w ,
+.Nm archive_entry_rdev ,
+.Nm archive_entry_rdevmajor ,
+.Nm archive_entry_rdevminor ,
+.Nm archive_entry_set_atime ,
+.Nm archive_entry_set_ctime ,
+.Nm archive_entry_set_dev ,
+.Nm archive_entry_set_devmajor ,
+.Nm archive_entry_set_devminor ,
+.Nm archive_entry_set_filetype ,
+.Nm archive_entry_set_fflags ,
+.Nm archive_entry_set_gid ,
+.Nm archive_entry_set_gname ,
+.Nm archive_entry_set_hardlink ,
+.Nm archive_entry_set_link ,
+.Nm archive_entry_set_mode ,
+.Nm archive_entry_set_mtime ,
+.Nm archive_entry_set_pathname ,
+.Nm archive_entry_set_rdevmajor ,
+.Nm archive_entry_set_rdevminor ,
+.Nm archive_entry_set_size ,
+.Nm archive_entry_set_symlink ,
+.Nm archive_entry_set_uid ,
+.Nm archive_entry_set_uname ,
+.Nm archive_entry_size ,
+.Nm archive_entry_stat ,
+.Nm archive_entry_symlink ,
+.Nm archive_entry_uid ,
+.Nm archive_entry_uname
+.Nd functions for manipulating archive entry descriptions
+.Sh SYNOPSIS
+.In archive_entry.h
+.Ft void
+.Fn archive_entry_acl_add_entry "struct archive_entry *" "int type" "int permset" "int tag" "int qual" "const char *name"
+.Ft void
+.Fn archive_entry_acl_add_entry_w "struct archive_entry *" "int type" "int permset" "int tag" "int qual" "const wchar_t *name"
+.Ft void
+.Fn archive_entry_acl_clear "struct archive_entry *"
+.Ft int
+.Fn archive_entry_acl_count "struct archive_entry *" "int type"
+.Ft int
+.Fn archive_entry_acl_next "struct archive_entry *" "int want_type" "int *type" "int *permset" "int *tag" "int *qual" "const char **name"
+.Ft int
+.Fn archive_entry_acl_next_w "struct archive_entry *" "int want_type" "int *type" "int *permset" "int *tag" "int *qual" "const wchar_t **name"
+.Ft int
+.Fn archive_entry_acl_reset "struct archive_entry *" "int want_type"
+.Ft const wchar_t *
+.Fn archive_entry_acl_text_w "struct archive_entry *" "int flags"
+.Ft time_t
+.Fn archive_entry_atime "struct archive_entry *"
+.Ft long
+.Fn archive_entry_atime_nsec "struct archive_entry *"
+.Ft "struct archive_entry *"
+.Fn archive_entry_clear "struct archive_entry *"
+.Ft struct archive_entry *
+.Fn archive_entry_clone "struct archive_entry *"
+.Ft const wchar_t *
+.Fn archive_entry_copy_fflags_text_w "struct archive_entry *" "const wchar_t *"
+.Ft void
+.Fn archive_entry_copy_gname "struct archive_entry *" "const char *"
+.Ft void
+.Fn archive_entry_copy_gname_w "struct archive_entry *" "const wchar_t *"
+.Ft void
+.Fn archive_entry_copy_hardlink "struct archive_entry *" "const char *"
+.Ft void
+.Fn archive_entry_copy_hardlink_w "struct archive_entry *" "const wchar_t *"
+.Ft void
+.Fn archive_entry_copy_pathname_w "struct archive_entry *" "const wchar_t *"
+.Ft void
+.Fn archive_entry_copy_stat "struct archive_entry *" "const struct stat *"
+.Ft void
+.Fn archive_entry_copy_symlink "struct archive_entry *" "const char *"
+.Ft void
+.Fn archive_entry_copy_symlink_w "struct archive_entry *" "const wchar_t *"
+.Ft void
+.Fn archive_entry_copy_uname "struct archive_entry *" "const char *"
+.Ft void
+.Fn archive_entry_copy_uname_w "struct archive_entry *" "const wchar_t *"
+.Ft dev_t
+.Fn archive_entry_dev "struct archive_entry *"
+.Ft dev_t
+.Fn archive_entry_devmajor "struct archive_entry *"
+.Ft dev_t
+.Fn archive_entry_devminor "struct archive_entry *"
+.Ft mode_t
+.Fn archive_entry_filetype "struct archive_entry *"
+.Ft void
+.Fn archive_entry_fflags "struct archive_entry *" "unsigned long *set" "unsigned long *clear"
+.Ft const char *
+.Fn archive_entry_fflags_text "struct archive_entry *"
+.Ft void
+.Fn archive_entry_free "struct archive_entry *"
+.Ft const char *
+.Fn archive_entry_gname "struct archive_entry *"
+.Ft const char *
+.Fn archive_entry_hardlink "struct archive_entry *"
+.Ft ino_t
+.Fn archive_entry_ino "struct archive_entry *"
+.Ft mode_t
+.Fn archive_entry_mode "struct archive_entry *"
+.Ft time_t
+.Fn archive_entry_mtime "struct archive_entry *"
+.Ft long
+.Fn archive_entry_mtime_nsec "struct archive_entry *"
+.Ft unsigned int
+.Fn archive_entry_nlink "struct archive_entry *"
+.Ft struct archive_entry *
+.Fn archive_entry_new "void"
+.Ft const char *
+.Fn archive_entry_pathname "struct archive_entry *"
+.Ft const wchar_t *
+.Fn archive_entry_pathname_w "struct archive_entry *"
+.Ft dev_t
+.Fn archive_entry_rdev "struct archive_entry *"
+.Ft dev_t
+.Fn archive_entry_rdevmajor "struct archive_entry *"
+.Ft dev_t
+.Fn archive_entry_rdevminor "struct archive_entry *"
+.Ft void
+.Fn archive_entry_set_dev "struct archive_entry *" "dev_t"
+.Ft void
+.Fn archive_entry_set_devmajor "struct archive_entry *" "dev_t"
+.Ft void
+.Fn archive_entry_set_devminor "struct archive_entry *" "dev_t"
+.Ft void
+.Fn archive_entry_set_filetype "struct archive_entry *" "unsigned int"
+.Ft void
+.Fn archive_entry_set_fflags "struct archive_entry *" "unsigned long set" "unsigned long clear"
+.Ft void
+.Fn archive_entry_set_gid "struct archive_entry *" "gid_t"
+.Ft void
+.Fn archive_entry_set_gname "struct archive_entry *" "const char *"
+.Ft void
+.Fn archive_entry_set_hardlink "struct archive_entry *" "const char *"
+.Ft void
+.Fn archive_entry_set_ino "struct archive_entry *" "unsigned long"
+.Ft void
+.Fn archive_entry_set_link "struct archive_entry *" "const char *"
+.Ft void
+.Fn archive_entry_set_mode "struct archive_entry *" "mode_t"
+.Ft void
+.Fn archive_entry_set_mtime "struct archive_entry *" "time_t" "long nanos"
+.Ft void
+.Fn archive_entry_set_nlink "struct archive_entry *" "unsigned int"
+.Ft void
+.Fn archive_entry_set_pathname "struct archive_entry *" "const char *"
+.Ft void
+.Fn archive_entry_set_rdev "struct archive_entry *" "dev_t"
+.Ft void
+.Fn archive_entry_set_rdevmajor "struct archive_entry *" "dev_t"
+.Ft void
+.Fn archive_entry_set_rdevminor "struct archive_entry *" "dev_t"
+.Ft void
+.Fn archive_entry_set_size "struct archive_entry *" "int64_t"
+.Ft void
+.Fn archive_entry_set_symlink "struct archive_entry *" "const char *"
+.Ft void
+.Fn archive_entry_set_uid "struct archive_entry *" "uid_t"
+.Ft void
+.Fn archive_entry_set_uname "struct archive_entry *" "const char *"
+.Ft int64_t
+.Fn archive_entry_size "struct archive_entry *"
+.Ft const struct stat *
+.Fn archive_entry_stat "struct archive_entry *"
+.Ft const char *
+.Fn archive_entry_symlink "struct archive_entry *"
+.Ft const char *
+.Fn archive_entry_uname "struct archive_entry *"
+.Sh DESCRIPTION
+These functions create and manipulate data objects that
+represent entries within an archive.
+You can think of a
+.Tn struct archive_entry
+as a heavy-duty version of
+.Tn struct stat :
+it includes everything from
+.Tn struct stat
+plus associated pathname, textual group and user names, etc.
+These objects are used by
+.Xr libarchive 3
+to represent the metadata associated with a particular
+entry in an archive.
+.Ss Create and Destroy
+There are functions to allocate, destroy, clear, and copy
+.Va archive_entry
+objects:
+.Bl -tag -compact -width indent
+.It Fn archive_entry_clear
+Erases the object, resetting all internal fields to the
+same state as a newly-created object.
+This is provided to allow you to quickly recycle objects
+without thrashing the heap.
+.It Fn archive_entry_clone
+A deep copy operation; all text fields are duplicated.
+.It Fn archive_entry_free
+Releases the
+.Tn struct archive_entry
+object.
+.It Fn archive_entry_new
+Allocate and return a blank
+.Tn struct archive_entry
+object.
+.El
+.Ss Set and Get Functions
+Most of the functions here set or read entries in an object.
+Such functions have one of the following forms:
+.Bl -tag -compact -width indent
+.It Fn archive_entry_set_XXXX
+Stores the provided data in the object.
+In particular, for strings, the pointer is stored,
+not the referenced string.
+.It Fn archive_entry_copy_XXXX
+As above, except that the referenced data is copied
+into the object.
+.It Fn archive_entry_XXXX
+Returns the specified data.
+In the case of strings, a const-qualified pointer to
+the string is returned.
+.El
+String data can be set or accessed as wide character strings
+or normal
+.Va char
+strings.
+The functions that use wide character strings are suffixed with
+.Cm _w .
+Note that these are different representations of the same data:
+For example, if you store a narrow string and read the corresponding
+wide string, the object will transparently convert formats
+using the current locale.
+Similarly, if you store a wide string and then store a
+narrow string for the same data, the previously-set wide string will
+be discarded in favor of the new data.
+.Pp
+There are a few set/get functions that merit additional description:
+.Bl -tag -compact -width indent
+.It Fn archive_entry_set_link
+This function sets the symlink field if it is already set.
+Otherwise, it sets the hardlink field.
+.El
+.Ss File Flags
+File flags are transparently converted between a bitmap
+representation and a textual format.
+For example, if you set the bitmap and ask for text, the library
+will build a canonical text format.
+However, if you set a text format and request a text format,
+you will get back the same text, even if it is ill-formed.
+If you need to canonicalize a textual flags string, you should first set the
+text form, then request the bitmap form, then use that to set the bitmap form.
+Setting the bitmap format will clear the internal text representation
+and force it to be reconstructed when you next request the text form.
+.Pp
+The bitmap format consists of two integers, one containing bits
+that should be set, the other specifying bits that should be
+cleared.
+Bits not mentioned in either bitmap will be ignored.
+Usually, the bitmap of bits to be cleared will be set to zero.
+In unusual circumstances, you can force a fully-specified set
+of file flags by setting the bitmap of flags to clear to the complement
+of the bitmap of flags to set.
+(This differs from
+.Xr fflagstostr 3 ,
+which only includes names for set bits.)
+Converting a bitmap to a textual string is a platform-specific
+operation; bits that are not meaningful on the current platform
+will be ignored.
+.Pp
+The canonical text format is a comma-separated list of flag names.
+The
+.Fn archive_entry_copy_fflags_text_w
+function parses the provided text and sets the internal bitmap values.
+This is a platform-specific operation; names that are not meaningful
+on the current platform will be ignored.
+The function returns a pointer to the start of the first name that was not
+recognized, or NULL if every name was recognized.
+Note that every name--including names that follow an unrecognized name--will
+be evaluated, and the bitmaps will be set to reflect every name that is
+recognized.
+(In particular, this differs from
+.Xr strtofflags 3 ,
+which stops parsing at the first unrecognized name.)
+.Ss ACL Handling
+XXX This needs serious help.
+XXX
+.Pp
+An
+.Dq Access Control List
+(ACL) is a list of permissions that grant access to particular users or
+groups beyond what would normally be provided by standard POSIX mode bits.
+The ACL handling here addresses some deficiencies in the POSIX.1e draft 17 ACL
+specification.
+In particular, POSIX.1e draft 17 specifies several different formats, but
+none of those formats include both textual user/group names and numeric
+UIDs/GIDs.
+.Pp
+XXX explain ACL stuff XXX
+.\" .Sh EXAMPLE
+.\" .Sh RETURN VALUES
+.\" .Sh ERRORS
+.Sh SEE ALSO
+.Xr archive 3
+.Sh HISTORY
+The
+.Nm libarchive
+library first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm libarchive
+library was written by
+.An Tim Kientzle Aq kientzle@acm.org .
+.\" .Sh BUGS
diff --git a/archivers/libarchive/files/doc/man/archive_read.3 b/archivers/libarchive/files/doc/man/archive_read.3
new file mode 100644
index 00000000000..6daba3f3d11
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/archive_read.3
@@ -0,0 +1,524 @@
+.\" Copyright (c) 2003-2007 Tim Kientzle
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD: src/lib/libarchive/archive_read.3,v 1.35 2007/09/19 16:37:45 kientzle Exp $
+.\"
+.Dd August 19, 2006
+.Dt archive_read 3
+.Os
+.Sh NAME
+.Nm archive_read_new ,
+.Nm archive_read_support_compression_all ,
+.Nm archive_read_support_compression_bzip2 ,
+.Nm archive_read_support_compression_compress ,
+.Nm archive_read_support_compression_gzip ,
+.Nm archive_read_support_compression_none ,
+.Nm archive_read_support_compression_program ,
+.Nm archive_read_support_format_all ,
+.Nm archive_read_support_format_cpio ,
+.Nm archive_read_support_format_empty ,
+.Nm archive_read_support_format_iso9660 ,
+.Nm archive_read_support_format_tar ,
+.Nm archive_read_support_format_zip ,
+.Nm archive_read_open ,
+.Nm archive_read_open2 ,
+.Nm archive_read_open_fd ,
+.Nm archive_read_open_FILE ,
+.Nm archive_read_open_filename ,
+.Nm archive_read_open_memory ,
+.Nm archive_read_next_header ,
+.Nm archive_read_data ,
+.Nm archive_read_data_block ,
+.Nm archive_read_data_skip ,
+.\" #if ARCHIVE_API_VERSION < 3
+.Nm archive_read_data_into_buffer ,
+.\" #endif
+.Nm archive_read_data_into_fd ,
+.Nm archive_read_extract ,
+.Nm archive_read_extract_set_progress_callback ,
+.Nm archive_read_close ,
+.Nm archive_read_finish
+.Nd functions for reading streaming archives
+.Sh SYNOPSIS
+.In archive.h
+.Ft struct archive *
+.Fn archive_read_new "void"
+.Ft int
+.Fn archive_read_support_compression_all "struct archive *"
+.Ft int
+.Fn archive_read_support_compression_bzip2 "struct archive *"
+.Ft int
+.Fn archive_read_support_compression_compress "struct archive *"
+.Ft int
+.Fn archive_read_support_compression_gzip "struct archive *"
+.Ft int
+.Fn archive_read_support_compression_none "struct archive *"
+.Ft int
+.Fn archive_read_support_compression_program "struct archive *" "const char *cmd"
+.Ft int
+.Fn archive_read_support_format_all "struct archive *"
+.Ft int
+.Fn archive_read_support_format_cpio "struct archive *"
+.Ft int
+.Fn archive_read_support_format_empty "struct archive *"
+.Ft int
+.Fn archive_read_support_format_iso9660 "struct archive *"
+.Ft int
+.Fn archive_read_support_format_tar "struct archive *"
+.Ft int
+.Fn archive_read_support_format_zip "struct archive *"
+.Ft int
+.Fn archive_read_open "struct archive *" "void *client_data" "archive_open_callback *" "archive_read_callback *" "archive_close_callback *"
+.Ft int
+.Fn archive_read_open2 "struct archive *" "void *client_data" "archive_open_callback *" "archive_read_callback *" "archive_skip_callback *" "archive_close_callback *"
+.Ft int
+.Fn archive_read_open_FILE "struct archive *" "FILE *file"
+.Ft int
+.Fn archive_read_open_fd "struct archive *" "int fd" "size_t block_size"
+.Ft int
+.Fn archive_read_open_filename "struct archive *" "const char *filename" "size_t block_size"
+.Ft int
+.Fn archive_read_open_memory "struct archive *" "void *buff" "size_t size"
+.Ft int
+.Fn archive_read_next_header "struct archive *" "struct archive_entry **"
+.Ft ssize_t
+.Fn archive_read_data "struct archive *" "void *buff" "size_t len"
+.Ft int
+.Fn archive_read_data_block "struct archive *" "const void **buff" "size_t *len" "off_t *offset"
+.Ft int
+.Fn archive_read_data_skip "struct archive *"
+.\" #if ARCHIVE_API_VERSION < 3
+.Ft int
+.Fn archive_read_data_into_buffer "struct archive *" "void *" "ssize_t len"
+.\" #endif
+.Ft int
+.Fn archive_read_data_into_fd "struct archive *" "int fd"
+.Ft int
+.Fn archive_read_extract "struct archive *" "struct archive_entry *" "int flags"
+.Ft void
+.Fn archive_read_extract_set_progress_callback "struct archive *" "void (*func)(void *)" "void *user_data"
+.Ft int
+.Fn archive_read_close "struct archive *"
+.Ft int
+.Fn archive_read_finish "struct archive *"
+.Sh DESCRIPTION
+These functions provide a complete API for reading streaming archives.
+The general process is to first create the
+.Tn struct archive
+object, set options, initialize the reader, iterate over the archive
+headers and associated data, then close the archive and release all
+resources.
+The following summary describes the functions in approximately the
+order they would be used:
+.Bl -tag -compact -width indent
+.It Fn archive_read_new
+Allocates and initializes a
+.Tn struct archive
+object suitable for reading from an archive.
+.It Fn archive_read_support_compression_all , Fn archive_read_support_compression_bzip2 , Fn archive_read_support_compression_compress , Fn archive_read_support_compression_gzip , Fn archive_read_support_compression_none
+Enables auto-detection code and decompression support for the
+specified compression.
+Note that
+.Dq none
+is always enabled by default.
+For convenience,
+.Fn archive_read_support_compression_all
+enables all available decompression code.
+.It Fn archive_read_support_compression_program
+Data is fed through the specified external program before being dearchived.
+Note that this disables automatic detection of the compression format,
+so it makes no sense to specify this in conjunction with any other
+decompression option.
+.It Fn archive_read_support_format_all , Fn archive_read_support_format_cpio , Fn archive_read_support_format_empty , Fn archive_read_support_format_iso9660 , Fn archive_read_support_format_tar, Fn archive_read_support_format_zip
+Enables support---including auto-detection code---for the
+specified archive format.
+For example,
+.Fn archive_read_support_format_tar
+enables support for a variety of standard tar formats, old-style tar,
+ustar, pax interchange format, and many common variants.
+For convenience,
+.Fn archive_read_support_format_all
+enables support for all available formats.
+Only empty archives are supported by default.
+.It Fn archive_read_open
+The same as
+.Fn archive_read_open2 ,
+except that the skip callback is assumed to be
+.Dv NULL .
+.It Fn archive_read_open2
+Freeze the settings, open the archive, and prepare for reading entries.
+This is the most generic version of this call, which accepts
+four callback functions.
+Most clients will want to use
+.Fn archive_read_open_filename ,
+.Fn archive_read_open_FILE ,
+.Fn archive_read_open_fd ,
+or
+.Fn archive_read_open_memory
+instead.
+The library invokes the client-provided functions to obtain
+raw bytes from the archive.
+.It Fn archive_read_open_FILE
+Like
+.Fn archive_read_open ,
+except that it accepts a
+.Ft "FILE *"
+pointer.
+This function should not be used with tape drives or other devices
+that require strict I/O blocking.
+.It Fn archive_read_open_fd
+Like
+.Fn archive_read_open ,
+except that it accepts a file descriptor and block size rather than
+a set of function pointers.
+Note that the file descriptor will not be automatically closed at
+end-of-archive.
+This function is safe for use with tape drives or other blocked devices.
+.It Fn archive_read_open_file
+This is a deprecated synonym for
+.Fn archive_read_open_filename .
+.It Fn archive_read_open_filename
+Like
+.Fn archive_read_open ,
+except that it accepts a simple filename and a block size.
+A NULL filename represents standard input.
+This function is safe for use with tape drives or other blocked devices.
+.It Fn archive_read_open_memory
+Like
+.Fn archive_read_open ,
+except that it accepts a pointer and size of a block of
+memory containing the archive data.
+.It Fn archive_read_next_header
+Read the header for the next entry and return a pointer to
+a
+.Tn struct archive_entry .
+.It Fn archive_read_data
+Read data associated with the header just read.
+Internally, this is a convenience function that calls
+.Fn archive_read_data_block
+and fills any gaps with nulls so that callers see a single
+continuous stream of data.
+.It Fn archive_read_data_block
+Return the next available block of data for this entry.
+Unlike
+.Fn archive_read_data ,
+the
+.Fn archive_read_data_block
+function avoids copying data and allows you to correctly handle
+sparse files, as supported by some archive formats.
+The library guarantees that offsets will increase and that blocks
+will not overlap.
+Note that the blocks returned from this function can be much larger
+than the block size read from disk, due to compression
+and internal buffer optimizations.
+.It Fn archive_read_data_skip
+A convenience function that repeatedly calls
+.Fn archive_read_data_block
+to skip all of the data for this archive entry.
+.\" #if ARCHIVE_API_VERSION < 3
+.It Fn archive_read_data_into_buffer
+This function is deprecated and will be removed.
+Use
+.Fn archive_read_data
+instead.
+.\" #endif
+.It Fn archive_read_data_into_fd
+A convenience function that repeatedly calls
+.Fn archive_read_data_block
+to copy the entire entry to the provided file descriptor.
+.It Fn archive_read_extract , Fn archive_read_extract_set_skip_file
+A convenience function that wraps the corresponding
+.Xr archive_write_disk 3
+interfaces.
+The first call to
+.Fn archive_read_extract
+creates a restore object using
+.Xr archive_write_disk_new 3
+and
+.Xr archive_write_disk_set_standard_lookup 3 ,
+then transparently invokes
+.Xr archive_write_disk_set_options 3 ,
+.Xr archive_write_header 3 ,
+.Xr archive_write_data 3 ,
+and
+.Xr archive_write_finish_entry 3
+to create the entry on disk and copy data into it.
+The
+.Va flags
+argument is passed unmodified to
+.Xr archive_write_disk_set_options 3 .
+.It Fn archive_read_extract_set_progress_callback
+Sets a pointer to a user-defined callback that can be used
+for updating progress displays during extraction.
+The progress function will be invoked during the extraction of large
+regular files.
+The progress function will be invoked with the pointer provided to this call.
+Generally, the data pointed to should include a reference to the archive
+object and the archive_entry object so that various statistics
+can be retrieved for the progress display.
+.It Fn archive_read_close
+Complete the archive and invoke the close callback.
+.It Fn archive_read_finish
+Invokes
+.Fn archive_read_close
+if it was not invoked manually, then release all resources.
+Note: In libarchive 1.x, this function was declared to return
+.Ft void ,
+which made it impossible to detect certain errors when
+.Fn archive_read_close
+was invoked implicitly from this function.
+The declaration is corrected beginning with libarchive 2.0.
+.El
+.Pp
+Note that the library determines most of the relevant information about
+the archive by inspection.
+In particular, it automatically detects
+.Xr gzip 1
+or
+.Xr bzip2 1
+compression and transparently performs the appropriate decompression.
+It also automatically detects the archive format.
+.Pp
+A complete description of the
+.Tn struct archive
+and
+.Tn struct archive_entry
+objects can be found in the overview manual page for
+.Xr libarchive 3 .
+.Sh CLIENT CALLBACKS
+The callback functions must match the following prototypes:
+.Bl -item -offset indent
+.It
+.Ft typedef ssize_t
+.Fn archive_read_callback "struct archive *" "void *client_data" "const void **buffer"
+.It
+.\" #if ARCHIVE_API_VERSION < 2
+.Ft typedef int
+.Fn archive_skip_callback "struct archive *" "void *client_data" "size_t request"
+.\" #else
+.\" .Ft typedef off_t
+.\" .Fn archive_skip_callback "struct archive *" "void *client_data" "off_t request"
+.\" #endif
+.It
+.Ft typedef int
+.Fn archive_open_callback "struct archive *" "void *client_data"
+.It
+.Ft typedef int
+.Fn archive_close_callback "struct archive *" "void *client_data"
+.El
+.Pp
+The open callback is invoked by
+.Fn archive_open .
+It should return
+.Cm ARCHIVE_OK
+if the underlying file or data source is successfully
+opened.
+If the open fails, it should call
+.Fn archive_set_error
+to register an error code and message and return
+.Cm ARCHIVE_FATAL .
+.Pp
+The read callback is invoked whenever the library
+requires raw bytes from the archive.
+The read callback should read data into a buffer,
+set the
+.Li const void **buffer
+argument to point to the available data, and
+return a count of the number of bytes available.
+The library will invoke the read callback again
+only after it has consumed this data.
+The library imposes no constraints on the size
+of the data blocks returned.
+On end-of-file, the read callback should
+return zero.
+On error, the read callback should invoke
+.Fn archive_set_error
+to register an error code and message and
+return -1.
+.Pp
+The skip callback is invoked when the
+library wants to ignore a block of data.
+The return value is the number of bytes actually
+skipped, which may differ from the request.
+If the callback cannot skip data, it should return
+zero.
+If the skip callback is not provided (the
+function pointer is
+.Dv NULL ),
+the library will invoke the read function
+instead and simply discard the result.
+A skip callback can provide significant
+performance gains when reading uncompressed
+archives from slow disk drives or other media
+that can skip quickly.
+.Pp
+The close callback is invoked by archive_close when
+the archive processing is complete.
+The callback should return
+.Cm ARCHIVE_OK
+on success.
+On failure, the callback should invoke
+.Fn archive_set_error
+to register an error code and message and
+return
+.Cm ARCHIVE_FATAL.
+.Sh EXAMPLE
+The following illustrates basic usage of the library.
+In this example,
+the callback functions are simply wrappers around the standard
+.Xr open 2 ,
+.Xr read 2 ,
+and
+.Xr close 2
+system calls.
+.Bd -literal -offset indent
+void
+list_archive(const char *name)
+{
+ struct mydata *mydata;
+ struct archive *a;
+ struct archive_entry *entry;
+
+ mydata = malloc(sizeof(struct mydata));
+ a = archive_read_new();
+ mydata->name = name;
+ archive_read_support_compression_all(a);
+ archive_read_support_format_all(a);
+ archive_read_open(a, mydata, myopen, myread, myclose);
+ while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
+ printf("%s\\n",archive_entry_pathname(entry));
+ archive_read_data_skip(a);
+ }
+ archive_read_finish(a);
+ free(mydata);
+}
+
+ssize_t
+myread(struct archive *a, void *client_data, const void **buff)
+{
+ struct mydata *mydata = client_data;
+
+ *buff = mydata->buff;
+ return (read(mydata->fd, mydata->buff, 10240));
+}
+
+int
+myopen(struct archive *a, void *client_data)
+{
+ struct mydata *mydata = client_data;
+
+ mydata->fd = open(mydata->name, O_RDONLY);
+ return (mydata->fd >= 0 ? ARCHIVE_OK : ARCHIVE_FATAL);
+}
+
+int
+myclose(struct archive *a, void *client_data)
+{
+ struct mydata *mydata = client_data;
+
+ if (mydata->fd > 0)
+ close(mydata->fd);
+ return (ARCHIVE_OK);
+}
+.Ed
+.Sh RETURN VALUES
+Most functions return zero on success, non-zero on error.
+The possible return codes include:
+.Cm ARCHIVE_OK
+(the operation succeeded),
+.Cm ARCHIVE_WARN
+(the operation succeeded but a non-critical error was encountered),
+.Cm ARCHIVE_EOF
+(end-of-archive was encountered),
+.Cm ARCHIVE_RETRY
+(the operation failed but can be retried),
+and
+.Cm ARCHIVE_FATAL
+(there was a fatal error; the archive should be closed immediately).
+Detailed error codes and textual descriptions are available from the
+.Fn archive_errno
+and
+.Fn archive_error_string
+functions.
+.Pp
+.Fn archive_read_new
+returns a pointer to a freshly allocated
+.Tn struct archive
+object.
+It returns
+.Dv NULL
+on error.
+.Pp
+.Fn archive_read_data
+returns a count of bytes actually read or zero at the end of the entry.
+On error, a value of
+.Cm ARCHIVE_FATAL ,
+.Cm ARCHIVE_WARN ,
+or
+.Cm ARCHIVE_RETRY
+is returned and an error code and textual description can be retrieved from the
+.Fn archive_errno
+and
+.Fn archive_error_string
+functions.
+.Pp
+The library expects the client callbacks to behave similarly.
+If there is an error, you can use
+.Fn archive_set_error
+to set an appropriate error code and description,
+then return one of the non-zero values above.
+(Note that the value eventually returned to the client may
+not be the same; many errors that are not critical at the level
+of basic I/O can prevent the archive from being properly read,
+thus most I/O errors eventually cause
+.Cm ARCHIVE_FATAL
+to be returned.)
+.\" .Sh ERRORS
+.Sh SEE ALSO
+.Xr tar 1 ,
+.Xr archive 3 ,
+.Xr archive_util 3 ,
+.Xr tar 5
+.Sh HISTORY
+The
+.Nm libarchive
+library first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm libarchive
+library was written by
+.An Tim Kientzle Aq kientzle@acm.org .
+.Sh BUGS
+Many traditional archiver programs treat
+empty files as valid empty archives.
+For example, many implementations of
+.Xr tar 1
+allow you to append entries to an empty file.
+Of course, it is impossible to determine the format of an empty file
+by inspecting the contents, so this library treats empty files as
+having a special
+.Dq empty
+format.
diff --git a/archivers/libarchive/files/doc/man/archive_util.3 b/archivers/libarchive/files/doc/man/archive_util.3
new file mode 100644
index 00000000000..b8a030e4932
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/archive_util.3
@@ -0,0 +1,146 @@
+.\" Copyright (c) 2003-2007 Tim Kientzle
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD: src/lib/libarchive/archive_util.3,v 1.7 2007/05/29 01:00:19 kientzle Exp $
+.\"
+.Dd January 8, 2005
+.Dt archive_util 3
+.Os
+.Sh NAME
+.Nm archive_clear_error ,
+.Nm archive_compression ,
+.Nm archive_compression_name ,
+.Nm archive_copy_error ,
+.Nm archive_errno ,
+.Nm archive_error_string ,
+.Nm archive_format ,
+.Nm archive_format_name ,
+.Nm archive_set_error
+.Nd libarchive utility functions
+.Sh SYNOPSIS
+.In archive.h
+.Ft void
+.Fn archive_clear_error "struct archive *"
+.Ft int
+.Fn archive_compression "struct archive *"
+.Ft const char *
+.Fn archive_compression_name "struct archive *"
+.Ft void
+.Fn archive_copy_error "struct archive *" "struct archive *"
+.Ft int
+.Fn archive_errno "struct archive *"
+.Ft const char *
+.Fn archive_error_string "struct archive *"
+.Ft int
+.Fn archive_format "struct archive *"
+.Ft const char *
+.Fn archive_format_name "struct archive *"
+.Ft void
+.Fn archive_set_error "struct archive *" "int error_code" "const char *fmt" "..."
+.Sh DESCRIPTION
+These functions provide access to various information about the
+.Tn struct archive
+object used in the
+.Xr libarchive 3
+library.
+.Bl -tag -compact -width indent
+.It Fn archive_clear_error
+Clears any error information left over from a previous call.
+Not generally used in client code.
+.It Fn archive_compression
+Returns a numeric code indicating the current compression.
+This value is set by
+.Fn archive_read_open .
+.It Fn archive_compression_name
+Returns a text description of the current compression suitable for display.
+.It Fn archive_copy_error
+Copies error information from one archive to another.
+.It Fn archive_errno
+Returns a numeric error code (see
+.Xr errno 2 )
+indicating the reason for the most recent error return.
+.It Fn archive_error_string
+Returns a textual error message suitable for display.
+The error message here is usually more specific than that
+obtained from passing the result of
+.Fn archive_errno
+to
+.Xr strerror 3 .
+.It Fn archive_format
+Returns a numeric code indicating the format of the current
+archive entry.
+This value is set by a successful call to
+.Fn archive_read_next_header .
+Note that it is common for this value to change from
+entry to entry.
+For example, a tar archive might have several entries that
+utilize GNU tar extensions and several entries that do not.
+These entries will have different format codes.
+.It Fn archive_format_name
+A textual description of the format of the current entry.
+.It Fn archive_set_error
+Sets the numeric error code and error description that will be returned
+by
+.Fn archive_errno
+and
+.Fn archive_error_string .
+This function should be used within I/O callbacks to set system-specific
+error codes and error descriptions.
+This function accepts a printf-like format string and arguments.
+However, you should be careful to use only the following printf
+format specifiers:
+.Dq %c ,
+.Dq %d ,
+.Dq %jd ,
+.Dq %jo ,
+.Dq %ju ,
+.Dq %jx ,
+.Dq %ld ,
+.Dq %lo ,
+.Dq %lu ,
+.Dq %lx ,
+.Dq %o ,
+.Dq %u ,
+.Dq %s ,
+.Dq %x ,
+.Dq %% .
+Field-width specifiers and other printf features are
+not uniformly supported and should not be used.
+.El
+.Sh SEE ALSO
+.Xr archive_read 3 ,
+.Xr archive_write 3 ,
+.Xr libarchive 3 ,
+.Xr printf 3
+.Sh HISTORY
+The
+.Nm libarchive
+library first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm libarchive
+library was written by
+.An Tim Kientzle Aq kientzle@acm.org .
diff --git a/archivers/libarchive/files/doc/man/archive_write.3 b/archivers/libarchive/files/doc/man/archive_write.3
new file mode 100644
index 00000000000..c07b6b570ea
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/archive_write.3
@@ -0,0 +1,524 @@
+.\" Copyright (c) 2003-2007 Tim Kientzle
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD: src/lib/libarchive/archive_write.3,v 1.22 2007/05/29 01:00:19 kientzle Exp $
+.\"
+.Dd August 19, 2006
+.Dt archive_write 3
+.Os
+.Sh NAME
+.Nm archive_write_new ,
+.Nm archive_write_set_format_cpio ,
+.Nm archive_write_set_format_pax ,
+.Nm archive_write_set_format_pax_restricted ,
+.Nm archive_write_set_format_shar ,
+.Nm archive_write_set_format_shar_binary ,
+.Nm archive_write_set_format_ustar ,
+.Nm archive_write_get_bytes_per_block ,
+.Nm archive_write_set_bytes_per_block ,
+.Nm archive_write_set_bytes_in_last_block ,
+.Nm archive_write_set_compression_bzip2 ,
+.Nm archive_write_set_compression_gzip ,
+.Nm archive_write_set_compression_none ,
+.Nm archive_write_set_compression_program ,
+.Nm archive_write_open ,
+.Nm archive_write_open_fd ,
+.Nm archive_write_open_FILE ,
+.Nm archive_write_open_filename ,
+.Nm archive_write_open_memory ,
+.Nm archive_write_header ,
+.Nm archive_write_data ,
+.Nm archive_write_finish_entry ,
+.Nm archive_write_close ,
+.Nm archive_write_finish
+.Nd functions for creating archives
+.Sh SYNOPSIS
+.In archive.h
+.Ft struct archive *
+.Fn archive_write_new "void"
+.Ft int
+.Fn archive_write_get_bytes_per_block "struct archive *"
+.Ft int
+.Fn archive_write_set_bytes_per_block "struct archive *" "int bytes_per_block"
+.Ft int
+.Fn archive_write_set_bytes_in_last_block "struct archive *" "int"
+.Ft int
+.Fn archive_write_set_compression_bzip2 "struct archive *"
+.Ft int
+.Fn archive_write_set_compression_gzip "struct archive *"
+.Ft int
+.Fn archive_write_set_compression_none "struct archive *"
+.Ft int
+.Fn archive_write_set_compression_program "struct archive *" "const char * cmd"
+.Ft int
+.Fn archive_write_set_format_cpio "struct archive *"
+.Ft int
+.Fn archive_write_set_format_pax "struct archive *"
+.Ft int
+.Fn archive_write_set_format_pax_restricted "struct archive *"
+.Ft int
+.Fn archive_write_set_format_shar "struct archive *"
+.Ft int
+.Fn archive_write_set_format_shar_binary "struct archive *"
+.Ft int
+.Fn archive_write_set_format_ustar "struct archive *"
+.Ft int
+.Fn archive_write_open "struct archive *" "void *client_data" "archive_open_callback *" "archive_write_callback *" "archive_close_callback *"
+.Ft int
+.Fn archive_write_open_fd "struct archive *" "int fd"
+.Ft int
+.Fn archive_write_open_FILE "struct archive *" "FILE *file"
+.Ft int
+.Fn archive_write_open_filename "struct archive *" "const char *filename"
+.Ft int
+.Fn archive_write_open_memory "struct archive *" "void *buffer" "size_t bufferSize" "size_t *outUsed"
+.Ft int
+.Fn archive_write_header "struct archive *" "struct archive_entry *"
+.Ft ssize_t
+.Fn archive_write_data "struct archive *" "const void *" "size_t"
+.Ft int
+.Fn archive_write_finish_entry "struct archive *"
+.Ft int
+.Fn archive_write_close "struct archive *"
+.Ft int
+.Fn archive_write_finish "struct archive *"
+.Sh DESCRIPTION
+These functions provide a complete API for creating streaming
+archive files.
+The general process is to first create the
+.Tn struct archive
+object, set any desired options, initialize the archive, append entries, then
+close the archive and release all resources.
+The following summary describes the functions in approximately
+the order they are ordinarily used:
+.Bl -tag -width indent
+.It Fn archive_write_new
+Allocates and initializes a
+.Tn struct archive
+object suitable for writing a tar archive.
+.It Fn archive_write_set_bytes_per_block
+Sets the block size used for writing the archive data.
+Every call to the write callback function, except possibly the last one, will
+use this value for the length.
+The third parameter is a boolean that specifies whether or not the final block
+written will be padded to the full block size.
+If it is zero, the last block will not be padded.
+If it is non-zero, padding will be added both before and after compression.
+The default is to use a block size of 10240 bytes and to pad the last block.
+Note that a block size of zero will suppress internal blocking
+and cause writes to be sent directly to the write callback as they occur.
+.It Fn archive_write_get_bytes_per_block
+Retrieve the block size to be used for writing.
+A value of -1 here indicates that the library should use default values.
+A value of zero indicates that internal blocking is suppressed.
+.It Fn archive_write_set_bytes_in_last_block
+Sets the block size used for writing the last block.
+If this value is zero, the last block will be padded to the same size
+as the other blocks.
+Otherwise, the final block will be padded to a multiple of this size.
+In particular, setting it to 1 will cause the final block to not be padded.
+For compressed output, any padding generated by this option
+is applied only after the compression.
+The uncompressed data is always unpadded.
+The default is to pad the last block to the full block size (note that
+.Fn archive_write_open_filename
+will set this based on the file type).
+Unlike the other
+.Dq set
+functions, this function can be called after the archive is opened.
+.It Fn archive_write_get_bytes_in_last_block
+Retrieve the currently-set value for last block size.
+A value of -1 here indicates that the library should use default values.
+.It Fn archive_write_set_format_cpio , Fn archive_write_set_format_pax , Fn archive_write_set_format_pax_restricted , Fn archive_write_set_format_shar , Fn archive_write_set_format_shar_binary , Fn archive_write_set_format_ustar
+Sets the format that will be used for the archive.
+The library can write
+POSIX octet-oriented cpio format archives,
+POSIX-standard
+.Dq pax interchange
+format archives,
+traditional
+.Dq shar
+archives,
+enhanced
+.Dq binary
+shar archives that store a variety of file attributes and handle binary files,
+and
+POSIX-standard
+.Dq ustar
+archives.
+The pax interchange format is a backwards-compatible tar format that
+adds key/value attributes to each entry and supports arbitrary
+filenames, linknames, uids, sizes, etc.
+.Dq Restricted pax interchange format
+is the library default; this is the same as pax format, but suppresses
+the pax extended header for most normal files.
+In most cases, this will result in ordinary ustar archives.
+.It Fn archive_write_set_compression_bzip2 , Fn archive_write_set_compression_gzip , Fn archive_write_set_compression_none
+The resulting archive will be compressed as specified.
+Note that the compressed output is always properly blocked.
+.It Fn archive_write_set_compression_program
+The archive will be fed into the specified compression program.
+The output of that program is blocked and written to the client
+write callbacks.
+.It Fn archive_write_open
+Freeze the settings, open the archive, and prepare for writing entries.
+This is the most generic form of this function, which accepts
+pointers to three callback functions which will be invoked by
+the compression layer to write the constructed archive.
+.It Fn archive_write_open_fd
+A convenience form of
+.Fn archive_write_open
+that accepts a file descriptor.
+The
+.Fn archive_write_open_fd
+function is safe for use with tape drives or other
+block-oriented devices.
+.It Fn archive_write_open_FILE
+A convenience form of
+.Fn archive_write_open
+that accepts a
+.Ft "FILE *"
+pointer.
+Note that
+.Fn archive_write_open_FILE
+is not safe for writing to tape drives or other devices
+that require correct blocking.
+.It Fn archive_write_open_file
+A deprecated synonym for
+.Fn archive_write_open_filename .
+.It Fn archive_write_open_filename
+A convenience form of
+.Fn archive_write_open
+that accepts a filename.
+A NULL argument indicates that the output should be written to standard output;
+an argument of
+.Dq -
+will open a file with that name.
+If you have not invoked
+.Fn archive_write_set_bytes_in_last_block ,
+then
+.Fn archive_write_open_filename
+will adjust the last-block padding depending on the file:
+it will enable padding when writing to standard output or
+to a character or block device node, it will disable padding otherwise.
+You can override this by manually invoking
+.Fn archive_write_set_bytes_in_last_block
+before calling
+.Fn archive_write_open .
+The
+.Fn archive_write_open_filename
+function is safe for use with tape drives or other
+block-oriented devices.
+.It Fn archive_write_open_memory
+A convenience form of
+.Fn archive_write_open
+that accepts a pointer to a block of memory that will receive
+the archive.
+The final
+.Ft "size_t *"
+argument points to a variable that will be updated
+after each write to reflect how much of the buffer
+is currently in use.
+You should be careful to ensure that this variable
+remains allocated until after the archive is
+closed.
+.It Fn archive_write_header
+Build and write a header using the data in the provided
+.Tn struct archive_entry
+structure.
+See
+.Xr archive_entry 3
+for information on creating and populating
+.Tn struct archive_entry
+objects.
+.It Fn archive_write_data
+Write data corresponding to the header just written.
+Returns number of bytes written or -1 on error.
+.It Fn archive_write_finish_entry
+Close out the entry just written.
+In particular, this writes out the final padding required by some formats.
+Ordinarily, clients never need to call this, as it
+is called automatically by
+.Fn archive_write_next_header
+and
+.Fn archive_write_close
+as needed.
+.It Fn archive_write_close
+Complete the archive and invoke the close callback.
+.It Fn archive_write_finish
+Invokes
+.Fn archive_write_close
+if it was not invoked manually, then releases all resources.
+Note that this function was declared to return
+.Ft void
+in libarchive 1.x, which made it impossible to detect errors when
+.Fn archive_write_close
+was invoked implicitly from this function.
+This is corrected beginning with libarchive 2.0.
+.El
+More information about the
+.Va struct archive
+object and the overall design of the library can be found in the
+.Xr libarchive 3
+overview.
+.Sh IMPLEMENTATION
+Compression support is built-in to libarchive, which uses zlib and bzlib
+to handle gzip and bzip2 compression, respectively.
+.Sh CLIENT CALLBACKS
+To use this library, you will need to define and register
+callback functions that will be invoked to write data to the
+resulting archive.
+These functions are registered by calling
+.Fn archive_write_open :
+.Bl -item -offset indent
+.It
+.Ft typedef int
+.Fn archive_open_callback "struct archive *" "void *client_data"
+.El
+.Pp
+The open callback is invoked by
+.Fn archive_write_open .
+It should return
+.Cm ARCHIVE_OK
+if the underlying file or data source is successfully
+opened.
+If the open fails, it should call
+.Fn archive_set_error
+to register an error code and message and return
+.Cm ARCHIVE_FATAL .
+.Bl -item -offset indent
+.It
+.Ft typedef ssize_t
+.Fn archive_write_callback "struct archive *" "void *client_data" "void *buffer" "size_t length"
+.El
+.Pp
+The write callback is invoked whenever the library
+needs to write raw bytes to the archive.
+For correct blocking, each call to the write callback function
+should translate into a single
+.Xr write 2
+system call.
+This is especially critical when writing archives to tape drives.
+On success, the write callback should return the
+number of bytes actually written.
+On error, the callback should invoke
+.Fn archive_set_error
+to register an error code and message and return -1.
+.Bl -item -offset indent
+.It
+.Ft typedef int
+.Fn archive_close_callback "struct archive *" "void *client_data"
+.El
+.Pp
+The close callback is invoked by archive_close when
+the archive processing is complete.
+The callback should return
+.Cm ARCHIVE_OK
+on success.
+On failure, the callback should invoke
+.Fn archive_set_error
+to register an error code and message and
+return
+.Cm ARCHIVE_FATAL.
+.Sh EXAMPLE
+The following sketch illustrates basic usage of the library.
+In this example,
+the callback functions are simply wrappers around the standard
+.Xr open 2 ,
+.Xr write 2 ,
+and
+.Xr close 2
+system calls.
+.Bd -literal -offset indent
+#include <sys/stat.h>
+#include <archive.h>
+#include <archive_entry.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+struct mydata {
+ const char *name;
+ int fd;
+};
+
+int
+myopen(struct archive *a, void *client_data)
+{
+ struct mydata *mydata = client_data;
+
+ mydata->fd = open(mydata->name, O_WRONLY | O_CREAT, 0644);
+ if (mydata->fd >= 0)
+ return (ARCHIVE_OK);
+ else
+ return (ARCHIVE_FATAL);
+}
+
+ssize_t
+mywrite(struct archive *a, void *client_data, void *buff, size_t n)
+{
+ struct mydata *mydata = client_data;
+
+ return (write(mydata->fd, buff, n));
+}
+
+int
+myclose(struct archive *a, void *client_data)
+{
+ struct mydata *mydata = client_data;
+
+ if (mydata->fd > 0)
+ close(mydata->fd);
+ return (0);
+}
+
+void
+write_archive(const char *outname, const char **filename)
+{
+ struct mydata *mydata = malloc(sizeof(struct mydata));
+ struct archive *a;
+ struct archive_entry *entry;
+ struct stat st;
+ char buff[8192];
+ int len;
+ int fd;
+
+ a = archive_write_new();
+ mydata->name = outname;
+ archive_write_set_compression_gzip(a);
+ archive_write_set_format_ustar(a);
+ archive_write_open(a, mydata, myopen, mywrite, myclose);
+ while (*filename) {
+ stat(*filename, &st);
+ entry = archive_entry_new();
+ archive_entry_copy_stat(entry, &st);
+ archive_entry_set_pathname(entry, *filename);
+ archive_write_header(a, entry);
+ fd = open(*filename, O_RDONLY);
+ len = read(fd, buff, sizeof(buff));
+ while ( len > 0 ) {
+ archive_write_data(a, buff, len);
+ len = read(fd, buff, sizeof(buff));
+ }
+ archive_entry_free(entry);
+ filename++;
+ }
+ archive_write_finish(a);
+}
+
+int main(int argc, const char **argv)
+{
+ const char *outname;
+ argv++;
+ outname = argv++;
+ write_archive(outname, argv);
+ return 0;
+}
+.Ed
+.Sh RETURN VALUES
+Most functions return
+.Cm ARCHIVE_OK
+(zero) on success, or one of several non-zero
+error codes for errors.
+Specific error codes include:
+.Cm ARCHIVE_RETRY
+for operations that might succeed if retried,
+.Cm ARCHIVE_WARN
+for unusual conditions that do not prevent further operations, and
+.Cm ARCHIVE_FATAL
+for serious errors that make remaining operations impossible.
+The
+.Fn archive_errno
+and
+.Fn archive_error_string
+functions can be used to retrieve an appropriate error code and a
+textual error message.
+.Pp
+.Fn archive_write_new
+returns a pointer to a newly-allocated
+.Tn struct archive
+object.
+.Pp
+.Fn archive_write_data
+returns a count of the number of bytes actually written.
+On error, -1 is returned and the
+.Fn archive_errno
+and
+.Fn archive_error_string
+functions will return appropriate values.
+Note that if the client-provided write callback function
+returns a non-zero value, that error will be propagated back to the caller
+through whatever API function resulted in that call, which
+may include
+.Fn archive_write_header ,
+.Fn archive_write_data ,
+.Fn archive_write_close ,
+or
+.Fn archive_write_finish .
+The client callback can call
+.Fn archive_set_error
+to provide values that can then be retrieved by
+.Fn archive_errno
+and
+.Fn archive_error_string .
+.Sh SEE ALSO
+.Xr tar 1 ,
+.Xr libarchive 3 ,
+.Xr tar 5
+.Sh HISTORY
+The
+.Nm libarchive
+library first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm libarchive
+library was written by
+.An Tim Kientzle Aq kientzle@acm.org .
+.Sh BUGS
+There are many peculiar bugs in historic tar implementations that may cause
+certain programs to reject archives written by this library.
+For example, several historic implementations calculated header checksums
+incorrectly and will thus reject valid archives; GNU tar does not fully support
+pax interchange format; some old tar implementations required specific
+field terminations.
+.Pp
+The default pax interchange format eliminates most of the historic
+tar limitations and provides a generic key/value attribute facility
+for vendor-defined extensions.
+One oversight in POSIX is the failure to provide a standard attribute
+for large device numbers.
+This library uses
+.Dq SCHILY.devminor
+and
+.Dq SCHILY.devmajor
+for device numbers that exceed the range supported by the backwards-compatible
+ustar header.
+These keys are compatible with Joerg Schilling's
+.Nm star
+archiver.
+Other implementations may not recognize these keys and will thus be unable
+to correctly restore device nodes with large device numbers from archives
+created by this library.
diff --git a/archivers/libarchive/files/doc/man/archive_write_disk.3 b/archivers/libarchive/files/doc/man/archive_write_disk.3
new file mode 100644
index 00000000000..880a399b949
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/archive_write_disk.3
@@ -0,0 +1,358 @@
+.\" Copyright (c) 2003-2007 Tim Kientzle
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD: src/lib/libarchive/archive_write_disk.3,v 1.1 2007/03/03 07:37:36 kientzle Exp $
+.\"
+.Dd March 2, 2007
+.Dt archive_write_disk 3
+.Os
+.Sh NAME
+.Nm archive_write_disk_new ,
+.Nm archive_write_disk_set_options ,
+.Nm archive_write_disk_set_skip_file ,
+.Nm archive_write_disk_set_group_lookup ,
+.Nm archive_write_disk_set_standard_lookup ,
+.Nm archive_write_disk_set_user_lookup ,
+.Nm archive_write_header ,
+.Nm archive_write_data ,
+.Nm archive_write_finish_entry ,
+.Nm archive_write_close ,
+.Nm archive_write_finish
+.Nd functions for creating objects on disk
+.Sh SYNOPSIS
+.In archive.h
+.Ft struct archive *
+.Fn archive_write_disk_new "void"
+.Ft int
+.Fn archive_write_disk_set_options "struct archive *" "int flags"
+.Ft int
+.Fn archive_write_disk_set_skip_file "struct archive *" "dev_t" "ino_t"
+.Ft int
+.Fn archive_write_disk_set_group_lookup "struct archive *" "void *" "gid_t (*)(void *, const char *gname, gid_t gid)" "void (*cleanup)(void *)"
+.Ft int
+.Fn archive_write_disk_set_standard_lookup "struct archive *"
+.Ft int
+.Fn archive_write_disk_set_user_lookup "struct archive *" "void *" "uid_t (*)(void *, const char *uname, uid_t uid)" "void (*cleanup)(void *)"
+.Ft int
+.Fn archive_write_header "struct archive *" "struct archive_entry *"
+.Ft ssize_t
+.Fn archive_write_data "struct archive *" "const void *" "size_t"
+.Ft int
+.Fn archive_write_finish_entry "struct archive *"
+.Ft int
+.Fn archive_write_close "struct archive *"
+.Ft int
+.Fn archive_write_finish "struct archive *"
+.Sh DESCRIPTION
+These functions provide a complete API for creating objects on
+disk from
+.Tn struct archive_entry
+descriptions.
+They are most naturally used when extracting objects from an archive
+using the
+.Fn archive_read
+interface.
+The general process is to read
+.Tn struct archive_entry
+objects from an archive, then write those objects to a
+.Tn struct archive
+object created using the
+.Fn archive_write_disk
+family functions.
+This interface is deliberately very similar to the
+.Fn archive_write
+interface used to write objects to a streaming archive.
+.Bl -tag -width indent
+.It Fn archive_write_disk_new
+Allocates and initializes a
+.Tn struct archive
+object suitable for writing objects to disk.
+.It Fn archive_write_disk_set_skip_file
+Records the device and inode numbers of a file that should not be
+overwritten.
+This is typically used to ensure that an extraction process does not
+overwrite the archive from which objects are being read.
+This capability is technically unnecessary but can be a significant
+performance optimization in practice.
+.It Fn archive_write_disk_set_options
+The options field consists of a bitwise OR of one or more of the
+following values:
+.Bl -tag -compact -width "indent"
+.It Cm ARCHIVE_EXTRACT_OWNER
+The user and group IDs should be set on the restored file.
+By default, the user and group IDs are not restored.
+.It Cm ARCHIVE_EXTRACT_PERM
+Full permissions (including SGID, SUID, and sticky bits) should
+be restored exactly as specified, without obeying the
+current umask.
+Note that SUID and SGID bits can only be restored if the
+user and group ID of the object on disk are correct.
+If
+.Cm ARCHIVE_EXTRACT_OWNER
+is not specified, then SUID and SGID bits will only be restored
+if the default user and group IDs of newly-created objects on disk
+happen to match those specified in the archive entry.
+By default, only basic permissions are restored, and umask is obeyed.
+.It Cm ARCHIVE_EXTRACT_TIME
+The timestamps (mtime, ctime, and atime) should be restored.
+By default, they are ignored.
+Note that restoring of atime is not currently supported.
+.It Cm ARCHIVE_EXTRACT_NO_OVERWRITE
+Existing files on disk will not be overwritten.
+By default, existing regular files are truncated and overwritten;
+existing directories will have their permissions updated;
+other pre-existing objects are unlinked and recreated from scratch.
+.It Cm ARCHIVE_EXTRACT_UNLINK
+Existing files on disk will be unlinked before any attempt to
+create them.
+In some cases, this can prove to be a significant performance improvement.
+By default, existing files are truncated and rewritten, but
+the file is not recreated.
+In particular, the default behavior does not break existing hard links.
+.It Cm ARCHIVE_EXTRACT_ACL
+Attempt to restore ACLs.
+By default, extended ACLs are ignored.
+.It Cm ARCHIVE_EXTRACT_FFLAGS
+Attempt to restore extended file flags.
+By default, file flags are ignored.
+.It Cm ARCHIVE_EXTRACT_XATTR
+Attempt to restore POSIX.1e extended attributes.
+By default, they are ignored.
+.It Cm ARCHIVE_EXTRACT_SECURE_SYMLINKS
+Refuse to extract any object whose final location would be altered
+by a symlink on disk.
+This is intended to help guard against a variety of mischief
+caused by archives that (deliberately or otherwise) extract
+files outside of the current directory.
+The default is not to perform this check.
+If
+.Cm ARCHIVE_EXTRACT_UNLINK
+is specified together with this option, the library will
+remove any intermediate symlinks it finds and return an
+error only if such symlink could not be removed.
+.It Cm ARCHIVE_EXTRACT_SECURE_NODOTDOT
+Refuse to extract a path that contains a
+.Pa ..
+element anywhere within it.
+The default is to not refuse such paths.
+Note that paths ending in
+.Pa ..
+always cause an error, regardless of this flag.
+.El
+.It Fn archive_write_disk_set_group_lookup , Fn archive_write_disk_set_user_lookup
+The
+.Tn struct archive_entry
+objects contain both names and ids that can be used to identify users
+and groups.
+These names and ids describe the ownership of the file itself and
+also appear in ACL lists.
+By default, the library uses the ids and ignores the names, but
+this can be overridden by registering user and group lookup functions.
+To register, you must provide a lookup function which
+accepts both a name and id and returns a suitable id.
+You may also provide a
+.Tn void *
+pointer to a private data structure and a cleanup function for
+that data.
+The cleanup function will be invoked when the
+.Tn struct archive
+object is destroyed.
+.It Fn archive_write_disk_set_standard_lookup
+This convenience function installs a standard set of user
+and group lookup functions.
+These functions use
+.Xr getpwnam 3
+and
+.Xr getgrnam 3
+to convert names to ids, defaulting to the ids if the names cannot
+be looked up.
+These functions also implement a simple memory cache to reduce
+the number of calls to
+.Xr getpwnam 3
+and
+.Xr getgrnam 3 .
+.It Fn archive_write_header
+Build and write a header using the data in the provided
+.Tn struct archive_entry
+structure.
+See
+.Xr archive_entry 3
+for information on creating and populating
+.Tn struct archive_entry
+objects.
+.It Fn archive_write_data
+Write data corresponding to the header just written.
+Returns number of bytes written or -1 on error.
+.It Fn archive_write_finish_entry
+Close out the entry just written.
+Ordinarily, clients never need to call this, as it
+is called automatically by
+.Fn archive_write_next_header
+and
+.Fn archive_write_close
+as needed.
+.It Fn archive_write_close
+Set any attributes that could not be set during the initial restore.
+For example, directory timestamps are not restored initially because
+restoring a subsequent file would alter that timestamp.
+Similarly, non-writable directories are initially created with
+write permissions (so that their contents can be restored).
+The
+.Nm
+library maintains a list of all such deferred attributes and
+sets them when this function is invoked.
+.It Fn archive_write_finish
+Invokes
+.Fn archive_write_close
+if it was not invoked manually, then releases all resources.
+.El
+More information about the
+.Va struct archive
+object and the overall design of the library can be found in the
+.Xr libarchive 3
+overview.
+Many of these functions are also documented under
+.Xr archive_write 3 .
+.Sh RETURN VALUES
+Most functions return
+.Cm ARCHIVE_OK
+(zero) on success, or one of several non-zero
+error codes for errors.
+Specific error codes include:
+.Cm ARCHIVE_RETRY
+for operations that might succeed if retried,
+.Cm ARCHIVE_WARN
+for unusual conditions that do not prevent further operations, and
+.Cm ARCHIVE_FATAL
+for serious errors that make remaining operations impossible.
+The
+.Fn archive_errno
+and
+.Fn archive_error_string
+functions can be used to retrieve an appropriate error code and a
+textual error message.
+.Pp
+.Fn archive_write_disk_new
+returns a pointer to a newly-allocated
+.Tn struct archive
+object.
+.Pp
+.Fn archive_write_data
+returns a count of the number of bytes actually written.
+On error, -1 is returned and the
+.Fn archive_errno
+and
+.Fn archive_error_string
+functions will return appropriate values.
+.Sh SEE ALSO
+.Xr archive_read 3 ,
+.Xr archive_write 3 ,
+.Xr tar 1 ,
+.Xr libarchive 3
+.Sh HISTORY
+The
+.Nm libarchive
+library first appeared in
+.Fx 5.3 .
+The
+.Nm archive_write_disk
+interface was added to
+.Nm libarchive 2.0
+and first appeared in
+.Fx 6.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm libarchive
+library was written by
+.An Tim Kientzle Aq kientzle@acm.org .
+.Sh BUGS
+Directories are actually extracted in two distinct phases.
+Directories are created during
+.Fn archive_write_header ,
+but final permissions are not set until
+.Fn archive_write_close .
+This separation is necessary to correctly handle borderline
+cases such as a non-writable directory containing
+files, but can cause unexpected results.
+In particular, directory permissions are not fully
+restored until the archive is closed.
+If you use
+.Xr chdir 2
+to change the current directory between calls to
+.Fn archive_read_extract
+or before calling
+.Fn archive_read_close ,
+you may confuse the permission-setting logic with
+the result that directory permissions are restored
+incorrectly.
+.Pp
+The library attempts to create objects with filenames longer than
+.Cm PATH_MAX
+by creating prefixes of the full path and changing the current directory.
+Currently, this logic is limited in scope; the fixup pass does
+not work correctly for such objects and the symlink security check
+option disables the support for very long pathnames.
+.Pp
+Restoring the path
+.Pa aa/../bb
+does create each intermediate directory.
+In particular, the directory
+.Pa aa
+is created as well as the final object
+.Pa bb .
+In theory, this can be exploited to create an entire directory heirarchy
+with a single request.
+Of course, this does not work if the
+.Cm ARCHIVE_EXTRACT_NODOTDOT
+option is specified.
+.Pp
+Implicit directories are always created obeying the current umask.
+Explicit objects are created obeying the current umask unless
+.Cm ARCHIVE_EXTRACT_PERM
+is specified, in which case they current umask is ignored.
+.Pp
+SGID and SUID bits are restored only if the correct user and
+group could be set.
+If
+.Cm ARCHIVE_EXTRACT_OWNER
+is not specified, then no attempt is made to set the ownership.
+In this case, SGID and SUID bits are restored only if the
+user and group of the final object happen to match those specified
+in the entry.
+.Pp
+The
+.Dq standard
+user-id and group-id lookup functions are not the defaults because
+.Xr getgrnam 3
+and
+.Xr getpwnam 3
+are sometimes too large for particular applications.
+The current design allows the application author to use a more
+compact implementation when appropriate.
+.Pp
+There should be a corresponding
+.Nm archive_read_disk
+interface that walks a directory heirarchy and returns archive
+entry objects. \ No newline at end of file
diff --git a/archivers/libarchive/files/doc/man/bsdcpio.1 b/archivers/libarchive/files/doc/man/bsdcpio.1
new file mode 100644
index 00000000000..58fc9bf5c1f
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/bsdcpio.1
@@ -0,0 +1,362 @@
+.\" Copyright (c) 2003-2007 Tim Kientzle
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 05, 2007
+.Dt BSDCPIO 1
+.Os
+.Sh NAME
+.Nm cpio
+.Nd copy files to and from archives
+.Sh SYNOPSIS
+.Nm
+.Brq Fl i
+.Op Ar options
+.Op Ar pattern ...
+.Op Ar < archive
+.Nm
+.Brq Fl o
+.Op Ar options
+.Ar < name-list
+.Op Ar > archive
+.Nm
+.Brq Fl p
+.Op Ar options
+.Ar dest-dir
+.Ar < name-list
+.Sh DESCRIPTION
+.Nm
+copies files between archives and directories.
+This implementation can extract from tar, pax, cpio, zip, jar, ar,
+and ISO 9660 cdrom images and can create tar, pax, cpio, ar,
+and shar archives.
+.Pp
+The first option to
+.Nm
+is a mode indicator from the following list:
+.Bl -tag -compact -width indent
+.It Fl i
+Input.
+Read an archive from standard input and extract the contents to disk or
+(if the
+.Fl t
+option is specified)
+list the contents to standard output.
+.It Fl o
+Output.
+Read a list of filenames from standard input and produce a new archive
+on standard output containing the specified items.
+If one or more file patterns are specified, only files matching
+one of the patterns will be extracted.
+.It Fl p
+Pass-through.
+Read a list of filenames from standard input and copy the files to the
+specified directory.
+.El
+.Pp
+.Sh OPTIONS
+Unless specifically stated otherwise, options are applicable in
+all operating modes.
+.Bl -tag -width indent
+.It Fl a
+(o and p modes)
+Reset access times on files after they are read.
+(Not yet implemented)
+.It Fl B
+(o mode only)
+Block output to records of 5120 bytes.
+.It Fl c
+(o mode only)
+Use the old POSIX portable character format.
+Equivalent to
+.Fl -format Ar odc .
+.It Fl d
+(i and p modes)
+Create directories as necessary.
+.It Fl f Ar pattern
+(i mode only)
+Ignore files that match
+.Ar pattern .
+(Not yet implemented.)
+.It Fl -format Ar format
+(o mode only)
+Produce the output archive in the specified format.
+Supported formats include:
+.Pp
+.Bl -tag -width "iso9660" -compact
+.It Ar cpio
+Synonym for
+.Ar odc .
+.It Ar newc
+The SVR4 portable cpio format.
+.It Ar odc
+The old POSIX.1 portable octet-oriented cpio format.
+.It Ar pax
+The POSIX.1 pax format, an extension of the ustar format.
+.It Ar ustar
+The POSIX.1 tar format.
+.El
+.Pp
+The default format is
+.Ar odc .
+See
+.Xr libarchive_formats 5
+for more complete information about the
+formats currently supported by the underlying
+.Xr libarchive 3
+library.
+.It Fl i
+Input mode.
+See above for description.
+.It Fl L
+(o and p modes)
+All symbolic links will be followed.
+Normally, symbolic links are archived and copied as symbolic links.
+With this option, the target of the link will be archived or copied instead.
+(Not yet implemented.)
+.It Fl l
+(p mode only)
+Create links from the target directory to the original files,
+instead of copying.
+.It Fl m
+(i and p modes)
+Set file modification time on created files to match
+those in the source.
+.It Fl o
+Output mode.
+See above for description.
+.It Fl p
+Pass-through mode.
+See above for description.
+.It Fl -quiet
+(Not yet implemented.)
+.It Fl R Oo user Oc Ns Oo : Oc Ns Oo group Oc
+Set the owner and/or group on files in the output.
+If group is specified with no user
+(for example,
+.Fl R Ar :wheel )
+then the group will be set but not the user.
+If the user is specified with a trailing colon and no group
+(for example,
+.Fl R Ar root: )
+then the group will be set to the user's default group.
+If the user is specified with no trailing colon, then
+the user will be set but not the group.
+In
+.Fl i
+and
+.Fl p
+modes, this option can only be used by the super-user.
+(For compatibility, a period can be used in place of the colon.)
+.It Fl r
+(All modes.)
+Rename files interactively.
+For each file, a prompt is written to
+.Pa /dev/tty
+containing the name of the file and a line is read from
+.Pa /dev/tty .
+If the line read is blank, the file is skipped.
+If the line contains a single period, the file is processed normally.
+Otherwise, the line is taken to be the new name of the file.
+.It Fl t
+(i mode only)
+List the contents of the archive to stdout;
+do not restore the contents to disk.
+.It Fl u
+(i and p modes)
+Unconditionally overwrite existing files.
+Ordinarily, an older file will not overwrite a newer file on disk.
+.It Fl v
+Print the name of each file to stderr as it is processed.
+With
+.Fl t ,
+provide a detailed listing of each file.
+.It Fl -version
+Print the program version information and exit.
+.It Fl y
+(o mode only)
+Compress the archive with bzip2-compatible compression before
+writing to stdout.
+In input mode, this option is ignored;
+bzip2 compression is recognized automatically on input.
+.It Fl z
+(o mode only)
+Compress the archive with gzip-compatible compression before writing
+it to stdout.
+In input mode, this option is ignored;
+gzip compression is recognized automatically on input.
+.El
+.Sh ENVIRONMENT
+The following environment variables affect the execution of
+.Nm :
+.Bl -tag -width ".Ev BLOCKSIZE"
+.It Ev LANG
+The locale to use.
+See
+.Xr environ 7
+for more information.
+.It Ev TZ
+The timezone to use when displaying dates.
+See
+.Xr environ 7
+for more information.
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+The
+.Nm
+command is traditionally used to copy file heirarchies in conjunction
+with the
+.Xr find 1
+command.
+The first example here simply copies all files from
+.Pa src
+to
+.Pa dest :
+.Dl Nm find Pa src | Nm Fl pmud Pa dest
+.Pp
+By carefully selecting options to the
+.Xr find 1
+command and combining it with other standard utilities,
+it is possible to exercise very fine control over which files are copied.
+This next example copies files from
+.Pa src
+to
+.Pa dest
+that are more than 2 days old and whose names match a particular pattern:
+.Dl Nm find Pa src Fl mtime Ar +2 | Nm grep foo[bar] | Nm Fl pdmu Pa dest
+.Pp
+This example copies files from
+.Pa src
+to
+.Pa dest
+that are more than 2 days old and which contain the word
+.Do foobar Dc :
+.Dl Nm find Pa src Fl mtime Ar +2 | Nm xargs Nm grep -l foobar | Nm Fl pdmu Pa dest
+.Sh COMPATIBILITY
+The mode options i, o, and p and the options
+a, B, c, d, f, l, m, r, t, u, and v comply with SUSv2.
+.Pp
+The old POSIX.1 standard specified that only
+.Fl i ,
+.Fl o ,
+and
+.Fl p
+were interpreted as command-line options.
+Each took a single argument of a list of modifier
+characters.
+For example, the standard syntax allows
+.Fl imu
+but does not support
+.Fl miu
+or
+.Fl i Fl m Fl u ,
+since
+.Ar m
+and
+.Ar u
+are only modifiers to
+.Fl i ,
+they are not command-line options in their own right.
+The syntax supported by this implementation is backwards-compatible
+with the standard.
+For best compatibility, scripts should limit themselves to the
+standard syntax.
+.Sh SEE ALSO
+.Xr bzip2 1 ,
+.Xr tar 1 ,
+.Xr gzip 1 ,
+.Xr mt 1 ,
+.Xr pax 1 ,
+.Xr libarchive 3 ,
+.Xr cpio 5 ,
+.Xr libarchive-formats 5 ,
+.Xr tar 5
+.Sh STANDARDS
+There is no current POSIX standard for the cpio command; it appeared
+in
+.St -p1003.1-96
+but was dropped from
+.St -p1003.1-2001 .
+.Pp
+The cpio, ustar, and pax interchange file formats are defined by
+.St -p1003.1-2001
+for the pax command.
+.Sh HISTORY
+The original
+.Nm cpio
+and
+.Nm find
+utilities were written by Dick Haight
+while working in AT&T's Unix Support Group.
+They first appeared in PWB/UNIX 1.0, the
+.Dq Programmer's Work Bench
+system developed for use within AT&T and released in 1977.
+XXX It was first released outside of AT&T
+as part of System III Unix in 1981. XXX
+XXX Need to verify the previous statement. XXX
+As a result,
+.Nm cpio
+actually predates
+.Nm tar ,
+even though it was not well-known outside of AT&T
+until some time later.
+XXX When did cpio first appear in BSD? XXX
+.Pp
+This is a complete re-implementation based on the
+.Xr libarchive 3
+library.
+.Sh BUGS
+The cpio archive format has several basic limitations:
+It does not store user and group names, only numbers.
+As a result, it cannot be reliably used to transfer
+files between systems with dissimilar user and group numbering.
+Older cpio formats limit the user and group numbers to
+16 or 18 bits, which is insufficient for modern systems.
+The cpio archive formats cannot support files over 4 gigabytes,
+except for the
+.Dq odc
+variant, which can support files up to 8 gigabytes.
+.Pp
+This is an early alpha version of
+.Nm .
+The underlying
+.Nm libarchive
+library is quite mature, so the archive format support
+and creation of objects on disk should be robust.
+However, the cpio-specific options and features
+are still very new.
+Known issues that will be fixed soon:
+.Bl -bullet -offset indent -compact
+.It
+Options documented above as
+.Do Not yet implemented Dc .
+.It
+Filter arguments to
+.Fl i ,
+and
+.Fl it .
+.El
diff --git a/archivers/libarchive/files/doc/man/bsdtar.1 b/archivers/libarchive/files/doc/man/bsdtar.1
new file mode 100644
index 00000000000..db6a10aa1ca
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/bsdtar.1
@@ -0,0 +1,769 @@
+.\" Copyright (c) 2003-2007 Tim Kientzle
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD: src/usr.bin/tar/bsdtar.1,v 1.35 2007/05/29 05:39:10 kientzle Exp $
+.\"
+.Dd April 13, 2004
+.Dt BSDTAR 1
+.Os
+.Sh NAME
+.Nm tar
+.Nd manipulate tape archives
+.Sh SYNOPSIS
+.Nm
+.Op Ar bundled-flags Ao args Ac
+.Op Ao Ar file Ac | Ao Ar pattern Ac ...
+.Nm
+.Brq Fl c
+.Op Ar options
+.Op Ar files | directories
+.Nm
+.Brq Fl r | Fl u
+.Fl f Ar archive-file
+.Op Ar options
+.Op Ar files | directories
+.Nm
+.Brq Fl t | Fl x
+.Op Ar options
+.Op Ar patterns
+.Sh DESCRIPTION
+.Nm
+creates and manipulates streaming archive files.
+This implementation can extract from tar, pax, cpio, zip, jar, ar,
+and ISO 9660 cdrom images and can create tar, pax, cpio, ar,
+and shar archives.
+.Pp
+The first synopsis form shows a
+.Dq bundled
+option word.
+This usage is provided for compatibility with historical implementations.
+See COMPATIBILITY below for details.
+.Pp
+The other synopsis forms show the preferred usage.
+The first option to
+.Nm
+is a mode indicator from the following list:
+.Bl -tag -compact -width indent
+.It Fl c
+Create a new archive containing the specified items.
+.It Fl r
+Like
+.Fl c ,
+but new entries are appended to the archive.
+Note that this only works on uncompressed archives stored in regular files.
+The
+.Fl f
+option is required.
+.It Fl t
+List archive contents to stdout.
+.It Fl u
+Like
+.Fl r ,
+but new entries are added only if they have a modification date
+newer than the corresponding entry in the archive.
+Note that this only works on uncompressed archives stored in regular files.
+The
+.Fl f
+option is required.
+.It Fl x
+Extract to disk from the archive.
+If a file with the same name appears more than once in the archive,
+each copy will be extracted, with later copies overwriting (replacing)
+earlier copies.
+.El
+.Pp
+In
+.Fl c ,
+.Fl r ,
+or
+.Fl u
+mode, each specified file or directory is added to the
+archive in the order specified on the command line.
+By default, the contents of each directory are also archived.
+.Pp
+In extract or list mode, the entire command line
+is read and parsed before the archive is opened.
+The pathnames or patterns on the command line indicate
+which items in the archive should be processed.
+Patterns are shell-style globbing patterns as
+documented in
+.Xr tcsh 1 .
+.Sh OPTIONS
+Unless specifically stated otherwise, options are applicable in
+all operating modes.
+.Bl -tag -width indent
+.It Cm @ Ns Pa archive
+(c and r mode only)
+The specified archive is opened and the entries
+in it will be appended to the current archive.
+As a simple example,
+.Dl Nm Fl c Fl f Pa - Pa newfile Cm @ Ns Pa original.tar
+writes a new archive to standard output containing a file
+.Pa newfile
+and all of the entries from
+.Pa original.tar .
+In contrast,
+.Dl Nm Fl c Fl f Pa - Pa newfile Pa original.tar
+creates a new archive with only two entries.
+Similarly,
+.Dl Nm Fl czf Pa - Fl -format Cm pax Cm @ Ns Pa -
+reads an archive from standard input (whose format will be determined
+automatically) and converts it into a gzip-compressed
+pax-format archive on stdout.
+In this way,
+.Nm
+can be used to convert archives from one format to another.
+.It Fl b Ar blocksize
+Specify the block size, in 512-byte records, for tape drive I/O.
+As a rule, this argument is only needed when reading from or writing
+to tape drives, and usually not even then as the default block size of
+20 records (10240 bytes) is very common.
+.It Fl C Ar directory
+In c and r mode, this changes the directory before adding
+the following files.
+In x mode, change directories after opening the archive
+but before extracting entries from the archive.
+.It Fl -check-links ( Fl W Cm check-links )
+(c and r modes only)
+Issue a warning message unless all links to each file are archived.
+.It Fl -exclude Ar pattern ( Fl W Cm exclude Ns = Ns Ar pattern )
+Do not process files or directories that match the
+specified pattern.
+Note that exclusions take precedence over patterns or filenames
+specified on the command line.
+.It Fl -format Ar format ( Fl W Cm format Ns = Ns Ar format )
+(c mode only)
+Use the specified format for the created archive.
+Supported formats include
+.Dq cpio ,
+.Dq pax ,
+.Dq shar ,
+and
+.Dq ustar .
+Other formats may also be supported; see
+.Xr libarchive-formats 5
+for more information about currently-supported formats.
+.It Fl f Ar file
+Read the archive from or write the archive to the specified file.
+The filename can be
+.Pa -
+for standard input or standard output.
+If not specified, the default tape device will be used.
+(On
+.Fx ,
+the default tape device is
+.Pa /dev/sa0 . )
+.It Fl -fast-read ( Fl W Cm fast-read )
+(x and t mode only)
+Extract or list only the first archive entry that matches each pattern
+or filename operand.
+Exit as soon as each specified pattern or filename has been matched.
+By default, the archive is always read to the very end, since
+there can be multiple entries with the same name and, by convention,
+later entries overwrite earlier entries.
+This option is provided as a performance optimization.
+.It Fl H
+(c and r mode only)
+Symbolic links named on the command line will be followed; the
+target of the link will be archived, not the link itself.
+.It Fl h
+(c and r mode only)
+Synonym for
+.Fl L .
+.It Fl I
+Synonym for
+.Fl T .
+.It Fl -include Ar pattern ( Fl W Cm include Ns = Ns Ar pattern )
+Process only files or directories that match the specified pattern.
+Note that exclusions specified with
+.Fl -exclude
+take precedence over inclusions.
+If no inclusions are explicitly specified, all entries are processed by
+default.
+The
+.Fl -include
+option is especially useful when filtering archives.
+For example, the command
+.Dl Nm Fl c Fl f Pa new.tar Fl -include='*foo*' Cm @ Ns Pa old.tgz
+creates a new archive
+.Pa new.tar
+containing only the entries from
+.Pa old.tgz
+containing the string
+.Sq foo .
+.It Fl j
+(c mode only)
+Compress the resulting archive with
+.Xr bzip2 1 .
+In extract or list modes, this option is ignored.
+Note that, unlike other
+.Nm tar
+implementations, this implementation recognizes bzip2 compression
+automatically when reading archives.
+.It Fl k
+(x mode only)
+Do not overwrite existing files.
+In particular, if a file appears more than once in an archive,
+later copies will not overwrite earlier copies.
+.It Fl L
+(c and r mode only)
+All symbolic links will be followed.
+Normally, symbolic links are archived as such.
+With this option, the target of the link will be archived instead.
+.It Fl l
+If
+.Ev POSIXLY_CORRECT
+is specified in the environment, this is a synonym for the
+.Fl -check-links
+option.
+Otherwise, an error will be displayed.
+Users who desire behavior compatible with GNU tar should use
+the
+.Fl -one-file-system
+option instead.
+.It Fl m
+(x mode only)
+Do not extract modification time.
+By default, the modification time is set to the time stored in the archive.
+.It Fl n
+(c, r, u modes only)
+Do not recursively archive the contents of directories.
+.It Fl -newer Ar date ( Fl W Cm newer Ns = Ns Ar date )
+(c, r, u modes only)
+Only include files and directories newer than the specified date.
+This compares ctime entries.
+.It Fl -newer-mtime Ar date ( Fl W Cm newer-mtime Ns = Ns Ar date )
+(c, r, u modes only)
+Like
+.Fl -newer ,
+except it compares mtime entries instead of ctime entries.
+.It Fl -newer-than Pa file ( Fl W Cm newer-than Ns = Ns Pa file )
+(c, r, u modes only)
+Only include files and directories newer than the specified file.
+This compares ctime entries.
+.It Fl -newer-mtime-than Pa file ( Fl W Cm newer-mtime-than Ns = Ns Pa file )
+(c, r, u modes only)
+Like
+.Fl -newer-than ,
+except it compares mtime entries instead of ctime entries.
+.It Fl -nodump ( Fl W Cm nodump )
+(c and r modes only)
+Honor the nodump file flag by skipping this file.
+.It Fl -null ( Fl W Cm null )
+(use with
+.Fl I ,
+.Fl T ,
+or
+.Fl X )
+Filenames or patterns are separated by null characters,
+not by newlines.
+This is often used to read filenames output by the
+.Fl print0
+option to
+.Xr find 1 .
+.It Fl O
+(x, t modes only)
+In extract (-x) mode, files will be written to standard out rather than
+being extracted to disk.
+In list (-t) mode, the file listing will be written to stderr rather than
+the usual stdout.
+.It Fl o
+(x mode only)
+Use the user and group of the user running the program rather
+than those specified in the archive.
+Note that this has no significance unless
+.Fl p
+is specified, and the program is being run by the root user.
+In this case, the file modes and flags from
+the archive will be restored, but ACLs or owner information in
+the archive will be discarded.
+.It Fl -one-file-system ( Fl W Cm one-file-system )
+(c, r, and u modes)
+Do not cross mount points.
+.It Fl P
+Preserve pathnames.
+By default, absolute pathnames (those that begin with a /
+character) have the leading slash removed both when creating archives
+and extracting from them.
+Also,
+.Nm
+will refuse to extract archive entries whose pathnames contain
+.Pa ..
+or whose target directory would be altered by a symlink.
+This option suppresses these behaviors.
+.It Fl p
+(x mode only)
+Preserve file permissions.
+Attempt to restore the full permissions, including owner, file modes, file
+flags and ACLs, if available, for each item extracted from the archive.
+By default, newly-created files are owned by the user running
+.Nm ,
+the file mode is restored for newly-created regular files, and
+all other types of entries receive default permissions.
+If
+.Nm
+is being run by root, the default is to restore the owner unless the
+.Fl o
+option is also specified.
+.It Fl -strip-components Ar count ( Fl W Cm strip-components Ns = Ns Ar count )
+(x and t mode only)
+Remove the specified number of leading path elements.
+Pathnames with fewer elements will be silently skipped.
+Note that the pathname is edited after checking inclusion/exclusion patterns
+but before security checks.
+.It Fl T Ar filename
+In x or t mode,
+.Nm
+will read the list of names to be extracted from
+.Pa filename .
+In c mode,
+.Nm
+will read names to be archived from
+.Pa filename .
+The special name
+.Dq -C
+on a line by itself will cause the current directory to be changed to
+the directory specified on the following line.
+Names are terminated by newlines unless
+.Fl -null
+is specified.
+Note that
+.Fl -null
+also disables the special handling of lines containing
+.Dq -C .
+.It Fl U
+(x mode only)
+Unlink files before creating them.
+Without this option,
+.Nm
+overwrites existing files, which preserves existing hardlinks.
+With this option, existing hardlinks will be broken, as will any
+symlink that would affect the location of an extracted file.
+.It Fl -use-compress-program Ar program
+Pipe the input (in x or t mode) or the output (in c mode) through
+.Pa program
+instead of using the builtin compression support.
+.It Fl v
+Produce verbose output.
+In create and extract modes,
+.Nm
+will list each file name as it is read from or written to
+the archive.
+In list mode,
+.Nm
+will produce output similar to that of
+.Xr ls 1 .
+Additional
+.Fl v
+options will provide additional detail.
+.It Fl W Ar longopt=value
+Long options (preceded by
+.Fl - )
+are only supported directly on systems that have the
+.Xr getopt_long 3
+function.
+The
+.Fl W
+option can be used to access long options on systems that
+do not support this function.
+.It Fl w
+Ask for confirmation for every action.
+.It Fl X Ar filename
+Read a list of exclusion patterns from the specified file.
+See
+.Fl -exclude
+for more information about the handling of exclusions.
+.It Fl y
+(c mode only)
+Compress the resulting archive with
+.Xr bzip2 1 .
+In extract or list modes, this option is ignored.
+Note that, unlike other
+.Nm tar
+implementations, this implementation recognizes bzip2 compression
+automatically when reading archives.
+.It Fl z
+(c mode only)
+Compress the resulting archive with
+.Xr gzip 1 .
+In extract or list modes, this option is ignored.
+Note that, unlike other
+.Nm tar
+implementations, this implementation recognizes gzip compression
+automatically when reading archives.
+.El
+.Sh ENVIRONMENT
+The following environment variables affect the execution of
+.Nm :
+.Bl -tag -width ".Ev BLOCKSIZE"
+.It Ev LANG
+The locale to use.
+See
+.Xr environ 7
+for more information.
+.It Ev POSIXLY_CORRECT
+If this environment variable is defined, the
+.Fl l
+option will be interpreted in accordance with
+.St -p1003.1-96 .
+.It Ev TAPE
+The default tape device.
+The
+.Fl f
+option overrides this.
+.It Ev TZ
+The timezone to use when displaying dates.
+See
+.Xr environ 7
+for more information.
+.El
+.Sh FILES
+.Bl -tag -width ".Ev BLOCKSIZE"
+.It Pa /dev/sa0
+The default tape device, if not overridden by the
+.Ev TAPE
+environment variable or the
+.Fl f
+option.
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+The following creates a new archive
+called
+.Ar file.tar.gz
+that contains two files
+.Ar source.c
+and
+.Ar source.h :
+.Dl Nm Fl czf Pa file.tar.gz Pa source.c Pa source.h
+.Pp
+To view a detailed table of contents for this
+archive:
+.Dl Nm Fl tvf Pa file.tar.gz
+.Pp
+To extract all entries from the archive on
+the default tape drive:
+.Dl Nm Fl x
+.Pp
+To examine the contents of an ISO 9660 cdrom image:
+.Dl Nm Fl tf Pa image.iso
+.Pp
+To move file hierarchies, invoke
+.Nm
+as
+.Dl Nm Fl cf Pa - Fl C Pa srcdir\ . | Nm Fl xpf Pa - Fl C Pa destdir
+or more traditionally
+.Dl cd srcdir \&; Nm Fl cf Pa -\ . | ( cd destdir \&; Nm Fl xpf Pa - )
+.Pp
+In create mode, the list of files and directories to be archived
+can also include directory change instructions of the form
+.Cm -C Ns Pa foo/baz
+and archive inclusions of the form
+.Cm @ Ns Pa archive-file .
+For example, the command line
+.Dl Nm Fl c Fl f Pa new.tar Pa foo1 Cm @ Ns Pa old.tgz Cm -C Ns Pa /tmp Pa foo2
+will create a new archive
+.Pa new.tar .
+.Nm
+will read the file
+.Pa foo1
+from the current directory and add it to the output archive.
+It will then read each entry from
+.Pa old.tgz
+and add those entries to the output archive.
+Finally, it will switch to the
+.Pa /tmp
+directory and add
+.Pa foo2
+to the output archive.
+.Pp
+The
+.Fl -newer
+and
+.Fl -newer-mtime
+switches accept a variety of common date and time specifications, including
+.Dq 12 Mar 2005 7:14:29pm ,
+.Dq 2005-03-12 19:14 ,
+.Dq 5 minutes ago ,
+and
+.Dq 19:14 PST May 1 .
+.Sh COMPATIBILITY
+The bundled-arguments format is supported for compatibility
+with historic implementations.
+It consists of an initial word (with no leading - character) in which
+each character indicates an option.
+Arguments follow as separate words.
+The order of the arguments must match the order
+of the corresponding characters in the bundled command word.
+For example,
+.Dl Nm Cm tbf 32 Pa file.tar
+specifies three flags
+.Cm t ,
+.Cm b ,
+and
+.Cm f .
+The
+.Cm b
+and
+.Cm f
+flags both require arguments,
+so there must be two additional items
+on the command line.
+The
+.Ar 32
+is the argument to the
+.Cm b
+flag, and
+.Ar file.tar
+is the argument to the
+.Cm f
+flag.
+.Pp
+The mode options c, r, t, u, and x and the options
+b, f, l, m, o, v, and w comply with SUSv2.
+.Pp
+For maximum portability, scripts that invoke
+.Nm tar
+should use the bundled-argument format above, should limit
+themselves to the
+.Cm c ,
+.Cm t ,
+and
+.Cm x
+modes, and the
+.Cm b ,
+.Cm f ,
+.Cm m ,
+.Cm v ,
+and
+.Cm w
+options.
+.Pp
+On systems that support getopt_long(), additional long options
+are available to improve compatibility with other tar implementations.
+.Sh SECURITY
+Certain security issues are common to many archiving programs, including
+.Nm .
+In particular, carefully-crafted archives can request that
+.Nm
+extract files to locations outside of the target directory.
+This can potentially be used to cause unwitting users to overwrite
+files they did not intend to overwrite.
+If the archive is being extracted by the superuser, any file
+on the system can potentially be overwritten.
+There are three ways this can happen.
+Although
+.Nm
+has mechanisms to protect against each one,
+savvy users should be aware of the implications:
+.Bl -bullet -width indent
+.It
+Archive entries can have absolute pathnames.
+By default,
+.Nm
+removes the leading
+.Pa /
+character from filenames before restoring them to guard against this problem.
+.It
+Archive entries can have pathnames that include
+.Pa ..
+components.
+By default,
+.Nm
+will not extract files containing
+.Pa ..
+components in their pathname.
+.It
+Archive entries can exploit symbolic links to restore
+files to other directories.
+An archive can restore a symbolic link to another directory,
+then use that link to restore a file into that directory.
+To guard against this,
+.Nm
+checks each extracted path for symlinks.
+If the final path element is a symlink, it will be removed
+and replaced with the archive entry.
+If
+.Fl U
+is specified, any intermediate symlink will also be unconditionally removed.
+If neither
+.Fl U
+nor
+.Fl P
+is specified,
+.Nm
+will refuse to extract the entry.
+.El
+To protect yourself, you should be wary of any archives that
+come from untrusted sources.
+You should examine the contents of an archive with
+.Dl Nm Fl tf Pa filename
+before extraction.
+You should use the
+.Fl k
+option to ensure that
+.Nm
+will not overwrite any existing files or the
+.Fl U
+option to remove any pre-existing files.
+You should generally not extract archives while running with super-user
+privileges.
+Note that the
+.Fl P
+option to
+.Nm
+disables the security checks above and allows you to extract
+an archive while preserving any absolute pathnames,
+.Pa ..
+components, or symlinks to other directories.
+.Sh SEE ALSO
+.Xr bzip2 1 ,
+.Xr cpio 1 ,
+.Xr gzip 1 ,
+.Xr mt 1 ,
+.Xr pax 1 ,
+.Xr shar 1 ,
+.Xr libarchive 3 ,
+.Xr libarchive-formats 5 ,
+.Xr tar 5
+.Sh STANDARDS
+There is no current POSIX standard for the tar command; it appeared
+in
+.St -p1003.1-96
+but was dropped from
+.St -p1003.1-2001 .
+The options used by this implementation were developed by surveying a
+number of existing tar implementations as well as the old POSIX specification
+for tar and the current POSIX specification for pax.
+.Pp
+The ustar and pax interchange file formats are defined by
+.St -p1003.1-2001
+for the pax command.
+.Sh HISTORY
+A
+.Nm tar
+command appeared in Seventh Edition Unix, which was released in January, 1979.
+There have been numerous other implementations,
+many of which extended the file format.
+John Gilmore's
+.Nm pdtar
+public-domain implementation (circa November, 1987)
+was quite influential, and formed the basis of GNU tar.
+GNU tar was included as the standard system tar
+in
+.Fx
+beginning with
+.Fx 1.0 .
+.Pp
+This is a complete re-implementation based on the
+.Xr libarchive 3
+library.
+.Sh BUGS
+POSIX and GNU violently disagree about the meaning of the
+.Fl l
+option.
+Because of the potential for disaster if someone expects
+one behavior and gets the other, the
+.Fl l
+option is deliberately broken in this implementation.
+.Pp
+The
+.Fl C Pa dir
+option may differ from historic implementations.
+.Pp
+All archive output is written in correctly-sized blocks, even
+if the output is being compressed.
+Whether or not the last output block is padded to a full
+block size varies depending on the format and the
+output device.
+For tar and cpio formats, the last block of output is padded
+to a full block size if the output is being
+written to standard output or to a character or block device such as
+a tape drive.
+If the output is being written to a regular file, the last block
+will not be padded.
+Many compressors, including
+.Xr gzip 1
+and
+.Xr bzip2 1 ,
+complain about the null padding when decompressing an archive created by
+.Nm ,
+although they still extract it correctly.
+.Pp
+The compression and decompression is implemented internally, so
+there may be insignificant differences between the compressed output
+generated by
+.Dl Nm Fl czf Pa - file
+and that generated by
+.Dl Nm Fl cf Pa - file | Nm gzip
+.Pp
+The default should be to read and write archives to the standard I/O paths,
+but tradition (and POSIX) dictates otherwise.
+.Pp
+The
+.Cm r
+and
+.Cm u
+modes require that the archive be uncompressed
+and located in a regular file on disk.
+Other archives can be modified using
+.Cm c
+mode with the
+.Pa @archive-file
+extension.
+.Pp
+To archive a file called
+.Pa @foo
+or
+.Pa -foo
+you must specify it as
+.Pa ./@foo
+or
+.Pa ./-foo ,
+respectively.
+.Pp
+In create mode, a leading
+.Pa ./
+is always removed.
+A leading
+.Pa /
+is stripped unless the
+.Fl P
+option is specified.
+.Pp
+There needs to be better support for file selection on both create
+and extract.
+.Pp
+There is not yet any support for multi-volume archives or for archiving
+sparse files.
+.Pp
+Converting between dissimilar archive formats (such as tar and cpio) using the
+.Cm @ Ns Pa -
+convention can cause hard link information to be lost.
+(This is a consequence of the incompatible ways that different archive
+formats store hardlink information.)
+.Pp
+There are alternative long options for many of the short options that
+are deliberately not documented.
diff --git a/archivers/libarchive/files/doc/man/cpio.5 b/archivers/libarchive/files/doc/man/cpio.5
new file mode 100644
index 00000000000..2f298332d18
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/cpio.5
@@ -0,0 +1,325 @@
+.\" Copyright (c) 2007 Tim Kientzle
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 5, 2007
+.Dt CPIO 5
+.Os
+.Sh NAME
+.Nm cpio
+.Nd format of cpio archive files
+.Sh DESCRIPTION
+The
+.Nm
+archive format collects any number of files, directories, and other
+file system objects (symbolic links, device nodes, etc.) into a single
+stream of bytes.
+.Ss General Format
+Each file system object in a
+.Nm
+archive comprises a header record with basic numeric metadata
+followed by the full pathname of the entry and the file data.
+The header record stores a series of integer values that generally
+follow the fields in
+.Va struct stat .
+(See
+.Xr stat 2
+for details.)
+The variants differ primarily in how they store those integers
+(binary, octal, or hexadecimal).
+The header is followed by the pathname of the
+entry (the length of the pathname is stored in the header)
+and any file data.
+The end of the archive is indicated by a special record with
+the pathname
+.Dq TRAILER!!! .
+.Ss PWB format
+XXX Any documentation of the original PWB/UNIX 1.0 format? XXX
+.Ss Old Binary Format
+The old binary
+.Nm
+format stores numbers as 2-byte and 4-byte binary values.
+Each entry begins with a header in the following format:
+.Bd -literal -offset indent
+struct header_old_cpio {
+ unsigned short c_magic;
+ unsigned short c_dev;
+ unsigned short c_ino;
+ unsigned short c_mode;
+ unsigned short c_uid;
+ unsigned short c_gid;
+ unsigned short c_nlink;
+ unsigned short c_rdev;
+ unsigned short c_mtime[2];
+ unsigned short c_namesize;
+ unsigned short c_filesize[2];
+};
+.Ed
+.Pp
+The
+.Va unsigned short
+fields here are 16-bit integer values; the
+.Va unsigned int
+fields are 32-bit integer values.
+The fields are as follows
+.Bl -tag -width indent
+.It Va magic
+The integer value octal 070707.
+This value can be used to determine whether this archive is
+written with little-endian or big-endian integers.
+.It Va dev , Va ino
+The device and inode numbers from the disk.
+These are used by programs that read
+.Nm
+archives to determine when two entries refer to the same file.
+Programs that synthesize
+.Nm
+archives should be careful to set these to distinct values for each entry.
+.It Va mode
+The mode specifies both the regular permissions and the file type.
+It consists of several bit fields as follows:
+.Bl -tag -width "MMMMMMM" -compact
+.It 0170000
+This masks the file type bits.
+.It 0140000
+File type value for sockets.
+.It 0120000
+File type value for symbolic links.
+For symbolic links, the link body is stored as file data.
+.It 0100000
+File type value for regular files.
+.It 0060000
+File type value for block special devices.
+.It 0040000
+File type value for directories.
+.It 0020000
+File type value for character special devices.
+.It 0010000
+File type value for named pipes or FIFOs.
+.It 0004000
+SUID bit.
+.It 0002000
+SGID bit.
+.It 0001000
+Sticky bit.
+On some systems, this modifies the behavior of executables and/or directories.
+.It 0000777
+The lower 9 bits specify read/write/execute permissions
+for world, group, and user following standard POSIX conventions.
+.El
+.It Va uid , Va gid
+The numeric user id and group id of the owner.
+.It Va nlink
+The number of links to this file.
+Directories always have a value of at least two here.
+Note that hardlinked files include file data with every copy in the archive.
+.It Va rdev
+For block special and character special entries,
+this field contains the associated device number.
+For all other entry types, it should be set to zero by writers
+and ignored by readers.
+.It Va mtime
+Modification time of the file, indicated as the number
+of seconds since the start of the epoch,
+00:00:00 UTC January 1, 1970.
+The four-byte integer is stored with the most-significant 16 bits first
+followed by the least-significant 16 bits.
+Each of the two 16 bit values are stored in machine-native byte order.
+.It Va namesize
+The number of bytes in the pathname that follows the header.
+This count includes the trailing NULL byte.
+.It Va filesize
+The size of the file.
+Note that this archive format is limited to
+four gigabyte file sizes.
+See
+.Va mtime
+above for a description of the storage of four-byte integers.
+.El
+.Pp
+The pathname immediately follows the fixed header.
+If the
+.Cm namesize
+is odd, an additional NULL byte is added after the pathname.
+The file data is then appended, padded with NULL
+bytes to an even length.
+.Pp
+Hardlinked files are not given special treatment;
+the full file contents are included with each copy of the
+file.
+.Ss Portable ASCII Format
+.St -susv2
+standardized an ASCII variant that is portable across all
+platforms.
+It is commonly known as the
+.Dq old character
+format or as the
+.Dq odc
+format.
+It stores the same numeric fields as the old binary format, but
+represents them as 6-character or 11-character octal values.
+.Bd -literal -offset indent
+struct cpio_odc_header {
+ char c_magic[6];
+ char c_dev[6];
+ char c_ino[6];
+ char c_mode[6];
+ char c_uid[6];
+ char c_gid[6];
+ char c_nlink[6];
+ char c_rdev[6];
+ char c_mtime[11];
+ char c_namesize[6];
+ char c_filesize[11];
+};
+.Ed
+.Pp
+The fields are identical to those in the old binary format.
+The name and file body follow the fixed header.
+Unlike the old binary format, there is no additional padding
+after the pathname or file contents.
+If the files being archived are themselves entirely ASCII, then
+the resulting archive will be entirely ASCII, except for the
+NULL byte that terminates the name field.
+.Ss New ASCII Format
+The "new" ASCII format uses 8-byte hexadecimal fields for
+all numbers and separates device numbers into separate fields
+for major and minor numbers.
+.Bd -literal -offset indent
+struct cpio_newc_header {
+ char c_magic[6];
+ char c_ino[8];
+ char c_mode[8];
+ char c_uid[8];
+ char c_gid[8];
+ char c_nlink[8];
+ char c_mtime[8];
+ char c_filesize[8];
+ char c_devmajor[8];
+ char c_devminor[8];
+ char c_rdevmajor[8];
+ char c_rdevminor[8];
+ char c_namesize[8];
+ char c_check[8];
+};
+.Ed
+.Pp
+Except as specified below, the fields here match those specified
+for the old binary format above.
+.Bl -tag -width indent
+.It Va magic
+The string
+.Dq 070701 .
+.It Va check
+This field is always set to zero by writers and ignored by readers.
+See the next section for more details.
+.El
+.Pp
+The pathname is followed by NULL bytes so that the total size
+of the fixed header plus pathname is a multiple of four.
+Likewise, the file data is padded to a multiple of four bytes.
+Note that this format supports only 4 gigabyte files (unlike the
+older ASCII format, which supports 8 gigabyte files).
+.Pp
+In this format, hardlinked files are handled by setting the
+filesize to zero for each entry except the last one that
+appears in the archive.
+.Ss New CRC Format
+The CRC format is identical to the new ASCII format described
+in the previous section except that the magic field is set
+to
+.Dq 070702
+and the
+.Va check
+field is set to the sum of all bytes in the file data.
+This sum is computed treating all bytes as unsigned values
+and using unsigned arithmetic.
+Only the least-significant 32 bits of the sum are stored.
+.Ss HP variants
+The
+.Nm cpio
+implementation distributed with HPUX used XXXX but stored
+device numbers differently XXX.
+.Ss Other Extensions and Variants
+Sun Solaris uses additional file types to store extended file
+data, including ACLs and extended attributes, as special
+entries in cpio archives.
+.Pp
+XXX Others? XXX
+.Sh BUGS
+The
+.Dq CRC
+format is mis-named, as it uses a simple checksum and
+not a cyclic redundancy check.
+.Pp
+The old binary format is limited to 16 bits for user id,
+group id, device, and inode numbers.
+It is limited to 4 gigabyte file sizes.
+.Pp
+The old ASCII format is limited to 18 bits for
+the user id, group id, device, and inode numbers.
+It is limited to 8 gigabyte file sizes.
+.Pp
+The new ASCII format is limited to 4 gigabyte file sizes.
+.Pp
+None of the cpio formats store user or group names,
+which are essential when moving files between systems with
+dissimilar user or group numbering.
+.Pp
+Especially when writing older cpio variants, it may be necessary
+to map actual device/inode values to synthesized values that
+fit the available fields.
+With very large filesystems, this may be necessary even for
+the newer formats.
+.Sh SEE ALSO
+.Xr cpio 1 ,
+.Xr tar 5
+.Sh STANDARDS
+The
+.Nm cpio
+utility is no longer a part of POSIX or the Single Unix Standard.
+It last appeared in
+.St -susv2 .
+It has been supplanted in subsequent standards by
+.Xr pax 1 .
+The portable ASCII format is currently part of the specification for the
+.Xr pax 1
+utility.
+.Sh HISTORY
+The original cpio utility was written by Dick Haight
+while working in AT&T's Unix Support Group.
+It appeared in 1977 as part of PWB/UNIX 1.0, the
+.Dq Programmer's Work Bench
+derived from
+.At v6
+that was used internally at AT&T.
+Both the old binary and old character formats were in use
+by 1980, according to the System III source released
+by SCO under their
+.Dq Ancient Unix
+license.
+The character format was adopted as part of
+.St -p1003.1-88 .
+XXX when did "newc" appear? Who invented it? When did HP come out with their variant? When did Sun introduce ACLs and extended attributes? XXX \ No newline at end of file
diff --git a/archivers/libarchive/files/doc/man/libarchive-formats.5 b/archivers/libarchive/files/doc/man/libarchive-formats.5
new file mode 100644
index 00000000000..0606a5ba1d0
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/libarchive-formats.5
@@ -0,0 +1,272 @@
+.\" Copyright (c) 2003-2007 Tim Kientzle
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD: src/lib/libarchive/libarchive-formats.5,v 1.14 2007/04/05 05:07:53 kientzle Exp $
+.\"
+.Dd April 27, 2004
+.Dt libarchive-formats 3
+.Os
+.Sh NAME
+.Nm libarchive-formats
+.Nd archive formats supported by the libarchive library
+.Sh DESCRIPTION
+The
+.Xr libarchive 3
+library reads and writes a variety of streaming archive formats.
+Generally speaking, all of these archive formats consist of a series of
+.Dq entries .
+Each entry stores a single file system object, such as a file, directory,
+or symbolic link.
+.Pp
+The following provides a brief description of each format supported
+by libarchive, with some information about recognized extensions or
+limitations of the current library support.
+Note that just because a format is supported by libarchive does not
+imply that a program that uses libarchive will support that format.
+Applications that use libarchive specify which formats they wish
+to support.
+.Ss Tar Formats
+The
+.Xr libarchive 3
+library can read most tar archives.
+However, it only writes POSIX-standard
+.Dq ustar
+and
+.Dq pax interchange
+formats.
+.Pp
+All tar formats store each entry in one or more 512-byte records.
+The first record is used for file metadata, including filename,
+timestamp, and mode information, and the file data is stored in
+subsequent records.
+Later variants have extended this by either appropriating undefined
+areas of the header record, extending the header to multiple records,
+or by storing special entries that modify the interpretation of
+subsequent entries.
+.Pp
+.Bl -tag -width indent
+.It Cm gnutar
+The
+.Xr libarchive 3
+library can read GNU-format tar archives.
+It currently supports the most popular GNU extensions, including
+modern long filename and linkname support, as well as atime and ctime data.
+The libarchive library does not support multi-volume
+archives, nor the old GNU long filename format.
+It can read GNU sparse file entries, including the new POSIX-based
+formats, but cannot write GNU sparse file entries.
+.It Cm pax
+The
+.Xr libarchive 3
+library can read and write POSIX-compliant pax interchange format
+archives.
+Pax interchange format archives are an extension of the older ustar
+format that adds a separate entry with additional attributes stored
+as key/value pairs.
+The presence of this additional entry is the only difference between
+pax interchange format and the older ustar format.
+The extended attributes are of unlimited length and are stored
+as UTF-8 Unicode strings.
+Keywords defined in the standard are in all lowercase; vendors are allowed
+to define custom keys by preceding them with the vendor name in all uppercase.
+When writing pax archives, libarchive uses many of the SCHILY keys
+defined by Joerg Schilling's
+.Dq star
+archiver.
+The libarchive library can read most of the SCHILY keys.
+It silently ignores any keywords that it does not understand.
+.It Cm restricted pax
+The libarchive library can also write pax archives in which it
+attempts to suppress the extended attributes entry whenever
+possible.
+The result will be identical to a ustar archive unless the
+extended attributes entry is required to store a long file
+name, long linkname, extended ACL, file flags, or if any of the standard
+ustar data (user name, group name, UID, GID, etc) cannot be fully
+represented in the ustar header.
+In all cases, the result can be dearchived by any program that
+can read POSIX-compliant pax interchange format archives.
+Programs that correctly read ustar format (see below) will also be
+able to read this format; any extended attributes will be extracted as
+separate files stored in
+.Pa PaxHeader
+directories.
+.It Cm ustar
+The libarchive library can both read and write this format.
+This format has the following limitations:
+.Bl -bullet -compact
+.It
+Device major and minor numbers are limited to 21 bits.
+Nodes with larger numbers will not be added to the archive.
+.It
+Path names in the archive are limited to 255 bytes.
+(Shorter if there is no / character in exactly the right place.)
+.It
+Symbolic links and hard links are stored in the archive with
+the name of the referenced file.
+This name is limited to 100 bytes.
+.It
+Extended attributes, file flags, and other extended
+security information cannot be stored.
+.It
+Archive entries are limited to 2 gigabytes in size.
+.El
+Note that the pax interchange format has none of these restrictions.
+.El
+.Pp
+The libarchive library can also read a variety of commonly-used extensions to
+the basic tar format.
+In particular, it supports base-256 values in certain numeric fields.
+This essentially removes the limitations on file size, modification time,
+and device numbers.
+.Pp
+The first tar program appeared in Seventh Edition Unix in 1979.
+The first official standard for the tar file format was the
+.Dq ustar
+(Unix Standard Tar) format defined by POSIX in 1988.
+POSIX.1-2001 extended the ustar format to create the
+.Dq pax interchange
+format.
+.Ss Cpio Formats
+The libarchive library can read a number of common cpio variants and can write
+.Dq odc
+and
+.Dq newc
+format archives.
+A cpio archive stores each entry as a fixed-size header followed
+by a variable-length filename and variable-length data.
+Unlike tar, cpio does only minimal padding of the header or file data.
+There are a variety of cpio formats, which differ primarily in
+how they store the initial header: some store the values as
+octal or hexadecimal numbers in ASCII, others as binary values of
+varying byte order and length.
+.Bl -tag -width indent
+.It Cm binary
+The libarchive library can read both big-endian and little-endian
+variants of the original binary cpio format.
+This format used 32-bit binary values for file size and mtime,
+and 16-bit binary values for the other fields.
+.It Cm odc
+The libarchive library can both read and write this
+POSIX-standard format.
+This format stores the header contents as octal values in ASCII.
+It is standard, portable, and immune from byte-order confusion.
+File sizes and mtime are limited to 33 bits (8GB file size),
+other fields are limited to 18 bits.
+.It Cm SVR4
+The libarchive library can read both CRC and non-CRC variants of
+this format.
+The SVR4 format uses eight-digit hexadecimal values for
+all header fields.
+This limits file size to 4GB, and also limits the mtime and
+other fields to 32 bits.
+The SVR4 format can optionally include a CRC of the file
+contents, although libarchive does not currently verify this CRC.
+.El
+.Pp
+Cpio first appeared in PWB/UNIX 1.0, which was released within
+AT&T in 1977.
+PWB/UNIX 1.0 formed the basis of System III Unix, released outside
+of AT&T in 1981.
+This makes cpio older than tar, although cpio was not included
+in Version 7 AT&T Unix.
+As a result, the tar command became much better known in universities
+and research groups that used Version 7.
+The combination of the
+.Nm find
+and
+.Nm cpio
+utilities provided very precise control over file selection.
+Unfortunately, the format has many limitations that make it unsuitable
+for widespread use.
+Only the POSIX format permits files over 4GB, and its 18-bit
+limit for most other fields makes it unsuitable for modern systems.
+In addition, cpio formats only store numeric UID/GID values (not
+usernames and group names), which can make it very difficult to correctly
+transfer archives across systems with dissimilar user numbering.
+.Ss Shar Formats
+A
+.Dq shell archive
+is a shell script that, when executed on a POSIX-compliant
+system, will recreate a collection of file system objects.
+The libarchive library can write two different kinds of shar archives:
+.Bl -tag -width indent
+.It Cm shar
+The traditional shar format uses a limited set of POSIX
+commands, including
+.Xr echo 1 ,
+.Xr mkdir 1 ,
+and
+.Xr sed 1 .
+It is suitable for portably archiving small collections of plain text files.
+However, it is not generally well-suited for large archives
+(many implementations of
+.Xr sh 1
+have limits on the size of a script) nor should it be used with non-text files.
+.It Cm shardump
+This format is similar to shar but encodes files using
+.Xr uuencode 1
+so that the result will be a plain text file regardless of the file contents.
+It also includes additional shell commands that attempt to reproduce as
+many file attributes as possible, including owner, mode, and flags.
+The additional commands used to restore file attributes make
+shardump archives less portable than plain shar archives.
+.El
+.Ss ISO9660 format
+Libarchive can read and extract from files containing ISO9660-compliant
+CDROM images.
+It also has partial support for Rockridge extensions.
+In many cases, this can remove the need to burn a physical CDROM.
+It also avoids security and complexity issues that come with
+virtual mounts and loopback devices.
+.Ss Zip format
+Libarchive can extract from most zip format archives.
+It currently only supports uncompressed entries and entries
+compressed with the
+.Dq deflate
+algorithm.
+Older zip compression algorithms are not supported.
+.Ss Archive (library) file format
+The Unix archive format (commonly created by the
+.Xr ar 1
+archiver) is a general-purpose format which is
+used almost exclusively for object files to be
+read by the link editor
+.Xr ld 1 .
+The ar format has never been standardised.
+There are two common variants:
+the GNU format derived from SVR4,
+and the BSD format, which first appeared in 4.4BSD.
+Libarchive provides read and write support for both variants.
+.Sh SEE ALSO
+.Xr ar 1 ,
+.Xr cpio 1 ,
+.Xr mkisofs 1 ,
+.Xr shar 1 ,
+.Xr tar 1 ,
+.Xr zip 1 ,
+.Xr zlib 3 ,
+.Xr cpio 5 ,
+.Xr mtree 5 ,
+.Xr tar 5
diff --git a/archivers/libarchive/files/doc/man/libarchive.3 b/archivers/libarchive/files/doc/man/libarchive.3
new file mode 100644
index 00000000000..8c19d008a90
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/libarchive.3
@@ -0,0 +1,331 @@
+.\" Copyright (c) 2003-2007 Tim Kientzle
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD: src/lib/libarchive/libarchive.3,v 1.11 2007/01/09 08:05:56 kientzle Exp $
+.\"
+.Dd August 19, 2006
+.Dt LIBARCHIVE 3
+.Os
+.Sh NAME
+.Nm libarchive
+.Nd functions for reading and writing streaming archives
+.Sh LIBRARY
+.Lb libarchive
+.Sh OVERVIEW
+The
+.Nm
+library provides a flexible interface for reading and writing
+streaming archive files such as tar and cpio.
+The library is inherently stream-oriented; readers serially iterate through
+the archive, writers serially add things to the archive.
+In particular, note that there is no built-in support for
+random access nor for in-place modification.
+.Pp
+When reading an archive, the library automatically detects the
+format and the compression.
+The library currently has read support for:
+.Bl -bullet -compact
+.It
+old-style tar archives,
+.It
+most variants of the POSIX
+.Dq ustar
+format,
+.It
+the POSIX
+.Dq pax interchange
+format,
+.It
+GNU-format tar archives,
+.It
+most common cpio archive formats,
+.It
+ISO9660 CD images (with or without RockRidge extensions),
+.It
+Zip archives.
+.El
+The library automatically detects archives compressed with
+.Xr gzip 1 ,
+.Xr bzip2 1 ,
+or
+.Xr compress 1
+and decompresses them transparently.
+.Pp
+When writing an archive, you can specify the compression
+to be used and the format to use.
+The library can write
+.Bl -bullet -compact
+.It
+POSIX-standard
+.Dq ustar
+archives,
+.It
+POSIX
+.Dq pax interchange format
+archives,
+.It
+POSIX octet-oriented cpio archives,
+.It
+two different variants of shar archives.
+.El
+Pax interchange format is an extension of the tar archive format that
+eliminates essentially all of the limitations of historic tar formats
+in a standard fashion that is supported
+by POSIX-compliant
+.Xr pax 1
+implementations on many systems as well as several newer implementations of
+.Xr tar 1 .
+Note that the default write format will suppress the pax extended
+attributes for most entries; explicitly requesting pax format will
+enable those attributes for all entries.
+.Pp
+The read and write APIs are accessed through the
+.Fn archive_read_XXX
+functions and the
+.Fn archive_write_XXX
+functions, respectively, and either can be used independently
+of the other.
+.Pp
+The rest of this manual page provides an overview of the library
+operation.
+More detailed information can be found in the individual manual
+pages for each API or utility function.
+.Sh READING AN ARCHIVE
+To read an archive, you must first obtain an initialized
+.Tn struct archive
+object from
+.Fn archive_read_new .
+You can then modify this object for the desired operations with the
+various
+.Fn archive_read_set_XXX
+and
+.Fn archive_read_support_XXX
+functions.
+In particular, you will need to invoke appropriate
+.Fn archive_read_support_XXX
+functions to enable the corresponding compression and format
+support.
+Note that these latter functions perform two distinct operations:
+they cause the corresponding support code to be linked into your
+program, and they enable the corresponding auto-detect code.
+Unless you have specific constraints, you will generally want
+to invoke
+.Fn archive_read_support_compression_all
+and
+.Fn archive_read_support_format_all
+to enable auto-detect for all formats and compression types
+currently supported by the library.
+.Pp
+Once you have prepared the
+.Tn struct archive
+object, you call
+.Fn archive_read_open
+to actually open the archive and prepare it for reading.
+There are several variants of this function;
+the most basic expects you to provide pointers to several
+functions that can provide blocks of bytes from the archive.
+There are convenience forms that allow you to
+specify a filename, file descriptor,
+.Ft "FILE *"
+object, or a block of memory from which to read the archive data.
+Note that the core library makes no assumptions about the
+size of the blocks read;
+callback functions are free to read whatever block size is
+most appropriate for the medium.
+.Pp
+Each archive entry consists of a header followed by a certain
+amount of data.
+You can obtain the next header with
+.Fn archive_read_next_header ,
+which returns a pointer to an
+.Tn struct archive_entry
+structure with information about the current archive element.
+If the entry is a regular file, then the header will be followed
+by the file data.
+You can use
+.Fn archive_read_data
+(which works much like the
+.Xr read 2
+system call)
+to read this data from the archive.
+You may prefer to use the higher-level
+.Fn archive_read_data_skip ,
+which reads and discards the data for this entry,
+.Fn archive_read_data_to_buffer ,
+which reads the data into an in-memory buffer,
+.Fn archive_read_data_to_file ,
+which copies the data to the provided file descriptor, or
+.Fn archive_read_extract ,
+which recreates the specified entry on disk and copies data
+from the archive.
+In particular, note that
+.Fn archive_read_extract
+uses the
+.Tn struct archive_entry
+structure that you provide it, which may differ from the
+entry just read from the archive.
+In particular, many applications will want to override the
+pathname, file permissions, or ownership.
+.Pp
+Once you have finished reading data from the archive, you
+should call
+.Fn archive_read_close
+to close the archive, then call
+.Fn archive_read_finish
+to release all resources, including all memory allocated by the library.
+.Pp
+The
+.Xr archive_read 3
+manual page provides more detailed calling information for this API.
+.Sh WRITING AN ARCHIVE
+You use a similar process to write an archive.
+The
+.Fn archive_write_new
+function creates an archive object useful for writing,
+the various
+.Fn archive_write_set_XXX
+functions are used to set parameters for writing the archive, and
+.Fn archive_write_open
+completes the setup and opens the archive for writing.
+.Pp
+Individual archive entries are written in a three-step
+process:
+You first initialize a
+.Tn struct archive_entry
+structure with information about the new entry.
+At a minimum, you should set the pathname of the
+entry and provide a
+.Va struct stat
+with a valid
+.Va st_mode
+field, which specifies the type of object and
+.Va st_size
+field, which specifies the size of the data portion of the object.
+The
+.Fn archive_write_header
+function actually writes the header data to the archive.
+You can then use
+.Fn archive_write_data
+to write the actual data.
+.Pp
+After all entries have been written, use the
+.Fn archive_write_finish
+function to release all resources.
+.Pp
+The
+.Xr archive_write 3
+manual page provides more detailed calling information for this API.
+.Sh DESCRIPTION
+Detailed descriptions of each function are provided by the
+corresponding manual pages.
+.Pp
+All of the functions utilize an opaque
+.Tn struct archive
+datatype that provides access to the archive contents.
+.Pp
+The
+.Tn struct archive_entry
+structure contains a complete description of a single archive
+entry.
+It uses an opaque interface that is fully documented in
+.Xr archive_entry 3 .
+.Pp
+Users familiar with historic formats should be aware that the newer
+variants have eliminated most restrictions on the length of textual fields.
+Clients should not assume that filenames, link names, user names, or
+group names are limited in length.
+In particular, pax interchange format can easily accommodate pathnames
+in arbitrary character sets that exceed
+.Va PATH_MAX .
+.Sh RETURN VALUES
+Most functions return zero on success, non-zero on error.
+The return value indicates the general severity of the error, ranging
+from
+.Cm ARCHIVE_WARN ,
+which indicates a minor problem that should probably be reported
+to the user, to
+.Cm ARCHIVE_FATAL ,
+which indicates a serious problem that will prevent any further
+operations on this archive.
+On error, the
+.Fn archive_errno
+function can be used to retrieve a numeric error code (see
+.Xr errno 2 ) .
+The
+.Fn archive_error_string
+returns a textual error message suitable for display.
+.Pp
+.Fn archive_read_new
+and
+.Fn archive_write_new
+return pointers to an allocated and initialized
+.Tn struct archive
+object.
+.Pp
+.Fn archive_read_data
+and
+.Fn archive_write_data
+return a count of the number of bytes actually read or written.
+A value of zero indicates the end of the data for this entry.
+A negative value indicates an error, in which case the
+.Fn archive_errno
+and
+.Fn archive_error_string
+functions can be used to obtain more information.
+.Sh ENVIRONMENT
+There are character set conversions within the
+.Xr archive_entry 3
+functions that are impacted by the currently-selected locale.
+.Sh SEE ALSO
+.Xr tar 1 ,
+.Xr archive_entry 3 ,
+.Xr archive_read 3 ,
+.Xr archive_util 3 ,
+.Xr archive_write 3 ,
+.Xr tar 5
+.Sh HISTORY
+The
+.Nm libarchive
+library first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm libarchive
+library was written by
+.An Tim Kientzle Aq kientzle@acm.org .
+.Sh BUGS
+Some archive formats support information that is not supported by
+.Tn struct archive_entry .
+Such information cannot be fully archived or restored using this library.
+This includes, for example, comments, character sets,
+or the arbitrary key/value pairs that can appear in
+pax interchange format archives.
+.Pp
+Conversely, of course, not all of the information that can be
+stored in an
+.Tn struct archive_entry
+is supported by all formats.
+For example, cpio formats do not support nanosecond timestamps;
+old tar formats do not support large device numbers.
diff --git a/archivers/libarchive/files/doc/man/libarchive_internals.3 b/archivers/libarchive/files/doc/man/libarchive_internals.3
new file mode 100644
index 00000000000..a84c9406d34
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/libarchive_internals.3
@@ -0,0 +1,366 @@
+.\" Copyright (c) 2003-2007 Tim Kientzle
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD: src/lib/libarchive/libarchive_internals.3,v 1.1 2007/05/29 01:00:20 kientzle Exp $
+.\"
+.Dd April 16, 2007
+.Dt LIBARCHIVE 3
+.Os
+.Sh NAME
+.Nm libarchive_internals
+.Nd description of libarchive internal interfaces
+.Sh OVERVIEW
+The
+.Nm libarchive
+library provides a flexible interface for reading and writing
+streaming archive files such as tar and cpio.
+Internally, it follows a modular layered design that should
+make it easy to add new archive and compression formats.
+.Sh GENERAL ARCHITECTURE
+Externally, libarchive exposes most operations through an
+opaque, object-style interface.
+The
+.Xr archive_entry 1
+objects store information about a single filesystem object.
+The rest of the library provides facilities to write
+.Xr archive_entry 1
+objects to archive files,
+read them from archive files,
+and write them to disk.
+(There are plans to add a facility to read
+.Xr archive_entry 1
+objects from disk as well.)
+.Pp
+The read and write APIs each have four layers: a public API
+layer, a format layer that understands the archive file format,
+a compression layer, and an I/O layer.
+The I/O layer is completely exposed to clients who can replace
+it entirely with their own functions.
+.Pp
+In order to provide as much consistency as possible for clients,
+some public functions are virtualized.
+Eventually, it should be possible for clients to open
+an archive or disk writer, and then use a single set of
+code to select and write entries, regardless of the target.
+.Sh READ ARCHITECTURE
+From the outside, clients use the
+.Xr archive_read 3
+API to manipulate an
+.Nm archive
+object to read entries and bodies from an archive stream.
+Internally, the
+.Nm archive
+object is cast to an
+.Nm archive_read
+object, which holds all read-specific data.
+The API has four layers:
+The lowest layer is the I/O layer.
+This layer can be overridden by clients, but most clients use
+the packaged I/O callbacks provided, for example, by
+.Xr archive_read_open_memory 3 ,
+and
+.Xr archive_read_open_fd 3 .
+The compression layer calls the I/O layer to
+read bytes and decompresses them for the format layer.
+The format layer unpacks a stream of uncompressed bytes and
+creates
+.Nm archive_entry
+objects from the incoming data.
+The API layer tracks overall state
+(for example, it prevents clients from reading data before reading a header)
+and invokes the format and compression layer operations
+through registered function pointers.
+In particular, the API layer drives the format-detection process:
+When opening the archive, it reads an initial block of data
+and offers it to each registered compression handler.
+The one with the highest bid is initialized with the first block.
+Similarly, the format handlers are polled to see which handler
+is the best for each archive.
+(Prior to 2.4.0, the format bidders were invoked for each
+entry, but this design hindered error recovery.)
+.Ss I/O Layer and Client Callbacks
+The read API goes to some lengths to be nice to clients.
+As a result, there are few restrictions on the behavior of
+the client callbacks.
+.Pp
+The client read callback is expected to provide a block
+of data on each call.
+A zero-length return does indicate end of file, but otherwise
+blocks may be as small as one byte or as large as the entire file.
+In particular, blocks may be of different sizes.
+.Pp
+The client skip callback returns the number of bytes actually
+skipped, which may be much smaller than the skip requested.
+The only requirement is that the skip not be larger.
+In particular, clients are allowed to return zero for any
+skip that they don't want to handle.
+The skip callback must never be invoked with a negative value.
+.Pp
+Keep in mind that not all clients are reading from disk:
+clients reading from networks may provide different-sized
+blocks on every request and cannot skip at all;
+advanced clients may use
+.Xr mmap 2
+to read the entire file into memory at once and return the
+entire file to libarchive as a single block;
+other clients may begin asynchronous I/O operations for the
+next block on each request.
+.Ss Decompresssion Layer
+The decompression layer not only handles decompression,
+it also buffers data so that the format handlers see a
+much nicer I/O model.
+The decompression API is a two stage peek/consume model.
+A read_ahead request specifies a minimum read amount;
+the decompression layer must provide a pointer to at least
+that much data.
+If more data is immediately available, it should return more:
+the format layer handles bulk data reads by asking for a minimum
+of one byte and then copying as much data as is available.
+.Pp
+A subsequent call to the
+.Fn consume
+function advances the read pointer.
+Note that data returned from a
+.Fn read_ahead
+call is guaranteed to remain in place until
+the next call to
+.Fn read_ahead .
+Intervening calls to
+.Fn consume
+should not cause the data to move.
+.Pp
+Skip requests must always be handled exactly.
+Decompression handlers that cannot seek forward should
+not register a skip handler;
+the API layer fills in a generic skip handler that reads and discards data.
+.Pp
+A decompression handler has a specific lifecycle:
+.Bl -tag -compact -width indent
+.It Registration/Configuration
+When the client invokes the public support function,
+the decompression handler invokes the internal
+.Fn __archive_read_register_compression
+function to provide bid and initialization functions.
+This function returns
+.Cm NULL
+on error or else a pointer to a
+.Cm struct decompressor_t .
+This structure contains a
+.Va void * config
+slot that can be used for storing any customization information.
+.It Bid
+The bid function is invoked with a pointer and size of a block of data.
+The decompressor can access its config data
+through the
+.Va decompressor
+element of the
+.Cm archive_read
+object.
+The bid function is otherwise stateless.
+In particular, it must not perform any I/O operations.
+.Pp
+The value returned by the bid function indicates its suitability
+for handling this data stream.
+A bid of zero will ensure that this decompressor is never invoked.
+Return zero if magic number checks fail.
+Otherwise, your initial implementation should return the number of bits
+actually checked.
+For example, if you verify two full bytes and three bits of another
+byte, bid 19.
+Note that the initial block may be very short;
+be careful to only inspect the data you are given.
+(The current decompressors require two bytes for correct bidding.)
+.It Initialize
+The winning bidder will have its init function called.
+This function should initialize the remaining slots of the
+.Va struct decompressor_t
+object pointed to by the
+.Va decompressor
+element of the
+.Va archive_read
+object.
+In particular, it should allocate any working data it needs
+in the
+.Va data
+slot of that structure.
+The init function is called with the block of data that
+was used for tasting.
+At this point, the decompressor is responsible for all I/O
+requests to the client callbacks.
+The decompressor is free to read more data as and when
+necessary.
+.It Satisfy I/O requests
+The format handler will invoke the
+.Va read_ahead ,
+.Va consume ,
+and
+.Va skip
+functions as needed.
+.It Finish
+The finish method is called only once when the archive is closed.
+It should release anything stored in the
+.Va data
+and
+.Va config
+slots of the
+.Va decompressor
+object.
+It should not invoke the client close callback.
+.El
+.Ss Format Layer
+The read formats have a similar lifecycle to the decompression handlers:
+.Bl -tag -compact -width indent
+.It Registration
+Allocate your private data and initialize your pointers.
+.It Bid
+Formats bid by invoking the
+.Fn read_ahead
+decompression method but not calling the
+.Fn consume
+method.
+This allows each bidder to look ahead in the input stream.
+Bidders should not look further ahead than necessary, as long
+look aheads put pressure on the decompression layer to buffer
+lots of data.
+Most formats only require a few hundred bytes of look ahead;
+look aheads of a few kilobytes are reasonable.
+(The ISO9660 reader sometimes looks ahead by 48k, which
+should be considered an upper limit.)
+.It Read header
+The header read is usually the most complex part of any format.
+There are a few strategies worth mentioning:
+For formats such as tar or cpio, reading and parsing the header is
+straightforward since headers alternate with data.
+For formats that store all header data at the beginning of the file,
+the first header read request may have to read all headers into
+memory and store that data, sorted by the location of the file
+data.
+Subsequent header read requests will skip forward to the
+beginning of the file data and return the corresponding header.
+.It Read Data
+The read data interface supports sparse files; this requires that
+each call return a block of data specifying the file offset and
+size.
+This may require you to carefully track the location so that you
+can return accurate file offsets for each read.
+Remember that the decompressor will return as much data as it has.
+Generally, you will want to request one byte,
+examine the return value to see how much data is available, and
+possibly trim that to the amount you can use.
+You should invoke consume for each block just before you return it.
+.It Skip All Data
+The skip data call should skip over all file data and trailing padding.
+This is called automatically by the API layer just before each
+header read.
+It is also called in response to the client calling the public
+.Fn data_skip
+function.
+.It Cleanup
+On cleanup, the format should release all of its allocated memory.
+.El
+.Ss API Layer
+XXX to do XXX
+.Sh WRITE ARCHITECTURE
+The write API has a similar set of four layers:
+an API layer, a format layer, a compression layer, and an I/O layer.
+The registration here is much simpler because only
+one format and one compression can be registered at a time.
+.Ss I/O Layer and Client Callbacks
+XXX To be written XXX
+.Ss Compression Layer
+XXX To be written XXX
+.Ss Format Layer
+XXX To be written XXX
+.Ss API Layer
+XXX To be written XXX
+.Sh WRITE_DISK ARCHITECTURE
+The write_disk API is intended to look just like the write API
+to clients.
+Since it does not handle multiple formats or compression, it
+is not layered internally.
+.Sh GENERAL SERVICES
+The
+.Nm archive_read ,
+.Nm archive_write ,
+and
+.Nm archive_write_disk
+objects all contain an initial
+.Nm archive
+object which provides common support for a set of standard services.
+(Recall that ANSI/ISO C90 guarantees that you can cast freely between
+a pointer to a structure and a pointer to the first element of that
+structure.)
+The
+.Nm archive
+object has a magic value that indicates which API this object
+is associated with,
+slots for storing error information,
+and function pointers for virtualized API functions.
+.Sh MISCELLANEOUS NOTES
+Connecting existing archiving libraries into libarchive is generally
+quite difficult.
+In particular, many existing libraries strongly assume that you
+are reading from a file; they seek forwards and backwards as necessary
+to locate various pieces of information.
+In contrast, libarchive never seeks backwards in its input, which
+sometimes requires very different approaches.
+.Pp
+For example, libarchive's ISO9660 support operates very differently
+from most ISO9660 readers.
+The libarchive support utilizes a work-queue design that
+keeps a list of known entries sorted by their location in the input.
+Whenever libarchive's ISO9660 implementation is asked for the next
+header, checks this list to find the next item on the disk.
+Directories are parsed when they are encountered and new
+items are added to the list.
+This design relies heavily on the ISO9660 image being optimized so that
+directories always occur earlier on the disk than the files they
+describe.
+.Pp
+Depending on the specific format, such approaches may not be possible.
+The ZIP format specification, for example, allows archivers to store
+key information only at the end of the file.
+In theory, it is possible to create ZIP archives that cannot
+be read without seeking.
+Fortunately, such archives are very rare, and libarchive can read
+most ZIP archives, though it cannot always extract as much information
+as a dedicated ZIP program.
+.Sh SEE ALSO
+.Xr archive 3 ,
+.Xr archive_entry 3 ,
+.Xr archive_read 3 ,
+.Xr archive_write 3 ,
+.Xr archive_write_disk 3
+.Sh HISTORY
+The
+.Nm libarchive
+library first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm libarchive
+library was written by
+.An Tim Kientzle Aq kientzle@acm.org .
+.Sh BUGS
diff --git a/archivers/libarchive/files/doc/man/mtree.5 b/archivers/libarchive/files/doc/man/mtree.5
new file mode 100644
index 00000000000..613de6a5dae
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/mtree.5
@@ -0,0 +1,270 @@
+.\" Copyright (c) 1989, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" From: @(#)mtree.8 8.2 (Berkeley) 12/11/93
+.\" $FreeBSD$
+.\"
+.Dd August 20, 2007
+.Dt MTREE 5
+.Os
+.Sh NAME
+.Nm mtree
+.Nd format of mtree dir heirarchy files
+.Sh DESCRIPTION
+The
+.Nm
+format is a textual format that describes a collection of filesystem objects.
+Such files are typically used to create or verify directory heirarchies.
+.Ss General Format
+An
+.Nm
+file consists of a series of lines, each providing information
+about a single filesystem object.
+Leading whitespace is always ignored.
+.Pp
+When encoding file or pathnames, any backslash character or
+character outside of the 95 printable ASCII characters must be
+encoded as a a backslash followed by three
+octal digits.
+When reading mtree files, any appearance of a backslash
+followed by three octal digits should be converted into the
+corresponding character.
+.Pp
+Each line is interpreted independently as one of the following types:
+.Bl -tag -width Cm
+.It Signature
+The first line of any mtree file must begin with
+.Dq #mtree .
+If a file contains any full path entries, the first line should
+begin with
+.Dq #mtree v2.0 ,
+otherwise, the first line should begin with
+.Dq #mtree v1.0 .
+.It Blank
+Blank lines are ignored.
+.It Comment
+Lines beginning with
+.Cm #
+are ignored.
+.It Special
+Lines beginning with
+.Cm /
+are special commands that influence
+the interpretation of later lines.
+.It Relative
+If the first whitespace-delimited word has no
+.Cm /
+characters,
+it is the name of a file in the current directory.
+Any relative entry that describes a directory changes the
+current directory.
+.It dot-dot
+As a special case, a relative entry with the filename
+.Pa ..
+changes the current directory to the parent directory.
+Options on dot-dot entries are always ignored.
+.It Full
+If the first whitespace-delimited word has a
+.Cm /
+character after
+the first character, it is the pathname of a file relative to the
+starting directory.
+There can be multiple full entries describing the same file.
+.El
+.Pp
+Some tools that process
+.Nm
+files may require that multiple lines describing the same file
+occur consecutively.
+It is not permitted for the same file to be mentioned using
+both a relative and a full file specification.
+.Ss Special commands
+Two special commands are currently defined:
+.Bl -tag -width Cm
+.It Cm /set
+This command defines default values for one or more keywords.
+It is followed on the same line by one or more whitespace-separated
+keyword definitions.
+These definitions apply to all following files that do not specify
+a value for that keyword.
+.It Cm /unset
+This command removes any default value set by a previous
+.Cm /set
+command.
+It is followed on the same line by one or more keywords
+separated by whitespace.
+.El
+.Ss Keywords
+After the filename, a full or relative entry consists of zero
+or more whitespace-separated keyword definitions.
+Each such definitions consists of a key from the following
+list immediately followed by an '=' sign
+and a value.
+Software programs reading mtree files should warn about
+unrecognized keywords.
+.Pp
+Currently supported keywords are as follows:
+.Bl -tag -width Cm
+.It Cm cksum
+The checksum of the file using the default algorithm specified by
+the
+.Xr cksum 1
+utility.
+.It Cm contents
+The full pathname of a file whose contents should be
+compared to the contents of this file.
+.It Cm flags
+The file flags as a symbolic name.
+See
+.Xr chflags 1
+for information on these names.
+If no flags are to be set the string
+.Dq none
+may be used to override the current default.
+.It Cm ignore
+Ignore any file hierarchy below this file.
+.It Cm gid
+The file group as a numeric value.
+.It Cm gname
+The file group as a symbolic name.
+.It Cm md5
+The MD5 message digest of the file.
+.It Cm md5digest
+A synonym for
+.Cm md5 .
+.It Cm sha1
+The
+.Tn FIPS
+160-1
+.Pq Dq Tn SHA-1
+message digest of the file.
+.It Cm sha1digest
+A synonym for
+.Cm sha1 .
+.It Cm sha256
+The
+.Tn FIPS
+180-2
+.Pq Dq Tn SHA-256
+message digest of the file.
+.It Cm sha256digest
+A synonym for
+.Cm sha256 .
+.It Cm ripemd160digest
+The
+.Tn RIPEMD160
+message digest of the file.
+.It Cm rmd160
+A synonym for
+.Cm ripemd160digest .
+.It Cm rmd160digest
+A synonym for
+.Cm ripemd160digest .
+.It Cm mode
+The current file's permissions as a numeric (octal) or symbolic
+value.
+.It Cm nlink
+The number of hard links the file is expected to have.
+.It Cm nochange
+Make sure this file or directory exists but otherwise ignore all attributes.
+.It Cm uid
+The file owner as a numeric value.
+.It Cm uname
+The file owner as a symbolic name.
+.It Cm size
+The size, in bytes, of the file.
+.It Cm link
+The file the symbolic link is expected to reference.
+.It Cm time
+The last modification time of the file.
+.It Cm type
+The type of the file; may be set to any one of the following:
+.Pp
+.Bl -tag -width Cm -compact
+.It Cm block
+block special device
+.It Cm char
+character special device
+.It Cm dir
+directory
+.It Cm fifo
+fifo
+.It Cm file
+regular file
+.It Cm link
+symbolic link
+.It Cm socket
+socket
+.El
+.El
+.Pp
+.Sh SEE ALSO
+.Xr cksum 1 ,
+.Xr find 1 ,
+.Xr mtree 8
+.Sh BUGS
+The
+.Fx
+implementation of mtree does not currently support
+the
+.Nm
+2.0
+format.
+The requirement for a
+.Dq #mtree
+signature line is new and not yet widely implemented.
+.Sh HISTORY
+The
+.Nm
+utility appeared in
+.Bx 4.3 Reno .
+The
+.Tn MD5
+digest capability was added in
+.Fx 2.1 ,
+in response to the widespread use of programs which can spoof
+.Xr cksum 1 .
+The
+.Tn SHA-1
+and
+.Tn RIPEMD160
+digests were added in
+.Fx 4.0 ,
+as new attacks have demonstrated weaknesses in
+.Tn MD5 .
+The
+.Tn SHA-256
+digest was added in
+.Fx 6.0 .
+Support for file flags was added in
+.Fx 4.0 ,
+and mostly comes from
+.Nx .
+The
+.Dq full
+entry format was added by
+.Nx .
diff --git a/archivers/libarchive/files/doc/man/tar.5 b/archivers/libarchive/files/doc/man/tar.5
new file mode 100644
index 00000000000..ab39df3338a
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/tar.5
@@ -0,0 +1,730 @@
+.\" Copyright (c) 2003-2007 Tim Kientzle
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD: src/lib/libarchive/tar.5,v 1.17 2007/01/09 08:05:56 kientzle Exp $
+.\"
+.Dd May 20, 2004
+.Dt TAR 5
+.Os
+.Sh NAME
+.Nm tar
+.Nd format of tape archive files
+.Sh DESCRIPTION
+The
+.Nm
+archive format collects any number of files, directories, and other
+file system objects (symbolic links, device nodes, etc.) into a single
+stream of bytes.
+The format was originally designed to be used with
+tape drives that operate with fixed-size blocks, but is widely used as
+a general packaging mechanism.
+.Ss General Format
+A
+.Nm
+archive consists of a series of 512-byte records.
+Each file system object requires a header record which stores basic metadata
+(pathname, owner, permissions, etc.) and zero or more records containing any
+file data.
+The end of the archive is indicated by two records consisting
+entirely of zero bytes.
+.Pp
+For compatibility with tape drives that use fixed block sizes,
+programs that read or write tar files always read or write a fixed
+number of records with each I/O operation.
+These
+.Dq blocks
+are always a multiple of the record size.
+The most common block size\(emand the maximum supported by historic
+implementations\(emis 10240 bytes or 20 records.
+(Note: the terms
+.Dq block
+and
+.Dq record
+here are not entirely standard; this document follows the
+convention established by John Gilmore in documenting
+.Nm pdtar . )
+.Ss Old-Style Archive Format
+The original tar archive format has been extended many times to
+include additional information that various implementors found
+necessary.
+This section describes the variant implemented by the tar command
+included in
+.At v7 ,
+which is one of the earliest widely-used versions of the tar program.
+.Pp
+The header record for an old-style
+.Nm
+archive consists of the following:
+.Bd -literal -offset indent
+struct header_old_tar {
+ char name[100];
+ char mode[8];
+ char uid[8];
+ char gid[8];
+ char size[12];
+ char mtime[12];
+ char checksum[8];
+ char linkflag[1];
+ char linkname[100];
+ char pad[255];
+};
+.Ed
+All unused bytes in the header record are filled with nulls.
+.Bl -tag -width indent
+.It Va name
+Pathname, stored as a null-terminated string.
+Early tar implementations only stored regular files (including
+hardlinks to those files).
+One common early convention used a trailing "/" character to indicate
+a directory name, allowing directory permissions and owner information
+to be archived and restored.
+.It Va mode
+File mode, stored as an octal number in ASCII.
+.It Va uid , Va gid
+User id and group id of owner, as octal numbers in ASCII.
+.It Va size
+Size of file, as octal number in ASCII.
+For regular files only, this indicates the amount of data
+that follows the header.
+In particular, this field was ignored by early tar implementations
+when extracting hardlinks.
+Modern writers should always store a zero length for hardlink entries.
+.It Va mtime
+Modification time of file, as an octal number in ASCII.
+This indicates the number of seconds since the start of the epoch,
+00:00:00 UTC January 1, 1970.
+Note that negative values should be avoided
+here, as they are handled inconsistently.
+.It Va checksum
+Header checksum, stored as an octal number in ASCII.
+To compute the checksum, set the checksum field to all spaces,
+then sum all bytes in the header using unsigned arithmetic.
+This field should be stored as six octal digits followed by a null and a space
+character.
+Note that many early implementations of tar used signed arithmetic
+for the checksum field, which can cause interoperability problems
+when transferring archives between systems.
+Modern robust readers compute the checksum both ways and accept the
+header if either computation matches.
+.It Va linkflag , Va linkname
+In order to preserve hardlinks and conserve tape, a file
+with multiple links is only written to the archive the first
+time it is encountered.
+The next time it is encountered, the
+.Va linkflag
+is set to an ASCII
+.Sq 1
+and the
+.Va linkname
+field holds the first name under which this file appears.
+(Note that regular files have a null value in the
+.Va linkflag
+field.)
+.El
+.Pp
+Early tar implementations varied in how they terminated these fields.
+The tar command in
+.At v7
+used the following conventions (this is also documented in early BSD manpages):
+the pathname must be null-terminated;
+the mode, uid, and gid fields must end in a space and a null byte;
+the size and mtime fields must end in a space;
+the checksum is terminated by a null and a space.
+Early implementations filled the numeric fields with leading spaces.
+This seems to have been common practice until the
+.St -p1003.1-88
+standard was released.
+For best portability, modern implementations should fill the numeric
+fields with leading zeros.
+.Ss Pre-POSIX Archives
+An early draft of
+.St -p1003.1-88
+served as the basis for John Gilmore's
+.Nm pdtar
+program and many system implementations from the late 1980s
+and early 1990s.
+These archives generally follow the POSIX ustar
+format described below with the following variations:
+.Bl -bullet -compact -width indent
+.It
+The magic value is
+.Dq ustar\ \&
+(note the following space).
+The version field contains a space character followed by a null.
+.It
+The numeric fields are generally filled with leading spaces
+(not leading zeros as recommended in the final standard).
+.It
+The prefix field is often not used, limiting pathnames to
+the 100 characters of old-style archives.
+.El
+.Ss POSIX ustar Archives
+.St -p1003.1-88
+defined a standard tar file format to be read and written
+by compliant implementations of
+.Xr tar 1 .
+This format is often called the
+.Dq ustar
+format, after the magic value used
+in the header.
+(The name is an acronym for
+.Dq Unix Standard TAR . )
+It extends the historic format with new fields:
+.Bd -literal -offset indent
+struct header_posix_ustar {
+ char name[100];
+ char mode[8];
+ char uid[8];
+ char gid[8];
+ char size[12];
+ char mtime[12];
+ char checksum[8];
+ char typeflag[1];
+ char linkname[100];
+ char magic[6];
+ char version[2];
+ char uname[32];
+ char gname[32];
+ char devmajor[8];
+ char devminor[8];
+ char prefix[155];
+ char pad[12];
+};
+.Ed
+.Bl -tag -width indent
+.It Va typeflag
+Type of entry.
+POSIX extended the earlier
+.Va linkflag
+field with several new type values:
+.Bl -tag -width indent -compact
+.It Dq 0
+Regular file.
+NULL should be treated as a synonym, for compatibility purposes.
+.It Dq 1
+Hard link.
+.It Dq 2
+Symbolic link.
+.It Dq 3
+Character device node.
+.It Dq 4
+Block device node.
+.It Dq 5
+Directory.
+.It Dq 6
+FIFO node.
+.It Dq 7
+Reserved.
+.It Other
+A POSIX-compliant implementation must treat any unrecognized typeflag value
+as a regular file.
+In particular, writers should ensure that all entries
+have a valid filename so that they can be restored by readers that do not
+support the corresponding extension.
+Uppercase letters "A" through "Z" are reserved for custom extensions.
+Note that sockets and whiteout entries are not archivable.
+.El
+It is worth noting that the
+.Va size
+field, in particular, has different meanings depending on the type.
+For regular files, of course, it indicates the amount of data
+following the header.
+For directories, it may be used to indicate the total size of all
+files in the directory, for use by operating systems that pre-allocate
+directory space.
+For all other types, it should be set to zero by writers and ignored
+by readers.
+.It Va magic
+Contains the magic value
+.Dq ustar
+followed by a NULL byte to indicate that this is a POSIX standard archive.
+Full compliance requires the uname and gname fields be properly set.
+.It Va version
+Version.
+This should be
+.Dq 00
+(two copies of the ASCII digit zero) for POSIX standard archives.
+.It Va uname , Va gname
+User and group names, as null-terminated ASCII strings.
+These should be used in preference to the uid/gid values
+when they are set and the corresponding names exist on
+the system.
+.It Va devmajor , Va devminor
+Major and minor numbers for character device or block device entry.
+.It Va prefix
+First part of pathname.
+If the pathname is too long to fit in the 100 bytes provided by the standard
+format, it can be split at any
+.Pa /
+character with the first portion going here.
+If the prefix field is not empty, the reader will prepend
+the prefix value and a
+.Pa /
+character to the regular name field to obtain the full pathname.
+.El
+.Pp
+Note that all unused bytes must be set to
+.Dv NULL .
+.Pp
+Field termination is specified slightly differently by POSIX
+than by previous implementations.
+The
+.Va magic ,
+.Va uname ,
+and
+.Va gname
+fields must have a trailing
+.Dv NULL .
+The
+.Va pathname ,
+.Va linkname ,
+and
+.Va prefix
+fields must have a trailing
+.Dv NULL
+unless they fill the entire field.
+(In particular, it is possible to store a 256-character pathname if it
+happens to have a
+.Pa /
+as the 156th character.)
+POSIX requires numeric fields to be zero-padded in the front, and allows
+them to be terminated with either space or
+.Dv NULL
+characters.
+.Pp
+Currently, most tar implementations comply with the ustar
+format, occasionally extending it by adding new fields to the
+blank area at the end of the header record.
+.Ss Pax Interchange Format
+There are many attributes that cannot be portably stored in a
+POSIX ustar archive.
+.St -p1003.1-2001
+defined a
+.Dq pax interchange format
+that uses two new types of entries to hold text-formatted
+metadata that applies to following entries.
+Note that a pax interchange format archive is a ustar archive in every
+respect.
+The new data is stored in ustar-compatible archive entries that use the
+.Dq x
+or
+.Dq g
+typeflag.
+In particular, older implementations that do not fully support these
+extensions will extract the metadata into regular files, where the
+metadata can be examined as necessary.
+.Pp
+An entry in a pax interchange format archive consists of one or
+two standard ustar entries, each with its own header and data.
+The first optional entry stores the extended attributes
+for the following entry.
+This optional first entry has an "x" typeflag and a size field that
+indicates the total size of the extended attributes.
+The extended attributes themselves are stored as a series of text-format
+lines encoded in the portable UTF-8 encoding.
+Each line consists of a decimal number, a space, a key string, an equals
+sign, a value string, and a new line.
+The decimal number indicates the length of the entire line, including the
+initial length field and the trailing newline.
+An example of such a field is:
+.Dl 25 ctime=1084839148.1212\en
+Keys in all lowercase are standard keys.
+Vendors can add their own keys by prefixing them with an all uppercase
+vendor name and a period.
+Note that, unlike the historic header, numeric values are stored using
+decimal, not octal.
+A description of some common keys follows:
+.Bl -tag -width indent
+.It Cm atime , Cm ctime , Cm mtime
+File access, inode change, and modification times.
+These fields can be negative or include a decimal point and a fractional value.
+.It Cm uname , Cm uid , Cm gname , Cm gid
+User name, group name, and numeric UID and GID values.
+The user name and group name stored here are encoded in UTF8
+and can thus include non-ASCII characters.
+The UID and GID fields can be of arbitrary length.
+.It Cm linkpath
+The full path of the linked-to file.
+Note that this is encoded in UTF8 and can thus include non-ASCII characters.
+.It Cm path
+The full pathname of the entry.
+Note that this is encoded in UTF8 and can thus include non-ASCII characters.
+.It Cm realtime.* , Cm security.*
+These keys are reserved and may be used for future standardization.
+.It Cm size
+The size of the file.
+Note that there is no length limit on this field, allowing conforming
+archives to store files much larger than the historic 8GB limit.
+.It Cm SCHILY.*
+Vendor-specific attributes used by Joerg Schilling's
+.Nm star
+implementation.
+.It Cm SCHILY.acl.access , Cm SCHILY.acl.default
+Stores the access and default ACLs as textual strings in a format
+that is an extension of the format specified by POSIX.1e draft 17.
+In particular, each user or group access specification can include a fourth
+colon-separated field with the numeric UID or GID.
+This allows ACLs to be restored on systems that may not have complete
+user or group information available (such as when NIS/YP or LDAP services
+are temporarily unavailable).
+.It Cm SCHILY.devminor , Cm SCHILY.devmajor
+The full minor and major numbers for device nodes.
+.It Cm SCHILY.dev, Cm SCHILY.ino , Cm SCHILY.nlinks
+The device number, inode number, and link count for the entry.
+In particular, note that a pax interchange format archive using Joerg
+Schilling's
+.Cm SCHILY.*
+extensions can store all of the data from
+.Va struct stat .
+.It Cm LIBARCHIVE.xattr. Ns Ar namespace Ns . Ns Ar key
+Libarchive stores POSIX.1e-style extended attributes using
+keys of this form.
+The
+.Ar key
+value is URL-encoded:
+All non-ASCII characters and the two special characters
+.Dq =
+and
+.Dq %
+are encoded as
+.Dq %
+followed by two uppercase hexadecimal digits.
+The value of this key is the extended attribute value
+encoded in base 64.
+XXX Detail the base-64 format here XXX
+.It Cm VENDOR.*
+XXX document other vendor-specific extensions XXX
+.El
+.Pp
+Any values stored in an extended attribute override the corresponding
+values in the regular tar header.
+Note that compliant readers should ignore the regular fields when they
+are overridden.
+This is important, as existing archivers are known to store non-compliant
+values in the standard header fields in this situation.
+There are no limits on length for any of these fields.
+In particular, numeric fields can be arbitrarily large.
+All text fields are encoded in UTF8.
+Compliant writers should store only portable 7-bit ASCII characters in
+the standard ustar header and use extended
+attributes whenever a text value contains non-ASCII characters.
+.Pp
+In addition to the
+.Cm x
+entry described above, the pax interchange format
+also supports a
+.Cm g
+entry.
+The
+.Cm g
+entry is identical in format, but specifies attributes that serve as
+defaults for all subsequent archive entries.
+The
+.Cm g
+entry is not widely used.
+.Pp
+Besides the new
+.Cm x
+and
+.Cm g
+entries, the pax interchange format has a few other minor variations
+from the earlier ustar format.
+The most troubling one is that hardlinks are permitted to have
+data following them.
+This allows readers to restore any hardlink to a file without
+having to rewind the archive to find an earlier entry.
+However, it creates complications for robust readers, as it is no longer
+clear whether or not they should ignore the size field for hardlink entries.
+.Ss GNU Tar Archives
+The GNU tar program started with a pre-POSIX format similar to that
+described earlier and has extended it using several different mechanisms:
+It added new fields to the empty space in the header (some of which was later
+used by POSIX for conflicting purposes);
+it allowed the header to be continued over multiple records;
+and it defined new entries that modify following entries
+(similar in principle to the
+.Cm x
+entry described above, but each GNU special entry is single-purpose,
+unlike the general-purpose
+.Cm x
+entry).
+As a result, GNU tar archives are not POSIX compatible, although
+more lenient POSIX-compliant readers can successfully extract most
+GNU tar archives.
+.Bd -literal -offset indent
+struct header_gnu_tar {
+ char name[100];
+ char mode[8];
+ char uid[8];
+ char gid[8];
+ char size[12];
+ char mtime[12];
+ char checksum[8];
+ char typeflag[1];
+ char linkname[100];
+ char magic[6];
+ char version[2];
+ char uname[32];
+ char gname[32];
+ char devmajor[8];
+ char devminor[8];
+ char atime[12];
+ char ctime[12];
+ char offset[12];
+ char longnames[4];
+ char unused[1];
+ struct {
+ char offset[12];
+ char numbytes[12];
+ } sparse[4];
+ char isextended[1];
+ char realsize[12];
+ char pad[17];
+};
+.Ed
+.Bl -tag -width indent
+.It Va typeflag
+GNU tar uses the following special entry types, in addition to
+those defined by POSIX:
+.Bl -tag -width indent
+.It "7"
+GNU tar treats type "7" records identically to type "0" records,
+except on one obscure RTOS where they are used to indicate the
+pre-allocation of a contiguous file on disk.
+.It "D"
+This indicates a directory entry.
+Unlike the POSIX-standard "5"
+typeflag, the header is followed by data records listing the names
+of files in this directory.
+Each name is preceded by an ASCII "Y"
+if the file is stored in this archive or "N" if the file is not
+stored in this archive.
+Each name is terminated with a null, and
+an extra null marks the end of the name list.
+The purpose of this
+entry is to support incremental backups; a program restoring from
+such an archive may wish to delete files on disk that did not exist
+in the directory when the archive was made.
+.Pp
+Note that the "D" typeflag specifically violates POSIX, which requires
+that unrecognized typeflags be restored as normal files.
+In this case, restoring the "D" entry as a file could interfere
+with subsequent creation of the like-named directory.
+.It "K"
+The data for this entry is a long linkname for the following regular entry.
+.It "L"
+The data for this entry is a long pathname for the following regular entry.
+.It "M"
+This is a continuation of the last file on the previous volume.
+GNU multi-volume archives guarantee that each volume begins with a valid
+entry header.
+To ensure this, a file may be split, with part stored at the end of one volume,
+and part stored at the beginning of the next volume.
+The "M" typeflag indicates that this entry continues an existing file.
+Such entries can only occur as the first or second entry
+in an archive (the latter only if the first entry is a volume label).
+The
+.Va size
+field specifies the size of this entry.
+The
+.Va offset
+field at bytes 369-380 specifies the offset where this file fragment
+begins.
+The
+.Va realsize
+field specifies the total size of the file (which must equal
+.Va size
+plus
+.Va offset ) .
+When extracting, GNU tar checks that the header file name is the one it is
+expecting, that the header offset is in the correct sequence, and that
+the sum of offset and size is equal to realsize.
+FreeBSD's version of GNU tar does not handle the corner case of an
+archive's being continued in the middle of a long name or other
+extension header.
+.It "N"
+Type "N" records are no longer generated by GNU tar.
+They contained a
+list of files to be renamed or symlinked after extraction; this was
+originally used to support long names.
+The contents of this record
+are a text description of the operations to be done, in the form
+.Dq Rename %s to %s\en
+or
+.Dq Symlink %s to %s\en ;
+in either case, both
+filenames are escaped using K&R C syntax.
+.It "S"
+This is a
+.Dq sparse
+regular file.
+Sparse files are stored as a series of fragments.
+The header contains a list of fragment offset/length pairs.
+If more than four such entries are required, the header is
+extended as necessary with
+.Dq extra
+header extensions (an older format that is no longer used), or
+.Dq sparse
+extensions.
+.It "V"
+The
+.Va name
+field should be interpreted as a tape/volume header name.
+This entry should generally be ignored on extraction.
+.El
+.It Va magic
+The magic field holds the five characters
+.Dq ustar
+followed by a space.
+Note that POSIX ustar archives have a trailing null.
+.It Va version
+The version field holds a space character followed by a null.
+Note that POSIX ustar archives use two copies of the ASCII digit
+.Dq 0 .
+.It Va atime , Va ctime
+The time the file was last accessed and the time of
+last change of file information, stored in octal as with
+.Va mtime .
+.It Va longnames
+This field is apparently no longer used.
+.It Sparse Va offset / Va numbytes
+Each such structure specifies a single fragment of a sparse
+file.
+The two fields store values as octal numbers.
+The fragments are each padded to a multiple of 512 bytes
+in the archive.
+On extraction, the list of fragments is collected from the
+header (including any extension headers), and the data
+is then read and written to the file at appropriate offsets.
+.It Va isextended
+If this is set to non-zero, the header will be followed by additional
+.Dq sparse header
+records.
+Each such record contains information about as many as 21 additional
+sparse blocks as shown here:
+.Bd -literal -offset indent
+struct gnu_sparse_header {
+ struct {
+ char offset[12];
+ char numbytes[12];
+ } sparse[21];
+ char isextended[1];
+ char padding[7];
+};
+.Ed
+.It Va realsize
+A binary representation of the file's complete size, with a much larger range
+than the POSIX file size.
+In particular, with
+.Cm M
+type files, the current entry is only a portion of the file.
+In that case, the POSIX size field will indicate the size of this
+entry; the
+.Va realsize
+field will indicate the total size of the file.
+.El
+.Ss Solaris Tar
+XXX More Details Needed XXX
+.Pp
+Solaris tar (beginning with SunOS XXX 5.7 ?? XXX) supports an
+.Dq extended
+format that is fundamentally similar to pax interchange format,
+with the following differences:
+.Bl -bullet -compact -width indent
+.It
+Extended attributes are stored in an entry whose type is
+.Cm X ,
+not
+.Cm x ,
+as used by pax interchange format.
+The detailed format of this entry appears to be the same
+as detailed above for the
+.Cm x
+entry.
+.It
+An additional
+.Cm A
+entry is used to store an ACL for the following regular entry.
+The body of this entry contains a seven-digit octal number
+(whose value is 01000000 plus the number of ACL entries)
+followed by a zero byte, followed by the
+textual ACL description.
+.El
+.Ss Other Extensions
+One common extension, utilized by GNU tar, star, and other newer
+.Nm
+implementations, permits binary numbers in the standard numeric
+fields.
+This is flagged by setting the high bit of the first character.
+This permits 95-bit values for the length and time fields
+and 63-bit values for the uid, gid, and device numbers.
+GNU tar supports this extension for the
+length, mtime, ctime, and atime fields.
+Joerg Schilling's star program supports this extension for
+all numeric fields.
+Note that this extension is largely obsoleted by the extended attribute
+record provided by the pax interchange format.
+.Pp
+Another early GNU extension allowed base-64 values rather
+than octal.
+This extension was short-lived and such archives are almost never seen.
+However, there is still code in GNU tar to support them; this code is
+responsible for a very cryptic warning message that is sometimes seen when
+GNU tar encounters a damaged archive.
+.Sh SEE ALSO
+.Xr ar 1 ,
+.Xr pax 1 ,
+.Xr tar 1
+.Sh STANDARDS
+The
+.Nm tar
+utility is no longer a part of POSIX or the Single Unix Standard.
+It last appeared in
+.St -susv2 .
+It has been supplanted in subsequent standards by
+.Xr pax 1 .
+The ustar format is currently part of the specification for the
+.Xr pax 1
+utility.
+The pax interchange file format is new with
+.St -p1003.1-2001 .
+.Sh HISTORY
+A
+.Nm tar
+command appeared in Seventh Edition Unix, which was released in January, 1979.
+It replaced the
+.Nm tp
+program from Fourth Edition Unix which in turn replaced the
+.Nm tap
+program from First Edition Unix.
+John Gilmore's
+.Nm pdtar
+public-domain implementation (circa 1987) was highly influential
+and formed the basis of
+.Nm GNU tar .
+Joerg Shilling's
+.Nm star
+archiver is another open-source (GPL) archiver (originally developed
+circa 1985) which features complete support for pax interchange
+format.
diff --git a/archivers/libarchive/files/doc/text/archive_entry.3.txt b/archivers/libarchive/files/doc/text/archive_entry.3.txt
new file mode 100644
index 00000000000..5201c4f6d5b
--- /dev/null
+++ b/archivers/libarchive/files/doc/text/archive_entry.3.txt
@@ -0,0 +1,350 @@
+archive_entry(3) FreeBSD Library Functions Manual archive_entry(3)
+
+NAME
+ archive_entry_acl_add_entry, archive_entry_acl_add_entry_w,
+ archive_entry_acl_clear, archive_entry_acl_count, archive_entry_acl_next,
+ archive_entry_acl_next_w, archive_entry_acl_reset,
+ archive_entry_acl_text_w, archive_entry_atime, archive_entry_atime_nsec,
+ archive_entry_clear, archive_entry_clone,
+ archive_entry_copy_fflags_text_w, archive_entry_copy_gname,
+ archive_entry_copy_gname_w, archive_entry_copy_hardlink,
+ archive_entry_copy_hardlink_w, archive_entry_copy_pathname_w,
+ archive_entry_copy_stat, archive_entry_copy_symlink,
+ archive_entry_copy_symlink_w, archive_entry_copy_uname,
+ archive_entry_copy_uname_w, archive_entry_dev, archive_entry_devmajor,
+ archive_entry_devminor, archive_entry_filetype, archive_entry_fflags,
+ archive_entry_fflags_text, archive_entry_free, archive_entry_gid,
+ archive_entry_gname, archive_entry_hardlink, archive_entry_ino,
+ archive_entry_mode, archive_entry_mtime, archive_entry_mtime_nsec,
+ archive_entry_nlink, archive_entry_new, archive_entry_pathname,
+ archive_entry_pathname_w, archive_entry_rdev, archive_entry_rdevmajor,
+ archive_entry_rdevminor, archive_entry_set_atime,
+ archive_entry_set_ctime, archive_entry_set_dev,
+ archive_entry_set_devmajor, archive_entry_set_devminor,
+ archive_entry_set_filetype, archive_entry_set_fflags,
+ archive_entry_set_gid, archive_entry_set_gname,
+ archive_entry_set_hardlink, archive_entry_set_link,
+ archive_entry_set_mode, archive_entry_set_mtime,
+ archive_entry_set_pathname, archive_entry_set_rdevmajor,
+ archive_entry_set_rdevminor, archive_entry_set_size,
+ archive_entry_set_symlink, archive_entry_set_uid,
+ archive_entry_set_uname, archive_entry_size, archive_entry_stat,
+ archive_entry_symlink, archive_entry_uid, archive_entry_uname -- func-
+ tions for manipulating archive entry descriptions
+
+SYNOPSIS
+ #include <archive_entry.h>
+
+ void
+ archive_entry_acl_add_entry(struct archive_entry *, int type,
+ int permset, int tag, int qual, const char *name);
+
+ void
+ archive_entry_acl_add_entry_w(struct archive_entry *, int type,
+ int permset, int tag, int qual, const wchar_t *name);
+
+ void
+ archive_entry_acl_clear(struct archive_entry *);
+
+ int
+ archive_entry_acl_count(struct archive_entry *, int type);
+
+ int
+ archive_entry_acl_next(struct archive_entry *, int want_type, int *type,
+ int *permset, int *tag, int *qual, const char **name);
+
+ int
+ archive_entry_acl_next_w(struct archive_entry *, int want_type,
+ int *type, int *permset, int *tag, int *qual, const wchar_t **name);
+
+ int
+ archive_entry_acl_reset(struct archive_entry *, int want_type);
+
+ const wchar_t *
+ archive_entry_acl_text_w(struct archive_entry *, int flags);
+
+ time_t
+ archive_entry_atime(struct archive_entry *);
+
+ long
+ archive_entry_atime_nsec(struct archive_entry *);
+
+ struct archive_entry *
+ archive_entry_clear(struct archive_entry *);
+
+ struct archive_entry *
+ archive_entry_clone(struct archive_entry *);
+
+ const wchar_t *
+ archive_entry_copy_fflags_text_w(struct archive_entry *,
+ const wchar_t *);
+
+ void
+ archive_entry_copy_gname(struct archive_entry *, const char *);
+
+ void
+ archive_entry_copy_gname_w(struct archive_entry *, const wchar_t *);
+
+ void
+ archive_entry_copy_hardlink(struct archive_entry *, const char *);
+
+ void
+ archive_entry_copy_hardlink_w(struct archive_entry *, const wchar_t *);
+
+ void
+ archive_entry_copy_pathname_w(struct archive_entry *, const wchar_t *);
+
+ void
+ archive_entry_copy_stat(struct archive_entry *, const struct stat *);
+
+ void
+ archive_entry_copy_symlink(struct archive_entry *, const char *);
+
+ void
+ archive_entry_copy_symlink_w(struct archive_entry *, const wchar_t *);
+
+ void
+ archive_entry_copy_uname(struct archive_entry *, const char *);
+
+ void
+ archive_entry_copy_uname_w(struct archive_entry *, const wchar_t *);
+
+ dev_t
+ archive_entry_dev(struct archive_entry *);
+
+ dev_t
+ archive_entry_devmajor(struct archive_entry *);
+
+ dev_t
+ archive_entry_devminor(struct archive_entry *);
+
+ mode_t
+ archive_entry_filetype(struct archive_entry *);
+
+ void
+ archive_entry_fflags(struct archive_entry *, unsigned long *set,
+ unsigned long *clear);
+
+ const char *
+ archive_entry_fflags_text(struct archive_entry *);
+
+ void
+ archive_entry_free(struct archive_entry *);
+
+ const char *
+ archive_entry_gname(struct archive_entry *);
+
+ const char *
+ archive_entry_hardlink(struct archive_entry *);
+
+ ino_t
+ archive_entry_ino(struct archive_entry *);
+
+ mode_t
+ archive_entry_mode(struct archive_entry *);
+
+ time_t
+ archive_entry_mtime(struct archive_entry *);
+
+ long
+ archive_entry_mtime_nsec(struct archive_entry *);
+
+ unsigned int
+ archive_entry_nlink(struct archive_entry *);
+
+ struct archive_entry *
+ archive_entry_new(void);
+
+ const char *
+ archive_entry_pathname(struct archive_entry *);
+
+ const wchar_t *
+ archive_entry_pathname_w(struct archive_entry *);
+
+ dev_t
+ archive_entry_rdev(struct archive_entry *);
+
+ dev_t
+ archive_entry_rdevmajor(struct archive_entry *);
+
+ dev_t
+ archive_entry_rdevminor(struct archive_entry *);
+
+ void
+ archive_entry_set_dev(struct archive_entry *, dev_t);
+
+ void
+ archive_entry_set_devmajor(struct archive_entry *, dev_t);
+
+ void
+ archive_entry_set_devminor(struct archive_entry *, dev_t);
+
+ void
+ archive_entry_set_filetype(struct archive_entry *, unsigned int);
+
+ void
+ archive_entry_set_fflags(struct archive_entry *, unsigned long set,
+ unsigned long clear);
+
+ void
+ archive_entry_set_gid(struct archive_entry *, gid_t);
+
+ void
+ archive_entry_set_gname(struct archive_entry *, const char *);
+
+ void
+ archive_entry_set_hardlink(struct archive_entry *, const char *);
+
+ void
+ archive_entry_set_ino(struct archive_entry *, unsigned long);
+
+ void
+ archive_entry_set_link(struct archive_entry *, const char *);
+
+ void
+ archive_entry_set_mode(struct archive_entry *, mode_t);
+
+ void
+ archive_entry_set_mtime(struct archive_entry *, time_t, long nanos);
+
+ void
+ archive_entry_set_nlink(struct archive_entry *, unsigned int);
+
+ void
+ archive_entry_set_pathname(struct archive_entry *, const char *);
+
+ void
+ archive_entry_set_rdev(struct archive_entry *, dev_t);
+
+ void
+ archive_entry_set_rdevmajor(struct archive_entry *, dev_t);
+
+ void
+ archive_entry_set_rdevminor(struct archive_entry *, dev_t);
+
+ void
+ archive_entry_set_size(struct archive_entry *, int64_t);
+
+ void
+ archive_entry_set_symlink(struct archive_entry *, const char *);
+
+ void
+ archive_entry_set_uid(struct archive_entry *, uid_t);
+
+ void
+ archive_entry_set_uname(struct archive_entry *, const char *);
+
+ int64_t
+ archive_entry_size(struct archive_entry *);
+
+ const struct stat *
+ archive_entry_stat(struct archive_entry *);
+
+ const char *
+ archive_entry_symlink(struct archive_entry *);
+
+ const char *
+ archive_entry_uname(struct archive_entry *);
+
+DESCRIPTION
+ These functions create and manipulate data objects that represent entries
+ within an archive. You can think of a struct archive_entry as a heavy-
+ duty version of struct stat: it includes everything from struct stat plus
+ associated pathname, textual group and user names, etc. These objects
+ are used by libarchive(3) to represent the metadata associated with a
+ particular entry in an archive.
+
+ Create and Destroy
+ There are functions to allocate, destroy, clear, and copy archive_entry
+ objects:
+ archive_entry_clear()
+ Erases the object, resetting all internal fields to the same
+ state as a newly-created object. This is provided to allow you
+ to quickly recycle objects without thrashing the heap.
+ archive_entry_clone()
+ A deep copy operation; all text fields are duplicated.
+ archive_entry_free()
+ Releases the struct archive_entry object.
+ archive_entry_new()
+ Allocate and return a blank struct archive_entry object.
+
+ Set and Get Functions
+ Most of the functions here set or read entries in an object. Such func-
+ tions have one of the following forms:
+ archive_entry_set_XXXX()
+ Stores the provided data in the object. In particular, for
+ strings, the pointer is stored, not the referenced string.
+ archive_entry_copy_XXXX()
+ As above, except that the referenced data is copied into the
+ object.
+ archive_entry_XXXX()
+ Returns the specified data. In the case of strings, a const-
+ qualified pointer to the string is returned.
+ String data can be set or accessed as wide character strings or normal
+ char strings. The functions that use wide character strings are suffixed
+ with _w. Note that these are different representations of the same data:
+ For example, if you store a narrow string and read the corresponding wide
+ string, the object will transparently convert formats using the current
+ locale. Similarly, if you store a wide string and then store a narrow
+ string for the same data, the previously-set wide string will be dis-
+ carded in favor of the new data.
+
+ There are a few set/get functions that merit additional description:
+ archive_entry_set_link()
+ This function sets the symlink field if it is already set. Oth-
+ erwise, it sets the hardlink field.
+
+ File Flags
+ File flags are transparently converted between a bitmap representation
+ and a textual format. For example, if you set the bitmap and ask for
+ text, the library will build a canonical text format. However, if you
+ set a text format and request a text format, you will get back the same
+ text, even if it is ill-formed. If you need to canonicalize a textual
+ flags string, you should first set the text form, then request the bitmap
+ form, then use that to set the bitmap form. Setting the bitmap format
+ will clear the internal text representation and force it to be recon-
+ structed when you next request the text form.
+
+ The bitmap format consists of two integers, one containing bits that
+ should be set, the other specifying bits that should be cleared. Bits
+ not mentioned in either bitmap will be ignored. Usually, the bitmap of
+ bits to be cleared will be set to zero. In unusual circumstances, you
+ can force a fully-specified set of file flags by setting the bitmap of
+ flags to clear to the complement of the bitmap of flags to set. (This
+ differs from fflagstostr(3), which only includes names for set bits.)
+ Converting a bitmap to a textual string is a platform-specific operation;
+ bits that are not meaningful on the current platform will be ignored.
+
+ The canonical text format is a comma-separated list of flag names. The
+ archive_entry_copy_fflags_text_w() function parses the provided text and
+ sets the internal bitmap values. This is a platform-specific operation;
+ names that are not meaningful on the current platform will be ignored.
+ The function returns a pointer to the start of the first name that was
+ not recognized, or NULL if every name was recognized. Note that every
+ name--including names that follow an unrecognized name--will be evalu-
+ ated, and the bitmaps will be set to reflect every name that is recog-
+ nized. (In particular, this differs from strtofflags(3), which stops
+ parsing at the first unrecognized name.)
+
+ ACL Handling
+ XXX This needs serious help. XXX
+
+ An ``Access Control List'' (ACL) is a list of permissions that grant
+ access to particular users or groups beyond what would normally be pro-
+ vided by standard POSIX mode bits. The ACL handling here addresses some
+ deficiencies in the POSIX.1e draft 17 ACL specification. In particular,
+ POSIX.1e draft 17 specifies several different formats, but none of those
+ formats include both textual user/group names and numeric UIDs/GIDs.
+
+ XXX explain ACL stuff XXX
+
+SEE ALSO
+ archive(3)
+
+HISTORY
+ The libarchive library first appeared in FreeBSD 5.3.
+
+AUTHORS
+ The libarchive library was written by Tim Kientzle <kientzle@acm.org>.
+
+FreeBSD 6.0 December 15, 2003 FreeBSD 6.0
diff --git a/archivers/libarchive/files/doc/text/archive_read.3.txt b/archivers/libarchive/files/doc/text/archive_read.3.txt
new file mode 100644
index 00000000000..95b86866b06
--- /dev/null
+++ b/archivers/libarchive/files/doc/text/archive_read.3.txt
@@ -0,0 +1,395 @@
+archive_read(3) FreeBSD Library Functions Manual archive_read(3)
+
+NAME
+ archive_read_new, archive_read_support_compression_all,
+ archive_read_support_compression_bzip2,
+ archive_read_support_compression_compress,
+ archive_read_support_compression_gzip,
+ archive_read_support_compression_none,
+ archive_read_support_compression_program,
+ archive_read_support_format_all, archive_read_support_format_cpio,
+ archive_read_support_format_empty, archive_read_support_format_iso9660,
+ archive_read_support_format_tar, archive_read_support_format_zip,
+ archive_read_open, archive_read_open2, archive_read_open_fd,
+ archive_read_open_FILE, archive_read_open_filename,
+ archive_read_open_memory, archive_read_next_header, archive_read_data,
+ archive_read_data_block, archive_read_data_skip,
+ archive_read_data_into_buffer, archive_read_data_into_fd,
+ archive_read_extract, archive_read_extract_set_progress_callback,
+ archive_read_close, archive_read_finish -- functions for reading stream-
+ ing archives
+
+SYNOPSIS
+ #include <archive.h>
+
+ struct archive *
+ archive_read_new(void);
+
+ int
+ archive_read_support_compression_all(struct archive *);
+
+ int
+ archive_read_support_compression_bzip2(struct archive *);
+
+ int
+ archive_read_support_compression_compress(struct archive *);
+
+ int
+ archive_read_support_compression_gzip(struct archive *);
+
+ int
+ archive_read_support_compression_none(struct archive *);
+
+ int
+ archive_read_support_compression_program(struct archive *,
+ const char *cmd);
+
+ int
+ archive_read_support_format_all(struct archive *);
+
+ int
+ archive_read_support_format_cpio(struct archive *);
+
+ int
+ archive_read_support_format_empty(struct archive *);
+
+ int
+ archive_read_support_format_iso9660(struct archive *);
+
+ int
+ archive_read_support_format_tar(struct archive *);
+
+ int
+ archive_read_support_format_zip(struct archive *);
+
+ int
+ archive_read_open(struct archive *, void *client_data,
+ archive_open_callback *, archive_read_callback *,
+ archive_close_callback *);
+
+ int
+ archive_read_open2(struct archive *, void *client_data,
+ archive_open_callback *, archive_read_callback *,
+ archive_skip_callback *, archive_close_callback *);
+
+ int
+ archive_read_open_FILE(struct archive *, FILE *file);
+
+ int
+ archive_read_open_fd(struct archive *, int fd, size_t block_size);
+
+ int
+ archive_read_open_filename(struct archive *, const char *filename,
+ size_t block_size);
+
+ int
+ archive_read_open_memory(struct archive *, void *buff, size_t size);
+
+ int
+ archive_read_next_header(struct archive *, struct archive_entry **);
+
+ ssize_t
+ archive_read_data(struct archive *, void *buff, size_t len);
+
+ int
+ archive_read_data_block(struct archive *, const void **buff, size_t *len,
+ off_t *offset);
+
+ int
+ archive_read_data_skip(struct archive *);
+
+ int
+ archive_read_data_into_buffer(struct archive *, void *, ssize_t len);
+
+ int
+ archive_read_data_into_fd(struct archive *, int fd);
+
+ int
+ archive_read_extract(struct archive *, struct archive_entry *,
+ int flags);
+
+ void
+ archive_read_extract_set_progress_callback(struct archive *,
+ void (*func)(void *), void *user_data);
+
+ int
+ archive_read_close(struct archive *);
+
+ int
+ archive_read_finish(struct archive *);
+
+DESCRIPTION
+ These functions provide a complete API for reading streaming archives.
+ The general process is to first create the struct archive object, set
+ options, initialize the reader, iterate over the archive headers and
+ associated data, then close the archive and release all resources. The
+ following summary describes the functions in approximately the order they
+ would be used:
+ archive_read_new()
+ Allocates and initializes a struct archive object suitable for
+ reading from an archive.
+ archive_read_support_compression_all(),
+ archive_read_support_compression_bzip2(),
+ archive_read_support_compression_compress(),
+ archive_read_support_compression_gzip(),
+ archive_read_support_compression_none()
+ Enables auto-detection code and decompression support for the
+ specified compression. Note that ``none'' is always enabled by
+ default. For convenience, archive_read_support_compression_all()
+ enables all available decompression code.
+ archive_read_support_compression_program()
+ Data is fed through the specified external program before being
+ dearchived. Note that this disables automatic detection of the
+ compression format, so it makes no sense to specify this in con-
+ junction with any other decompression option.
+ archive_read_support_format_all(), archive_read_support_format_cpio(),
+ archive_read_support_format_empty(),
+ archive_read_support_format_iso9660(),
+ archive_read_support_format_tar,()
+ archive_read_support_format_zip()
+ Enables support---including auto-detection code---for the speci-
+ fied archive format. For example,
+ archive_read_support_format_tar() enables support for a variety
+ of standard tar formats, old-style tar, ustar, pax interchange
+ format, and many common variants. For convenience,
+ archive_read_support_format_all() enables support for all avail-
+ able formats. Only empty archives are supported by default.
+ archive_read_open()
+ The same as archive_read_open2(), except that the skip callback
+ is assumed to be NULL.
+ archive_read_open2()
+ Freeze the settings, open the archive, and prepare for reading
+ entries. This is the most generic version of this call, which
+ accepts four callback functions. Most clients will want to use
+ archive_read_open_filename(), archive_read_open_FILE(),
+ archive_read_open_fd(), or archive_read_open_memory() instead.
+ The library invokes the client-provided functions to obtain raw
+ bytes from the archive.
+ archive_read_open_FILE()
+ Like archive_read_open(), except that it accepts a FILE *
+ pointer. This function should not be used with tape drives or
+ other devices that require strict I/O blocking.
+ archive_read_open_fd()
+ Like archive_read_open(), except that it accepts a file descrip-
+ tor and block size rather than a set of function pointers. Note
+ that the file descriptor will not be automatically closed at end-
+ of-archive. This function is safe for use with tape drives or
+ other blocked devices.
+ archive_read_open_file()
+ This is a deprecated synonym for archive_read_open_filename().
+ archive_read_open_filename()
+ Like archive_read_open(), except that it accepts a simple file-
+ name and a block size. A NULL filename represents standard
+ input. This function is safe for use with tape drives or other
+ blocked devices.
+ archive_read_open_memory()
+ Like archive_read_open(), except that it accepts a pointer and
+ size of a block of memory containing the archive data.
+ archive_read_next_header()
+ Read the header for the next entry and return a pointer to a
+ struct archive_entry.
+ archive_read_data()
+ Read data associated with the header just read. Internally, this
+ is a convenience function that calls archive_read_data_block()
+ and fills any gaps with nulls so that callers see a single con-
+ tinuous stream of data.
+ archive_read_data_block()
+ Return the next available block of data for this entry. Unlike
+ archive_read_data(), the archive_read_data_block() function
+ avoids copying data and allows you to correctly handle sparse
+ files, as supported by some archive formats. The library guaran-
+ tees that offsets will increase and that blocks will not overlap.
+ Note that the blocks returned from this function can be much
+ larger than the block size read from disk, due to compression and
+ internal buffer optimizations.
+ archive_read_data_skip()
+ A convenience function that repeatedly calls
+ archive_read_data_block() to skip all of the data for this ar-
+ chive entry.
+ archive_read_data_into_buffer()
+ This function is deprecated and will be removed. Use
+ archive_read_data() instead.
+ archive_read_data_into_fd()
+ A convenience function that repeatedly calls
+ archive_read_data_block() to copy the entire entry to the pro-
+ vided file descriptor.
+ archive_read_extract(), archive_read_extract_set_skip_file()
+ A convenience function that wraps the corresponding
+ archive_write_disk(3) interfaces. The first call to
+ archive_read_extract() creates a restore object using
+ archive_write_disk_new(3) and
+ archive_write_disk_set_standard_lookup(3), then transparently
+ invokes archive_write_disk_set_options(3),
+ archive_write_header(3), archive_write_data(3), and
+ archive_write_finish_entry(3) to create the entry on disk and
+ copy data into it. The flags argument is passed unmodified to
+ archive_write_disk_set_options(3).
+ archive_read_extract_set_progress_callback()
+ Sets a pointer to a user-defined callback that can be used for
+ updating progress displays during extraction. The progress func-
+ tion will be invoked during the extraction of large regular
+ files. The progress function will be invoked with the pointer
+ provided to this call. Generally, the data pointed to should
+ include a reference to the archive object and the archive_entry
+ object so that various statistics can be retrieved for the
+ progress display.
+ archive_read_close()
+ Complete the archive and invoke the close callback.
+ archive_read_finish()
+ Invokes archive_read_close() if it was not invoked manually, then
+ release all resources. Note: In libarchive 1.x, this function
+ was declared to return void, which made it impossible to detect
+ certain errors when archive_read_close() was invoked implicitly
+ from this function. The declaration is corrected beginning with
+ libarchive 2.0.
+
+ Note that the library determines most of the relevant information about
+ the archive by inspection. In particular, it automatically detects
+ gzip(1) or bzip2(1) compression and transparently performs the appropri-
+ ate decompression. It also automatically detects the archive format.
+
+ A complete description of the struct archive and struct archive_entry
+ objects can be found in the overview manual page for libarchive(3).
+
+CLIENT CALLBACKS
+ The callback functions must match the following prototypes:
+
+ typedef ssize_t archive_read_callback(struct archive *, void
+ *client_data, const void **buffer)
+
+ typedef int archive_skip_callback(struct archive *, void
+ *client_data, size_t request)
+
+ typedef int archive_open_callback(struct archive *, void
+ *client_data)
+
+ typedef int archive_close_callback(struct archive *, void
+ *client_data)
+
+ The open callback is invoked by archive_open(). It should return
+ ARCHIVE_OK if the underlying file or data source is successfully opened.
+ If the open fails, it should call archive_set_error() to register an
+ error code and message and return ARCHIVE_FATAL.
+
+ The read callback is invoked whenever the library requires raw bytes from
+ the archive. The read callback should read data into a buffer, set the
+ const void **buffer argument to point to the available data, and return a
+ count of the number of bytes available. The library will invoke the read
+ callback again only after it has consumed this data. The library imposes
+ no constraints on the size of the data blocks returned. On end-of-file,
+ the read callback should return zero. On error, the read callback should
+ invoke archive_set_error() to register an error code and message and
+ return -1.
+
+ The skip callback is invoked when the library wants to ignore a block of
+ data. The return value is the number of bytes actually skipped, which
+ may differ from the request. If the callback cannot skip data, it should
+ return zero. If the skip callback is not provided (the function pointer
+ is NULL ), the library will invoke the read function instead and simply
+ discard the result. A skip callback can provide significant performance
+ gains when reading uncompressed archives from slow disk drives or other
+ media that can skip quickly.
+
+ The close callback is invoked by archive_close when the archive process-
+ ing is complete. The callback should return ARCHIVE_OK on success. On
+ failure, the callback should invoke archive_set_error() to register an
+ error code and message and return ARCHIVE_FATAL.
+
+EXAMPLE
+ The following illustrates basic usage of the library. In this example,
+ the callback functions are simply wrappers around the standard open(2),
+ read(2), and close(2) system calls.
+
+ void
+ list_archive(const char *name)
+ {
+ struct mydata *mydata;
+ struct archive *a;
+ struct archive_entry *entry;
+
+ mydata = malloc(sizeof(struct mydata));
+ a = archive_read_new();
+ mydata->name = name;
+ archive_read_support_compression_all(a);
+ archive_read_support_format_all(a);
+ archive_read_open(a, mydata, myopen, myread, myclose);
+ while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
+ printf("%s\n",archive_entry_pathname(entry));
+ archive_read_data_skip(a);
+ }
+ archive_read_finish(a);
+ free(mydata);
+ }
+
+ ssize_t
+ myread(struct archive *a, void *client_data, const void **buff)
+ {
+ struct mydata *mydata = client_data;
+
+ *buff = mydata->buff;
+ return (read(mydata->fd, mydata->buff, 10240));
+ }
+
+ int
+ myopen(struct archive *a, void *client_data)
+ {
+ struct mydata *mydata = client_data;
+
+ mydata->fd = open(mydata->name, O_RDONLY);
+ return (mydata->fd >= 0 ? ARCHIVE_OK : ARCHIVE_FATAL);
+ }
+
+ int
+ myclose(struct archive *a, void *client_data)
+ {
+ struct mydata *mydata = client_data;
+
+ if (mydata->fd > 0)
+ close(mydata->fd);
+ return (ARCHIVE_OK);
+ }
+
+RETURN VALUES
+ Most functions return zero on success, non-zero on error. The possible
+ return codes include: ARCHIVE_OK (the operation succeeded), ARCHIVE_WARN
+ (the operation succeeded but a non-critical error was encountered),
+ ARCHIVE_EOF (end-of-archive was encountered), ARCHIVE_RETRY (the opera-
+ tion failed but can be retried), and ARCHIVE_FATAL (there was a fatal
+ error; the archive should be closed immediately). Detailed error codes
+ and textual descriptions are available from the archive_errno() and
+ archive_error_string() functions.
+
+ archive_read_new() returns a pointer to a freshly allocated struct
+ archive object. It returns NULL on error.
+
+ archive_read_data() returns a count of bytes actually read or zero at the
+ end of the entry. On error, a value of ARCHIVE_FATAL, ARCHIVE_WARN, or
+ ARCHIVE_RETRY is returned and an error code and textual description can
+ be retrieved from the archive_errno() and archive_error_string() func-
+ tions.
+
+ The library expects the client callbacks to behave similarly. If there
+ is an error, you can use archive_set_error() to set an appropriate error
+ code and description, then return one of the non-zero values above.
+ (Note that the value eventually returned to the client may not be the
+ same; many errors that are not critical at the level of basic I/O can
+ prevent the archive from being properly read, thus most I/O errors even-
+ tually cause ARCHIVE_FATAL to be returned.)
+
+SEE ALSO
+ tar(1), archive(3), archive_util(3), tar(5)
+
+HISTORY
+ The libarchive library first appeared in FreeBSD 5.3.
+
+AUTHORS
+ The libarchive library was written by Tim Kientzle <kientzle@acm.org>.
+
+BUGS
+ Many traditional archiver programs treat empty files as valid empty ar-
+ chives. For example, many implementations of tar(1) allow you to append
+ entries to an empty file. Of course, it is impossible to determine the
+ format of an empty file by inspecting the contents, so this library
+ treats empty files as having a special ``empty'' format.
+
+FreeBSD 6.0 August 19, 2006 FreeBSD 6.0
diff --git a/archivers/libarchive/files/doc/text/archive_util.3.txt b/archivers/libarchive/files/doc/text/archive_util.3.txt
new file mode 100644
index 00000000000..28b688362ba
--- /dev/null
+++ b/archivers/libarchive/files/doc/text/archive_util.3.txt
@@ -0,0 +1,91 @@
+archive_util(3) FreeBSD Library Functions Manual archive_util(3)
+
+NAME
+ archive_clear_error, archive_compression, archive_compression_name,
+ archive_copy_error, archive_errno, archive_error_string, archive_format,
+ archive_format_name, archive_set_error -- libarchive utility functions
+
+SYNOPSIS
+ #include <archive.h>
+
+ void
+ archive_clear_error(struct archive *);
+
+ int
+ archive_compression(struct archive *);
+
+ const char *
+ archive_compression_name(struct archive *);
+
+ void
+ archive_copy_error(struct archive *, struct archive *);
+
+ int
+ archive_errno(struct archive *);
+
+ const char *
+ archive_error_string(struct archive *);
+
+ int
+ archive_format(struct archive *);
+
+ const char *
+ archive_format_name(struct archive *);
+
+ void
+ archive_set_error(struct archive *, int error_code, const char *fmt,
+ ...);
+
+DESCRIPTION
+ These functions provide access to various information about the struct
+ archive object used in the libarchive(3) library.
+ archive_clear_error()
+ Clears any error information left over from a previous call. Not
+ generally used in client code.
+ archive_compression()
+ Returns a numeric code indicating the current compression. This
+ value is set by archive_read_open().
+ archive_compression_name()
+ Returns a text description of the current compression suitable
+ for display.
+ archive_copy_error()
+ Copies error information from one archive to another.
+ archive_errno()
+ Returns a numeric error code (see errno(2)) indicating the reason
+ for the most recent error return.
+ archive_error_string()
+ Returns a textual error message suitable for display. The error
+ message here is usually more specific than that obtained from
+ passing the result of archive_errno() to strerror(3).
+ archive_format()
+ Returns a numeric code indicating the format of the current ar-
+ chive entry. This value is set by a successful call to
+ archive_read_next_header(). Note that it is common for this
+ value to change from entry to entry. For example, a tar archive
+ might have several entries that utilize GNU tar extensions and
+ several entries that do not. These entries will have different
+ format codes.
+ archive_format_name()
+ A textual description of the format of the current entry.
+ archive_set_error()
+ Sets the numeric error code and error description that will be
+ returned by archive_errno() and archive_error_string(). This
+ function should be used within I/O callbacks to set system-spe-
+ cific error codes and error descriptions. This function accepts
+ a printf-like format string and arguments. However, you should
+ be careful to use only the following printf format specifiers:
+ ``%c'', ``%d'', ``%jd'', ``%jo'', ``%ju'', ``%jx'', ``%ld'',
+ ``%lo'', ``%lu'', ``%lx'', ``%o'', ``%u'', ``%s'', ``%x'',
+ ``%%''. Field-width specifiers and other printf features are not
+ uniformly supported and should not be used.
+
+SEE ALSO
+ archive_read(3), archive_write(3), libarchive(3), printf(3)
+
+HISTORY
+ The libarchive library first appeared in FreeBSD 5.3.
+
+AUTHORS
+ The libarchive library was written by Tim Kientzle <kientzle@acm.org>.
+
+FreeBSD 6.0 January 8, 2005 FreeBSD 6.0
diff --git a/archivers/libarchive/files/doc/text/archive_write.3.txt b/archivers/libarchive/files/doc/text/archive_write.3.txt
new file mode 100644
index 00000000000..a16d36419bd
--- /dev/null
+++ b/archivers/libarchive/files/doc/text/archive_write.3.txt
@@ -0,0 +1,420 @@
+archive_write(3) FreeBSD Library Functions Manual archive_write(3)
+
+NAME
+ archive_write_new, archive_write_set_format_cpio,
+ archive_write_set_format_pax, archive_write_set_format_pax_restricted,
+ archive_write_set_format_shar, archive_write_set_format_shar_binary,
+ archive_write_set_format_ustar, archive_write_get_bytes_per_block,
+ archive_write_set_bytes_per_block, archive_write_set_bytes_in_last_block,
+ archive_write_set_compression_bzip2, archive_write_set_compression_gzip,
+ archive_write_set_compression_none,
+ archive_write_set_compression_program, archive_write_open,
+ archive_write_open_fd, archive_write_open_FILE,
+ archive_write_open_filename, archive_write_open_memory,
+ archive_write_header, archive_write_data, archive_write_finish_entry,
+ archive_write_close, archive_write_finish -- functions for creating ar-
+ chives
+
+SYNOPSIS
+ #include <archive.h>
+
+ struct archive *
+ archive_write_new(void);
+
+ int
+ archive_write_get_bytes_per_block(struct archive *);
+
+ int
+ archive_write_set_bytes_per_block(struct archive *, int bytes_per_block);
+
+ int
+ archive_write_set_bytes_in_last_block(struct archive *, int);
+
+ int
+ archive_write_set_compression_bzip2(struct archive *);
+
+ int
+ archive_write_set_compression_gzip(struct archive *);
+
+ int
+ archive_write_set_compression_none(struct archive *);
+
+ int
+ archive_write_set_compression_program(struct archive *,
+ const char * cmd);
+
+ int
+ archive_write_set_format_cpio(struct archive *);
+
+ int
+ archive_write_set_format_pax(struct archive *);
+
+ int
+ archive_write_set_format_pax_restricted(struct archive *);
+
+ int
+ archive_write_set_format_shar(struct archive *);
+
+ int
+ archive_write_set_format_shar_binary(struct archive *);
+
+ int
+ archive_write_set_format_ustar(struct archive *);
+
+ int
+ archive_write_open(struct archive *, void *client_data,
+ archive_open_callback *, archive_write_callback *,
+ archive_close_callback *);
+
+ int
+ archive_write_open_fd(struct archive *, int fd);
+
+ int
+ archive_write_open_FILE(struct archive *, FILE *file);
+
+ int
+ archive_write_open_filename(struct archive *, const char *filename);
+
+ int
+ archive_write_open_memory(struct archive *, void *buffer,
+ size_t bufferSize, size_t *outUsed);
+
+ int
+ archive_write_header(struct archive *, struct archive_entry *);
+
+ ssize_t
+ archive_write_data(struct archive *, const void *, size_t);
+
+ int
+ archive_write_finish_entry(struct archive *);
+
+ int
+ archive_write_close(struct archive *);
+
+ int
+ archive_write_finish(struct archive *);
+
+DESCRIPTION
+ These functions provide a complete API for creating streaming archive
+ files. The general process is to first create the struct archive object,
+ set any desired options, initialize the archive, append entries, then
+ close the archive and release all resources. The following summary
+ describes the functions in approximately the order they are ordinarily
+ used:
+
+ archive_write_new()
+ Allocates and initializes a struct archive object suitable for
+ writing a tar archive.
+
+ archive_write_set_bytes_per_block()
+ Sets the block size used for writing the archive data. Every
+ call to the write callback function, except possibly the last
+ one, will use this value for the length. The third parameter is
+ a boolean that specifies whether or not the final block written
+ will be padded to the full block size. If it is zero, the last
+ block will not be padded. If it is non-zero, padding will be
+ added both before and after compression. The default is to use a
+ block size of 10240 bytes and to pad the last block. Note that a
+ block size of zero will suppress internal blocking and cause
+ writes to be sent directly to the write callback as they occur.
+
+ archive_write_get_bytes_per_block()
+ Retrieve the block size to be used for writing. A value of -1
+ here indicates that the library should use default values. A
+ value of zero indicates that internal blocking is suppressed.
+
+ archive_write_set_bytes_in_last_block()
+ Sets the block size used for writing the last block. If this
+ value is zero, the last block will be padded to the same size as
+ the other blocks. Otherwise, the final block will be padded to a
+ multiple of this size. In particular, setting it to 1 will cause
+ the final block to not be padded. For compressed output, any
+ padding generated by this option is applied only after the com-
+ pression. The uncompressed data is always unpadded. The default
+ is to pad the last block to the full block size (note that
+ archive_write_open_filename() will set this based on the file
+ type). Unlike the other ``set'' functions, this function can be
+ called after the archive is opened.
+
+ archive_write_get_bytes_in_last_block()
+ Retrieve the currently-set value for last block size. A value of
+ -1 here indicates that the library should use default values.
+
+ archive_write_set_format_cpio(), archive_write_set_format_pax(),
+ archive_write_set_format_pax_restricted(),
+ archive_write_set_format_shar(),
+ archive_write_set_format_shar_binary(),
+ archive_write_set_format_ustar()
+ Sets the format that will be used for the archive. The library
+ can write POSIX octet-oriented cpio format archives, POSIX-stan-
+ dard ``pax interchange'' format archives, traditional ``shar''
+ archives, enhanced ``binary'' shar archives that store a variety
+ of file attributes and handle binary files, and POSIX-standard
+ ``ustar'' archives. The pax interchange format is a backwards-
+ compatible tar format that adds key/value attributes to each
+ entry and supports arbitrary filenames, linknames, uids, sizes,
+ etc. ``Restricted pax interchange format'' is the library
+ default; this is the same as pax format, but suppresses the pax
+ extended header for most normal files. In most cases, this will
+ result in ordinary ustar archives.
+
+ archive_write_set_compression_bzip2(),
+ archive_write_set_compression_gzip(),
+ archive_write_set_compression_none()
+ The resulting archive will be compressed as specified. Note that
+ the compressed output is always properly blocked.
+
+ archive_write_set_compression_program()
+ The archive will be fed into the specified compression program.
+ The output of that program is blocked and written to the client
+ write callbacks.
+
+ archive_write_open()
+ Freeze the settings, open the archive, and prepare for writing
+ entries. This is the most generic form of this function, which
+ accepts pointers to three callback functions which will be
+ invoked by the compression layer to write the constructed ar-
+ chive.
+
+ archive_write_open_fd()
+ A convenience form of archive_write_open() that accepts a file
+ descriptor. The archive_write_open_fd() function is safe for use
+ with tape drives or other block-oriented devices.
+
+ archive_write_open_FILE()
+ A convenience form of archive_write_open() that accepts a FILE *
+ pointer. Note that archive_write_open_FILE() is not safe for
+ writing to tape drives or other devices that require correct
+ blocking.
+
+ archive_write_open_file()
+ A deprecated synonym for archive_write_open_filename().
+
+ archive_write_open_filename()
+ A convenience form of archive_write_open() that accepts a file-
+ name. A NULL argument indicates that the output should be writ-
+ ten to standard output; an argument of ``-'' will open a file
+ with that name. If you have not invoked
+ archive_write_set_bytes_in_last_block(), then
+ archive_write_open_filename() will adjust the last-block padding
+ depending on the file: it will enable padding when writing to
+ standard output or to a character or block device node, it will
+ disable padding otherwise. You can override this by manually
+ invoking archive_write_set_bytes_in_last_block() before calling
+ archive_write_open(). The archive_write_open_filename() function
+ is safe for use with tape drives or other block-oriented devices.
+
+ archive_write_open_memory()
+ A convenience form of archive_write_open() that accepts a pointer
+ to a block of memory that will receive the archive. The final
+ size_t * argument points to a variable that will be updated after
+ each write to reflect how much of the buffer is currently in use.
+ You should be careful to ensure that this variable remains allo-
+ cated until after the archive is closed.
+
+ archive_write_header()
+ Build and write a header using the data in the provided struct
+ archive_entry structure. See archive_entry(3) for information on
+ creating and populating struct archive_entry objects.
+
+ archive_write_data()
+ Write data corresponding to the header just written. Returns
+ number of bytes written or -1 on error.
+
+ archive_write_finish_entry()
+ Close out the entry just written. In particular, this writes out
+ the final padding required by some formats. Ordinarily, clients
+ never need to call this, as it is called automatically by
+ archive_write_next_header() and archive_write_close() as needed.
+
+ archive_write_close()
+ Complete the archive and invoke the close callback.
+
+ archive_write_finish()
+ Invokes archive_write_close() if it was not invoked manually,
+ then releases all resources. Note that this function was
+ declared to return void in libarchive 1.x, which made it impossi-
+ ble to detect errors when archive_write_close() was invoked
+ implicitly from this function. This is corrected beginning with
+ libarchive 2.0.
+ More information about the struct archive object and the overall design
+ of the library can be found in the libarchive(3) overview.
+
+IMPLEMENTATION
+ Compression support is built-in to libarchive, which uses zlib and bzlib
+ to handle gzip and bzip2 compression, respectively.
+
+CLIENT CALLBACKS
+ To use this library, you will need to define and register callback func-
+ tions that will be invoked to write data to the resulting archive. These
+ functions are registered by calling archive_write_open():
+
+ typedef int archive_open_callback(struct archive *, void
+ *client_data)
+
+ The open callback is invoked by archive_write_open(). It should return
+ ARCHIVE_OK if the underlying file or data source is successfully opened.
+ If the open fails, it should call archive_set_error() to register an
+ error code and message and return ARCHIVE_FATAL.
+
+ typedef ssize_t archive_write_callback(struct archive *, void
+ *client_data, void *buffer, size_t length)
+
+ The write callback is invoked whenever the library needs to write raw
+ bytes to the archive. For correct blocking, each call to the write call-
+ back function should translate into a single write(2) system call. This
+ is especially critical when writing archives to tape drives. On success,
+ the write callback should return the number of bytes actually written.
+ On error, the callback should invoke archive_set_error() to register an
+ error code and message and return -1.
+
+ typedef int archive_close_callback(struct archive *, void
+ *client_data)
+
+ The close callback is invoked by archive_close when the archive process-
+ ing is complete. The callback should return ARCHIVE_OK on success. On
+ failure, the callback should invoke archive_set_error() to register an
+ error code and message and return ARCHIVE_FATAL.
+
+EXAMPLE
+ The following sketch illustrates basic usage of the library. In this
+ example, the callback functions are simply wrappers around the standard
+ open(2), write(2), and close(2) system calls.
+
+ #include <sys/stat.h>
+ #include <archive.h>
+ #include <archive_entry.h>
+ #include <fcntl.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ struct mydata {
+ const char *name;
+ int fd;
+ };
+
+ int
+ myopen(struct archive *a, void *client_data)
+ {
+ struct mydata *mydata = client_data;
+
+ mydata->fd = open(mydata->name, O_WRONLY | O_CREAT, 0644);
+ if (mydata->fd >= 0)
+ return (ARCHIVE_OK);
+ else
+ return (ARCHIVE_FATAL);
+ }
+
+ ssize_t
+ mywrite(struct archive *a, void *client_data, void *buff, size_t n)
+ {
+ struct mydata *mydata = client_data;
+
+ return (write(mydata->fd, buff, n));
+ }
+
+ int
+ myclose(struct archive *a, void *client_data)
+ {
+ struct mydata *mydata = client_data;
+
+ if (mydata->fd > 0)
+ close(mydata->fd);
+ return (0);
+ }
+
+ void
+ write_archive(const char *outname, const char **filename)
+ {
+ struct mydata *mydata = malloc(sizeof(struct mydata));
+ struct archive *a;
+ struct archive_entry *entry;
+ struct stat st;
+ char buff[8192];
+ int len;
+ int fd;
+
+ a = archive_write_new();
+ mydata->name = outname;
+ archive_write_set_compression_gzip(a);
+ archive_write_set_format_ustar(a);
+ archive_write_open(a, mydata, myopen, mywrite, myclose);
+ while (*filename) {
+ stat(*filename, &st);
+ entry = archive_entry_new();
+ archive_entry_copy_stat(entry, &st);
+ archive_entry_set_pathname(entry, *filename);
+ archive_write_header(a, entry);
+ fd = open(*filename, O_RDONLY);
+ len = read(fd, buff, sizeof(buff));
+ while ( len > 0 ) {
+ archive_write_data(a, buff, len);
+ len = read(fd, buff, sizeof(buff));
+ }
+ archive_entry_free(entry);
+ filename++;
+ }
+ archive_write_finish(a);
+ }
+
+ int main(int argc, const char **argv)
+ {
+ const char *outname;
+ argv++;
+ outname = argv++;
+ write_archive(outname, argv);
+ return 0;
+ }
+
+RETURN VALUES
+ Most functions return ARCHIVE_OK (zero) on success, or one of several
+ non-zero error codes for errors. Specific error codes include:
+ ARCHIVE_RETRY for operations that might succeed if retried, ARCHIVE_WARN
+ for unusual conditions that do not prevent further operations, and
+ ARCHIVE_FATAL for serious errors that make remaining operations impossi-
+ ble. The archive_errno() and archive_error_string() functions can be
+ used to retrieve an appropriate error code and a textual error message.
+
+ archive_write_new() returns a pointer to a newly-allocated struct archive
+ object.
+
+ archive_write_data() returns a count of the number of bytes actually
+ written. On error, -1 is returned and the archive_errno() and
+ archive_error_string() functions will return appropriate values. Note
+ that if the client-provided write callback function returns a non-zero
+ value, that error will be propagated back to the caller through whatever
+ API function resulted in that call, which may include
+ archive_write_header(), archive_write_data(), archive_write_close(), or
+ archive_write_finish(). The client callback can call archive_set_error()
+ to provide values that can then be retrieved by archive_errno() and
+ archive_error_string().
+
+SEE ALSO
+ tar(1), libarchive(3), tar(5)
+
+HISTORY
+ The libarchive library first appeared in FreeBSD 5.3.
+
+AUTHORS
+ The libarchive library was written by Tim Kientzle <kientzle@acm.org>.
+
+BUGS
+ There are many peculiar bugs in historic tar implementations that may
+ cause certain programs to reject archives written by this library. For
+ example, several historic implementations calculated header checksums
+ incorrectly and will thus reject valid archives; GNU tar does not fully
+ support pax interchange format; some old tar implementations required
+ specific field terminations.
+
+ The default pax interchange format eliminates most of the historic tar
+ limitations and provides a generic key/value attribute facility for ven-
+ dor-defined extensions. One oversight in POSIX is the failure to provide
+ a standard attribute for large device numbers. This library uses
+ ``SCHILY.devminor'' and ``SCHILY.devmajor'' for device numbers that
+ exceed the range supported by the backwards-compatible ustar header.
+ These keys are compatible with Joerg Schilling's star archiver. Other
+ implementations may not recognize these keys and will thus be unable to
+ correctly restore device nodes with large device numbers from archives
+ created by this library.
+
+FreeBSD 6.0 August 19, 2006 FreeBSD 6.0
diff --git a/archivers/libarchive/files/doc/text/archive_write_disk.3.txt b/archivers/libarchive/files/doc/text/archive_write_disk.3.txt
new file mode 100644
index 00000000000..18e4e50c113
--- /dev/null
+++ b/archivers/libarchive/files/doc/text/archive_write_disk.3.txt
@@ -0,0 +1,253 @@
+archive_write_disk(3) FreeBSD Library Functions Manual archive_write_disk(3)
+
+NAME
+ archive_write_disk_new, archive_write_disk_set_options,
+ archive_write_disk_set_skip_file, archive_write_disk_set_group_lookup,
+ archive_write_disk_set_standard_lookup,
+ archive_write_disk_set_user_lookup, archive_write_header,
+ archive_write_data, archive_write_finish_entry, archive_write_close,
+ archive_write_finish -- functions for creating objects on disk
+
+SYNOPSIS
+ #include <archive.h>
+
+ struct archive *
+ archive_write_disk_new(void);
+
+ int
+ archive_write_disk_set_options(struct archive *, int flags);
+
+ int
+ archive_write_disk_set_skip_file(struct archive *, dev_t, ino_t);
+
+ int
+ archive_write_disk_set_group_lookup(struct archive *, void *,
+ gid_t (*)(void *, const char *gname, gid_t gid),
+ void (*cleanup)(void *));
+
+ int
+ archive_write_disk_set_standard_lookup(struct archive *);
+
+ int
+ archive_write_disk_set_user_lookup(struct archive *, void *,
+ uid_t (*)(void *, const char *uname, uid_t uid),
+ void (*cleanup)(void *));
+
+ int
+ archive_write_header(struct archive *, struct archive_entry *);
+
+ ssize_t
+ archive_write_data(struct archive *, const void *, size_t);
+
+ int
+ archive_write_finish_entry(struct archive *);
+
+ int
+ archive_write_close(struct archive *);
+
+ int
+ archive_write_finish(struct archive *);
+
+DESCRIPTION
+ These functions provide a complete API for creating objects on disk from
+ struct archive_entry descriptions. They are most naturally used when
+ extracting objects from an archive using the archive_read() interface.
+ The general process is to read struct archive_entry objects from an ar-
+ chive, then write those objects to a struct archive object created using
+ the archive_write_disk() family functions. This interface is deliber-
+ ately very similar to the archive_write() interface used to write objects
+ to a streaming archive.
+
+ archive_write_disk_new()
+ Allocates and initializes a struct archive object suitable for
+ writing objects to disk.
+
+ archive_write_disk_set_skip_file()
+ Records the device and inode numbers of a file that should not be
+ overwritten. This is typically used to ensure that an extraction
+ process does not overwrite the archive from which objects are
+ being read. This capability is technically unnecessary but can
+ be a significant performance optimization in practice.
+
+ archive_write_disk_set_options()
+ The options field consists of a bitwise OR of one or more of the
+ following values:
+ ARCHIVE_EXTRACT_OWNER
+ The user and group IDs should be set on the restored
+ file. By default, the user and group IDs are not
+ restored.
+ ARCHIVE_EXTRACT_PERM
+ Full permissions (including SGID, SUID, and sticky bits)
+ should be restored exactly as specified, without obeying
+ the current umask. Note that SUID and SGID bits can only
+ be restored if the user and group ID of the object on
+ disk are correct. If ARCHIVE_EXTRACT_OWNER is not speci-
+ fied, then SUID and SGID bits will only be restored if
+ the default user and group IDs of newly-created objects
+ on disk happen to match those specified in the archive
+ entry. By default, only basic permissions are restored,
+ and umask is obeyed.
+ ARCHIVE_EXTRACT_TIME
+ The timestamps (mtime, ctime, and atime) should be
+ restored. By default, they are ignored. Note that
+ restoring of atime is not currently supported.
+ ARCHIVE_EXTRACT_NO_OVERWRITE
+ Existing files on disk will not be overwritten. By
+ default, existing regular files are truncated and over-
+ written; existing directories will have their permissions
+ updated; other pre-existing objects are unlinked and
+ recreated from scratch.
+ ARCHIVE_EXTRACT_UNLINK
+ Existing files on disk will be unlinked before any
+ attempt to create them. In some cases, this can prove to
+ be a significant performance improvement. By default,
+ existing files are truncated and rewritten, but the file
+ is not recreated. In particular, the default behavior
+ does not break existing hard links.
+ ARCHIVE_EXTRACT_ACL
+ Attempt to restore ACLs. By default, extended ACLs are
+ ignored.
+ ARCHIVE_EXTRACT_FFLAGS
+ Attempt to restore extended file flags. By default, file
+ flags are ignored.
+ ARCHIVE_EXTRACT_XATTR
+ Attempt to restore POSIX.1e extended attributes. By
+ default, they are ignored.
+ ARCHIVE_EXTRACT_SECURE_SYMLINKS
+ Refuse to extract any object whose final location would
+ be altered by a symlink on disk. This is intended to
+ help guard against a variety of mischief caused by ar-
+ chives that (deliberately or otherwise) extract files
+ outside of the current directory. The default is not to
+ perform this check. If ARCHIVE_EXTRACT_UNLINK is speci-
+ fied together with this option, the library will remove
+ any intermediate symlinks it finds and return an error
+ only if such symlink could not be removed.
+ ARCHIVE_EXTRACT_SECURE_NODOTDOT
+ Refuse to extract a path that contains a .. element any-
+ where within it. The default is to not refuse such
+ paths. Note that paths ending in .. always cause an
+ error, regardless of this flag.
+
+ archive_write_disk_set_group_lookup(),
+ archive_write_disk_set_user_lookup()
+ The struct archive_entry objects contain both names and ids that
+ can be used to identify users and groups. These names and ids
+ describe the ownership of the file itself and also appear in ACL
+ lists. By default, the library uses the ids and ignores the
+ names, but this can be overridden by registering user and group
+ lookup functions. To register, you must provide a lookup func-
+ tion which accepts both a name and id and returns a suitable id.
+ You may also provide a void * pointer to a private data structure
+ and a cleanup function for that data. The cleanup function will
+ be invoked when the struct archive object is destroyed.
+
+ archive_write_disk_set_standard_lookup()
+ This convenience function installs a standard set of user and
+ group lookup functions. These functions use getpwnam(3) and
+ getgrnam(3) to convert names to ids, defaulting to the ids if the
+ names cannot be looked up. These functions also implement a sim-
+ ple memory cache to reduce the number of calls to getpwnam(3) and
+ getgrnam(3).
+
+ archive_write_header()
+ Build and write a header using the data in the provided struct
+ archive_entry structure. See archive_entry(3) for information on
+ creating and populating struct archive_entry objects.
+
+ archive_write_data()
+ Write data corresponding to the header just written. Returns
+ number of bytes written or -1 on error.
+
+ archive_write_finish_entry()
+ Close out the entry just written. Ordinarily, clients never need
+ to call this, as it is called automatically by
+ archive_write_next_header() and archive_write_close() as needed.
+
+ archive_write_close()
+ Set any attributes that could not be set during the initial
+ restore. For example, directory timestamps are not restored ini-
+ tially because restoring a subsequent file would alter that time-
+ stamp. Similarly, non-writable directories are initially created
+ with write permissions (so that their contents can be restored).
+ The archive_write_disk_new library maintains a list of all such
+ deferred attributes and sets them when this function is invoked.
+
+ archive_write_finish()
+ Invokes archive_write_close() if it was not invoked manually,
+ then releases all resources.
+ More information about the struct archive object and the overall design
+ of the library can be found in the libarchive(3) overview. Many of these
+ functions are also documented under archive_write(3).
+
+RETURN VALUES
+ Most functions return ARCHIVE_OK (zero) on success, or one of several
+ non-zero error codes for errors. Specific error codes include:
+ ARCHIVE_RETRY for operations that might succeed if retried, ARCHIVE_WARN
+ for unusual conditions that do not prevent further operations, and
+ ARCHIVE_FATAL for serious errors that make remaining operations impossi-
+ ble. The archive_errno() and archive_error_string() functions can be
+ used to retrieve an appropriate error code and a textual error message.
+
+ archive_write_disk_new() returns a pointer to a newly-allocated struct
+ archive object.
+
+ archive_write_data() returns a count of the number of bytes actually
+ written. On error, -1 is returned and the archive_errno() and
+ archive_error_string() functions will return appropriate values.
+
+SEE ALSO
+ archive_read(3), archive_write(3), tar(1), libarchive(3)
+
+HISTORY
+ The libarchive library first appeared in FreeBSD 5.3. The
+ archive_write_disk interface was added to libarchive 2.0 and first
+ appeared in FreeBSD 6.3.
+
+AUTHORS
+ The libarchive library was written by Tim Kientzle <kientzle@acm.org>.
+
+BUGS
+ Directories are actually extracted in two distinct phases. Directories
+ are created during archive_write_header(), but final permissions are not
+ set until archive_write_close(). This separation is necessary to cor-
+ rectly handle borderline cases such as a non-writable directory contain-
+ ing files, but can cause unexpected results. In particular, directory
+ permissions are not fully restored until the archive is closed. If you
+ use chdir(2) to change the current directory between calls to
+ archive_read_extract() or before calling archive_read_close(), you may
+ confuse the permission-setting logic with the result that directory per-
+ missions are restored incorrectly.
+
+ The library attempts to create objects with filenames longer than
+ PATH_MAX by creating prefixes of the full path and changing the current
+ directory. Currently, this logic is limited in scope; the fixup pass
+ does not work correctly for such objects and the symlink security check
+ option disables the support for very long pathnames.
+
+ Restoring the path aa/../bb does create each intermediate directory. In
+ particular, the directory aa is created as well as the final object bb.
+ In theory, this can be exploited to create an entire directory heirarchy
+ with a single request. Of course, this does not work if the
+ ARCHIVE_EXTRACT_NODOTDOT option is specified.
+
+ Implicit directories are always created obeying the current umask.
+ Explicit objects are created obeying the current umask unless
+ ARCHIVE_EXTRACT_PERM is specified, in which case they current umask is
+ ignored.
+
+ SGID and SUID bits are restored only if the correct user and group could
+ be set. If ARCHIVE_EXTRACT_OWNER is not specified, then no attempt is
+ made to set the ownership. In this case, SGID and SUID bits are restored
+ only if the user and group of the final object happen to match those
+ specified in the entry.
+
+ The ``standard'' user-id and group-id lookup functions are not the
+ defaults because getgrnam(3) and getpwnam(3) are sometimes too large for
+ particular applications. The current design allows the application
+ author to use a more compact implementation when appropriate.
+
+ There should be a corresponding archive_read_disk interface that walks a
+ directory heirarchy and returns archive entry objects.
+
+FreeBSD 6.0 March 2, 2007 FreeBSD 6.0
diff --git a/archivers/libarchive/files/doc/text/bsdcpio.1.txt b/archivers/libarchive/files/doc/text/bsdcpio.1.txt
new file mode 100644
index 00000000000..75e097ea722
--- /dev/null
+++ b/archivers/libarchive/files/doc/text/bsdcpio.1.txt
@@ -0,0 +1,199 @@
+BSDCPIO(1) FreeBSD General Commands Manual BSDCPIO(1)
+
+NAME
+ cpio -- copy files to and from archives
+
+SYNOPSIS
+ cpio {-i} [options] [pattern ...] [< archive]
+ cpio {-o} [options] < name-list [> archive]
+ cpio {-p} [options] dest-dir < name-list
+
+DESCRIPTION
+ cpio copies files between archives and directories. This implementation
+ can extract from tar, pax, cpio, zip, jar, ar, and ISO 9660 cdrom images
+ and can create tar, pax, cpio, ar, and shar archives.
+
+ The first option to cpio is a mode indicator from the following list:
+ -i Input. Read an archive from standard input and extract the con-
+ tents to disk or (if the -t option is specified) list the con-
+ tents to standard output.
+ -o Output. Read a list of filenames from standard input and produce
+ a new archive on standard output containing the specified items.
+ If one or more file patterns are specified, only files matching
+ one of the patterns will be extracted.
+ -p Pass-through. Read a list of filenames from standard input and
+ copy the files to the specified directory.
+
+OPTIONS
+ Unless specifically stated otherwise, options are applicable in all oper-
+ ating modes.
+
+ -a (o and p modes) Reset access times on files after they are read.
+ (Not yet implemented)
+
+ -B (o mode only) Block output to records of 5120 bytes.
+
+ -c (o mode only) Use the old POSIX portable character format.
+ Equivalent to --format odc.
+
+ -d (i and p modes) Create directories as necessary.
+
+ -f pattern
+ (i mode only) Ignore files that match pattern. (Not yet imple-
+ mented.)
+
+ --format format
+ (o mode only) Produce the output archive in the specified format.
+ Supported formats include:
+
+ cpio Synonym for odc.
+ newc The SVR4 portable cpio format.
+ odc The old POSIX.1 portable octet-oriented cpio format.
+ pax The POSIX.1 pax format, an extension of the ustar for-
+ mat.
+ ustar The POSIX.1 tar format.
+
+ The default format is odc. See libarchive_formats(5) for more
+ complete information about the formats currently supported by the
+ underlying libarchive(3) library.
+
+ -i Input mode. See above for description.
+
+ -L (o and p modes) All symbolic links will be followed. Normally,
+ symbolic links are archived and copied as symbolic links. With
+ this option, the target of the link will be archived or copied
+ instead. (Not yet implemented.)
+
+ -l (p mode only) Create links from the target directory to the orig-
+ inal files, instead of copying.
+
+ -m (i and p modes) Set file modification time on created files to
+ match those in the source.
+
+ -o Output mode. See above for description.
+
+ -p Pass-through mode. See above for description.
+
+ --quiet
+ (Not yet implemented.)
+
+ -R [user][:][group]
+ Set the owner and/or group on files in the output. If group is
+ specified with no user (for example, -R :wheel) then the group
+ will be set but not the user. If the user is specified with a
+ trailing colon and no group (for example, -R root:) then the
+ group will be set to the user's default group. If the user is
+ specified with no trailing colon, then the user will be set but
+ not the group. In -i and -p modes, this option can only be used
+ by the super-user. (For compatibility, a period can be used in
+ place of the colon.)
+
+ -r (All modes.) Rename files interactively. For each file, a
+ prompt is written to /dev/tty containing the name of the file and
+ a line is read from /dev/tty. If the line read is blank, the
+ file is skipped. If the line contains a single period, the file
+ is processed normally. Otherwise, the line is taken to be the
+ new name of the file.
+
+ -t (i mode only) List the contents of the archive to stdout; do not
+ restore the contents to disk.
+
+ -u (i and p modes) Unconditionally overwrite existing files. Ordi-
+ narily, an older file will not overwrite a newer file on disk.
+
+ -v Print the name of each file to stderr as it is processed. With
+ -t, provide a detailed listing of each file.
+
+ --version
+ Print the program version information and exit.
+
+ -y (o mode only) Compress the archive with bzip2-compatible compres-
+ sion before writing to stdout. In input mode, this option is
+ ignored; bzip2 compression is recognized automatically on input.
+
+ -z (o mode only) Compress the archive with gzip-compatible compres-
+ sion before writing it to stdout. In input mode, this option is
+ ignored; gzip compression is recognized automatically on input.
+
+ENVIRONMENT
+ The following environment variables affect the execution of cpio:
+
+ LANG The locale to use. See environ(7) for more information.
+
+ TZ The timezone to use when displaying dates. See environ(7) for
+ more information.
+
+EXIT STATUS
+ The cpio utility exits 0 on success, and >0 if an error occurs.
+
+EXAMPLES
+ The cpio command is traditionally used to copy file heirarchies in con-
+ junction with the find(1) command. The first example here simply copies
+ all files from src to dest:
+ find src | cpio -pmud dest
+
+ By carefully selecting options to the find(1) command and combining it
+ with other standard utilities, it is possible to exercise very fine con-
+ trol over which files are copied. This next example copies files from
+ src to dest that are more than 2 days old and whose names match a partic-
+ ular pattern:
+ find src -mtime +2 | grep foo[bar] | cpio -pdmu dest
+
+ This example copies files from src to dest that are more than 2 days old
+ and which contain the word ``foobar'':
+ find src -mtime +2 | xargs grep -l foobar | cpio -pdmu dest
+
+COMPATIBILITY
+ The mode options i, o, and p and the options a, B, c, d, f, l, m, r, t,
+ u, and v comply with SUSv2.
+
+ The old POSIX.1 standard specified that only -i, -o, and -p were inter-
+ preted as command-line options. Each took a single argument of a list of
+ modifier characters. For example, the standard syntax allows -imu but
+ does not support -miu or -i -m -u, since m and u are only modifiers to
+ -i, they are not command-line options in their own right. The syntax
+ supported by this implementation is backwards-compatible with the stan-
+ dard. For best compatibility, scripts should limit themselves to the
+ standard syntax.
+
+SEE ALSO
+ bzip2(1), tar(1), gzip(1), mt(1), pax(1), libarchive(3), cpio(5),
+ libarchive-formats(5), tar(5)
+
+STANDARDS
+ There is no current POSIX standard for the cpio command; it appeared in
+ ISO/IEC 9945-1:1996 (``POSIX.1'') but was dropped from IEEE Std
+ 1003.1-2001 (``POSIX.1'').
+
+ The cpio, ustar, and pax interchange file formats are defined by IEEE Std
+ 1003.1-2001 (``POSIX.1'') for the pax command.
+
+HISTORY
+ The original cpio and find utilities were written by Dick Haight while
+ working in AT&T's Unix Support Group. They first appeared in PWB/UNIX
+ 1.0, the ``Programmer's Work Bench'' system developed for use within AT&T
+ and released in 1977. XXX It was first released outside of AT&T as part
+ of System III Unix in 1981. XXX XXX Need to verify the previous state-
+ ment. XXX As a result, cpio actually predates tar, even though it was not
+ well-known outside of AT&T until some time later. XXX When did cpio
+ first appear in BSD? XXX
+
+ This is a complete re-implementation based on the libarchive(3) library.
+
+BUGS
+ The cpio archive format has several basic limitations: It does not store
+ user and group names, only numbers. As a result, it cannot be reliably
+ used to transfer files between systems with dissimilar user and group
+ numbering. Older cpio formats limit the user and group numbers to 16 or
+ 18 bits, which is insufficient for modern systems. The cpio archive for-
+ mats cannot support files over 4 gigabytes, except for the ``odc'' vari-
+ ant, which can support files up to 8 gigabytes.
+
+ This is an early alpha version of cpio. The underlying libarchive
+ library is quite mature, so the archive format support and creation of
+ objects on disk should be robust. However, the cpio-specific options and
+ features are still very new. Known issues that will be fixed soon:
+ o Options documented above as ``Not yet implemented''.
+ o Filter arguments to -i, and -it.
+
+FreeBSD 6.0 August 05, 2007 FreeBSD 6.0
diff --git a/archivers/libarchive/files/doc/text/bsdtar.1.txt b/archivers/libarchive/files/doc/text/bsdtar.1.txt
new file mode 100644
index 00000000000..0340a12af81
--- /dev/null
+++ b/archivers/libarchive/files/doc/text/bsdtar.1.txt
@@ -0,0 +1,450 @@
+BSDTAR(1) FreeBSD General Commands Manual BSDTAR(1)
+
+NAME
+ tar -- manipulate tape archives
+
+SYNOPSIS
+ tar [bundled-flags <args>] [<file> | <pattern> ...]
+ tar {-c} [options] [files | directories]
+ tar {-r | -u} -f archive-file [options] [files | directories]
+ tar {-t | -x} [options] [patterns]
+
+DESCRIPTION
+ tar creates and manipulates streaming archive files. This implementation
+ can extract from tar, pax, cpio, zip, jar, ar, and ISO 9660 cdrom images
+ and can create tar, pax, cpio, ar, and shar archives.
+
+ The first synopsis form shows a ``bundled'' option word. This usage is
+ provided for compatibility with historical implementations. See COMPATI-
+ BILITY below for details.
+
+ The other synopsis forms show the preferred usage. The first option to
+ tar is a mode indicator from the following list:
+ -c Create a new archive containing the specified items.
+ -r Like -c, but new entries are appended to the archive. Note that
+ this only works on uncompressed archives stored in regular files.
+ The -f option is required.
+ -t List archive contents to stdout.
+ -u Like -r, but new entries are added only if they have a modifica-
+ tion date newer than the corresponding entry in the archive.
+ Note that this only works on uncompressed archives stored in reg-
+ ular files. The -f option is required.
+ -x Extract to disk from the archive. If a file with the same name
+ appears more than once in the archive, each copy will be
+ extracted, with later copies overwriting (replacing) earlier
+ copies.
+
+ In -c, -r, or -u mode, each specified file or directory is added to the
+ archive in the order specified on the command line. By default, the con-
+ tents of each directory are also archived.
+
+ In extract or list mode, the entire command line is read and parsed
+ before the archive is opened. The pathnames or patterns on the command
+ line indicate which items in the archive should be processed. Patterns
+ are shell-style globbing patterns as documented in tcsh(1).
+
+OPTIONS
+ Unless specifically stated otherwise, options are applicable in all oper-
+ ating modes.
+
+ @archive
+ (c and r mode only) The specified archive is opened and the
+ entries in it will be appended to the current archive. As a sim-
+ ple example,
+ tar -c -f - newfile @original.tar
+ writes a new archive to standard output containing a file newfile
+ and all of the entries from original.tar. In contrast,
+ tar -c -f - newfile original.tar
+ creates a new archive with only two entries. Similarly,
+ tar -czf - --format pax @-
+ reads an archive from standard input (whose format will be deter-
+ mined automatically) and converts it into a gzip-compressed pax-
+ format archive on stdout. In this way, tar can be used to con-
+ vert archives from one format to another.
+
+ -b blocksize
+ Specify the block size, in 512-byte records, for tape drive I/O.
+ As a rule, this argument is only needed when reading from or
+ writing to tape drives, and usually not even then as the default
+ block size of 20 records (10240 bytes) is very common.
+
+ -C directory
+ In c and r mode, this changes the directory before adding the
+ following files. In x mode, change directories after opening the
+ archive but before extracting entries from the archive.
+
+ --check-links (-W check-links)
+ (c and r modes only) Issue a warning message unless all links to
+ each file are archived.
+
+ --exclude pattern (-W exclude=pattern)
+ Do not process files or directories that match the specified pat-
+ tern. Note that exclusions take precedence over patterns or
+ filenames specified on the command line.
+
+ --format format (-W format=format)
+ (c mode only) Use the specified format for the created archive.
+ Supported formats include ``cpio'', ``pax'', ``shar'', and
+ ``ustar''. Other formats may also be supported; see
+ libarchive-formats(5) for more information about currently-sup-
+ ported formats.
+
+ -f file
+ Read the archive from or write the archive to the specified file.
+ The filename can be - for standard input or standard output. If
+ not specified, the default tape device will be used. (On
+ FreeBSD, the default tape device is /dev/sa0.)
+
+ --fast-read (-W fast-read)
+ (x and t mode only) Extract or list only the first archive entry
+ that matches each pattern or filename operand. Exit as soon as
+ each specified pattern or filename has been matched. By default,
+ the archive is always read to the very end, since there can be
+ multiple entries with the same name and, by convention, later
+ entries overwrite earlier entries. This option is provided as a
+ performance optimization.
+
+ -H (c and r mode only) Symbolic links named on the command line will
+ be followed; the target of the link will be archived, not the
+ link itself.
+
+ -h (c and r mode only) Synonym for -L.
+
+ -I Synonym for -T.
+
+ --include pattern (-W include=pattern)
+ Process only files or directories that match the specified pat-
+ tern. Note that exclusions specified with --exclude take prece-
+ dence over inclusions. If no inclusions are explicitly speci-
+ fied, all entries are processed by default. The --include option
+ is especially useful when filtering archives. For example, the
+ command
+ tar -c -f new.tar --include='*foo*' @old.tgz
+ creates a new archive new.tar containing only the entries from
+ old.tgz containing the string `foo'.
+
+ -j (c mode only) Compress the resulting archive with bzip2(1). In
+ extract or list modes, this option is ignored. Note that, unlike
+ other tar implementations, this implementation recognizes bzip2
+ compression automatically when reading archives.
+
+ -k (x mode only) Do not overwrite existing files. In particular, if
+ a file appears more than once in an archive, later copies will
+ not overwrite earlier copies.
+
+ -L (c and r mode only) All symbolic links will be followed. Nor-
+ mally, symbolic links are archived as such. With this option,
+ the target of the link will be archived instead.
+
+ -l If POSIXLY_CORRECT is specified in the environment, this is a
+ synonym for the --check-links option. Otherwise, an error will
+ be displayed. Users who desire behavior compatible with GNU tar
+ should use the --one-file-system option instead.
+
+ -m (x mode only) Do not extract modification time. By default, the
+ modification time is set to the time stored in the archive.
+
+ -n (c, r, u modes only) Do not recursively archive the contents of
+ directories.
+
+ --newer date (-W newer=date)
+ (c, r, u modes only) Only include files and directories newer
+ than the specified date. This compares ctime entries.
+
+ --newer-mtime date (-W newer-mtime=date)
+ (c, r, u modes only) Like --newer, except it compares mtime
+ entries instead of ctime entries.
+
+ --newer-than file (-W newer-than=file)
+ (c, r, u modes only) Only include files and directories newer
+ than the specified file. This compares ctime entries.
+
+ --newer-mtime-than file (-W newer-mtime-than=file)
+ (c, r, u modes only) Like --newer-than, except it compares mtime
+ entries instead of ctime entries.
+
+ --nodump (-W nodump)
+ (c and r modes only) Honor the nodump file flag by skipping this
+ file.
+
+ --null (-W null)
+ (use with -I, -T, or -X) Filenames or patterns are separated by
+ null characters, not by newlines. This is often used to read
+ filenames output by the -print0 option to find(1).
+
+ -O (x, t modes only) In extract (-x) mode, files will be written to
+ standard out rather than being extracted to disk. In list (-t)
+ mode, the file listing will be written to stderr rather than the
+ usual stdout.
+
+ -o (x mode only) Use the user and group of the user running the pro-
+ gram rather than those specified in the archive. Note that this
+ has no significance unless -p is specified, and the program is
+ being run by the root user. In this case, the file modes and
+ flags from the archive will be restored, but ACLs or owner infor-
+ mation in the archive will be discarded.
+
+ --one-file-system (-W one-file-system)
+ (c, r, and u modes) Do not cross mount points.
+
+ -P Preserve pathnames. By default, absolute pathnames (those that
+ begin with a / character) have the leading slash removed both
+ when creating archives and extracting from them. Also, tar will
+ refuse to extract archive entries whose pathnames contain .. or
+ whose target directory would be altered by a symlink. This
+ option suppresses these behaviors.
+
+ -p (x mode only) Preserve file permissions. Attempt to restore the
+ full permissions, including owner, file modes, file flags and
+ ACLs, if available, for each item extracted from the archive. By
+ default, newly-created files are owned by the user running tar,
+ the file mode is restored for newly-created regular files, and
+ all other types of entries receive default permissions. If tar
+ is being run by root, the default is to restore the owner unless
+ the -o option is also specified.
+
+ --strip-components count (-W strip-components=count)
+ (x and t mode only) Remove the specified number of leading path
+ elements. Pathnames with fewer elements will be silently
+ skipped. Note that the pathname is edited after checking inclu-
+ sion/exclusion patterns but before security checks.
+
+ -T filename
+ In x or t mode, tar will read the list of names to be extracted
+ from filename. In c mode, tar will read names to be archived
+ from filename. The special name ``-C'' on a line by itself will
+ cause the current directory to be changed to the directory speci-
+ fied on the following line. Names are terminated by newlines
+ unless --null is specified. Note that --null also disables the
+ special handling of lines containing ``-C''.
+
+ -U (x mode only) Unlink files before creating them. Without this
+ option, tar overwrites existing files, which preserves existing
+ hardlinks. With this option, existing hardlinks will be broken,
+ as will any symlink that would affect the location of an
+ extracted file.
+
+ --use-compress-program program
+ Pipe the input (in x or t mode) or the output (in c mode) through
+ program instead of using the builtin compression support.
+
+ -v Produce verbose output. In create and extract modes, tar will
+ list each file name as it is read from or written to the archive.
+ In list mode, tar will produce output similar to that of ls(1).
+ Additional -v options will provide additional detail.
+
+ -W longopt=value
+ Long options (preceded by --) are only supported directly on sys-
+ tems that have the getopt_long(3) function. The -W option can be
+ used to access long options on systems that do not support this
+ function.
+
+ -w Ask for confirmation for every action.
+
+ -X filename
+ Read a list of exclusion patterns from the specified file. See
+ --exclude for more information about the handling of exclusions.
+
+ -y (c mode only) Compress the resulting archive with bzip2(1). In
+ extract or list modes, this option is ignored. Note that, unlike
+ other tar implementations, this implementation recognizes bzip2
+ compression automatically when reading archives.
+
+ -z (c mode only) Compress the resulting archive with gzip(1). In
+ extract or list modes, this option is ignored. Note that, unlike
+ other tar implementations, this implementation recognizes gzip
+ compression automatically when reading archives.
+
+ENVIRONMENT
+ The following environment variables affect the execution of tar:
+
+ LANG The locale to use. See environ(7) for more information.
+
+ POSIXLY_CORRECT
+ If this environment variable is defined, the -l option will be
+ interpreted in accordance with ISO/IEC 9945-1:1996
+ (``POSIX.1'').
+
+ TAPE The default tape device. The -f option overrides this.
+
+ TZ The timezone to use when displaying dates. See environ(7) for
+ more information.
+
+FILES
+ /dev/sa0 The default tape device, if not overridden by the TAPE envi-
+ ronment variable or the -f option.
+
+EXIT STATUS
+ The tar utility exits 0 on success, and >0 if an error occurs.
+
+EXAMPLES
+ The following creates a new archive called file.tar.gz that contains two
+ files source.c and source.h:
+ tar -czf file.tar.gz source.c source.h
+
+ To view a detailed table of contents for this archive:
+ tar -tvf file.tar.gz
+
+ To extract all entries from the archive on the default tape drive:
+ tar -x
+
+ To examine the contents of an ISO 9660 cdrom image:
+ tar -tf image.iso
+
+ To move file hierarchies, invoke tar as
+ tar -cf - -C srcdir . | tar -xpf - -C destdir
+ or more traditionally
+ cd srcdir ; tar -cf - . | (cd destdir ; tar -xpf -)
+
+ In create mode, the list of files and directories to be archived can also
+ include directory change instructions of the form -Cfoo/baz and archive
+ inclusions of the form @archive-file. For example, the command line
+ tar -c -f new.tar foo1 @old.tgz -C/tmp foo2
+ will create a new archive new.tar. tar will read the file foo1 from the
+ current directory and add it to the output archive. It will then read
+ each entry from old.tgz and add those entries to the output archive.
+ Finally, it will switch to the /tmp directory and add foo2 to the output
+ archive.
+
+ The --newer and --newer-mtime switches accept a variety of common date
+ and time specifications, including ``12 Mar 2005 7:14:29pm'',
+ ``2005-03-12 19:14'', ``5 minutes ago'', and ``19:14 PST May 1''.
+
+COMPATIBILITY
+ The bundled-arguments format is supported for compatibility with historic
+ implementations. It consists of an initial word (with no leading - char-
+ acter) in which each character indicates an option. Arguments follow as
+ separate words. The order of the arguments must match the order of the
+ corresponding characters in the bundled command word. For example,
+ tar tbf 32 file.tar
+ specifies three flags t, b, and f. The b and f flags both require argu-
+ ments, so there must be two additional items on the command line. The 32
+ is the argument to the b flag, and file.tar is the argument to the f
+ flag.
+
+ The mode options c, r, t, u, and x and the options b, f, l, m, o, v, and
+ w comply with SUSv2.
+
+ For maximum portability, scripts that invoke tar should use the bundled-
+ argument format above, should limit themselves to the c, t, and x modes,
+ and the b, f, m, v, and w options.
+
+ On systems that support getopt_long(), additional long options are avail-
+ able to improve compatibility with other tar implementations.
+
+SECURITY
+ Certain security issues are common to many archiving programs, including
+ tar. In particular, carefully-crafted archives can request that tar
+ extract files to locations outside of the target directory. This can
+ potentially be used to cause unwitting users to overwrite files they did
+ not intend to overwrite. If the archive is being extracted by the supe-
+ ruser, any file on the system can potentially be overwritten. There are
+ three ways this can happen. Although tar has mechanisms to protect
+ against each one, savvy users should be aware of the implications:
+
+ o Archive entries can have absolute pathnames. By default, tar
+ removes the leading / character from filenames before restoring
+ them to guard against this problem.
+
+ o Archive entries can have pathnames that include .. components.
+ By default, tar will not extract files containing .. components
+ in their pathname.
+
+ o Archive entries can exploit symbolic links to restore files to
+ other directories. An archive can restore a symbolic link to
+ another directory, then use that link to restore a file into that
+ directory. To guard against this, tar checks each extracted path
+ for symlinks. If the final path element is a symlink, it will be
+ removed and replaced with the archive entry. If -U is specified,
+ any intermediate symlink will also be unconditionally removed.
+ If neither -U nor -P is specified, tar will refuse to extract the
+ entry.
+ To protect yourself, you should be wary of any archives that come from
+ untrusted sources. You should examine the contents of an archive with
+ tar -tf filename
+ before extraction. You should use the -k option to ensure that tar will
+ not overwrite any existing files or the -U option to remove any pre-
+ existing files. You should generally not extract archives while running
+ with super-user privileges. Note that the -P option to tar disables the
+ security checks above and allows you to extract an archive while preserv-
+ ing any absolute pathnames, .. components, or symlinks to other directo-
+ ries.
+
+SEE ALSO
+ bzip2(1), cpio(1), gzip(1), mt(1), pax(1), shar(1), libarchive(3),
+ libarchive-formats(5), tar(5)
+
+STANDARDS
+ There is no current POSIX standard for the tar command; it appeared in
+ ISO/IEC 9945-1:1996 (``POSIX.1'') but was dropped from IEEE Std
+ 1003.1-2001 (``POSIX.1''). The options used by this implementation were
+ developed by surveying a number of existing tar implementations as well
+ as the old POSIX specification for tar and the current POSIX specifica-
+ tion for pax.
+
+ The ustar and pax interchange file formats are defined by IEEE Std
+ 1003.1-2001 (``POSIX.1'') for the pax command.
+
+HISTORY
+ A tar command appeared in Seventh Edition Unix, which was released in
+ January, 1979. There have been numerous other implementations, many of
+ which extended the file format. John Gilmore's pdtar public-domain
+ implementation (circa November, 1987) was quite influential, and formed
+ the basis of GNU tar. GNU tar was included as the standard system tar in
+ FreeBSD beginning with FreeBSD 1.0.
+
+ This is a complete re-implementation based on the libarchive(3) library.
+
+BUGS
+ POSIX and GNU violently disagree about the meaning of the -l option.
+ Because of the potential for disaster if someone expects one behavior and
+ gets the other, the -l option is deliberately broken in this implementa-
+ tion.
+
+ The -C dir option may differ from historic implementations.
+
+ All archive output is written in correctly-sized blocks, even if the out-
+ put is being compressed. Whether or not the last output block is padded
+ to a full block size varies depending on the format and the output
+ device. For tar and cpio formats, the last block of output is padded to
+ a full block size if the output is being written to standard output or to
+ a character or block device such as a tape drive. If the output is being
+ written to a regular file, the last block will not be padded. Many com-
+ pressors, including gzip(1) and bzip2(1), complain about the null padding
+ when decompressing an archive created by tar, although they still extract
+ it correctly.
+
+ The compression and decompression is implemented internally, so there may
+ be insignificant differences between the compressed output generated by
+ tar -czf - file
+ and that generated by
+ tar -cf - file | gzip
+
+ The default should be to read and write archives to the standard I/O
+ paths, but tradition (and POSIX) dictates otherwise.
+
+ The r and u modes require that the archive be uncompressed and located in
+ a regular file on disk. Other archives can be modified using c mode with
+ the @archive-file extension.
+
+ To archive a file called @foo or -foo you must specify it as ./@foo or
+ ./-foo, respectively.
+
+ In create mode, a leading ./ is always removed. A leading / is stripped
+ unless the -P option is specified.
+
+ There needs to be better support for file selection on both create and
+ extract.
+
+ There is not yet any support for multi-volume archives or for archiving
+ sparse files.
+
+ Converting between dissimilar archive formats (such as tar and cpio)
+ using the @- convention can cause hard link information to be lost.
+ (This is a consequence of the incompatible ways that different archive
+ formats store hardlink information.)
+
+ There are alternative long options for many of the short options that are
+ deliberately not documented.
+
+FreeBSD 6.0 April 13, 2004 FreeBSD 6.0
diff --git a/archivers/libarchive/files/doc/text/cpio.5.txt b/archivers/libarchive/files/doc/text/cpio.5.txt
new file mode 100644
index 00000000000..db5da1e9c9b
--- /dev/null
+++ b/archivers/libarchive/files/doc/text/cpio.5.txt
@@ -0,0 +1,235 @@
+CPIO(5) FreeBSD File Formats Manual CPIO(5)
+
+NAME
+ cpio -- format of cpio archive files
+
+DESCRIPTION
+ The cpio archive format collects any number of files, directories, and
+ other file system objects (symbolic links, device nodes, etc.) into a
+ single stream of bytes.
+
+ General Format
+ Each file system object in a cpio archive comprises a header record with
+ basic numeric metadata followed by the full pathname of the entry and the
+ file data. The header record stores a series of integer values that gen-
+ erally follow the fields in struct stat. (See stat(2) for details.) The
+ variants differ primarily in how they store those integers (binary,
+ octal, or hexadecimal). The header is followed by the pathname of the
+ entry (the length of the pathname is stored in the header) and any file
+ data. The end of the archive is indicated by a special record with the
+ pathname ``TRAILER!!!''.
+
+ PWB format
+ XXX Any documentation of the original PWB/UNIX 1.0 format? XXX
+
+ Old Binary Format
+ The old binary cpio format stores numbers as 2-byte and 4-byte binary
+ values. Each entry begins with a header in the following format:
+
+ struct header_old_cpio {
+ unsigned short c_magic;
+ unsigned short c_dev;
+ unsigned short c_ino;
+ unsigned short c_mode;
+ unsigned short c_uid;
+ unsigned short c_gid;
+ unsigned short c_nlink;
+ unsigned short c_rdev;
+ unsigned short c_mtime[2];
+ unsigned short c_namesize;
+ unsigned short c_filesize[2];
+ };
+
+ The unsigned short fields here are 16-bit integer values; the unsigned
+ int fields are 32-bit integer values. The fields are as follows
+
+ magic The integer value octal 070707. This value can be used to deter-
+ mine whether this archive is written with little-endian or big-
+ endian integers.
+
+ dev, ino
+ The device and inode numbers from the disk. These are used by
+ programs that read cpio archives to determine when two entries
+ refer to the same file. Programs that synthesize cpio archives
+ should be careful to set these to distinct values for each entry.
+
+ mode The mode specifies both the regular permissions and the file
+ type. It consists of several bit fields as follows:
+ 0170000 This masks the file type bits.
+ 0140000 File type value for sockets.
+ 0120000 File type value for symbolic links. For symbolic links,
+ the link body is stored as file data.
+ 0100000 File type value for regular files.
+ 0060000 File type value for block special devices.
+ 0040000 File type value for directories.
+ 0020000 File type value for character special devices.
+ 0010000 File type value for named pipes or FIFOs.
+ 0004000 SUID bit.
+ 0002000 SGID bit.
+ 0001000 Sticky bit. On some systems, this modifies the behavior
+ of executables and/or directories.
+ 0000777 The lower 9 bits specify read/write/execute permissions
+ for world, group, and user following standard POSIX con-
+ ventions.
+
+ uid, gid
+ The numeric user id and group id of the owner.
+
+ nlink The number of links to this file. Directories always have a
+ value of at least two here. Note that hardlinked files include
+ file data with every copy in the archive.
+
+ rdev For block special and character special entries, this field con-
+ tains the associated device number. For all other entry types,
+ it should be set to zero by writers and ignored by readers.
+
+ mtime Modification time of the file, indicated as the number of seconds
+ since the start of the epoch, 00:00:00 UTC January 1, 1970. The
+ four-byte integer is stored with the most-significant 16 bits
+ first followed by the least-significant 16 bits. Each of the two
+ 16 bit values are stored in machine-native byte order.
+
+ namesize
+ The number of bytes in the pathname that follows the header.
+ This count includes the trailing NULL byte.
+
+ filesize
+ The size of the file. Note that this archive format is limited
+ to four gigabyte file sizes. See mtime above for a description
+ of the storage of four-byte integers.
+
+ The pathname immediately follows the fixed header. If the namesize is
+ odd, an additional NULL byte is added after the pathname. The file data
+ is then appended, padded with NULL bytes to an even length.
+
+ Hardlinked files are not given special treatment; the full file contents
+ are included with each copy of the file.
+
+ Portable ASCII Format
+ Version 2 of the Single UNIX Specification (``SUSv2'') standardized an
+ ASCII variant that is portable across all platforms. It is commonly
+ known as the ``old character'' format or as the ``odc'' format. It
+ stores the same numeric fields as the old binary format, but represents
+ them as 6-character or 11-character octal values.
+
+ struct cpio_odc_header {
+ char c_magic[6];
+ char c_dev[6];
+ char c_ino[6];
+ char c_mode[6];
+ char c_uid[6];
+ char c_gid[6];
+ char c_nlink[6];
+ char c_rdev[6];
+ char c_mtime[11];
+ char c_namesize[6];
+ char c_filesize[11];
+ };
+
+ The fields are identical to those in the old binary format. The name and
+ file body follow the fixed header. Unlike the old binary format, there
+ is no additional padding after the pathname or file contents. If the
+ files being archived are themselves entirely ASCII, then the resulting
+ archive will be entirely ASCII, except for the NULL byte that terminates
+ the name field.
+
+ New ASCII Format
+ The "new" ASCII format uses 8-byte hexadecimal fields for all numbers and
+ separates device numbers into separate fields for major and minor num-
+ bers.
+
+ struct cpio_newc_header {
+ char c_magic[6];
+ char c_ino[8];
+ char c_mode[8];
+ char c_uid[8];
+ char c_gid[8];
+ char c_nlink[8];
+ char c_mtime[8];
+ char c_filesize[8];
+ char c_devmajor[8];
+ char c_devminor[8];
+ char c_rdevmajor[8];
+ char c_rdevminor[8];
+ char c_namesize[8];
+ char c_check[8];
+ };
+
+ Except as specified below, the fields here match those specified for the
+ old binary format above.
+
+ magic The string ``070701''.
+
+ check This field is always set to zero by writers and ignored by read-
+ ers. See the next section for more details.
+
+ The pathname is followed by NULL bytes so that the total size of the
+ fixed header plus pathname is a multiple of four. Likewise, the file
+ data is padded to a multiple of four bytes. Note that this format sup-
+ ports only 4 gigabyte files (unlike the older ASCII format, which sup-
+ ports 8 gigabyte files).
+
+ In this format, hardlinked files are handled by setting the filesize to
+ zero for each entry except the last one that appears in the archive.
+
+ New CRC Format
+ The CRC format is identical to the new ASCII format described in the pre-
+ vious section except that the magic field is set to ``070702'' and the
+ check field is set to the sum of all bytes in the file data. This sum is
+ computed treating all bytes as unsigned values and using unsigned arith-
+ metic. Only the least-significant 32 bits of the sum are stored.
+
+ HP variants
+ The cpio implementation distributed with HPUX used XXXX but stored device
+ numbers differently XXX.
+
+ Other Extensions and Variants
+ Sun Solaris uses additional file types to store extended file data,
+ including ACLs and extended attributes, as special entries in cpio ar-
+ chives.
+
+ XXX Others? XXX
+
+BUGS
+ The ``CRC'' format is mis-named, as it uses a simple checksum and not a
+ cyclic redundancy check.
+
+ The old binary format is limited to 16 bits for user id, group id,
+ device, and inode numbers. It is limited to 4 gigabyte file sizes.
+
+ The old ASCII format is limited to 18 bits for the user id, group id,
+ device, and inode numbers. It is limited to 8 gigabyte file sizes.
+
+ The new ASCII format is limited to 4 gigabyte file sizes.
+
+ None of the cpio formats store user or group names, which are essential
+ when moving files between systems with dissimilar user or group number-
+ ing.
+
+ Especially when writing older cpio variants, it may be necessary to map
+ actual device/inode values to synthesized values that fit the available
+ fields. With very large filesystems, this may be necessary even for the
+ newer formats.
+
+SEE ALSO
+ cpio(1), tar(5)
+
+STANDARDS
+ The cpio utility is no longer a part of POSIX or the Single Unix Stan-
+ dard. It last appeared in Version 2 of the Single UNIX Specification
+ (``SUSv2''). It has been supplanted in subsequent standards by pax(1).
+ The portable ASCII format is currently part of the specification for the
+ pax(1) utility.
+
+HISTORY
+ The original cpio utility was written by Dick Haight while working in
+ AT&T's Unix Support Group. It appeared in 1977 as part of PWB/UNIX 1.0,
+ the ``Programmer's Work Bench'' derived from Version 6 AT&T UNIX that was
+ used internally at AT&T. Both the old binary and old character formats
+ were in use by 1980, according to the System III source released by SCO
+ under their ``Ancient Unix'' license. The character format was adopted
+ as part of IEEE Std 1003.1-1988 (``POSIX.1''). XXX when did "newc"
+ appear? Who invented it? When did HP come out with their variant? When
+ did Sun introduce ACLs and extended attributes? XXX
+
+FreeBSD 6.0 October 5, 2007 FreeBSD 6.0
diff --git a/archivers/libarchive/files/doc/text/libarchive-formats.5.txt b/archivers/libarchive/files/doc/text/libarchive-formats.5.txt
new file mode 100644
index 00000000000..35eb2783bab
--- /dev/null
+++ b/archivers/libarchive/files/doc/text/libarchive-formats.5.txt
@@ -0,0 +1,180 @@
+libarchive-formats(3) FreeBSD Library Functions Manual libarchive-formats(3)
+
+NAME
+ libarchive-formats -- archive formats supported by the libarchive library
+
+DESCRIPTION
+ The libarchive(3) library reads and writes a variety of streaming archive
+ formats. Generally speaking, all of these archive formats consist of a
+ series of ``entries''. Each entry stores a single file system object,
+ such as a file, directory, or symbolic link.
+
+ The following provides a brief description of each format supported by
+ libarchive, with some information about recognized extensions or limita-
+ tions of the current library support. Note that just because a format is
+ supported by libarchive does not imply that a program that uses
+ libarchive will support that format. Applications that use libarchive
+ specify which formats they wish to support.
+
+ Tar Formats
+ The libarchive(3) library can read most tar archives. However, it only
+ writes POSIX-standard ``ustar'' and ``pax interchange'' formats.
+
+ All tar formats store each entry in one or more 512-byte records. The
+ first record is used for file metadata, including filename, timestamp,
+ and mode information, and the file data is stored in subsequent records.
+ Later variants have extended this by either appropriating undefined areas
+ of the header record, extending the header to multiple records, or by
+ storing special entries that modify the interpretation of subsequent
+ entries.
+
+ gnutar The libarchive(3) library can read GNU-format tar archives. It
+ currently supports the most popular GNU extensions, including
+ modern long filename and linkname support, as well as atime and
+ ctime data. The libarchive library does not support multi-volume
+ archives, nor the old GNU long filename format. It can read GNU
+ sparse file entries, including the new POSIX-based formats, but
+ cannot write GNU sparse file entries.
+
+ pax The libarchive(3) library can read and write POSIX-compliant pax
+ interchange format archives. Pax interchange format archives are
+ an extension of the older ustar format that adds a separate entry
+ with additional attributes stored as key/value pairs. The pres-
+ ence of this additional entry is the only difference between pax
+ interchange format and the older ustar format. The extended
+ attributes are of unlimited length and are stored as UTF-8 Uni-
+ code strings. Keywords defined in the standard are in all lower-
+ case; vendors are allowed to define custom keys by preceding them
+ with the vendor name in all uppercase. When writing pax ar-
+ chives, libarchive uses many of the SCHILY keys defined by Joerg
+ Schilling's ``star'' archiver. The libarchive library can read
+ most of the SCHILY keys. It silently ignores any keywords that
+ it does not understand.
+
+ restricted pax
+ The libarchive library can also write pax archives in which it
+ attempts to suppress the extended attributes entry whenever pos-
+ sible. The result will be identical to a ustar archive unless
+ the extended attributes entry is required to store a long file
+ name, long linkname, extended ACL, file flags, or if any of the
+ standard ustar data (user name, group name, UID, GID, etc) cannot
+ be fully represented in the ustar header. In all cases, the
+ result can be dearchived by any program that can read POSIX-com-
+ pliant pax interchange format archives. Programs that correctly
+ read ustar format (see below) will also be able to read this for-
+ mat; any extended attributes will be extracted as separate files
+ stored in PaxHeader directories.
+
+ ustar The libarchive library can both read and write this format. This
+ format has the following limitations:
+ o Device major and minor numbers are limited to 21 bits. Nodes
+ with larger numbers will not be added to the archive.
+ o Path names in the archive are limited to 255 bytes. (Shorter
+ if there is no / character in exactly the right place.)
+ o Symbolic links and hard links are stored in the archive with
+ the name of the referenced file. This name is limited to 100
+ bytes.
+ o Extended attributes, file flags, and other extended security
+ information cannot be stored.
+ o Archive entries are limited to 2 gigabytes in size.
+ Note that the pax interchange format has none of these restric-
+ tions.
+
+ The libarchive library can also read a variety of commonly-used exten-
+ sions to the basic tar format. In particular, it supports base-256 val-
+ ues in certain numeric fields. This essentially removes the limitations
+ on file size, modification time, and device numbers.
+
+ The first tar program appeared in Seventh Edition Unix in 1979. The
+ first official standard for the tar file format was the ``ustar'' (Unix
+ Standard Tar) format defined by POSIX in 1988. POSIX.1-2001 extended the
+ ustar format to create the ``pax interchange'' format.
+
+ Cpio Formats
+ The libarchive library can read a number of common cpio variants and can
+ write ``odc'' and ``newc'' format archives. A cpio archive stores each
+ entry as a fixed-size header followed by a variable-length filename and
+ variable-length data. Unlike tar, cpio does only minimal padding of the
+ header or file data. There are a variety of cpio formats, which differ
+ primarily in how they store the initial header: some store the values as
+ octal or hexadecimal numbers in ASCII, others as binary values of varying
+ byte order and length.
+
+ binary The libarchive library can read both big-endian and little-endian
+ variants of the original binary cpio format. This format used
+ 32-bit binary values for file size and mtime, and 16-bit binary
+ values for the other fields.
+
+ odc The libarchive library can both read and write this POSIX-stan-
+ dard format. This format stores the header contents as octal
+ values in ASCII. It is standard, portable, and immune from byte-
+ order confusion. File sizes and mtime are limited to 33 bits
+ (8GB file size), other fields are limited to 18 bits.
+
+ SVR4 The libarchive library can read both CRC and non-CRC variants of
+ this format. The SVR4 format uses eight-digit hexadecimal values
+ for all header fields. This limits file size to 4GB, and also
+ limits the mtime and other fields to 32 bits. The SVR4 format
+ can optionally include a CRC of the file contents, although
+ libarchive does not currently verify this CRC.
+
+ Cpio first appeared in PWB/UNIX 1.0, which was released within AT&T in
+ 1977. PWB/UNIX 1.0 formed the basis of System III Unix, released outside
+ of AT&T in 1981. This makes cpio older than tar, although cpio was not
+ included in Version 7 AT&T Unix. As a result, the tar command became
+ much better known in universities and research groups that used Version
+ 7. The combination of the find and cpio utilities provided very precise
+ control over file selection. Unfortunately, the format has many limita-
+ tions that make it unsuitable for widespread use. Only the POSIX format
+ permits files over 4GB, and its 18-bit limit for most other fields makes
+ it unsuitable for modern systems. In addition, cpio formats only store
+ numeric UID/GID values (not usernames and group names), which can make it
+ very difficult to correctly transfer archives across systems with dissim-
+ ilar user numbering.
+
+ Shar Formats
+ A ``shell archive'' is a shell script that, when executed on a POSIX-com-
+ pliant system, will recreate a collection of file system objects. The
+ libarchive library can write two different kinds of shar archives:
+
+ shar The traditional shar format uses a limited set of POSIX commands,
+ including echo(1), mkdir(1), and sed(1). It is suitable for
+ portably archiving small collections of plain text files. How-
+ ever, it is not generally well-suited for large archives (many
+ implementations of sh(1) have limits on the size of a script) nor
+ should it be used with non-text files.
+
+ shardump
+ This format is similar to shar but encodes files using
+ uuencode(1) so that the result will be a plain text file regard-
+ less of the file contents. It also includes additional shell
+ commands that attempt to reproduce as many file attributes as
+ possible, including owner, mode, and flags. The additional com-
+ mands used to restore file attributes make shardump archives less
+ portable than plain shar archives.
+
+ ISO9660 format
+ Libarchive can read and extract from files containing ISO9660-compliant
+ CDROM images. It also has partial support for Rockridge extensions. In
+ many cases, this can remove the need to burn a physical CDROM. It also
+ avoids security and complexity issues that come with virtual mounts and
+ loopback devices.
+
+ Zip format
+ Libarchive can extract from most zip format archives. It currently only
+ supports uncompressed entries and entries compressed with the ``deflate''
+ algorithm. Older zip compression algorithms are not supported.
+
+ Archive (library) file format
+ The Unix archive format (commonly created by the ar(1) archiver) is a
+ general-purpose format which is used almost exclusively for object files
+ to be read by the link editor ld(1). The ar format has never been stan-
+ dardised. There are two common variants: the GNU format derived from
+ SVR4, and the BSD format, which first appeared in 4.4BSD. Libarchive
+ provides read and write support for both variants.
+
+SEE ALSO
+ ar(1), cpio(1), mkisofs(1), shar(1), tar(1), zip(1), zlib(3), cpio(5),
+ mtree(5), tar(5)
+
+FreeBSD 6.0 April 27, 2004 FreeBSD 6.0
diff --git a/archivers/libarchive/files/doc/text/libarchive.3.txt b/archivers/libarchive/files/doc/text/libarchive.3.txt
new file mode 100644
index 00000000000..f4925f08ae8
--- /dev/null
+++ b/archivers/libarchive/files/doc/text/libarchive.3.txt
@@ -0,0 +1,185 @@
+LIBARCHIVE(3) FreeBSD Library Functions Manual LIBARCHIVE(3)
+
+NAME
+ libarchive -- functions for reading and writing streaming archives
+
+LIBRARY
+ Streaming Archive Library (libarchive, -larchive)
+
+OVERVIEW
+ The libarchive library provides a flexible interface for reading and
+ writing streaming archive files such as tar and cpio. The library is
+ inherently stream-oriented; readers serially iterate through the archive,
+ writers serially add things to the archive. In particular, note that
+ there is no built-in support for random access nor for in-place modifica-
+ tion.
+
+ When reading an archive, the library automatically detects the format and
+ the compression. The library currently has read support for:
+ o old-style tar archives,
+ o most variants of the POSIX ``ustar'' format,
+ o the POSIX ``pax interchange'' format,
+ o GNU-format tar archives,
+ o most common cpio archive formats,
+ o ISO9660 CD images (with or without RockRidge extensions),
+ o Zip archives.
+ The library automatically detects archives compressed with gzip(1),
+ bzip2(1), or compress(1) and decompresses them transparently.
+
+ When writing an archive, you can specify the compression to be used and
+ the format to use. The library can write
+ o POSIX-standard ``ustar'' archives,
+ o POSIX ``pax interchange format'' archives,
+ o POSIX octet-oriented cpio archives,
+ o two different variants of shar archives.
+ Pax interchange format is an extension of the tar archive format that
+ eliminates essentially all of the limitations of historic tar formats in
+ a standard fashion that is supported by POSIX-compliant pax(1) implemen-
+ tations on many systems as well as several newer implementations of
+ tar(1). Note that the default write format will suppress the pax
+ extended attributes for most entries; explicitly requesting pax format
+ will enable those attributes for all entries.
+
+ The read and write APIs are accessed through the archive_read_XXX() func-
+ tions and the archive_write_XXX() functions, respectively, and either can
+ be used independently of the other.
+
+ The rest of this manual page provides an overview of the library opera-
+ tion. More detailed information can be found in the individual manual
+ pages for each API or utility function.
+
+READING AN ARCHIVE
+ To read an archive, you must first obtain an initialized struct archive
+ object from archive_read_new(). You can then modify this object for the
+ desired operations with the various archive_read_set_XXX() and
+ archive_read_support_XXX() functions. In particular, you will need to
+ invoke appropriate archive_read_support_XXX() functions to enable the
+ corresponding compression and format support. Note that these latter
+ functions perform two distinct operations: they cause the corresponding
+ support code to be linked into your program, and they enable the corre-
+ sponding auto-detect code. Unless you have specific constraints, you
+ will generally want to invoke archive_read_support_compression_all() and
+ archive_read_support_format_all() to enable auto-detect for all formats
+ and compression types currently supported by the library.
+
+ Once you have prepared the struct archive object, you call
+ archive_read_open() to actually open the archive and prepare it for read-
+ ing. There are several variants of this function; the most basic expects
+ you to provide pointers to several functions that can provide blocks of
+ bytes from the archive. There are convenience forms that allow you to
+ specify a filename, file descriptor, FILE * object, or a block of memory
+ from which to read the archive data. Note that the core library makes no
+ assumptions about the size of the blocks read; callback functions are
+ free to read whatever block size is most appropriate for the medium.
+
+ Each archive entry consists of a header followed by a certain amount of
+ data. You can obtain the next header with archive_read_next_header(),
+ which returns a pointer to an struct archive_entry structure with infor-
+ mation about the current archive element. If the entry is a regular
+ file, then the header will be followed by the file data. You can use
+ archive_read_data() (which works much like the read(2) system call) to
+ read this data from the archive. You may prefer to use the higher-level
+ archive_read_data_skip(), which reads and discards the data for this
+ entry, archive_read_data_to_buffer(), which reads the data into an in-
+ memory buffer, archive_read_data_to_file(), which copies the data to the
+ provided file descriptor, or archive_read_extract(), which recreates the
+ specified entry on disk and copies data from the archive. In particular,
+ note that archive_read_extract() uses the struct archive_entry structure
+ that you provide it, which may differ from the entry just read from the
+ archive. In particular, many applications will want to override the
+ pathname, file permissions, or ownership.
+
+ Once you have finished reading data from the archive, you should call
+ archive_read_close() to close the archive, then call
+ archive_read_finish() to release all resources, including all memory
+ allocated by the library.
+
+ The archive_read(3) manual page provides more detailed calling informa-
+ tion for this API.
+
+WRITING AN ARCHIVE
+ You use a similar process to write an archive. The archive_write_new()
+ function creates an archive object useful for writing, the various
+ archive_write_set_XXX() functions are used to set parameters for writing
+ the archive, and archive_write_open() completes the setup and opens the
+ archive for writing.
+
+ Individual archive entries are written in a three-step process: You first
+ initialize a struct archive_entry structure with information about the
+ new entry. At a minimum, you should set the pathname of the entry and
+ provide a struct stat with a valid st_mode field, which specifies the
+ type of object and st_size field, which specifies the size of the data
+ portion of the object. The archive_write_header() function actually
+ writes the header data to the archive. You can then use
+ archive_write_data() to write the actual data.
+
+ After all entries have been written, use the archive_write_finish() func-
+ tion to release all resources.
+
+ The archive_write(3) manual page provides more detailed calling informa-
+ tion for this API.
+
+DESCRIPTION
+ Detailed descriptions of each function are provided by the corresponding
+ manual pages.
+
+ All of the functions utilize an opaque struct archive datatype that pro-
+ vides access to the archive contents.
+
+ The struct archive_entry structure contains a complete description of a
+ single archive entry. It uses an opaque interface that is fully docu-
+ mented in archive_entry(3).
+
+ Users familiar with historic formats should be aware that the newer vari-
+ ants have eliminated most restrictions on the length of textual fields.
+ Clients should not assume that filenames, link names, user names, or
+ group names are limited in length. In particular, pax interchange format
+ can easily accommodate pathnames in arbitrary character sets that exceed
+ PATH_MAX.
+
+RETURN VALUES
+ Most functions return zero on success, non-zero on error. The return
+ value indicates the general severity of the error, ranging from
+ ARCHIVE_WARN, which indicates a minor problem that should probably be
+ reported to the user, to ARCHIVE_FATAL, which indicates a serious problem
+ that will prevent any further operations on this archive. On error, the
+ archive_errno() function can be used to retrieve a numeric error code
+ (see errno(2)). The archive_error_string() returns a textual error mes-
+ sage suitable for display.
+
+ archive_read_new() and archive_write_new() return pointers to an allo-
+ cated and initialized struct archive object.
+
+ archive_read_data() and archive_write_data() return a count of the number
+ of bytes actually read or written. A value of zero indicates the end of
+ the data for this entry. A negative value indicates an error, in which
+ case the archive_errno() and archive_error_string() functions can be used
+ to obtain more information.
+
+ENVIRONMENT
+ There are character set conversions within the archive_entry(3) functions
+ that are impacted by the currently-selected locale.
+
+SEE ALSO
+ tar(1), archive_entry(3), archive_read(3), archive_util(3),
+ archive_write(3), tar(5)
+
+HISTORY
+ The libarchive library first appeared in FreeBSD 5.3.
+
+AUTHORS
+ The libarchive library was written by Tim Kientzle <kientzle@acm.org>.
+
+BUGS
+ Some archive formats support information that is not supported by struct
+ archive_entry. Such information cannot be fully archived or restored
+ using this library. This includes, for example, comments, character
+ sets, or the arbitrary key/value pairs that can appear in pax interchange
+ format archives.
+
+ Conversely, of course, not all of the information that can be stored in
+ an struct archive_entry is supported by all formats. For example, cpio
+ formats do not support nanosecond timestamps; old tar formats do not sup-
+ port large device numbers.
+
+FreeBSD 6.0 August 19, 2006 FreeBSD 6.0
diff --git a/archivers/libarchive/files/doc/text/libarchive_internals.3.txt b/archivers/libarchive/files/doc/text/libarchive_internals.3.txt
new file mode 100644
index 00000000000..4e398a1b3dc
--- /dev/null
+++ b/archivers/libarchive/files/doc/text/libarchive_internals.3.txt
@@ -0,0 +1,248 @@
+LIBARCHIVE(3) FreeBSD Library Functions Manual LIBARCHIVE(3)
+
+NAME
+ libarchive_internals -- description of libarchive internal interfaces
+
+OVERVIEW
+ The libarchive library provides a flexible interface for reading and
+ writing streaming archive files such as tar and cpio. Internally, it
+ follows a modular layered design that should make it easy to add new ar-
+ chive and compression formats.
+
+GENERAL ARCHITECTURE
+ Externally, libarchive exposes most operations through an opaque, object-
+ style interface. The archive_entry(1) objects store information about a
+ single filesystem object. The rest of the library provides facilities to
+ write archive_entry(1) objects to archive files, read them from archive
+ files, and write them to disk. (There are plans to add a facility to
+ read archive_entry(1) objects from disk as well.)
+
+ The read and write APIs each have four layers: a public API layer, a for-
+ mat layer that understands the archive file format, a compression layer,
+ and an I/O layer. The I/O layer is completely exposed to clients who can
+ replace it entirely with their own functions.
+
+ In order to provide as much consistency as possible for clients, some
+ public functions are virtualized. Eventually, it should be possible for
+ clients to open an archive or disk writer, and then use a single set of
+ code to select and write entries, regardless of the target.
+
+READ ARCHITECTURE
+ From the outside, clients use the archive_read(3) API to manipulate an
+ archive object to read entries and bodies from an archive stream. Inter-
+ nally, the archive object is cast to an archive_read object, which holds
+ all read-specific data. The API has four layers: The lowest layer is the
+ I/O layer. This layer can be overridden by clients, but most clients use
+ the packaged I/O callbacks provided, for example, by
+ archive_read_open_memory(3), and archive_read_open_fd(3). The compres-
+ sion layer calls the I/O layer to read bytes and decompresses them for
+ the format layer. The format layer unpacks a stream of uncompressed
+ bytes and creates archive_entry objects from the incoming data. The API
+ layer tracks overall state (for example, it prevents clients from reading
+ data before reading a header) and invokes the format and compression
+ layer operations through registered function pointers. In particular,
+ the API layer drives the format-detection process: When opening the ar-
+ chive, it reads an initial block of data and offers it to each registered
+ compression handler. The one with the highest bid is initialized with
+ the first block. Similarly, the format handlers are polled to see which
+ handler is the best for each archive. (Prior to 2.4.0, the format bid-
+ ders were invoked for each entry, but this design hindered error recov-
+ ery.)
+
+ I/O Layer and Client Callbacks
+ The read API goes to some lengths to be nice to clients. As a result,
+ there are few restrictions on the behavior of the client callbacks.
+
+ The client read callback is expected to provide a block of data on each
+ call. A zero-length return does indicate end of file, but otherwise
+ blocks may be as small as one byte or as large as the entire file. In
+ particular, blocks may be of different sizes.
+
+ The client skip callback returns the number of bytes actually skipped,
+ which may be much smaller than the skip requested. The only requirement
+ is that the skip not be larger. In particular, clients are allowed to
+ return zero for any skip that they don't want to handle. The skip call-
+ back must never be invoked with a negative value.
+
+ Keep in mind that not all clients are reading from disk: clients reading
+ from networks may provide different-sized blocks on every request and
+ cannot skip at all; advanced clients may use mmap(2) to read the entire
+ file into memory at once and return the entire file to libarchive as a
+ single block; other clients may begin asynchronous I/O operations for the
+ next block on each request.
+
+ Decompresssion Layer
+ The decompression layer not only handles decompression, it also buffers
+ data so that the format handlers see a much nicer I/O model. The decom-
+ pression API is a two stage peek/consume model. A read_ahead request
+ specifies a minimum read amount; the decompression layer must provide a
+ pointer to at least that much data. If more data is immediately avail-
+ able, it should return more: the format layer handles bulk data reads by
+ asking for a minimum of one byte and then copying as much data as is
+ available.
+
+ A subsequent call to the consume() function advances the read pointer.
+ Note that data returned from a read_ahead() call is guaranteed to remain
+ in place until the next call to read_ahead(). Intervening calls to
+ consume() should not cause the data to move.
+
+ Skip requests must always be handled exactly. Decompression handlers
+ that cannot seek forward should not register a skip handler; the API
+ layer fills in a generic skip handler that reads and discards data.
+
+ A decompression handler has a specific lifecycle:
+ Registration/Configuration
+ When the client invokes the public support function, the decom-
+ pression handler invokes the internal
+ __archive_read_register_compression() function to provide bid and
+ initialization functions. This function returns NULL on error or
+ else a pointer to a struct decompressor_t. This structure con-
+ tains a void * config slot that can be used for storing any cus-
+ tomization information.
+ Bid The bid function is invoked with a pointer and size of a block of
+ data. The decompressor can access its config data through the
+ decompressor element of the archive_read object. The bid func-
+ tion is otherwise stateless. In particular, it must not perform
+ any I/O operations.
+
+ The value returned by the bid function indicates its suitability
+ for handling this data stream. A bid of zero will ensure that
+ this decompressor is never invoked. Return zero if magic number
+ checks fail. Otherwise, your initial implementation should
+ return the number of bits actually checked. For example, if you
+ verify two full bytes and three bits of another byte, bid 19.
+ Note that the initial block may be very short; be careful to only
+ inspect the data you are given. (The current decompressors
+ require two bytes for correct bidding.)
+ Initialize
+ The winning bidder will have its init function called. This
+ function should initialize the remaining slots of the struct
+ decompressor_t object pointed to by the decompressor element of
+ the archive_read object. In particular, it should allocate any
+ working data it needs in the data slot of that structure. The
+ init function is called with the block of data that was used for
+ tasting. At this point, the decompressor is responsible for all
+ I/O requests to the client callbacks. The decompressor is free
+ to read more data as and when necessary.
+ Satisfy I/O requests
+ The format handler will invoke the read_ahead, consume, and skip
+ functions as needed.
+ Finish The finish method is called only once when the archive is closed.
+ It should release anything stored in the data and config slots of
+ the decompressor object. It should not invoke the client close
+ callback.
+
+ Format Layer
+ The read formats have a similar lifecycle to the decompression handlers:
+ Registration
+ Allocate your private data and initialize your pointers.
+ Bid Formats bid by invoking the read_ahead() decompression method but
+ not calling the consume() method. This allows each bidder to
+ look ahead in the input stream. Bidders should not look further
+ ahead than necessary, as long look aheads put pressure on the
+ decompression layer to buffer lots of data. Most formats only
+ require a few hundred bytes of look ahead; look aheads of a few
+ kilobytes are reasonable. (The ISO9660 reader sometimes looks
+ ahead by 48k, which should be considered an upper limit.)
+ Read header
+ The header read is usually the most complex part of any format.
+ There are a few strategies worth mentioning: For formats such as
+ tar or cpio, reading and parsing the header is straightforward
+ since headers alternate with data. For formats that store all
+ header data at the beginning of the file, the first header read
+ request may have to read all headers into memory and store that
+ data, sorted by the location of the file data. Subsequent header
+ read requests will skip forward to the beginning of the file data
+ and return the corresponding header.
+ Read Data
+ The read data interface supports sparse files; this requires that
+ each call return a block of data specifying the file offset and
+ size. This may require you to carefully track the location so
+ that you can return accurate file offsets for each read. Remem-
+ ber that the decompressor will return as much data as it has.
+ Generally, you will want to request one byte, examine the return
+ value to see how much data is available, and possibly trim that
+ to the amount you can use. You should invoke consume for each
+ block just before you return it.
+ Skip All Data
+ The skip data call should skip over all file data and trailing
+ padding. This is called automatically by the API layer just
+ before each header read. It is also called in response to the
+ client calling the public data_skip() function.
+ Cleanup
+ On cleanup, the format should release all of its allocated mem-
+ ory.
+
+ API Layer
+ XXX to do XXX
+
+WRITE ARCHITECTURE
+ The write API has a similar set of four layers: an API layer, a format
+ layer, a compression layer, and an I/O layer. The registration here is
+ much simpler because only one format and one compression can be regis-
+ tered at a time.
+
+ I/O Layer and Client Callbacks
+ XXX To be written XXX
+
+ Compression Layer
+ XXX To be written XXX
+
+ Format Layer
+ XXX To be written XXX
+
+ API Layer
+ XXX To be written XXX
+
+WRITE_DISK ARCHITECTURE
+ The write_disk API is intended to look just like the write API to
+ clients. Since it does not handle multiple formats or compression, it is
+ not layered internally.
+
+GENERAL SERVICES
+ The archive_read, archive_write, and archive_write_disk objects all con-
+ tain an initial archive object which provides common support for a set of
+ standard services. (Recall that ANSI/ISO C90 guarantees that you can
+ cast freely between a pointer to a structure and a pointer to the first
+ element of that structure.) The archive object has a magic value that
+ indicates which API this object is associated with, slots for storing
+ error information, and function pointers for virtualized API functions.
+
+MISCELLANEOUS NOTES
+ Connecting existing archiving libraries into libarchive is generally
+ quite difficult. In particular, many existing libraries strongly assume
+ that you are reading from a file; they seek forwards and backwards as
+ necessary to locate various pieces of information. In contrast,
+ libarchive never seeks backwards in its input, which sometimes requires
+ very different approaches.
+
+ For example, libarchive's ISO9660 support operates very differently from
+ most ISO9660 readers. The libarchive support utilizes a work-queue
+ design that keeps a list of known entries sorted by their location in the
+ input. Whenever libarchive's ISO9660 implementation is asked for the
+ next header, checks this list to find the next item on the disk. Direc-
+ tories are parsed when they are encountered and new items are added to
+ the list. This design relies heavily on the ISO9660 image being opti-
+ mized so that directories always occur earlier on the disk than the files
+ they describe.
+
+ Depending on the specific format, such approaches may not be possible.
+ The ZIP format specification, for example, allows archivers to store key
+ information only at the end of the file. In theory, it is possible to
+ create ZIP archives that cannot be read without seeking. Fortunately,
+ such archives are very rare, and libarchive can read most ZIP archives,
+ though it cannot always extract as much information as a dedicated ZIP
+ program.
+
+SEE ALSO
+ archive(3), archive_entry(3), archive_read(3), archive_write(3),
+ archive_write_disk(3)
+
+HISTORY
+ The libarchive library first appeared in FreeBSD 5.3.
+
+AUTHORS
+ The libarchive library was written by Tim Kientzle <kientzle@acm.org>.
+
+BUGS
+FreeBSD 6.0 April 16, 2007 FreeBSD 6.0
diff --git a/archivers/libarchive/files/doc/text/mtree.5.txt b/archivers/libarchive/files/doc/text/mtree.5.txt
new file mode 100644
index 00000000000..1e5eb4f42b0
--- /dev/null
+++ b/archivers/libarchive/files/doc/text/mtree.5.txt
@@ -0,0 +1,158 @@
+MTREE(5) FreeBSD File Formats Manual MTREE(5)
+
+NAME
+ mtree -- format of mtree dir heirarchy files
+
+DESCRIPTION
+ The mtree format is a textual format that describes a collection of
+ filesystem objects. Such files are typically used to create or verify
+ directory heirarchies.
+
+ General Format
+ An mtree file consists of a series of lines, each providing information
+ about a single filesystem object. Leading whitespace is always ignored.
+
+ When encoding file or pathnames, any backslash character or character
+ outside of the 95 printable ASCII characters must be encoded as a a back-
+ slash followed by three octal digits. When reading mtree files, any
+ appearance of a backslash followed by three octal digits should be con-
+ verted into the corresponding character.
+
+ Each line is interpreted independently as one of the following types:
+
+ Signature The first line of any mtree file must begin with ``#mtree''.
+ If a file contains any full path entries, the first line
+ should begin with ``#mtree v2.0'', otherwise, the first line
+ should begin with ``#mtree v1.0''.
+
+ Blank Blank lines are ignored.
+
+ Comment Lines beginning with # are ignored.
+
+ Special Lines beginning with / are special commands that influence
+ the interpretation of later lines.
+
+ Relative If the first whitespace-delimited word has no / characters,
+ it is the name of a file in the current directory. Any rela-
+ tive entry that describes a directory changes the current
+ directory.
+
+ dot-dot As a special case, a relative entry with the filename ..
+ changes the current directory to the parent directory.
+ Options on dot-dot entries are always ignored.
+
+ Full If the first whitespace-delimited word has a / character
+ after the first character, it is the pathname of a file rela-
+ tive to the starting directory. There can be multiple full
+ entries describing the same file.
+
+ Some tools that process mtree files may require that multiple lines
+ describing the same file occur consecutively. It is not permitted for
+ the same file to be mentioned using both a relative and a full file spec-
+ ification.
+
+ Special commands
+ Two special commands are currently defined:
+
+ /set This command defines default values for one or more keywords.
+ It is followed on the same line by one or more whitespace-
+ separated keyword definitions. These definitions apply to
+ all following files that do not specify a value for that key-
+ word.
+
+ /unset This command removes any default value set by a previous /set
+ command. It is followed on the same line by one or more key-
+ words separated by whitespace.
+
+ Keywords
+ After the filename, a full or relative entry consists of zero or more
+ whitespace-separated keyword definitions. Each such definitions consists
+ of a key from the following list immediately followed by an '=' sign and
+ a value. Software programs reading mtree files should warn about unrec-
+ ognized keywords.
+
+ Currently supported keywords are as follows:
+
+ cksum The checksum of the file using the default algorithm speci-
+ fied by the cksum(1) utility.
+
+ contents The full pathname of a file whose contents should be compared
+ to the contents of this file.
+
+ flags The file flags as a symbolic name. See chflags(1) for infor-
+ mation on these names. If no flags are to be set the string
+ ``none'' may be used to override the current default.
+
+ ignore Ignore any file hierarchy below this file.
+
+ gid The file group as a numeric value.
+
+ gname The file group as a symbolic name.
+
+ md5 The MD5 message digest of the file.
+
+ md5digest A synonym for md5.
+
+ sha1 The FIPS 160-1 (``SHA-1'') message digest of the file.
+
+ sha1digest A synonym for sha1.
+
+ sha256 The FIPS 180-2 (``SHA-256'') message digest of the file.
+
+ sha256digest
+ A synonym for sha256.
+
+ ripemd160digest
+ The RIPEMD160 message digest of the file.
+
+ rmd160 A synonym for ripemd160digest.
+
+ rmd160digest
+ A synonym for ripemd160digest.
+
+ mode The current file's permissions as a numeric (octal) or sym-
+ bolic value.
+
+ nlink The number of hard links the file is expected to have.
+
+ nochange Make sure this file or directory exists but otherwise ignore
+ all attributes.
+
+ uid The file owner as a numeric value.
+
+ uname The file owner as a symbolic name.
+
+ size The size, in bytes, of the file.
+
+ link The file the symbolic link is expected to reference.
+
+ time The last modification time of the file.
+
+ type The type of the file; may be set to any one of the following:
+
+ block block special device
+ char character special device
+ dir directory
+ fifo fifo
+ file regular file
+ link symbolic link
+ socket socket
+
+SEE ALSO
+ cksum(1), find(1), mtree(8)
+
+BUGS
+ The FreeBSD implementation of mtree does not currently support the mtree
+ 2.0 format. The requirement for a ``#mtree'' signature line is new and
+ not yet widely implemented.
+
+HISTORY
+ The mtree utility appeared in 4.3BSD-Reno. The MD5 digest capability was
+ added in FreeBSD 2.1, in response to the widespread use of programs which
+ can spoof cksum(1). The SHA-1 and RIPEMD160 digests were added in
+ FreeBSD 4.0, as new attacks have demonstrated weaknesses in MD5. The
+ SHA-256 digest was added in FreeBSD 6.0. Support for file flags was
+ added in FreeBSD 4.0, and mostly comes from NetBSD. The ``full'' entry
+ format was added by NetBSD.
+
+FreeBSD 6.0 August 20, 2007 FreeBSD 6.0
diff --git a/archivers/libarchive/files/doc/text/tar.5.txt b/archivers/libarchive/files/doc/text/tar.5.txt
new file mode 100644
index 00000000000..24b77e15984
--- /dev/null
+++ b/archivers/libarchive/files/doc/text/tar.5.txt
@@ -0,0 +1,534 @@
+TAR(5) FreeBSD File Formats Manual TAR(5)
+
+NAME
+ tar -- format of tape archive files
+
+DESCRIPTION
+ The tar archive format collects any number of files, directories, and
+ other file system objects (symbolic links, device nodes, etc.) into a
+ single stream of bytes. The format was originally designed to be used
+ with tape drives that operate with fixed-size blocks, but is widely used
+ as a general packaging mechanism.
+
+ General Format
+ A tar archive consists of a series of 512-byte records. Each file system
+ object requires a header record which stores basic metadata (pathname,
+ owner, permissions, etc.) and zero or more records containing any file
+ data. The end of the archive is indicated by two records consisting
+ entirely of zero bytes.
+
+ For compatibility with tape drives that use fixed block sizes, programs
+ that read or write tar files always read or write a fixed number of
+ records with each I/O operation. These ``blocks'' are always a multiple
+ of the record size. The most common block size--and the maximum sup-
+ ported by historic implementations--is 10240 bytes or 20 records. (Note:
+ the terms ``block'' and ``record'' here are not entirely standard; this
+ document follows the convention established by John Gilmore in document-
+ ing pdtar.)
+
+ Old-Style Archive Format
+ The original tar archive format has been extended many times to include
+ additional information that various implementors found necessary. This
+ section describes the variant implemented by the tar command included in
+ Version 7 AT&T UNIX, which is one of the earliest widely-used versions of
+ the tar program.
+
+ The header record for an old-style tar archive consists of the following:
+
+ struct header_old_tar {
+ char name[100];
+ char mode[8];
+ char uid[8];
+ char gid[8];
+ char size[12];
+ char mtime[12];
+ char checksum[8];
+ char linkflag[1];
+ char linkname[100];
+ char pad[255];
+ };
+ All unused bytes in the header record are filled with nulls.
+
+ name Pathname, stored as a null-terminated string. Early tar imple-
+ mentations only stored regular files (including hardlinks to
+ those files). One common early convention used a trailing "/"
+ character to indicate a directory name, allowing directory per-
+ missions and owner information to be archived and restored.
+
+ mode File mode, stored as an octal number in ASCII.
+
+ uid, gid
+ User id and group id of owner, as octal numbers in ASCII.
+
+ size Size of file, as octal number in ASCII. For regular files only,
+ this indicates the amount of data that follows the header. In
+ particular, this field was ignored by early tar implementations
+ when extracting hardlinks. Modern writers should always store a
+ zero length for hardlink entries.
+
+ mtime Modification time of file, as an octal number in ASCII. This
+ indicates the number of seconds since the start of the epoch,
+ 00:00:00 UTC January 1, 1970. Note that negative values should
+ be avoided here, as they are handled inconsistently.
+
+ checksum
+ Header checksum, stored as an octal number in ASCII. To compute
+ the checksum, set the checksum field to all spaces, then sum all
+ bytes in the header using unsigned arithmetic. This field should
+ be stored as six octal digits followed by a null and a space
+ character. Note that many early implementations of tar used
+ signed arithmetic for the checksum field, which can cause inter-
+ operability problems when transferring archives between systems.
+ Modern robust readers compute the checksum both ways and accept
+ the header if either computation matches.
+
+ linkflag, linkname
+ In order to preserve hardlinks and conserve tape, a file with
+ multiple links is only written to the archive the first time it
+ is encountered. The next time it is encountered, the linkflag is
+ set to an ASCII `1' and the linkname field holds the first name
+ under which this file appears. (Note that regular files have a
+ null value in the linkflag field.)
+
+ Early tar implementations varied in how they terminated these fields.
+ The tar command in Version 7 AT&T UNIX used the following conventions
+ (this is also documented in early BSD manpages): the pathname must be
+ null-terminated; the mode, uid, and gid fields must end in a space and a
+ null byte; the size and mtime fields must end in a space; the checksum is
+ terminated by a null and a space. Early implementations filled the
+ numeric fields with leading spaces. This seems to have been common prac-
+ tice until the IEEE Std 1003.1-1988 (``POSIX.1'') standard was released.
+ For best portability, modern implementations should fill the numeric
+ fields with leading zeros.
+
+ Pre-POSIX Archives
+ An early draft of IEEE Std 1003.1-1988 (``POSIX.1'') served as the basis
+ for John Gilmore's pdtar program and many system implementations from the
+ late 1980s and early 1990s. These archives generally follow the POSIX
+ ustar format described below with the following variations:
+ o The magic value is ``ustar '' (note the following space). The
+ version field contains a space character followed by a null.
+ o The numeric fields are generally filled with leading spaces (not
+ leading zeros as recommended in the final standard).
+ o The prefix field is often not used, limiting pathnames to the 100
+ characters of old-style archives.
+
+ POSIX ustar Archives
+ IEEE Std 1003.1-1988 (``POSIX.1'') defined a standard tar file format to
+ be read and written by compliant implementations of tar(1). This format
+ is often called the ``ustar'' format, after the magic value used in the
+ header. (The name is an acronym for ``Unix Standard TAR''.) It extends
+ the historic format with new fields:
+
+ struct header_posix_ustar {
+ char name[100];
+ char mode[8];
+ char uid[8];
+ char gid[8];
+ char size[12];
+ char mtime[12];
+ char checksum[8];
+ char typeflag[1];
+ char linkname[100];
+ char magic[6];
+ char version[2];
+ char uname[32];
+ char gname[32];
+ char devmajor[8];
+ char devminor[8];
+ char prefix[155];
+ char pad[12];
+ };
+
+ typeflag
+ Type of entry. POSIX extended the earlier linkflag field with
+ several new type values:
+ ``0'' Regular file. NULL should be treated as a synonym, for
+ compatibility purposes.
+ ``1'' Hard link.
+ ``2'' Symbolic link.
+ ``3'' Character device node.
+ ``4'' Block device node.
+ ``5'' Directory.
+ ``6'' FIFO node.
+ ``7'' Reserved.
+ Other A POSIX-compliant implementation must treat any unrecog-
+ nized typeflag value as a regular file. In particular,
+ writers should ensure that all entries have a valid file-
+ name so that they can be restored by readers that do not
+ support the corresponding extension. Uppercase letters
+ "A" through "Z" are reserved for custom extensions. Note
+ that sockets and whiteout entries are not archivable.
+ It is worth noting that the size field, in particular, has dif-
+ ferent meanings depending on the type. For regular files, of
+ course, it indicates the amount of data following the header.
+ For directories, it may be used to indicate the total size of all
+ files in the directory, for use by operating systems that pre-
+ allocate directory space. For all other types, it should be set
+ to zero by writers and ignored by readers.
+
+ magic Contains the magic value ``ustar'' followed by a NULL byte to
+ indicate that this is a POSIX standard archive. Full compliance
+ requires the uname and gname fields be properly set.
+
+ version
+ Version. This should be ``00'' (two copies of the ASCII digit
+ zero) for POSIX standard archives.
+
+ uname, gname
+ User and group names, as null-terminated ASCII strings. These
+ should be used in preference to the uid/gid values when they are
+ set and the corresponding names exist on the system.
+
+ devmajor, devminor
+ Major and minor numbers for character device or block device
+ entry.
+
+ prefix First part of pathname. If the pathname is too long to fit in
+ the 100 bytes provided by the standard format, it can be split at
+ any / character with the first portion going here. If the prefix
+ field is not empty, the reader will prepend the prefix value and
+ a / character to the regular name field to obtain the full path-
+ name.
+
+ Note that all unused bytes must be set to NULL.
+
+ Field termination is specified slightly differently by POSIX than by pre-
+ vious implementations. The magic, uname, and gname fields must have a
+ trailing NULL. The pathname, linkname, and prefix fields must have a
+ trailing NULL unless they fill the entire field. (In particular, it is
+ possible to store a 256-character pathname if it happens to have a / as
+ the 156th character.) POSIX requires numeric fields to be zero-padded in
+ the front, and allows them to be terminated with either space or NULL
+ characters.
+
+ Currently, most tar implementations comply with the ustar format, occa-
+ sionally extending it by adding new fields to the blank area at the end
+ of the header record.
+
+ Pax Interchange Format
+ There are many attributes that cannot be portably stored in a POSIX ustar
+ archive. IEEE Std 1003.1-2001 (``POSIX.1'') defined a ``pax interchange
+ format'' that uses two new types of entries to hold text-formatted meta-
+ data that applies to following entries. Note that a pax interchange for-
+ mat archive is a ustar archive in every respect. The new data is stored
+ in ustar-compatible archive entries that use the ``x'' or ``g'' typeflag.
+ In particular, older implementations that do not fully support these
+ extensions will extract the metadata into regular files, where the meta-
+ data can be examined as necessary.
+
+ An entry in a pax interchange format archive consists of one or two stan-
+ dard ustar entries, each with its own header and data. The first
+ optional entry stores the extended attributes for the following entry.
+ This optional first entry has an "x" typeflag and a size field that indi-
+ cates the total size of the extended attributes. The extended attributes
+ themselves are stored as a series of text-format lines encoded in the
+ portable UTF-8 encoding. Each line consists of a decimal number, a
+ space, a key string, an equals sign, a value string, and a new line. The
+ decimal number indicates the length of the entire line, including the
+ initial length field and the trailing newline. An example of such a
+ field is:
+ 25 ctime=1084839148.1212\n
+ Keys in all lowercase are standard keys. Vendors can add their own keys
+ by prefixing them with an all uppercase vendor name and a period. Note
+ that, unlike the historic header, numeric values are stored using deci-
+ mal, not octal. A description of some common keys follows:
+
+ atime, ctime, mtime
+ File access, inode change, and modification times. These fields
+ can be negative or include a decimal point and a fractional
+ value.
+
+ uname, uid, gname, gid
+ User name, group name, and numeric UID and GID values. The user
+ name and group name stored here are encoded in UTF8 and can thus
+ include non-ASCII characters. The UID and GID fields can be of
+ arbitrary length.
+
+ linkpath
+ The full path of the linked-to file. Note that this is encoded
+ in UTF8 and can thus include non-ASCII characters.
+
+ path The full pathname of the entry. Note that this is encoded in
+ UTF8 and can thus include non-ASCII characters.
+
+ realtime.*, security.*
+ These keys are reserved and may be used for future standardiza-
+ tion.
+
+ size The size of the file. Note that there is no length limit on this
+ field, allowing conforming archives to store files much larger
+ than the historic 8GB limit.
+
+ SCHILY.*
+ Vendor-specific attributes used by Joerg Schilling's star imple-
+ mentation.
+
+ SCHILY.acl.access, SCHILY.acl.default
+ Stores the access and default ACLs as textual strings in a format
+ that is an extension of the format specified by POSIX.1e draft
+ 17. In particular, each user or group access specification can
+ include a fourth colon-separated field with the numeric UID or
+ GID. This allows ACLs to be restored on systems that may not
+ have complete user or group information available (such as when
+ NIS/YP or LDAP services are temporarily unavailable).
+
+ SCHILY.devminor, SCHILY.devmajor
+ The full minor and major numbers for device nodes.
+
+ SCHILY.dev, SCHILY.ino, SCHILY.nlinks
+ The device number, inode number, and link count for the entry.
+ In particular, note that a pax interchange format archive using
+ Joerg Schilling's SCHILY.* extensions can store all of the data
+ from struct stat.
+
+ LIBARCHIVE.xattr.namespace.key
+ Libarchive stores POSIX.1e-style extended attributes using keys
+ of this form. The key value is URL-encoded: All non-ASCII char-
+ acters and the two special characters ``='' and ``%'' are encoded
+ as ``%'' followed by two uppercase hexadecimal digits. The value
+ of this key is the extended attribute value encoded in base 64.
+ XXX Detail the base-64 format here XXX
+
+ VENDOR.*
+ XXX document other vendor-specific extensions XXX
+
+ Any values stored in an extended attribute override the corresponding
+ values in the regular tar header. Note that compliant readers should
+ ignore the regular fields when they are overridden. This is important,
+ as existing archivers are known to store non-compliant values in the
+ standard header fields in this situation. There are no limits on length
+ for any of these fields. In particular, numeric fields can be arbitrar-
+ ily large. All text fields are encoded in UTF8. Compliant writers
+ should store only portable 7-bit ASCII characters in the standard ustar
+ header and use extended attributes whenever a text value contains non-
+ ASCII characters.
+
+ In addition to the x entry described above, the pax interchange format
+ also supports a g entry. The g entry is identical in format, but speci-
+ fies attributes that serve as defaults for all subsequent archive
+ entries. The g entry is not widely used.
+
+ Besides the new x and g entries, the pax interchange format has a few
+ other minor variations from the earlier ustar format. The most troubling
+ one is that hardlinks are permitted to have data following them. This
+ allows readers to restore any hardlink to a file without having to rewind
+ the archive to find an earlier entry. However, it creates complications
+ for robust readers, as it is no longer clear whether or not they should
+ ignore the size field for hardlink entries.
+
+ GNU Tar Archives
+ The GNU tar program started with a pre-POSIX format similar to that
+ described earlier and has extended it using several different mechanisms:
+ It added new fields to the empty space in the header (some of which was
+ later used by POSIX for conflicting purposes); it allowed the header to
+ be continued over multiple records; and it defined new entries that mod-
+ ify following entries (similar in principle to the x entry described
+ above, but each GNU special entry is single-purpose, unlike the general-
+ purpose x entry). As a result, GNU tar archives are not POSIX compati-
+ ble, although more lenient POSIX-compliant readers can successfully
+ extract most GNU tar archives.
+
+ struct header_gnu_tar {
+ char name[100];
+ char mode[8];
+ char uid[8];
+ char gid[8];
+ char size[12];
+ char mtime[12];
+ char checksum[8];
+ char typeflag[1];
+ char linkname[100];
+ char magic[6];
+ char version[2];
+ char uname[32];
+ char gname[32];
+ char devmajor[8];
+ char devminor[8];
+ char atime[12];
+ char ctime[12];
+ char offset[12];
+ char longnames[4];
+ char unused[1];
+ struct {
+ char offset[12];
+ char numbytes[12];
+ } sparse[4];
+ char isextended[1];
+ char realsize[12];
+ char pad[17];
+ };
+
+ typeflag
+ GNU tar uses the following special entry types, in addition to
+ those defined by POSIX:
+
+ 7 GNU tar treats type "7" records identically to type "0"
+ records, except on one obscure RTOS where they are used
+ to indicate the pre-allocation of a contiguous file on
+ disk.
+
+ D This indicates a directory entry. Unlike the POSIX-stan-
+ dard "5" typeflag, the header is followed by data records
+ listing the names of files in this directory. Each name
+ is preceded by an ASCII "Y" if the file is stored in this
+ archive or "N" if the file is not stored in this archive.
+ Each name is terminated with a null, and an extra null
+ marks the end of the name list. The purpose of this
+ entry is to support incremental backups; a program
+ restoring from such an archive may wish to delete files
+ on disk that did not exist in the directory when the ar-
+ chive was made.
+
+ Note that the "D" typeflag specifically violates POSIX,
+ which requires that unrecognized typeflags be restored as
+ normal files. In this case, restoring the "D" entry as a
+ file could interfere with subsequent creation of the
+ like-named directory.
+
+ K The data for this entry is a long linkname for the fol-
+ lowing regular entry.
+
+ L The data for this entry is a long pathname for the fol-
+ lowing regular entry.
+
+ M This is a continuation of the last file on the previous
+ volume. GNU multi-volume archives guarantee that each
+ volume begins with a valid entry header. To ensure this,
+ a file may be split, with part stored at the end of one
+ volume, and part stored at the beginning of the next vol-
+ ume. The "M" typeflag indicates that this entry contin-
+ ues an existing file. Such entries can only occur as the
+ first or second entry in an archive (the latter only if
+ the first entry is a volume label). The size field spec-
+ ifies the size of this entry. The offset field at bytes
+ 369-380 specifies the offset where this file fragment
+ begins. The realsize field specifies the total size of
+ the file (which must equal size plus offset). When
+ extracting, GNU tar checks that the header file name is
+ the one it is expecting, that the header offset is in the
+ correct sequence, and that the sum of offset and size is
+ equal to realsize. FreeBSD's version of GNU tar does not
+ handle the corner case of an archive's being continued in
+ the middle of a long name or other extension header.
+
+ N Type "N" records are no longer generated by GNU tar.
+ They contained a list of files to be renamed or symlinked
+ after extraction; this was originally used to support
+ long names. The contents of this record are a text
+ description of the operations to be done, in the form
+ ``Rename %s to %s\n'' or ``Symlink %s to %s\n''; in
+ either case, both filenames are escaped using K&R C syn-
+ tax.
+
+ S This is a ``sparse'' regular file. Sparse files are
+ stored as a series of fragments. The header contains a
+ list of fragment offset/length pairs. If more than four
+ such entries are required, the header is extended as nec-
+ essary with ``extra'' header extensions (an older format
+ that is no longer used), or ``sparse'' extensions.
+
+ V The name field should be interpreted as a tape/volume
+ header name. This entry should generally be ignored on
+ extraction.
+
+ magic The magic field holds the five characters ``ustar'' followed by a
+ space. Note that POSIX ustar archives have a trailing null.
+
+ version
+ The version field holds a space character followed by a null.
+ Note that POSIX ustar archives use two copies of the ASCII digit
+ ``0''.
+
+ atime, ctime
+ The time the file was last accessed and the time of last change
+ of file information, stored in octal as with mtime.
+
+ longnames
+ This field is apparently no longer used.
+
+ Sparse offset / numbytes
+ Each such structure specifies a single fragment of a sparse file.
+ The two fields store values as octal numbers. The fragments are
+ each padded to a multiple of 512 bytes in the archive. On
+ extraction, the list of fragments is collected from the header
+ (including any extension headers), and the data is then read and
+ written to the file at appropriate offsets.
+
+ isextended
+ If this is set to non-zero, the header will be followed by addi-
+ tional ``sparse header'' records. Each such record contains
+ information about as many as 21 additional sparse blocks as shown
+ here:
+
+ struct gnu_sparse_header {
+ struct {
+ char offset[12];
+ char numbytes[12];
+ } sparse[21];
+ char isextended[1];
+ char padding[7];
+ };
+
+ realsize
+ A binary representation of the file's complete size, with a much
+ larger range than the POSIX file size. In particular, with M
+ type files, the current entry is only a portion of the file. In
+ that case, the POSIX size field will indicate the size of this
+ entry; the realsize field will indicate the total size of the
+ file.
+
+ Solaris Tar
+ XXX More Details Needed XXX
+
+ Solaris tar (beginning with SunOS XXX 5.7 ?? XXX) supports an
+ ``extended'' format that is fundamentally similar to pax interchange for-
+ mat, with the following differences:
+ o Extended attributes are stored in an entry whose type is X, not
+ x, as used by pax interchange format. The detailed format of
+ this entry appears to be the same as detailed above for the x
+ entry.
+ o An additional A entry is used to store an ACL for the following
+ regular entry. The body of this entry contains a seven-digit
+ octal number (whose value is 01000000 plus the number of ACL
+ entries) followed by a zero byte, followed by the textual ACL
+ description.
+
+ Other Extensions
+ One common extension, utilized by GNU tar, star, and other newer tar
+ implementations, permits binary numbers in the standard numeric fields.
+ This is flagged by setting the high bit of the first character. This
+ permits 95-bit values for the length and time fields and 63-bit values
+ for the uid, gid, and device numbers. GNU tar supports this extension
+ for the length, mtime, ctime, and atime fields. Joerg Schilling's star
+ program supports this extension for all numeric fields. Note that this
+ extension is largely obsoleted by the extended attribute record provided
+ by the pax interchange format.
+
+ Another early GNU extension allowed base-64 values rather than octal.
+ This extension was short-lived and such archives are almost never seen.
+ However, there is still code in GNU tar to support them; this code is
+ responsible for a very cryptic warning message that is sometimes seen
+ when GNU tar encounters a damaged archive.
+
+SEE ALSO
+ ar(1), pax(1), tar(1)
+
+STANDARDS
+ The tar utility is no longer a part of POSIX or the Single Unix Standard.
+ It last appeared in Version 2 of the Single UNIX Specification
+ (``SUSv2''). It has been supplanted in subsequent standards by pax(1).
+ The ustar format is currently part of the specification for the pax(1)
+ utility. The pax interchange file format is new with IEEE Std
+ 1003.1-2001 (``POSIX.1'').
+
+HISTORY
+ A tar command appeared in Seventh Edition Unix, which was released in
+ January, 1979. It replaced the tp program from Fourth Edition Unix which
+ in turn replaced the tap program from First Edition Unix. John Gilmore's
+ pdtar public-domain implementation (circa 1987) was highly influential
+ and formed the basis of GNU tar. Joerg Shilling's star archiver is
+ another open-source (GPL) archiver (originally developed circa 1985)
+ which features complete support for pax interchange format.
+
+FreeBSD 6.0 May 20, 2004 FreeBSD 6.0
diff --git a/archivers/libarchive/files/libarchive/archive.h.in b/archivers/libarchive/files/libarchive/archive.h.in
index eb374437d13..e21a7105e7c 100644
--- a/archivers/libarchive/files/libarchive/archive.h.in
+++ b/archivers/libarchive/files/libarchive/archive.h.in
@@ -60,40 +60,10 @@ extern "C" {
/*
* Textual name/version of the library, useful for version displays.
*/
-#define ARCHIVE_LIBRARY_VERSION "libarchive @ARCHIVE_VERSION@"
+#define ARCHIVE_LIBRARY_VERSION "libarchive @LIBARCHIVE_VERSION_STRING@"
const char * archive_version(void);
/*
- * Major version number: If ARCHIVE_API_VERSION !=
- * archive_api_version(), then the library you were linked with is
- * using an incompatible API to the one you were compiled with. This
- * is almost certainly a fatal problem.
- */
-#define ARCHIVE_API_VERSION @ARCHIVE_API_MAJOR@
-int archive_api_version(void);
-
-/*
- * Minor version number: ARCHIVE_API_FEATURE is incremented with each
- * significant feature addition, so you can test (at compile or run
- * time) if a particular feature is implemented. It's no big deal if
- * ARCHIVE_API_FEATURE != archive_api_feature(), as long as both are
- * high enough to include the features you're relying on. Specific
- * values of FEATURE are documented here:
- *
- * 1 - Version tests are available.
- * 2 - archive_{read,write}_close available separately from _finish.
- * 3 - open_memory, open_memory2, open_FILE, open_fd available
- * 5 - archive_write_disk interface available
- *
- * Unfortunately, this count resets whenever ARCHIVE_API_VERSION changes,
- * making it awkward to use in practice. For that reason, it is deprecated
- * in favor of the more-accurate version stamp below. It will eventually
- * be removed.
- */
-#define ARCHIVE_API_FEATURE @ARCHIVE_API_MINOR@
-int archive_api_feature(void);
-
-/*
* The "version stamp" is a single integer that makes it easy to check
* the exact version: for version a.b.c, the version stamp is
* printf("%d%03d%03d",a,b,c). For example, version 2.12.108 has
@@ -102,16 +72,34 @@ int archive_api_feature(void);
* This was introduced with libarchive 1.9.0 in the libarchive 1.x family
* and libarchive 2.2.4 in the libarchive 2.x family. The following
* may be useful if you really want to do feature detection for earlier
- * libarchive versions:
+ * libarchive versions (which defined API_VERSION and API_FEATURE):
*
* #ifndef ARCHIVE_VERSION_STAMP
* #define ARCHIVE_VERSION_STAMP \
* (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000)
* #endif
*/
-#define ARCHIVE_VERSION_STAMP @ARCHIVE_VERSION_STAMP@
+#define ARCHIVE_VERSION_STAMP @LIBARCHIVE_VERSION@
int archive_version_stamp(void);
+/*
+ * Major version number: If ARCHIVE_API_VERSION !=
+ * archive_api_version(), then the library you were linked with is
+ * using an incompatible API to the one you were compiled with. This
+ * is almost certainly a fatal problem.
+ * This is deprecated and will be removed; use ARCHIVE_VERSION_STAMP
+ * instead.
+ */
+#define ARCHIVE_API_VERSION (ARCHIVE_VERSION_STAMP / 1000000)
+int archive_api_version(void);
+
+/*
+ * Minor version number. This is deprecated and will be removed.
+ * Use ARCHIVE_VERSION_STAMP to adapt to libarchive API variations.
+ */
+#define ARCHIVE_API_FEATURE ((ARCHIVE_VERSION_STAMP / 1000) % 1000)
+int archive_api_feature(void);
+
#define ARCHIVE_BYTES_PER_RECORD 512
#define ARCHIVE_DEFAULT_BYTES_PER_BLOCK 10240
diff --git a/archivers/libarchive/files/libarchive/archive_entry.h b/archivers/libarchive/files/libarchive/archive_entry.h
index 95fe8c61c75..33c5649a9f1 100644
--- a/archivers/libarchive/files/libarchive/archive_entry.h
+++ b/archivers/libarchive/files/libarchive/archive_entry.h
@@ -62,6 +62,7 @@ struct archive_entry;
#define AE_IFMT 0170000
#define AE_IFREG 0100000
#define AE_IFLNK 0120000
+#define AE_IFSOCK 0140000
#define AE_IFCHR 0020000
#define AE_IFBLK 0060000
#define AE_IFDIR 0040000
@@ -108,6 +109,7 @@ dev_t archive_entry_rdev(struct archive_entry *);
dev_t archive_entry_rdevmajor(struct archive_entry *);
dev_t archive_entry_rdevminor(struct archive_entry *);
int64_t archive_entry_size(struct archive_entry *);
+const char *archive_entry_strmode(struct archive_entry *);
const char *archive_entry_symlink(struct archive_entry *);
const wchar_t *archive_entry_symlink_w(struct archive_entry *);
uid_t archive_entry_uid(struct archive_entry *);
@@ -261,11 +263,6 @@ int archive_entry_acl_count(struct archive_entry *, int want_type);
int __archive_entry_acl_parse_w(struct archive_entry *,
const wchar_t *, int type);
-
-#ifdef __cplusplus
-}
-#endif
-
/*
* extended attributes
*/
@@ -284,5 +281,32 @@ int archive_entry_xattr_reset(struct archive_entry *);
int archive_entry_xattr_next(struct archive_entry *,
const char **name, const void **value, size_t *);
+/*
+ * Utility to detect hardlinks.
+ *
+ * The 'struct archive_hardlink_lookup' is a cache of entry
+ * names and dev/ino numbers. Here's how to use it:
+ * 1. Create a lookup object with archive_hardlink_lookup_new()
+ * 2. Hand each archive_entry to archive_hardlink_lookup().
+ * That function will return NULL (this is not a hardlink to
+ * a previous entry) or the pathname of the first entry
+ * that matched this.
+ * 3. Use archive_hardlink_lookup_free() to release the cache.
+ *
+ * To make things more efficient, be sure that each entry has a valid
+ * nlinks value. The hardlink cache uses this to track when all links
+ * have been found. If the nlinks value is zero, it will keep every
+ * name in the cache indefinitely, which can use a lot of memory.
+ */
+struct archive_entry_linkresolver;
+
+struct archive_entry_linkresolver *archive_entry_linkresolver_new(void);
+void archive_entry_linkresolver_free(struct archive_entry_linkresolver *);
+const char *archive_entry_linkresolve(struct archive_entry_linkresolver *,
+ struct archive_entry *);
+
+#ifdef __cplusplus
+}
+#endif
#endif /* !ARCHIVE_ENTRY_H_INCLUDED */
diff --git a/archivers/libarchive/files/libarchive/archive_entry_link_resolver.c b/archivers/libarchive/files/libarchive/archive_entry_link_resolver.c
new file mode 100644
index 00000000000..0f07e068e07
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_entry_link_resolver.c
@@ -0,0 +1,222 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "archive_platform.h"
+__FBSDID("$FreeBSD$");
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "archive_entry.h"
+
+/* Initial size of link cache. */
+#define links_cache_initial_size 1024
+
+struct archive_entry_linkresolver {
+ char *last_name;
+ unsigned long number_entries;
+ size_t number_buckets;
+ struct links_entry **buckets;
+};
+
+struct links_entry {
+ struct links_entry *next;
+ struct links_entry *previous;
+ int links;
+ dev_t dev;
+ ino_t ino;
+ char *name;
+};
+
+struct archive_entry_linkresolver *
+archive_entry_linkresolver_new(void)
+{
+ struct archive_entry_linkresolver *links_cache;
+ size_t i;
+
+ links_cache = malloc(sizeof(struct archive_entry_linkresolver));
+ if (links_cache == NULL)
+ return (NULL);
+ memset(links_cache, 0, sizeof(struct archive_entry_linkresolver));
+ links_cache->number_buckets = links_cache_initial_size;
+ links_cache->buckets = malloc(links_cache->number_buckets *
+ sizeof(links_cache->buckets[0]));
+ if (links_cache->buckets == NULL) {
+ free(links_cache);
+ return (NULL);
+ }
+ for (i = 0; i < links_cache->number_buckets; i++)
+ links_cache->buckets[i] = NULL;
+ return (links_cache);
+}
+
+void
+archive_entry_linkresolver_free(struct archive_entry_linkresolver *links_cache)
+{
+ size_t i;
+
+ if (links_cache->buckets == NULL)
+ return;
+
+ for (i = 0; i < links_cache->number_buckets; i++) {
+ while (links_cache->buckets[i] != NULL) {
+ struct links_entry *lp = links_cache->buckets[i]->next;
+ if (links_cache->buckets[i]->name != NULL)
+ free(links_cache->buckets[i]->name);
+ free(links_cache->buckets[i]);
+ links_cache->buckets[i] = lp;
+ }
+ }
+ free(links_cache->buckets);
+ links_cache->buckets = NULL;
+}
+
+const char *
+archive_entry_linkresolve(struct archive_entry_linkresolver *links_cache,
+ struct archive_entry *entry)
+{
+ struct links_entry *le, **new_buckets;
+ int hash;
+ size_t i, new_size;
+ dev_t dev;
+ ino_t ino;
+ int nlinks;
+
+
+ /* Free a held name. */
+ free(links_cache->last_name);
+ links_cache->last_name = NULL;
+
+ /* If the links cache overflowed and got flushed, don't bother. */
+ if (links_cache->buckets == NULL)
+ return (NULL);
+
+ dev = archive_entry_dev(entry);
+ ino = archive_entry_ino(entry);
+ nlinks = archive_entry_nlink(entry);
+
+ /* An entry with one link can't be a hard link. */
+ if (nlinks == 1)
+ return (NULL);
+
+ /* If the links cache is getting too full, enlarge the hash table. */
+ if (links_cache->number_entries > links_cache->number_buckets * 2)
+ {
+ /* Try to enlarge the bucket list. */
+ new_size = links_cache->number_buckets * 2;
+ new_buckets = malloc(new_size * sizeof(struct links_entry *));
+
+ if (new_buckets != NULL) {
+ memset(new_buckets, 0,
+ new_size * sizeof(struct links_entry *));
+ for (i = 0; i < links_cache->number_buckets; i++) {
+ while (links_cache->buckets[i] != NULL) {
+ /* Remove entry from old bucket. */
+ le = links_cache->buckets[i];
+ links_cache->buckets[i] = le->next;
+
+ /* Add entry to new bucket. */
+ hash = (le->dev ^ le->ino) % new_size;
+
+ if (new_buckets[hash] != NULL)
+ new_buckets[hash]->previous =
+ le;
+ le->next = new_buckets[hash];
+ le->previous = NULL;
+ new_buckets[hash] = le;
+ }
+ }
+ free(links_cache->buckets);
+ links_cache->buckets = new_buckets;
+ links_cache->number_buckets = new_size;
+ }
+ }
+
+ /* Try to locate this entry in the links cache. */
+ hash = ( dev ^ ino ) % links_cache->number_buckets;
+ for (le = links_cache->buckets[hash]; le != NULL; le = le->next) {
+ if (le->dev == dev && le->ino == ino) {
+ /*
+ * Decrement link count each time and release
+ * the entry if it hits zero. This saves
+ * memory and is necessary for detecting
+ * missed links.
+ */
+ --le->links;
+ if (le->links > 0)
+ return (le->name);
+ /*
+ * When we release the entry, save the name
+ * until the next call.
+ */
+ links_cache->last_name = le->name;
+ /*
+ * Release the entry.
+ */
+ if (le->previous != NULL)
+ le->previous->next = le->next;
+ if (le->next != NULL)
+ le->next->previous = le->previous;
+ if (links_cache->buckets[hash] == le)
+ links_cache->buckets[hash] = le->next;
+ links_cache->number_entries--;
+ free(le);
+ return (links_cache->last_name);
+ }
+ }
+
+ /* Add this entry to the links cache. */
+ le = malloc(sizeof(struct links_entry));
+ if (le == NULL)
+ return (NULL);
+ le->name = strdup(archive_entry_pathname(entry));
+ if (le->name == NULL) {
+ free(le);
+ return (NULL);
+ }
+
+ /* If we could allocate the entry, record it. */
+ if (links_cache->buckets[hash] != NULL)
+ links_cache->buckets[hash]->previous = le;
+ links_cache->number_entries++;
+ le->next = links_cache->buckets[hash];
+ le->previous = NULL;
+ links_cache->buckets[hash] = le;
+ le->dev = dev;
+ le->ino = ino;
+ le->links = nlinks - 1;
+ return (NULL);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_entry_private.h b/archivers/libarchive/files/libarchive/archive_entry_private.h
index 234ba47e844..50ad7b9064b 100644
--- a/archivers/libarchive/files/libarchive/archive_entry_private.h
+++ b/archivers/libarchive/files/libarchive/archive_entry_private.h
@@ -149,6 +149,8 @@ struct archive_entry {
struct ae_xattr *xattr_head;
struct ae_xattr *xattr_p;
+
+ char strmode[11];
};
diff --git a/archivers/libarchive/files/libarchive/archive_entry_strmode.c b/archivers/libarchive/files/libarchive/archive_entry_strmode.c
new file mode 100644
index 00000000000..1a018734bce
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_entry_strmode.c
@@ -0,0 +1,83 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "archive_platform.h"
+__FBSDID("$FreeBSD$");
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "archive_entry.h"
+#include "archive_entry_private.h"
+
+const char *
+archive_entry_strmode(struct archive_entry *entry)
+{
+ static const char *perms = "?rwxrwxrwx ";
+ static const mode_t permbits[] =
+ { 0400, 0200, 0100, 0040, 0020, 0010, 0004, 0002, 0001 };
+ char *bp = entry->strmode;
+ mode_t mode;
+ int i;
+
+ /* Fill in a default string, then selectively override. */
+ strcpy(bp, perms);
+
+ mode = archive_entry_mode(entry);
+ switch (archive_entry_filetype(entry)) {
+ case AE_IFREG: bp[0] = '-'; break;
+ case AE_IFBLK: bp[0] = 'b'; break;
+ case AE_IFCHR: bp[0] = 'c'; break;
+ case AE_IFDIR: bp[0] = 'd'; break;
+ case AE_IFLNK: bp[0] = 'l'; break;
+ case AE_IFSOCK: bp[0] = 's'; break;
+ case AE_IFIFO: bp[0] = 'p'; break;
+ }
+
+ for (i = 0; i < 9; i++)
+ if (!(mode & permbits[i]))
+ bp[i+1] = '-';
+
+ if (mode & S_ISUID) {
+ if (mode & S_IXUSR) bp[3] = 's';
+ else bp[3] = 'S';
+ }
+ if (mode & S_ISGID) {
+ if (mode & S_IXGRP) bp[6] = 's';
+ else bp[6] = 'S';
+ }
+ if (mode & S_ISVTX) {
+ if (mode & S_IXOTH) bp[9] = 't';
+ else bp[9] = 'T';
+ }
+ if (archive_entry_acl_count(entry, ARCHIVE_ENTRY_ACL_TYPE_ACCESS))
+ bp[10] = '+';
+
+ return (bp);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_platform.h b/archivers/libarchive/files/libarchive/archive_platform.h
index 70cc037c3ac..193a52cc674 100644
--- a/archivers/libarchive/files/libarchive/archive_platform.h
+++ b/archivers/libarchive/files/libarchive/archive_platform.h
@@ -57,7 +57,8 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h> /* For __FBSDID */
#else
-#define __FBSDID(a) /* null */
+/* Just leaving this macro replacement empty leads to a dangling semicolon. */
+#define __FBSDID(a) struct _undefined_hack
#endif
/* Try to get standard C99-style integer type definitions. */
diff --git a/archivers/libarchive/files/libarchive/archive_read.3 b/archivers/libarchive/files/libarchive/archive_read.3
index 9e4f878dc10..6daba3f3d11 100644
--- a/archivers/libarchive/files/libarchive/archive_read.3
+++ b/archivers/libarchive/files/libarchive/archive_read.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/lib/libarchive/archive_read.3,v 1.34 2007/05/29 01:00:18 kientzle Exp $
+.\" $FreeBSD: src/lib/libarchive/archive_read.3,v 1.35 2007/09/19 16:37:45 kientzle Exp $
.\"
.Dd August 19, 2006
.Dt archive_read 3
@@ -267,7 +267,7 @@ to create the entry on disk and copy data into it.
The
.Va flags
argument is passed unmodified to
-.Xr archiv_write_disk_set_options 3 .
+.Xr archive_write_disk_set_options 3 .
.It Fn archive_read_extract_set_progress_callback
Sets a pointer to a user-defined callback that can be used
for updating progress displays during extraction.
diff --git a/archivers/libarchive/files/libarchive/archive_read.c b/archivers/libarchive/files/libarchive/archive_read.c
index 54330971200..7803fd2f9fe 100644
--- a/archivers/libarchive/files/libarchive/archive_read.c
+++ b/archivers/libarchive/files/libarchive/archive_read.c
@@ -307,6 +307,18 @@ archive_read_next_header(struct archive *_a, struct archive_entry **entryp)
archive_clear_error(&a->archive);
/*
+ * If no format has yet been chosen, choose one.
+ */
+ if (a->format == NULL) {
+ slot = choose_format(a);
+ if (slot < 0) {
+ a->archive.state = ARCHIVE_STATE_FATAL;
+ return (ARCHIVE_FATAL);
+ }
+ a->format = &(a->formats[slot]);
+ }
+
+ /*
* If client didn't consume entire data, skip any remainder
* (This is especially important for GNU incremental directories.)
*/
@@ -324,12 +336,6 @@ archive_read_next_header(struct archive *_a, struct archive_entry **entryp)
/* Record start-of-header. */
a->header_position = a->archive.file_position;
- slot = choose_format(a);
- if (slot < 0) {
- a->archive.state = ARCHIVE_STATE_FATAL;
- return (ARCHIVE_FATAL);
- }
- a->format = &(a->formats[slot]);
ret = (a->format->read_header)(a, entry);
/*
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_compression_none.c b/archivers/libarchive/files/libarchive/archive_read_support_compression_none.c
index 58a5559167f..1cafd8385a5 100644
--- a/archivers/libarchive/files/libarchive/archive_read_support_compression_none.c
+++ b/archivers/libarchive/files/libarchive/archive_read_support_compression_none.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_compression_none.c,v 1.17 2007/05/29 01:00:19 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_compression_none.c,v 1.18 2007/10/27 22:45:40 kientzle Exp $");
#ifdef HAVE_ERRNO_H
#include <errno.h>
@@ -170,56 +170,45 @@ archive_decompressor_none_read_ahead(struct archive_read *a, const void **buff,
min = state->buffer_size;
/*
- * Try to satisfy the request directly from the client
- * buffer. We can do this if all of the data in the copy
- * buffer was copied from the current client buffer. This
- * also covers the case where the copy buffer is empty and
- * the client buffer has all the data we need.
+ * Keep pulling more data until we can satisfy the request.
*/
- if (state->client_total >= state->client_avail + state->avail
- && state->client_avail + state->avail >= min) {
- state->client_avail += state->avail;
- state->client_next -= state->avail;
- state->avail = 0;
- state->next = state->buffer;
- *buff = state->client_next;
- return (state->client_avail);
- }
+ for (;;) {
- /*
- * If we can't use client buffer, we'll have to use copy buffer.
- */
+ /*
+ * If we can satisfy from the copy buffer, we're done.
+ */
+ if (state->avail >= min) {
+ *buff = state->next;
+ return (state->avail);
+ }
- /* Move data forward in copy buffer if necessary. */
- if (state->next > state->buffer &&
- state->next + min > state->buffer + state->buffer_size) {
- if (state->avail > 0)
- memmove(state->buffer, state->next, state->avail);
- state->next = state->buffer;
- }
+ /*
+ * We can satisfy directly from client buffer if everything
+ * currently in the copy buffer is still in the client buffer.
+ */
+ if (state->client_total >= state->client_avail + state->avail
+ && state->client_avail + state->avail >= min) {
+ /* "Roll back" to client buffer. */
+ state->client_avail += state->avail;
+ state->client_next -= state->avail;
+ /* Copy buffer is now empty. */
+ state->avail = 0;
+ state->next = state->buffer;
+ /* Return data from client buffer. */
+ *buff = state->client_next;
+ return (state->client_avail);
+ }
- /* Collect data in copy buffer to fulfill request. */
- while (state->avail < min) {
- /* Copy data from client buffer to our copy buffer. */
- if (state->client_avail > 0) {
- /* First estimate: copy to fill rest of buffer. */
- size_t tocopy = (state->buffer + state->buffer_size)
- - (state->next + state->avail);
- /* Don't copy more than is available. */
- if (tocopy > state->client_avail)
- tocopy = state->client_avail;
- memcpy(state->next + state->avail, state->client_next,
- tocopy);
- state->client_next += tocopy;
- state->client_avail -= tocopy;
- state->avail += tocopy;
- } else {
- /* There is no more client data: fetch more. */
- /*
- * It seems to me that const void ** and const
- * char ** should be compatible, but they
- * aren't, hence the cast.
- */
+ /* Move data forward in copy buffer if necessary. */
+ if (state->next > state->buffer &&
+ state->next + min > state->buffer + state->buffer_size) {
+ if (state->avail > 0)
+ memmove(state->buffer, state->next, state->avail);
+ state->next = state->buffer;
+ }
+
+ /* If we've used up the client data, get more. */
+ if (state->client_avail <= 0) {
bytes_read = (a->client_reader)(&a->archive,
a->client_data, &state->client_buff);
if (bytes_read < 0) { /* Read error. */
@@ -232,17 +221,33 @@ archive_decompressor_none_read_ahead(struct archive_read *a, const void **buff,
state->client_total = state->client_avail = 0;
state->client_next = state->client_buff = NULL;
state->end_of_file = 1;
- break;
+ /* Return whatever we do have. */
+ *buff = state->next;
+ return (state->avail);
}
a->archive.raw_position += bytes_read;
state->client_total = bytes_read;
state->client_avail = state->client_total;
state->client_next = state->client_buff;
}
+ else
+ {
+ /* We can add client data to copy buffer. */
+ /* First estimate: copy to fill rest of buffer. */
+ size_t tocopy = (state->buffer + state->buffer_size)
+ - (state->next + state->avail);
+ /* Don't copy more than is available. */
+ if (tocopy > state->client_avail)
+ tocopy = state->client_avail;
+ memcpy(state->next + state->avail, state->client_next,
+ tocopy);
+ /* Remove this data from client buffer. */
+ state->client_next += tocopy;
+ state->client_avail -= tocopy;
+ /* add it to copy buffer. */
+ state->avail += tocopy;
+ }
}
-
- *buff = state->next;
- return (state->avail);
}
/*
@@ -334,7 +339,7 @@ archive_decompressor_none_skip(struct archive_read *a, off_t request)
const void* dummy_buffer;
ssize_t bytes_read;
bytes_read = archive_decompressor_none_read_ahead(a,
- &dummy_buffer, request);
+ &dummy_buffer, 1);
if (bytes_read < 0)
return (bytes_read);
if (bytes_read == 0) {
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c b/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c
index 97ed28af1fa..5fad4aea038 100644
--- a/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c
@@ -47,7 +47,6 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_ar.c,v 1.6 20
#include "archive_read_private.h"
struct ar {
- int bid;
off_t entry_bytes_remaining;
off_t entry_offset;
off_t entry_padding;
@@ -103,7 +102,6 @@ archive_read_support_format_ar(struct archive *_a)
return (ARCHIVE_FATAL);
}
memset(ar, 0, sizeof(*ar));
- ar->bid = -1;
ar->strtab = NULL;
r = __archive_read_register_format(a,
@@ -148,9 +146,6 @@ archive_read_format_ar_bid(struct archive_read *a)
ar = (struct ar *)(a->format->data);
- if (ar->bid > 0)
- return (ar->bid);
-
/*
* Verify the 8-byte file signature.
* TODO: Do we need to check more than this?
@@ -159,8 +154,7 @@ archive_read_format_ar_bid(struct archive_read *a)
if (bytes_read < 8)
return (-1);
if (strncmp((const char*)h, "!<arch>\n", 8) == 0) {
- ar->bid = 64;
- return (ar->bid);
+ return (64);
}
return (-1);
}
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_cpio.c b/archivers/libarchive/files/libarchive/archive_read_support_format_cpio.c
index 7a056b9f439..1ede8b622b2 100644
--- a/archivers/libarchive/files/libarchive/archive_read_support_format_cpio.c
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_cpio.c
@@ -118,6 +118,8 @@ static int archive_read_format_cpio_read_data(struct archive_read *,
static int archive_read_format_cpio_read_header(struct archive_read *,
struct archive_entry *);
static int be4(const unsigned char *);
+static int find_odc_header(struct archive_read *);
+static int find_newc_header(struct archive_read *);
static int header_bin_be(struct archive_read *, struct cpio *,
struct archive_entry *, size_t *, size_t *);
static int header_bin_le(struct archive_read *, struct cpio *,
@@ -126,6 +128,8 @@ static int header_newc(struct archive_read *, struct cpio *,
struct archive_entry *, size_t *, size_t *);
static int header_odc(struct archive_read *, struct cpio *,
struct archive_entry *, size_t *, size_t *);
+static int is_octal(const char *, size_t);
+static int is_hex(const char *, size_t);
static int le4(const unsigned char *);
static void record_hardlink(struct cpio *cpio, struct archive_entry *entry);
@@ -161,13 +165,14 @@ archive_read_support_format_cpio(struct archive *_a)
static int
archive_read_format_cpio_bid(struct archive_read *a)
{
- int bid, bytes_read;
+ int bytes_read;
const void *h;
const unsigned char *p;
struct cpio *cpio;
+ int bid;
cpio = (struct cpio *)(a->format->data);
- bid = 0;
+
bytes_read = (a->decompressor->read_ahead)(a, &h, 6);
/* Convert error code into error return. */
if (bytes_read < 0)
@@ -176,6 +181,7 @@ archive_read_format_cpio_bid(struct archive_read *a)
return (-1);
p = (const unsigned char *)h;
+ bid = 0;
if (memcmp(p, "070707", 6) == 0) {
/* ASCII cpio archive (odc, POSIX.1) */
cpio->read_header = header_odc;
@@ -231,7 +237,7 @@ archive_read_format_cpio_read_header(struct archive_read *a,
cpio = (struct cpio *)(a->format->data);
r = (cpio->read_header(a, cpio, entry, &namelength, &name_pad));
- if (r != ARCHIVE_OK)
+ if (r < ARCHIVE_WARN)
return (r);
/* Read name from buffer. */
@@ -266,7 +272,7 @@ archive_read_format_cpio_read_header(struct archive_read *a,
/* Detect and record hardlinks to previously-extracted entries. */
record_hardlink(cpio, entry);
- return (ARCHIVE_OK);
+ return (r);
}
static int
@@ -306,6 +312,82 @@ archive_read_format_cpio_read_data(struct archive_read *a,
}
}
+/*
+ * Skip forward to the next cpio newc header by searching for the
+ * 07070[12] string. This should be generalized and merged with
+ * find_odc_header below.
+ */
+static int
+is_hex(const char *p, size_t len)
+{
+ while (len-- > 0) {
+ if (*p < '0' || (*p > '9' && *p < 'a') || *p > 'f') {
+ return (0);
+ }
+ ++p;
+ }
+ return (1);
+}
+
+static int
+find_newc_header(struct archive_read *a)
+{
+ const void *h;
+ const char *p, *q;
+ size_t skip, bytes, skipped = 0;
+
+ for (;;) {
+ bytes = (a->decompressor->read_ahead)(a, &h, 2048);
+ if (bytes < sizeof(struct cpio_newc_header))
+ return (ARCHIVE_FATAL);
+ p = h;
+ q = p + bytes;
+
+ /* Try the typical case first, then go into the slow search.*/
+ if (memcmp("07070", p, 5) == 0
+ && (p[5] == '1' || p[5] == '2')
+ && is_hex(p, sizeof(struct cpio_newc_header)))
+ return (ARCHIVE_OK);
+
+ /*
+ * Scan ahead until we find something that looks
+ * like an odc header.
+ */
+ while (p + sizeof(struct cpio_newc_header) < q) {
+ switch (p[5]) {
+ case '1':
+ case '2':
+ if (memcmp("07070", p, 5) == 0
+ && is_hex(p, sizeof(struct cpio_newc_header))) {
+ skip = p - (const char *)h;
+ (a->decompressor->consume)(a, skip);
+ skipped += skip;
+ if (skipped > 0) {
+ archive_set_error(&a->archive,
+ 0,
+ "Skipped %d bytes before "
+ "finding valid header",
+ (int)skipped);
+ return (ARCHIVE_WARN);
+ }
+ return (ARCHIVE_OK);
+ }
+ p += 2;
+ break;
+ case '0':
+ p++;
+ break;
+ default:
+ p += 6;
+ break;
+ }
+ }
+ skip = p - (const char *)h;
+ (a->decompressor->consume)(a, skip);
+ skipped += skip;
+ }
+}
+
static int
header_newc(struct archive_read *a, struct cpio *cpio,
struct archive_entry *entry, size_t *namelength, size_t *name_pad)
@@ -313,6 +395,11 @@ header_newc(struct archive_read *a, struct cpio *cpio,
const void *h;
const struct cpio_newc_header *header;
size_t bytes;
+ int r;
+
+ r = find_newc_header(a);
+ if (r < ARCHIVE_WARN)
+ return (r);
/* Read fixed-size portion of header. */
bytes = (a->decompressor->read_ahead)(a, &h, sizeof(struct cpio_newc_header));
@@ -357,7 +444,81 @@ header_newc(struct archive_read *a, struct cpio *cpio,
archive_entry_set_size(entry, cpio->entry_bytes_remaining);
/* Pad file contents to a multiple of 4. */
cpio->entry_padding = 3 & -cpio->entry_bytes_remaining;
- return (ARCHIVE_OK);
+ return (r);
+}
+
+/*
+ * Skip forward to the next cpio odc header by searching for the
+ * 070707 string. This is a hand-optimized search that could
+ * probably be easily generalized to handle all character-based
+ * cpio variants.
+ */
+static int
+is_octal(const char *p, size_t len)
+{
+ while (len-- > 0) {
+ if (*p < '0' || *p > '7')
+ return (0);
+ ++p;
+ }
+ return (1);
+}
+
+static int
+find_odc_header(struct archive_read *a)
+{
+ const void *h;
+ const char *p, *q;
+ size_t skip, bytes, skipped = 0;
+
+ for (;;) {
+ bytes = (a->decompressor->read_ahead)(a, &h, 512);
+ if (bytes < sizeof(struct cpio_odc_header))
+ return (ARCHIVE_FATAL);
+ p = h;
+ q = p + bytes;
+
+ /* Try the typical case first, then go into the slow search.*/
+ if (memcmp("070707", p, 6) == 0
+ && is_octal(p, sizeof(struct cpio_odc_header)))
+ return (ARCHIVE_OK);
+
+ /*
+ * Scan ahead until we find something that looks
+ * like an odc header.
+ */
+ while (p + sizeof(struct cpio_odc_header) < q) {
+ switch (p[5]) {
+ case '7':
+ if (memcmp("070707", p, 6) == 0
+ && is_octal(p, sizeof(struct cpio_odc_header))) {
+ skip = p - (const char *)h;
+ (a->decompressor->consume)(a, skip);
+ skipped += skip;
+ if (skipped > 0) {
+ archive_set_error(&a->archive,
+ 0,
+ "Skipped %d bytes before "
+ "finding valid header",
+ (int)skipped);
+ return (ARCHIVE_WARN);
+ }
+ return (ARCHIVE_OK);
+ }
+ p += 2;
+ break;
+ case '0':
+ p++;
+ break;
+ default:
+ p += 6;
+ break;
+ }
+ }
+ skip = p - (const char *)h;
+ (a->decompressor->consume)(a, skip);
+ skipped += skip;
+ }
}
static int
@@ -365,12 +526,18 @@ header_odc(struct archive_read *a, struct cpio *cpio,
struct archive_entry *entry, size_t *namelength, size_t *name_pad)
{
const void *h;
+ int r;
const struct cpio_odc_header *header;
size_t bytes;
a->archive.archive_format = ARCHIVE_FORMAT_CPIO_POSIX;
a->archive.archive_format_name = "POSIX octet-oriented cpio";
+ /* Find the start of the next header. */
+ r = find_odc_header(a);
+ if (r < ARCHIVE_WARN)
+ return (r);
+
/* Read fixed-size portion of header. */
bytes = (a->decompressor->read_ahead)(a, &h, sizeof(struct cpio_odc_header));
if (bytes < sizeof(struct cpio_odc_header))
@@ -400,7 +567,7 @@ header_odc(struct archive_read *a, struct cpio *cpio,
atol8(header->c_filesize, sizeof(header->c_filesize));
archive_entry_set_size(entry, cpio->entry_bytes_remaining);
cpio->entry_padding = 0;
- return (ARCHIVE_OK);
+ return (r);
}
static int
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c b/archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c
index d77bd871c0e..d2419eac66f 100644
--- a/archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c
@@ -194,7 +194,6 @@ struct file_info {
struct iso9660 {
int magic;
#define ISO9660_MAGIC 0x96609660
- int bid; /* If non-zero, return this as our bid. */
struct archive_string pathname;
char seenRockridge; /* Set true if RR extensions are used. */
unsigned char suspOffset;
@@ -255,7 +254,6 @@ archive_read_support_format_iso9660(struct archive *_a)
}
memset(iso9660, 0, sizeof(*iso9660));
iso9660->magic = ISO9660_MAGIC;
- iso9660->bid = -1; /* We haven't yet bid. */
r = __archive_read_register_format(a,
iso9660,
@@ -280,12 +278,10 @@ archive_read_format_iso9660_bid(struct archive_read *a)
ssize_t bytes_read;
const void *h;
const unsigned char *p;
+ int bid;
iso9660 = (struct iso9660 *)(a->format->data);
- if (iso9660->bid >= 0)
- return (iso9660->bid);
-
/*
* Skip the first 32k (reserved area) and get the first
* 8 sectors of the volume descriptor table. Of course,
@@ -293,7 +289,7 @@ archive_read_format_iso9660_bid(struct archive_read *a)
*/
bytes_read = (a->decompressor->read_ahead)(a, &h, 32768 + 8*2048);
if (bytes_read < 32768 + 8*2048)
- return (iso9660->bid = -1);
+ return (-1);
p = (const unsigned char *)h;
/* Skip the reserved area. */
@@ -302,16 +298,15 @@ archive_read_format_iso9660_bid(struct archive_read *a)
/* Check each volume descriptor to locate the PVD. */
for (; bytes_read > 2048; bytes_read -= 2048, p += 2048) {
- iso9660->bid = isPVD(iso9660, p);
- if (iso9660->bid > 0)
- return (iso9660->bid);
+ bid = isPVD(iso9660, p);
+ if (bid > 0)
+ return (bid);
if (*p == '\177') /* End-of-volume-descriptor marker. */
break;
}
/* We didn't find a valid PVD; return a bid of zero. */
- iso9660->bid = 0;
- return (iso9660->bid);
+ return (0);
}
static int
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c b/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c
index 6b6ca925930..e6ac99f6bfb 100644
--- a/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c
@@ -65,7 +65,6 @@ struct mtree {
char *buff;
off_t offset;
int fd;
- int bid;
int filetype;
int archive_format;
const char *archive_format_name;
@@ -75,8 +74,8 @@ struct mtree {
struct archive_string contents_name;
};
-static int bid(struct archive_read *);
static int cleanup(struct archive_read *);
+static int mtree_bid(struct archive_read *);
static void parse_escapes(char *, struct mtree_entry *);
static int parse_setting(struct archive_read *, struct mtree *,
struct archive_entry *, char *, char *);
@@ -103,11 +102,10 @@ archive_read_support_format_mtree(struct archive *_a)
return (ARCHIVE_FATAL);
}
memset(mtree, 0, sizeof(*mtree));
- mtree->bid = -1;
mtree->fd = -1;
r = __archive_read_register_format(a, mtree,
- bid, read_header, read_data, skip, cleanup);
+ mtree_bid, read_header, read_data, skip, cleanup);
if (r != ARCHIVE_OK)
free(mtree);
@@ -144,17 +142,16 @@ cleanup(struct archive_read *a)
static int
-bid(struct archive_read *a)
+mtree_bid(struct archive_read *a)
{
struct mtree *mtree;
ssize_t bytes_read;
const void *h;
const char *signature = "#mtree";
const char *p;
+ int bid;
mtree = (struct mtree *)(a->format->data);
- if (mtree->bid != -1)
- return (mtree->bid);
/* Now let's look at the actual header and see if it matches. */
bytes_read = (a->decompressor->read_ahead)(a, &h, strlen(signature));
@@ -163,16 +160,16 @@ bid(struct archive_read *a)
return (bytes_read);
p = h;
- mtree->bid = 0;
+ bid = 0;
while (bytes_read > 0 && *signature != '\0') {
if (*p != *signature)
- return (mtree->bid = 0);
- mtree->bid += 8;
+ return (bid = 0);
+ bid += 8;
p++;
signature++;
bytes_read--;
}
- return (mtree->bid);
+ return (bid);
}
/*
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_tar.c b/archivers/libarchive/files/libarchive/archive_read_support_format_tar.c
index 5e7748eb1b4..6d6ee309571 100644
--- a/archivers/libarchive/files/libarchive/archive_read_support_format_tar.c
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_tar.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_tar.c,v 1.61 2007/08/18 21:53:25 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_tar.c,v 1.62 2007/10/24 04:01:31 kientzle Exp $");
#ifdef HAVE_ERRNO_H
#include <errno.h>
@@ -128,8 +128,8 @@ struct archive_entry_header_gnutar {
char isextended[1];
char realsize[12];
/*
- * GNU doesn't use POSIX 'prefix' field; they use the 'L' (longname)
- * entry instead.
+ * Old GNU format doesn't use POSIX 'prefix' field; they use
+ * the 'L' (longname) entry instead.
*/
};
@@ -318,23 +318,8 @@ archive_read_format_tar_bid(struct archive_read *a)
bytes_read = 0; /* Empty file. */
if (bytes_read < 0)
return (ARCHIVE_FATAL);
- if (bytes_read == 0 && bid > 0) {
- /* An archive without a proper end-of-archive marker. */
- /* Hold our nose and bid 1 anyway. */
- return (1);
- }
- if (bytes_read < 512) {
- /* If it's a new archive, then just return a zero bid. */
- if (bid == 0)
- return (0);
- /*
- * If we already know this is a tar archive,
- * then we have a problem.
- */
- archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
- "Truncated tar archive");
- return (ARCHIVE_FATAL);
- }
+ if (bytes_read < 512)
+ return (0);
/* If it's an end-of-archive mark, we can handle it. */
if ((*(const char *)h) == 0 && archive_block_is_null((const unsigned char *)h)) {
@@ -440,6 +425,7 @@ archive_read_format_tar_read_header(struct archive_read *a,
free(sp);
}
tar->sparse_last = NULL;
+ tar->realsize = -1; /* Mark this as "unset" */
r = tar_read_header(a, tar, entry);
@@ -450,8 +436,6 @@ archive_read_format_tar_read_header(struct archive_read *a,
if (tar->sparse_list == NULL)
gnu_add_sparse_entry(tar, 0, tar->entry_bytes_remaining);
- tar->realsize = archive_entry_size(entry);
-
if (r == ARCHIVE_OK) {
/*
* "Regular" entry with trailing '/' is really
@@ -579,16 +563,24 @@ tar_read_header(struct archive_read *a, struct tar *tar,
/* Read 512-byte header record */
bytes = (a->decompressor->read_ahead)(a, &h, 512);
- if (bytes < 512) {
+ if (bytes < 0)
+ return (bytes);
+ if (bytes == 0) {
/*
- * If we're here, it's becase the _bid function accepted
- * this file. So just call a short read end-of-archive
- * and be done with it.
+ * An archive that just ends without a proper
+ * end-of-archive marker. Yes, there are tar programs
+ * that do this; hold our nose and accept it.
*/
return (ARCHIVE_EOF);
}
+ if (bytes < 512) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Truncated tar archive");
+ return (ARCHIVE_FATAL);
+ }
(a->decompressor->consume)(a, 512);
+
/* Check for end-of-archive mark. */
if (((*(const char *)h)==0) && archive_block_is_null((const unsigned char *)h)) {
/* Try to consume a second all-null record, as well. */
@@ -934,6 +926,7 @@ header_common(struct archive_read *a, struct tar *tar,
archive_entry_set_uid(entry, tar_atol(header->uid, sizeof(header->uid)));
archive_entry_set_gid(entry, tar_atol(header->gid, sizeof(header->gid)));
tar->entry_bytes_remaining = tar_atol(header->size, sizeof(header->size));
+ tar->realsize = tar->entry_bytes_remaining;
archive_entry_set_size(entry, tar->entry_bytes_remaining);
archive_entry_set_mtime(entry, tar_atol(header->mtime, sizeof(header->mtime)), 0);
@@ -1365,9 +1358,10 @@ pax_attribute(struct tar *tar, struct archive_entry *entry,
tar->sparse_numbytes = -1;
}
}
- if (wcscmp(key, L"GNU.sparse.size") == 0)
- archive_entry_set_size(entry,
- tar_atol10(value, wcslen(value)));
+ if (wcscmp(key, L"GNU.sparse.size") == 0) {
+ tar->realsize = tar_atol10(value, wcslen(value));
+ archive_entry_set_size(entry, tar->realsize);
+ }
/* GNU "0.1" sparse pax format. */
if (wcscmp(key, L"GNU.sparse.map") == 0) {
@@ -1388,9 +1382,10 @@ pax_attribute(struct tar *tar, struct archive_entry *entry,
}
if (wcscmp(key, L"GNU.sparse.name") == 0)
archive_entry_copy_pathname_w(entry, value);
- if (wcscmp(key, L"GNU.sparse.realsize") == 0)
- archive_entry_set_size(entry,
- tar_atol10(value, wcslen(value)));
+ if (wcscmp(key, L"GNU.sparse.realsize") == 0) {
+ tar->realsize = tar_atol10(value, wcslen(value));
+ archive_entry_set_size(entry, tar->realsize);
+ }
break;
case 'L':
/* Our extensions */
@@ -1422,6 +1417,10 @@ pax_attribute(struct tar *tar, struct archive_entry *entry,
archive_entry_set_ino(entry, tar_atol10(value, wcslen(value)));
else if (wcscmp(key, L"SCHILY.nlink")==0)
archive_entry_set_nlink(entry, tar_atol10(value, wcslen(value)));
+ else if (wcscmp(key, L"SCHILY.realsize")==0) {
+ tar->realsize = tar_atol10(value, wcslen(value));
+ archive_entry_set_size(entry, tar->realsize);
+ }
break;
case 'a':
if (wcscmp(key, L"atime")==0) {
@@ -1471,11 +1470,24 @@ pax_attribute(struct tar *tar, struct archive_entry *entry,
/* POSIX has reserved 'security.*' */
/* Someday: if (wcscmp(key, L"security.acl")==0) { ... } */
if (wcscmp(key, L"size")==0) {
- tar->entry_bytes_remaining = tar_atol10(value, wcslen(value));
- archive_entry_set_size(entry, tar->entry_bytes_remaining);
+ /* "size" is the size of the data in the entry. */
+ tar->entry_bytes_remaining
+ = tar_atol10(value, wcslen(value));
+ /*
+ * But, "size" is not necessarily the size of
+ * the file on disk; if this is a sparse file,
+ * the disk size may have already been set from
+ * GNU.sparse.realsize or GNU.sparse.size or
+ * an old GNU header field or SCHILY.realsize
+ * or ....
+ */
+ if (tar->realsize < 0) {
+ archive_entry_set_size(entry,
+ tar->entry_bytes_remaining);
+ tar->realsize
+ = tar->entry_bytes_remaining;
+ }
}
- tar->entry_bytes_remaining = 0;
-
break;
case 'u':
if (wcscmp(key, L"uid")==0)
@@ -1594,8 +1606,9 @@ header_gnutar(struct archive_read *a, struct tar *tar,
archive_entry_set_ctime(entry,
tar_atol(header->ctime, sizeof(header->ctime)), 0);
if (header->realsize[0] != 0) {
- archive_entry_set_size(entry,
- tar_atol(header->realsize, sizeof(header->realsize)));
+ tar->realsize
+ = tar_atol(header->realsize, sizeof(header->realsize));
+ archive_entry_set_size(entry, tar->realsize);
}
if (header->sparse[0].offset[0] != 0) {
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_zip.c b/archivers/libarchive/files/libarchive/archive_read_support_format_zip.c
index 0d8df370e35..f5d97adb064 100644
--- a/archivers/libarchive/files/libarchive/archive_read_support_format_zip.c
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_zip.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_zip.c,v 1.14 2007/07/15 19:13:59 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_zip.c,v 1.15 2007/10/12 04:08:28 kientzle Exp $");
#ifdef HAVE_ERRNO_H
#include <errno.h>
@@ -179,18 +179,19 @@ archive_read_format_zip_bid(struct archive_read *a)
return (-1);
p = (const char *)h;
+ /*
+ * Bid of 30 here is: 16 bits for "PK",
+ * next 16-bit field has four options (-2 bits).
+ * 16 + 16-2 = 30.
+ */
if (p[0] == 'P' && p[1] == 'K') {
- bid += 16;
- if (p[2] == '\001' && p[3] == '\002')
- bid += 16;
- else if (p[2] == '\003' && p[3] == '\004')
- bid += 16;
- else if (p[2] == '\005' && p[3] == '\006')
- bid += 16;
- else if (p[2] == '\007' && p[3] == '\010')
- bid += 16;
+ if ((p[2] == '\001' && p[3] == '\002')
+ || (p[2] == '\003' && p[3] == '\004')
+ || (p[2] == '\005' && p[3] == '\006')
+ || (p[2] == '\007' && p[3] == '\010'))
+ return (30);
}
- return (bid);
+ return (0);
}
static int
@@ -335,6 +336,10 @@ zip_read_file_header(struct archive_read *a, struct archive_entry *entry,
zip->entry_bytes_remaining = zip->compressed_size;
zip->entry_offset = 0;
+ /* If there's no body, force read_data() to return EOF immediately. */
+ if (zip->entry_bytes_remaining < 1)
+ zip->end_of_entry = 1;
+
/* Set up a more descriptive format name. */
sprintf(zip->format_name, "ZIP %d.%d (%s)",
zip->version / 10, zip->version % 10,
@@ -422,6 +427,9 @@ archive_read_format_zip_read_data(struct archive_read *a,
/* End-of-entry cleanup done. */
zip->end_of_entry_cleanup = 1;
}
+ *offset = zip->entry_uncompressed_bytes_read;
+ *size = 0;
+ *buff = NULL;
return (ARCHIVE_EOF);
}
diff --git a/archivers/libarchive/files/libarchive/archive_util.c b/archivers/libarchive/files/libarchive/archive_util.c
index d73366357d0..2bc2844abcb 100644
--- a/archivers/libarchive/files/libarchive/archive_util.c
+++ b/archivers/libarchive/files/libarchive/archive_util.c
@@ -60,7 +60,7 @@ archive_version_stamp(void)
const char *
archive_version(void)
{
- return (PACKAGE_NAME " " PACKAGE_VERSION);
+ return (ARCHIVE_LIBRARY_VERSION);
}
int
diff --git a/archivers/libarchive/files/libarchive/archive_write_disk.c b/archivers/libarchive/files/libarchive/archive_write_disk.c
index e3b3a328cc6..ec220869074 100644
--- a/archivers/libarchive/files/libarchive/archive_write_disk.c
+++ b/archivers/libarchive/files/libarchive/archive_write_disk.c
@@ -25,7 +25,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.14 2007/08/12 17:35:05 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.17 2007/09/21 04:52:42 kientzle Exp $");
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -421,6 +421,12 @@ _archive_write_header(struct archive *_a, struct archive_entry *entry)
/* We've created the object and are ready to pour data into it. */
if (ret == ARCHIVE_OK)
a->archive.state = ARCHIVE_STATE_DATA;
+ /*
+ * If it's not open, tell our client not to try writing.
+ * In particular, dirs, links, etc, don't get written to.
+ */
+ if (a->fd < 0)
+ archive_entry_set_size(entry, 0);
done:
/* Restore the user's umask before returning. */
umask(a->user_umask);
@@ -448,8 +454,10 @@ _archive_write_data_block(struct archive *_a,
__archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
ARCHIVE_STATE_DATA, "archive_write_disk_block");
- if (a->fd < 0)
- return (ARCHIVE_OK);
+ if (a->fd < 0) {
+ archive_set_error(&a->archive, 0, "File not open");
+ return (ARCHIVE_WARN);
+ }
archive_clear_error(&a->archive);
/* Seek if necessary to the specified offset. */
@@ -478,12 +486,17 @@ static ssize_t
_archive_write_data(struct archive *_a, const void *buff, size_t size)
{
struct archive_write_disk *a = (struct archive_write_disk *)_a;
+ int r;
+
__archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
ARCHIVE_STATE_DATA, "archive_write_data");
if (a->fd < 0)
return (ARCHIVE_OK);
- return (_archive_write_data_block(_a, buff, size, a->offset));
+ r = _archive_write_data_block(_a, buff, size, a->offset);
+ if (r < ARCHIVE_OK)
+ return (r);
+ return (size);
}
static int
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_compression_none.c b/archivers/libarchive/files/libarchive/archive_write_set_compression_none.c
index 0ad962a5007..bb8555ef4eb 100644
--- a/archivers/libarchive/files/libarchive/archive_write_set_compression_none.c
+++ b/archivers/libarchive/files/libarchive/archive_write_set_compression_none.c
@@ -151,11 +151,18 @@ archive_compressor_none_write(struct archive_write *a, const void *vbuff,
return (ARCHIVE_OK);
}
- while ((remaining > 0) || (state->avail == 0)) {
- /*
- * If we have a full output block, write it and reset the
- * output buffer.
- */
+ /* If the copy buffer isn't empty, try to fill it. */
+ if (state->avail < state->buffer_size) {
+ /* If buffer is not empty... */
+ /* ... copy data into buffer ... */
+ to_copy = (remaining > state->avail) ?
+ state->avail : remaining;
+ memcpy(state->next, buff, to_copy);
+ state->next += to_copy;
+ state->avail -= to_copy;
+ buff += to_copy;
+ remaining -= to_copy;
+ /* ... if it's full, write it out. */
if (state->avail == 0) {
bytes_written = (a->client_writer)(&a->archive,
a->client_data, state->buffer, state->buffer_size);
@@ -166,16 +173,26 @@ archive_compressor_none_write(struct archive_write *a, const void *vbuff,
state->next = state->buffer;
state->avail = state->buffer_size;
}
+ }
- /* Now we have space in the buffer; copy new data into it. */
- to_copy = (remaining > state->avail) ?
- state->avail : remaining;
- memcpy(state->next, buff, to_copy);
- state->next += to_copy;
- state->avail -= to_copy;
- buff += to_copy;
- remaining -= to_copy;
+ while (remaining > state->buffer_size) {
+ /* Write out full blocks directly to client. */
+ bytes_written = (a->client_writer)(&a->archive,
+ a->client_data, buff, state->buffer_size);
+ if (bytes_written <= 0)
+ return (ARCHIVE_FATAL);
+ a->archive.raw_position += bytes_written;
+ buff += bytes_written;
+ remaining -= bytes_written;
}
+
+ if (remaining > 0) {
+ /* Copy last bit into copy buffer. */
+ memcpy(state->next, buff, remaining);
+ state->next += remaining;
+ state->avail -= remaining;
+ }
+
a->archive.file_position += length;
return (ARCHIVE_OK);
}
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format_cpio.c b/archivers/libarchive/files/libarchive/archive_write_set_format_cpio.c
index 6459477e420..c8a6a7ac5ec 100644
--- a/archivers/libarchive/files/libarchive/archive_write_set_format_cpio.c
+++ b/archivers/libarchive/files/libarchive/archive_write_set_format_cpio.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_cpio.c,v 1.11 2007/05/29 01:00:19 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_cpio.c,v 1.12 2007/10/12 04:11:31 kientzle Exp $");
#ifdef HAVE_ERRNO_H
#include <errno.h>
@@ -142,12 +142,17 @@ archive_write_cpio_header(struct archive_write *a, struct archive_entry *entry)
format_octal(archive_entry_mtime(entry), &h.c_mtime, sizeof(h.c_mtime));
format_octal(pathlength, &h.c_namesize, sizeof(h.c_namesize));
+ /* Non-regular files don't store bodies. */
+ if (archive_entry_filetype(entry) != AE_IFREG)
+ archive_entry_set_size(entry, 0);
+
/* Symlinks get the link written as the body of the entry. */
p = archive_entry_symlink(entry);
if (p != NULL && *p != '\0')
format_octal(strlen(p), &h.c_filesize, sizeof(h.c_filesize));
else
- format_octal(archive_entry_size(entry), &h.c_filesize, sizeof(h.c_filesize));
+ format_octal(archive_entry_size(entry),
+ &h.c_filesize, sizeof(h.c_filesize));
ret = (a->compressor.write)(a, &h, sizeof(h));
if (ret != ARCHIVE_OK)
@@ -223,6 +228,7 @@ archive_write_cpio_finish(struct archive_write *a)
cpio = (struct cpio *)a->format_data;
trailer = archive_entry_new();
+ /* nlink = 1 here for GNU cpio compat. */
archive_entry_set_nlink(trailer, 1);
archive_entry_set_pathname(trailer, "TRAILER!!!");
er = archive_write_cpio_header(a, trailer);
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format_cpio_newc.c b/archivers/libarchive/files/libarchive/archive_write_set_format_cpio_newc.c
index ab48d380043..e50544b45f3 100644
--- a/archivers/libarchive/files/libarchive/archive_write_set_format_cpio_newc.c
+++ b/archivers/libarchive/files/libarchive/archive_write_set_format_cpio_newc.c
@@ -25,7 +25,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_cpio_newc.c,v 1.1 2007/06/22 05:47:00 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_cpio_newc.c,v 1.2 2007/10/12 04:11:31 kientzle Exp $");
#ifdef HAVE_ERRNO_H
#include <errno.h>
@@ -148,12 +148,17 @@ archive_write_newc_header(struct archive_write *a, struct archive_entry *entry)
format_hex(pathlength, &h.c_namesize, sizeof(h.c_namesize));
format_hex(0, &h.c_checksum, sizeof(h.c_checksum));
+ /* Non-regular files don't store bodies. */
+ if (archive_entry_filetype(entry) != AE_IFREG)
+ archive_entry_set_size(entry, 0);
+
/* Symlinks get the link written as the body of the entry. */
p = archive_entry_symlink(entry);
if (p != NULL && *p != '\0')
format_hex(strlen(p), &h.c_filesize, sizeof(h.c_filesize));
else
- format_hex(archive_entry_size(entry), &h.c_filesize, sizeof(h.c_filesize));
+ format_hex(archive_entry_size(entry),
+ &h.c_filesize, sizeof(h.c_filesize));
ret = (a->compressor.write)(a, &h, sizeof(h));
if (ret != ARCHIVE_OK)
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c b/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c
index 471feb8307e..cedbfd75c96 100644
--- a/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c
+++ b/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c
@@ -418,12 +418,15 @@ archive_write_pax_header(struct archive_write *a,
p = archive_entry_pathname(entry_original);
if (p[strlen(p) - 1] != '/') {
t = (char *)malloc(strlen(p) + 2);
- if (t != NULL) {
- strcpy(t, p);
- strcat(t, "/");
- archive_entry_copy_pathname(entry_original, t);
- free(t);
+ if (t == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate pax data");
+ return(ARCHIVE_FATAL);
}
+ strcpy(t, p);
+ strcat(t, "/");
+ archive_entry_copy_pathname(entry_original, t);
+ free(t);
}
break;
default:
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c b/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c
index 61c90d50415..287afe0657c 100644
--- a/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c
+++ b/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c
@@ -216,12 +216,15 @@ archive_write_ustar_header(struct archive_write *a, struct archive_entry *entry)
p = archive_entry_pathname(entry);
if (p[strlen(p) - 1] != '/') {
t = (char *)malloc(strlen(p) + 2);
- if (t != NULL) {
- strcpy(t, p);
- strcat(t, "/");
- archive_entry_copy_pathname(entry, t);
- free(t);
+ if (t == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate ustar data");
+ return(ARCHIVE_FATAL);
}
+ strcpy(t, p);
+ strcat(t, "/");
+ archive_entry_copy_pathname(entry, t);
+ free(t);
}
}
diff --git a/archivers/libarchive/files/libarchive/config_windows.h b/archivers/libarchive/files/libarchive/config_windows.h
index 074bb3bdf85..fa55c8e306d 100644
--- a/archivers/libarchive/files/libarchive/config_windows.h
+++ b/archivers/libarchive/files/libarchive/config_windows.h
@@ -159,9 +159,6 @@ typedef _int64 intmax_t;
#define mkdir _mkdir
#define close _close
-#define PACKAGE_NAME "libarchive"
-#define PACKAGE_VERSION "2.0experimental"
-
/* TODO: Fix the code, don't suppress the warnings. */
#pragma warning(disable:4996)
#pragma warning(disable:4244)
diff --git a/archivers/libarchive/files/libarchive/cpio.5 b/archivers/libarchive/files/libarchive/cpio.5
new file mode 100644
index 00000000000..2f298332d18
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/cpio.5
@@ -0,0 +1,325 @@
+.\" Copyright (c) 2007 Tim Kientzle
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 5, 2007
+.Dt CPIO 5
+.Os
+.Sh NAME
+.Nm cpio
+.Nd format of cpio archive files
+.Sh DESCRIPTION
+The
+.Nm
+archive format collects any number of files, directories, and other
+file system objects (symbolic links, device nodes, etc.) into a single
+stream of bytes.
+.Ss General Format
+Each file system object in a
+.Nm
+archive comprises a header record with basic numeric metadata
+followed by the full pathname of the entry and the file data.
+The header record stores a series of integer values that generally
+follow the fields in
+.Va struct stat .
+(See
+.Xr stat 2
+for details.)
+The variants differ primarily in how they store those integers
+(binary, octal, or hexadecimal).
+The header is followed by the pathname of the
+entry (the length of the pathname is stored in the header)
+and any file data.
+The end of the archive is indicated by a special record with
+the pathname
+.Dq TRAILER!!! .
+.Ss PWB format
+XXX Any documentation of the original PWB/UNIX 1.0 format? XXX
+.Ss Old Binary Format
+The old binary
+.Nm
+format stores numbers as 2-byte and 4-byte binary values.
+Each entry begins with a header in the following format:
+.Bd -literal -offset indent
+struct header_old_cpio {
+ unsigned short c_magic;
+ unsigned short c_dev;
+ unsigned short c_ino;
+ unsigned short c_mode;
+ unsigned short c_uid;
+ unsigned short c_gid;
+ unsigned short c_nlink;
+ unsigned short c_rdev;
+ unsigned short c_mtime[2];
+ unsigned short c_namesize;
+ unsigned short c_filesize[2];
+};
+.Ed
+.Pp
+The
+.Va unsigned short
+fields here are 16-bit integer values; the
+.Va unsigned int
+fields are 32-bit integer values.
+The fields are as follows
+.Bl -tag -width indent
+.It Va magic
+The integer value octal 070707.
+This value can be used to determine whether this archive is
+written with little-endian or big-endian integers.
+.It Va dev , Va ino
+The device and inode numbers from the disk.
+These are used by programs that read
+.Nm
+archives to determine when two entries refer to the same file.
+Programs that synthesize
+.Nm
+archives should be careful to set these to distinct values for each entry.
+.It Va mode
+The mode specifies both the regular permissions and the file type.
+It consists of several bit fields as follows:
+.Bl -tag -width "MMMMMMM" -compact
+.It 0170000
+This masks the file type bits.
+.It 0140000
+File type value for sockets.
+.It 0120000
+File type value for symbolic links.
+For symbolic links, the link body is stored as file data.
+.It 0100000
+File type value for regular files.
+.It 0060000
+File type value for block special devices.
+.It 0040000
+File type value for directories.
+.It 0020000
+File type value for character special devices.
+.It 0010000
+File type value for named pipes or FIFOs.
+.It 0004000
+SUID bit.
+.It 0002000
+SGID bit.
+.It 0001000
+Sticky bit.
+On some systems, this modifies the behavior of executables and/or directories.
+.It 0000777
+The lower 9 bits specify read/write/execute permissions
+for world, group, and user following standard POSIX conventions.
+.El
+.It Va uid , Va gid
+The numeric user id and group id of the owner.
+.It Va nlink
+The number of links to this file.
+Directories always have a value of at least two here.
+Note that hardlinked files include file data with every copy in the archive.
+.It Va rdev
+For block special and character special entries,
+this field contains the associated device number.
+For all other entry types, it should be set to zero by writers
+and ignored by readers.
+.It Va mtime
+Modification time of the file, indicated as the number
+of seconds since the start of the epoch,
+00:00:00 UTC January 1, 1970.
+The four-byte integer is stored with the most-significant 16 bits first
+followed by the least-significant 16 bits.
+Each of the two 16 bit values are stored in machine-native byte order.
+.It Va namesize
+The number of bytes in the pathname that follows the header.
+This count includes the trailing NULL byte.
+.It Va filesize
+The size of the file.
+Note that this archive format is limited to
+four gigabyte file sizes.
+See
+.Va mtime
+above for a description of the storage of four-byte integers.
+.El
+.Pp
+The pathname immediately follows the fixed header.
+If the
+.Cm namesize
+is odd, an additional NULL byte is added after the pathname.
+The file data is then appended, padded with NULL
+bytes to an even length.
+.Pp
+Hardlinked files are not given special treatment;
+the full file contents are included with each copy of the
+file.
+.Ss Portable ASCII Format
+.St -susv2
+standardized an ASCII variant that is portable across all
+platforms.
+It is commonly known as the
+.Dq old character
+format or as the
+.Dq odc
+format.
+It stores the same numeric fields as the old binary format, but
+represents them as 6-character or 11-character octal values.
+.Bd -literal -offset indent
+struct cpio_odc_header {
+ char c_magic[6];
+ char c_dev[6];
+ char c_ino[6];
+ char c_mode[6];
+ char c_uid[6];
+ char c_gid[6];
+ char c_nlink[6];
+ char c_rdev[6];
+ char c_mtime[11];
+ char c_namesize[6];
+ char c_filesize[11];
+};
+.Ed
+.Pp
+The fields are identical to those in the old binary format.
+The name and file body follow the fixed header.
+Unlike the old binary format, there is no additional padding
+after the pathname or file contents.
+If the files being archived are themselves entirely ASCII, then
+the resulting archive will be entirely ASCII, except for the
+NULL byte that terminates the name field.
+.Ss New ASCII Format
+The "new" ASCII format uses 8-byte hexadecimal fields for
+all numbers and separates device numbers into separate fields
+for major and minor numbers.
+.Bd -literal -offset indent
+struct cpio_newc_header {
+ char c_magic[6];
+ char c_ino[8];
+ char c_mode[8];
+ char c_uid[8];
+ char c_gid[8];
+ char c_nlink[8];
+ char c_mtime[8];
+ char c_filesize[8];
+ char c_devmajor[8];
+ char c_devminor[8];
+ char c_rdevmajor[8];
+ char c_rdevminor[8];
+ char c_namesize[8];
+ char c_check[8];
+};
+.Ed
+.Pp
+Except as specified below, the fields here match those specified
+for the old binary format above.
+.Bl -tag -width indent
+.It Va magic
+The string
+.Dq 070701 .
+.It Va check
+This field is always set to zero by writers and ignored by readers.
+See the next section for more details.
+.El
+.Pp
+The pathname is followed by NULL bytes so that the total size
+of the fixed header plus pathname is a multiple of four.
+Likewise, the file data is padded to a multiple of four bytes.
+Note that this format supports only 4 gigabyte files (unlike the
+older ASCII format, which supports 8 gigabyte files).
+.Pp
+In this format, hardlinked files are handled by setting the
+filesize to zero for each entry except the last one that
+appears in the archive.
+.Ss New CRC Format
+The CRC format is identical to the new ASCII format described
+in the previous section except that the magic field is set
+to
+.Dq 070702
+and the
+.Va check
+field is set to the sum of all bytes in the file data.
+This sum is computed treating all bytes as unsigned values
+and using unsigned arithmetic.
+Only the least-significant 32 bits of the sum are stored.
+.Ss HP variants
+The
+.Nm cpio
+implementation distributed with HPUX used XXXX but stored
+device numbers differently XXX.
+.Ss Other Extensions and Variants
+Sun Solaris uses additional file types to store extended file
+data, including ACLs and extended attributes, as special
+entries in cpio archives.
+.Pp
+XXX Others? XXX
+.Sh BUGS
+The
+.Dq CRC
+format is mis-named, as it uses a simple checksum and
+not a cyclic redundancy check.
+.Pp
+The old binary format is limited to 16 bits for user id,
+group id, device, and inode numbers.
+It is limited to 4 gigabyte file sizes.
+.Pp
+The old ASCII format is limited to 18 bits for
+the user id, group id, device, and inode numbers.
+It is limited to 8 gigabyte file sizes.
+.Pp
+The new ASCII format is limited to 4 gigabyte file sizes.
+.Pp
+None of the cpio formats store user or group names,
+which are essential when moving files between systems with
+dissimilar user or group numbering.
+.Pp
+Especially when writing older cpio variants, it may be necessary
+to map actual device/inode values to synthesized values that
+fit the available fields.
+With very large filesystems, this may be necessary even for
+the newer formats.
+.Sh SEE ALSO
+.Xr cpio 1 ,
+.Xr tar 5
+.Sh STANDARDS
+The
+.Nm cpio
+utility is no longer a part of POSIX or the Single Unix Standard.
+It last appeared in
+.St -susv2 .
+It has been supplanted in subsequent standards by
+.Xr pax 1 .
+The portable ASCII format is currently part of the specification for the
+.Xr pax 1
+utility.
+.Sh HISTORY
+The original cpio utility was written by Dick Haight
+while working in AT&T's Unix Support Group.
+It appeared in 1977 as part of PWB/UNIX 1.0, the
+.Dq Programmer's Work Bench
+derived from
+.At v6
+that was used internally at AT&T.
+Both the old binary and old character formats were in use
+by 1980, according to the System III source released
+by SCO under their
+.Dq Ancient Unix
+license.
+The character format was adopted as part of
+.St -p1003.1-88 .
+XXX when did "newc" appear? Who invented it? When did HP come out with their variant? When did Sun introduce ACLs and extended attributes? XXX \ No newline at end of file
diff --git a/archivers/libarchive/files/libarchive/libarchive-formats.5 b/archivers/libarchive/files/libarchive/libarchive-formats.5
index cd34622b2c5..0606a5ba1d0 100644
--- a/archivers/libarchive/files/libarchive/libarchive-formats.5
+++ b/archivers/libarchive/files/libarchive/libarchive-formats.5
@@ -74,6 +74,8 @@ It currently supports the most popular GNU extensions, including
modern long filename and linkname support, as well as atime and ctime data.
The libarchive library does not support multi-volume
archives, nor the old GNU long filename format.
+It can read GNU sparse file entries, including the new POSIX-based
+formats, but cannot write GNU sparse file entries.
.It Cm pax
The
.Xr libarchive 3
@@ -93,7 +95,7 @@ defined by Joerg Schilling's
.Dq star
archiver.
The libarchive library can read most of the SCHILY keys.
-It ignores any keywords that it does not understand.
+It silently ignores any keywords that it does not understand.
.It Cm restricted pax
The libarchive library can also write pax archives in which it
attempts to suppress the extended attributes entry whenever
@@ -139,19 +141,18 @@ In particular, it supports base-256 values in certain numeric fields.
This essentially removes the limitations on file size, modification time,
and device numbers.
.Pp
-The first tar program appeared in Sixth Edition Unix (circa 1976).
-This makes the tar format one of the oldest and most widely-supported
-archive formats.
+The first tar program appeared in Seventh Edition Unix in 1979.
The first official standard for the tar file format was the
.Dq ustar
(Unix Standard Tar) format defined by POSIX in 1988.
POSIX.1-2001 extended the ustar format to create the
.Dq pax interchange
format.
-There have also been many custom variations.
.Ss Cpio Formats
The libarchive library can read a number of common cpio variants and can write
.Dq odc
+and
+.Dq newc
format archives.
A cpio archive stores each entry as a fixed-size header followed
by a variable-length filename and variable-length data.
@@ -184,15 +185,26 @@ The SVR4 format can optionally include a CRC of the file
contents, although libarchive does not currently verify this CRC.
.El
.Pp
-Cpio is an old format that was widely used because of its simplicity
-and its support for very long filenames.
-Unfortunately, it has many limitations that make it unsuitable
+Cpio first appeared in PWB/UNIX 1.0, which was released within
+AT&T in 1977.
+PWB/UNIX 1.0 formed the basis of System III Unix, released outside
+of AT&T in 1981.
+This makes cpio older than tar, although cpio was not included
+in Version 7 AT&T Unix.
+As a result, the tar command became much better known in universities
+and research groups that used Version 7.
+The combination of the
+.Nm find
+and
+.Nm cpio
+utilities provided very precise control over file selection.
+Unfortunately, the format has many limitations that make it unsuitable
for widespread use.
Only the POSIX format permits files over 4GB, and its 18-bit
limit for most other fields makes it unsuitable for modern systems.
In addition, cpio formats only store numeric UID/GID values (not
usernames and group names), which can make it very difficult to correctly
-transfer archives across systems.
+transfer archives across systems with dissimilar user numbering.
.Ss Shar Formats
A
.Dq shell archive
@@ -255,4 +267,6 @@ Libarchive provides read and write support for both variants.
.Xr tar 1 ,
.Xr zip 1 ,
.Xr zlib 3 ,
+.Xr cpio 5 ,
+.Xr mtree 5 ,
.Xr tar 5
diff --git a/archivers/libarchive/files/libarchive/libarchive_internals.3 b/archivers/libarchive/files/libarchive/libarchive_internals.3
index 1161f65fb4e..a84c9406d34 100644
--- a/archivers/libarchive/files/libarchive/libarchive_internals.3
+++ b/archivers/libarchive/files/libarchive/libarchive_internals.3
@@ -96,12 +96,9 @@ When opening the archive, it reads an initial block of data
and offers it to each registered compression handler.
The one with the highest bid is initialized with the first block.
Similarly, the format handlers are polled to see which handler
-is the best for each header request.
-(Note that a single file can have entries handled by different
-format handlers;
-this allows a simple handler for a generic version of a format
-with more complex handlers implemented independently for
-extended sub-formats.)
+is the best for each archive.
+(Prior to 2.4.0, the format bidders were invoked for each
+entry, but this design hindered error recovery.)
.Ss I/O Layer and Client Callbacks
The read API goes to some lengths to be nice to clients.
As a result, there are few restrictions on the behavior of
@@ -116,6 +113,8 @@ In particular, blocks may be of different sizes.
The client skip callback returns the number of bytes actually
skipped, which may be much smaller than the skip requested.
The only requirement is that the skip not be larger.
+In particular, clients are allowed to return zero for any
+skip that they don't want to handle.
The skip callback must never be invoked with a negative value.
.Pp
Keep in mind that not all clients are reading from disk:
@@ -242,21 +241,12 @@ decompression method but not calling the
method.
This allows each bidder to look ahead in the input stream.
Bidders should not look further ahead than necessary, as long
-look aheads put pressure on the compression layer to buffer
+look aheads put pressure on the decompression layer to buffer
lots of data.
Most formats only require a few hundred bytes of look ahead;
look aheads of a few kilobytes are reasonable.
(The ISO9660 reader sometimes looks ahead by 48k, which
should be considered an upper limit.)
-Note that the bidder is invoked for every entry.
-For many formats, this is inappropriate; if you can only bid at
-the beginning of the file, store your bid value and check that
-each time your bid function is called.
-For example, the ISO9660 reader initializes a
-.Va bid
-value to -1 at registration time;
-each time the bid function is called, the bid value is returned
-immediately if it is zero or larger.
.It Read header
The header read is usually the most complex part of any format.
There are a few strategies worth mentioning:
diff --git a/archivers/libarchive/files/libarchive/mtree.5 b/archivers/libarchive/files/libarchive/mtree.5
new file mode 100644
index 00000000000..613de6a5dae
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/mtree.5
@@ -0,0 +1,270 @@
+.\" Copyright (c) 1989, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" From: @(#)mtree.8 8.2 (Berkeley) 12/11/93
+.\" $FreeBSD$
+.\"
+.Dd August 20, 2007
+.Dt MTREE 5
+.Os
+.Sh NAME
+.Nm mtree
+.Nd format of mtree dir heirarchy files
+.Sh DESCRIPTION
+The
+.Nm
+format is a textual format that describes a collection of filesystem objects.
+Such files are typically used to create or verify directory heirarchies.
+.Ss General Format
+An
+.Nm
+file consists of a series of lines, each providing information
+about a single filesystem object.
+Leading whitespace is always ignored.
+.Pp
+When encoding file or pathnames, any backslash character or
+character outside of the 95 printable ASCII characters must be
+encoded as a a backslash followed by three
+octal digits.
+When reading mtree files, any appearance of a backslash
+followed by three octal digits should be converted into the
+corresponding character.
+.Pp
+Each line is interpreted independently as one of the following types:
+.Bl -tag -width Cm
+.It Signature
+The first line of any mtree file must begin with
+.Dq #mtree .
+If a file contains any full path entries, the first line should
+begin with
+.Dq #mtree v2.0 ,
+otherwise, the first line should begin with
+.Dq #mtree v1.0 .
+.It Blank
+Blank lines are ignored.
+.It Comment
+Lines beginning with
+.Cm #
+are ignored.
+.It Special
+Lines beginning with
+.Cm /
+are special commands that influence
+the interpretation of later lines.
+.It Relative
+If the first whitespace-delimited word has no
+.Cm /
+characters,
+it is the name of a file in the current directory.
+Any relative entry that describes a directory changes the
+current directory.
+.It dot-dot
+As a special case, a relative entry with the filename
+.Pa ..
+changes the current directory to the parent directory.
+Options on dot-dot entries are always ignored.
+.It Full
+If the first whitespace-delimited word has a
+.Cm /
+character after
+the first character, it is the pathname of a file relative to the
+starting directory.
+There can be multiple full entries describing the same file.
+.El
+.Pp
+Some tools that process
+.Nm
+files may require that multiple lines describing the same file
+occur consecutively.
+It is not permitted for the same file to be mentioned using
+both a relative and a full file specification.
+.Ss Special commands
+Two special commands are currently defined:
+.Bl -tag -width Cm
+.It Cm /set
+This command defines default values for one or more keywords.
+It is followed on the same line by one or more whitespace-separated
+keyword definitions.
+These definitions apply to all following files that do not specify
+a value for that keyword.
+.It Cm /unset
+This command removes any default value set by a previous
+.Cm /set
+command.
+It is followed on the same line by one or more keywords
+separated by whitespace.
+.El
+.Ss Keywords
+After the filename, a full or relative entry consists of zero
+or more whitespace-separated keyword definitions.
+Each such definitions consists of a key from the following
+list immediately followed by an '=' sign
+and a value.
+Software programs reading mtree files should warn about
+unrecognized keywords.
+.Pp
+Currently supported keywords are as follows:
+.Bl -tag -width Cm
+.It Cm cksum
+The checksum of the file using the default algorithm specified by
+the
+.Xr cksum 1
+utility.
+.It Cm contents
+The full pathname of a file whose contents should be
+compared to the contents of this file.
+.It Cm flags
+The file flags as a symbolic name.
+See
+.Xr chflags 1
+for information on these names.
+If no flags are to be set the string
+.Dq none
+may be used to override the current default.
+.It Cm ignore
+Ignore any file hierarchy below this file.
+.It Cm gid
+The file group as a numeric value.
+.It Cm gname
+The file group as a symbolic name.
+.It Cm md5
+The MD5 message digest of the file.
+.It Cm md5digest
+A synonym for
+.Cm md5 .
+.It Cm sha1
+The
+.Tn FIPS
+160-1
+.Pq Dq Tn SHA-1
+message digest of the file.
+.It Cm sha1digest
+A synonym for
+.Cm sha1 .
+.It Cm sha256
+The
+.Tn FIPS
+180-2
+.Pq Dq Tn SHA-256
+message digest of the file.
+.It Cm sha256digest
+A synonym for
+.Cm sha256 .
+.It Cm ripemd160digest
+The
+.Tn RIPEMD160
+message digest of the file.
+.It Cm rmd160
+A synonym for
+.Cm ripemd160digest .
+.It Cm rmd160digest
+A synonym for
+.Cm ripemd160digest .
+.It Cm mode
+The current file's permissions as a numeric (octal) or symbolic
+value.
+.It Cm nlink
+The number of hard links the file is expected to have.
+.It Cm nochange
+Make sure this file or directory exists but otherwise ignore all attributes.
+.It Cm uid
+The file owner as a numeric value.
+.It Cm uname
+The file owner as a symbolic name.
+.It Cm size
+The size, in bytes, of the file.
+.It Cm link
+The file the symbolic link is expected to reference.
+.It Cm time
+The last modification time of the file.
+.It Cm type
+The type of the file; may be set to any one of the following:
+.Pp
+.Bl -tag -width Cm -compact
+.It Cm block
+block special device
+.It Cm char
+character special device
+.It Cm dir
+directory
+.It Cm fifo
+fifo
+.It Cm file
+regular file
+.It Cm link
+symbolic link
+.It Cm socket
+socket
+.El
+.El
+.Pp
+.Sh SEE ALSO
+.Xr cksum 1 ,
+.Xr find 1 ,
+.Xr mtree 8
+.Sh BUGS
+The
+.Fx
+implementation of mtree does not currently support
+the
+.Nm
+2.0
+format.
+The requirement for a
+.Dq #mtree
+signature line is new and not yet widely implemented.
+.Sh HISTORY
+The
+.Nm
+utility appeared in
+.Bx 4.3 Reno .
+The
+.Tn MD5
+digest capability was added in
+.Fx 2.1 ,
+in response to the widespread use of programs which can spoof
+.Xr cksum 1 .
+The
+.Tn SHA-1
+and
+.Tn RIPEMD160
+digests were added in
+.Fx 4.0 ,
+as new attacks have demonstrated weaknesses in
+.Tn MD5 .
+The
+.Tn SHA-256
+digest was added in
+.Fx 6.0 .
+Support for file flags was added in
+.Fx 4.0 ,
+and mostly comes from
+.Nx .
+The
+.Dq full
+entry format was added by
+.Nx .
diff --git a/archivers/libarchive/files/libarchive/test/list.h b/archivers/libarchive/files/libarchive/test/list.h
index 252651f2c09..0b221fcec97 100644
--- a/archivers/libarchive/files/libarchive/test/list.h
+++ b/archivers/libarchive/files/libarchive/test/list.h
@@ -3,6 +3,7 @@ DEFINE_TEST(test_acl_pax)
DEFINE_TEST(test_archive_api_feature)
DEFINE_TEST(test_bad_fd)
DEFINE_TEST(test_entry)
+DEFINE_TEST(test_entry_strmode)
DEFINE_TEST(test_read_compress_program)
DEFINE_TEST(test_read_data_large)
DEFINE_TEST(test_read_extract)
@@ -31,6 +32,7 @@ DEFINE_TEST(test_read_pax_truncated)
DEFINE_TEST(test_read_position)
DEFINE_TEST(test_read_truncated)
DEFINE_TEST(test_tar_filenames)
+DEFINE_TEST(test_tar_large)
DEFINE_TEST(test_write_compress_program)
DEFINE_TEST(test_write_disk)
DEFINE_TEST(test_write_disk_perms)
@@ -38,6 +40,8 @@ DEFINE_TEST(test_write_disk_secure)
DEFINE_TEST(test_write_format_ar)
DEFINE_TEST(test_write_format_cpio)
DEFINE_TEST(test_write_format_cpio_empty)
+DEFINE_TEST(test_write_format_cpio_newc)
+DEFINE_TEST(test_write_format_cpio_odc)
DEFINE_TEST(test_write_format_shar_empty)
DEFINE_TEST(test_write_format_tar)
DEFINE_TEST(test_write_format_tar_empty)
diff --git a/archivers/libarchive/files/libarchive/test/main.c b/archivers/libarchive/files/libarchive/test/main.c
index 9dd852ffa75..4585c2631db 100644
--- a/archivers/libarchive/files/libarchive/test/main.c
+++ b/archivers/libarchive/files/libarchive/test/main.c
@@ -34,6 +34,18 @@
#include "test.h"
__FBSDID("$FreeBSD: src/lib/libarchive/test/main.c,v 1.8 2007/07/31 05:03:27 kientzle Exp $");
+/*
+ * "list.h" is simply created by "grep DEFINE_TEST"; it has
+ * a line like
+ * DEFINE_TEST(test_function)
+ * for each test.
+ * Include it here with a suitable DEFINE_TEST to declare all of the
+ * test functions.
+ */
+#undef DEFINE_TEST
+#define DEFINE_TEST(name) void name(void);
+#include "list.h"
+
/* Interix doesn't define these in a standard header. */
#if __INTERIX__
extern char *optarg;
@@ -57,12 +69,10 @@ static int skips = 0;
* Emacs. ;-)
*
* It also supports a few special features specifically to simplify
- * libarchive test harnesses:
+ * test harnesses:
* failure(fmt, args) -- Stores a text string that gets
* printed if the following assertion fails, good for
* explaining subtle tests.
- * assertA(a, cond) -- If the test fails, also prints out any error
- * message stored in archive object 'a'.
*/
static char msg[4096];
@@ -77,11 +87,13 @@ static struct line {
} failed_lines[1000];
-/* Count this failure; return the number of previous failures. */
+/*
+ * Count this failure; return the number of previous failures.
+ */
static int
previous_failures(const char *filename, int line)
{
- int i;
+ unsigned int i;
int count;
if (failed_filename == NULL || strcmp(failed_filename, filename) != 0)
@@ -100,9 +112,12 @@ previous_failures(const char *filename, int line)
return (0);
}
}
+ return (0);
}
-/* Inform user that we're skipping a test. */
+/*
+ * Inform user that we're skipping a test.
+ */
static const char *skipped_filename;
static int skipped_line;
void skipping_setup(const char *filename, int line)
@@ -113,8 +128,6 @@ void skipping_setup(const char *filename, int line)
void
test_skipping(const char *fmt, ...)
{
- int i;
- int line = skipped_line;
va_list ap;
if (previous_failures(skipped_filename, skipped_line))
@@ -130,29 +143,30 @@ test_skipping(const char *fmt, ...)
/* Common handling of failed tests. */
static void
-test_failed(struct archive *a, int line)
+report_failure(void *extra)
{
- int i;
-
- failures ++;
-
if (msg[0] != '\0') {
fprintf(stderr, " Description: %s\n", msg);
msg[0] = '\0';
}
- if (a != NULL) {
- fprintf(stderr, " archive error: %s\n", archive_error_string(a));
+ if (extra != NULL) {
+ fprintf(stderr, " archive error: %s\n", archive_error_string((struct archive *)extra));
}
if (dump_on_failure) {
- fprintf(stderr, " *** forcing core dump so failure can be debugged ***\n");
+ fprintf(stderr,
+ " *** forcing core dump so failure can be debugged ***\n");
*(char *)(NULL) = 0;
exit(1);
}
}
-/* Summarize repeated failures in the just-completed test file. */
-int
+/*
+ * Summarize repeated failures in the just-completed test file.
+ * The reports above suppress multiple failures from the same source
+ * line; this reports on any tests that did fail multiple times.
+ */
+static int
summarize_comparator(const void *a0, const void *b0)
{
const struct line *a = a0, *b = b0;
@@ -165,10 +179,10 @@ summarize_comparator(const void *a0, const void *b0)
return (a->line - b->line);
}
-void
-summarize(const char *filename)
+static void
+summarize(void)
{
- int i;
+ unsigned int i;
qsort(failed_lines, sizeof(failed_lines)/sizeof(failed_lines[0]),
sizeof(failed_lines[0]), summarize_comparator);
@@ -196,35 +210,37 @@ failure(const char *fmt, ...)
/* Generic assert() just displays the failed condition. */
void
-test_assert(const char *file, int line, int value, const char *condition, struct archive *a)
+test_assert(const char *file, int line, int value, const char *condition, void *extra)
{
if (value) {
msg[0] = '\0';
return;
}
+ failures ++;
if (previous_failures(file, line))
return;
fprintf(stderr, "%s:%d: Assertion failed\n", file, line);
fprintf(stderr, " Condition: %s\n", condition);
- test_failed(a, line);
+ report_failure(extra);
}
/* assertEqualInt() displays the values of the two integers. */
void
test_assert_equal_int(const char *file, int line,
- int v1, const char *e1, int v2, const char *e2, struct archive *a)
+ int v1, const char *e1, int v2, const char *e2, void *extra)
{
if (v1 == v2) {
msg[0] = '\0';
return;
}
+ failures ++;
if (previous_failures(file, line))
return;
fprintf(stderr, "%s:%d: Assertion failed: Ints not equal\n",
file, line);
fprintf(stderr, " %s=%d\n", e1, v1);
fprintf(stderr, " %s=%d\n", e2, v2);
- test_failed(a, line);
+ report_failure(extra);
}
/* assertEqualString() displays the values of the two strings. */
@@ -232,7 +248,7 @@ void
test_assert_equal_string(const char *file, int line,
const char *v1, const char *e1,
const char *v2, const char *e2,
- struct archive *a)
+ void *extra)
{
if (v1 == NULL || v2 == NULL) {
if (v1 == v2) {
@@ -243,13 +259,14 @@ test_assert_equal_string(const char *file, int line,
msg[0] = '\0';
return;
}
+ failures ++;
if (previous_failures(file, line))
return;
fprintf(stderr, "%s:%d: Assertion failed: Strings not equal\n",
file, line);
fprintf(stderr, " %s = \"%s\"\n", e1, v1);
fprintf(stderr, " %s = \"%s\"\n", e2, v2);
- test_failed(a, line);
+ report_failure(extra);
}
/* assertEqualWString() displays the values of the two strings. */
@@ -257,19 +274,139 @@ void
test_assert_equal_wstring(const char *file, int line,
const wchar_t *v1, const char *e1,
const wchar_t *v2, const char *e2,
- struct archive *a)
+ void *extra)
{
if (wcscmp(v1, v2) == 0) {
msg[0] = '\0';
return;
}
+ failures ++;
if (previous_failures(file, line))
return;
fprintf(stderr, "%s:%d: Assertion failed: Unicode strings not equal\n",
file, line);
fwprintf(stderr, L" %s = \"%ls\"\n", e1, v1);
fwprintf(stderr, L" %s = \"%ls\"\n", e2, v2);
- test_failed(a, line);
+ report_failure(extra);
+}
+
+/* assertEqualMem() displays the values of the two strings. */
+void
+test_assert_equal_mem(const char *file, int line,
+ const char *v1, const char *e1,
+ const char *v2, const char *e2,
+ size_t l, const char *ld, void *extra)
+{
+ unsigned int i;
+
+ if (v1 == NULL || v2 == NULL) {
+ if (v1 == v2) {
+ msg[0] = '\0';
+ return;
+ }
+ } else if (memcmp(v1, v2, l) == 0) {
+ msg[0] = '\0';
+ return;
+ }
+ failures ++;
+ if (previous_failures(file, line))
+ return;
+ fprintf(stderr, "%s:%d: Assertion failed: memory not equal\n",
+ file, line);
+ fprintf(stderr, " size %s = %d\n", ld, (int)l);
+ fprintf(stderr, " %s = ", e1);
+ for(i=0; i < 32 && i < l; i++) {
+ int c = v1[i];
+ if (c >= ' ' && c <= 126)
+ fprintf(stderr, "'%c'", c);
+ else
+ fprintf(stderr, "0x%02x", c);
+ if (i < l)
+ fprintf(stderr, ", ");
+ }
+ fprintf(stderr, "\n");
+ fprintf(stderr, " %s = ", e2);
+ for(i=0; i < 32 && i < l; i++) {
+ int c = v2[i];
+ if (c >= ' ' && c <= 126)
+ fprintf(stderr, "'%c'", c);
+ else
+ fprintf(stderr, "0x%02x", c);
+ if (i < l)
+ fprintf(stderr, ", ");
+ }
+ fprintf(stderr, "\n");
+ report_failure(extra);
+}
+
+
+/*
+ * Call standard system() call, but build up the command line using
+ * sprintf() conventions.
+ */
+int
+systemf(const char *fmt, ...)
+{
+ char buff[8192];
+ va_list ap;
+ int r;
+
+ va_start(ap, fmt);
+ vsprintf(buff, fmt, ap);
+ r = system(buff);
+ va_end(ap);
+ return (r);
+}
+
+/*
+ * Slurp a file into memory for ease of comparison and testing.
+ * Returns size of file in 'sizep' if non-NULL, null-terminates
+ * data in memory for ease of use.
+ */
+char *
+slurpfile(size_t * sizep, const char *fmt, ...)
+{
+ char filename[8192];
+ struct stat st;
+ va_list ap;
+ char *p;
+ ssize_t bytes_read;
+ int fd;
+ int r;
+
+ va_start(ap, fmt);
+ vsprintf(filename, fmt, ap);
+ va_end(ap);
+
+ fd = open(filename, O_RDONLY);
+ if (fd < 0) {
+ /* Note: No error; non-existent file is okay here. */
+ return (NULL);
+ }
+ r = fstat(fd, &st);
+ if (r != 0) {
+ fprintf(stderr, "Can't stat file %s\n", filename);
+ close(fd);
+ return (NULL);
+ }
+ p = malloc(st.st_size + 1);
+ if (p == NULL) {
+ fprintf(stderr, "Can't allocate %ld bytes of memory to read file %s\n", (long int)st.st_size, filename);
+ close(fd);
+ return (NULL);
+ }
+ bytes_read = read(fd, p, st.st_size);
+ if (bytes_read < st.st_size) {
+ fprintf(stderr, "Can't read file %s\n", filename);
+ close(fd);
+ free(p);
+ return (NULL);
+ }
+ p[st.st_size] = '\0';
+ if (sizep != NULL)
+ *sizep = (size_t)st.st_size;
+ close(fd);
+ return (p);
}
/*
@@ -284,6 +421,12 @@ struct { void (*func)(void); const char *name; } tests[] = {
#include "list.h"
};
+/*
+ * Each test is run in a private work dir. Those work dirs
+ * do have consistent and predictable names, in case a group
+ * of tests need to collaborate. However, there is no provision
+ * for requiring that tests run in a certain order.
+ */
static int test_run(int i, const char *tmpdir)
{
int failures_before = failures;
@@ -307,29 +450,35 @@ static int test_run(int i, const char *tmpdir)
tests[i].name);
exit(1);
}
+ /* Chdir() to that work directory. */
if (chdir(tests[i].name)) {
fprintf(stderr,
"ERROR: Couldn't chdir to temp dir ``%s''\n",
tests[i].name);
exit(1);
}
+ /* Run the actual test. */
(*tests[i].func)();
- summarize(tests[i].name);
+ /* Summarize the results of this test. */
+ summarize();
+ /* Return appropriate status. */
return (failures == failures_before ? 0 : 1);
}
-static void usage(void)
+static void usage(const char *program)
{
static const int limit = sizeof(tests) / sizeof(tests[0]);
int i;
- printf("Usage: libarchive_test [options] <test> <test> ...\n");
+ printf("Usage: %s [options] <test> <test> ...\n", program);
printf("Default is to run all tests.\n");
printf("Otherwise, specify the numbers of the tests you wish to run.\n");
printf("Options:\n");
printf(" -k Keep running after failures.\n");
printf(" Default: Core dump after any failure.\n");
printf(" -q Quiet.\n");
+ printf(" -r <dir> Path to dir containing reference files.\n");
+ printf(" Default: Current directory.\n");
printf("Available tests:\n");
for (i = 0; i < limit; i++)
printf(" %d: %s\n", i, tests[i].name);
@@ -341,19 +490,41 @@ int main(int argc, char **argv)
static const int limit = sizeof(tests) / sizeof(tests[0]);
int i, tests_run = 0, tests_failed = 0, opt;
time_t now;
+ char *progname, *p;
char tmpdir[256];
+ char tmpdir_timestamp[256];
+
+ /*
+ * Name of this program, used to build root of our temp directory
+ * tree.
+ */
+ progname = p = argv[0];
+ while (*p != '\0') {
+ if (*p == '/')
+ progname = p + 1;
+ ++p;
+ }
- while ((opt = getopt(argc, argv, "kq")) != -1) {
+ /* Get the directory holding test files from environment. */
+ refdir = getenv("LIBARCHIVE_TEST_FILES");
+
+ /*
+ * Parse options.
+ */
+ while ((opt = getopt(argc, argv, "kqr:")) != -1) {
switch (opt) {
case 'k':
dump_on_failure = 0;
break;
case 'q':
- quiet_flag = 1;
+ quiet_flag++;
+ break;
+ case 'r':
+ refdir = optarg;
break;
case '?':
default:
- usage();
+ usage(progname);
}
}
argc -= optind;
@@ -366,10 +537,10 @@ int main(int argc, char **argv)
*/
now = time(NULL);
for (i = 0; i < 1000; i++) {
- strftime(tmpdir, sizeof(tmpdir),
- "/tmp/libarchive_test.%Y-%m-%dT%H.%M.%S",
+ strftime(tmpdir_timestamp, sizeof(tmpdir_timestamp),
+ "%Y-%m-%dT%H.%M.%S",
localtime(&now));
- sprintf(tmpdir + strlen(tmpdir), "-%03d", i);
+ sprintf(tmpdir, "/tmp/%s.%s-%03d", progname, tmpdir_timestamp, i);
if (mkdir(tmpdir,0755) == 0)
break;
if (errno == EEXIST)
@@ -379,11 +550,32 @@ int main(int argc, char **argv)
exit(1);
}
+ /*
+ * If the user didn't specify a directory for locating
+ * reference files, use the current directory for that.
+ */
+ if (refdir == NULL) {
+ systemf("/bin/pwd > %s/refdir", tmpdir);
+ refdir = slurpfile(NULL, "%s/refdir", tmpdir);
+ p = refdir + strlen(refdir);
+ while (p[-1] == '\n') {
+ --p;
+ *p = '\0';
+ }
+ }
+
+ /*
+ * Banner with basic information.
+ */
if (!quiet_flag) {
- printf("Running libarchive tests in: %s\n", tmpdir);
+ printf("Running tests in: %s\n", tmpdir);
+ printf("Reference files will be read from: %s\n", refdir);
printf("Exercising %s\n", archive_version());
}
+ /*
+ * Run some or all of the individual tests.
+ */
if (argc == 0) {
/* Default: Run all tests. */
for (i = 0; i < limit; i++) {
@@ -396,7 +588,7 @@ int main(int argc, char **argv)
i = atoi(*argv);
if (**argv < '0' || **argv > '9' || i < 0 || i >= limit) {
printf("*** INVALID Test %s\n", *argv);
- usage();
+ usage(progname);
} else {
if (test_run(i, tmpdir))
tests_failed++;
@@ -405,10 +597,16 @@ int main(int argc, char **argv)
argv++;
}
}
- printf("\n");
- printf("%d of %d test groups reported failures\n",
- tests_failed, tests_run);
- printf(" Total of %d individual tests failed.\n", failures);
- printf(" Total of %d individual tests were skipped.\n", skips);
+
+ /*
+ * Report summary statistics.
+ */
+ if (!quiet_flag) {
+ printf("\n");
+ printf("%d of %d test groups reported failures\n",
+ tests_failed, tests_run);
+ printf(" Total of %d individual tests failed.\n", failures);
+ printf(" Total of %d individual tests were skipped.\n", skips);
+ }
return (tests_failed);
}
diff --git a/archivers/libarchive/files/libarchive/test/read_open_memory.c b/archivers/libarchive/files/libarchive/test/read_open_memory.c
index 2729e1fdaaf..8be3d63eaef 100644
--- a/archivers/libarchive/files/libarchive/test/read_open_memory.c
+++ b/archivers/libarchive/files/libarchive/test/read_open_memory.c
@@ -96,7 +96,7 @@ static ssize_t
memory_read(struct archive *a, void *client_data, const void **buff)
{
struct read_memory_data *mine = (struct read_memory_data *)client_data;
- ssize_t size;
+ size_t size;
(void)a; /* UNUSED */
size = mine->end - mine->buffer;
diff --git a/archivers/libarchive/files/libarchive/test/test.h b/archivers/libarchive/files/libarchive/test/test.h
index c4a110c7199..940b0274bf5 100644
--- a/archivers/libarchive/files/libarchive/test/test.h
+++ b/archivers/libarchive/files/libarchive/test/test.h
@@ -34,13 +34,13 @@
#define _FILE_OFFSET_BITS 64
-#include <archive.h>
-#include <archive_entry.h>
+#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
+#include <unistd.h>
#include <wchar.h>
#ifdef USE_DMALLOC
@@ -69,52 +69,27 @@
#endif
/*
- * ARCHIVE_VERSION_STAMP first appeared in 1.9 and libarchive 2.2.4.
- * We can approximate it for earlier versions, though.
- * This is used to disable tests of features not present in the current
- * version.
- */
-#ifndef ARCHIVE_VERSION_STAMP
-#define ARCHIVE_VERSION_STAMP \
- (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000)
-#endif
-
-
-/*
- * "list.h" is simply created by "grep DEFINE_TEST"; it has
- * a line like
- * DEFINE_TEST(test_function)
- * for each test.
- * Include it here with a suitable DEFINE_TEST to declare all of the
- * test functions.
- */
-#define DEFINE_TEST(name) void name(void);
-#include "list.h"
-/*
* Redefine DEFINE_TEST for use in defining the test functions.
*/
#undef DEFINE_TEST
-#define DEFINE_TEST(name) void name(void)
+#define DEFINE_TEST(name) void name(void); void name(void)
/* An implementation of the standard assert() macro */
#define assert(e) test_assert(__FILE__, __LINE__, (e), #e, NULL)
-/* As above, but reports any archive_error found in variable 'a' */
-#define assertA(e) test_assert(__FILE__, __LINE__, (e), #e, (a))
-/* Asserts that two integers are the same. Reports value of each one if not. */
-#define assertEqualIntA(a,v1,v2) \
- test_assert_equal_int(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (a))
+/* Assert two integers are the same. Reports value of each one if not. */
#define assertEqualInt(v1,v2) \
test_assert_equal_int(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
-/* Asserts that two strings are the same. Reports value of each one if not. */
-#define assertEqualStringA(a,v1,v2) \
- test_assert_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (a))
+/* Assert two strings are the same. Reports value of each one if not. */
#define assertEqualString(v1,v2) \
test_assert_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
/* As above, but v1 and v2 are wchar_t * */
#define assertEqualWString(v1,v2) \
test_assert_equal_wstring(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
+/* As above, but raw blocks of bytes. */
+#define assertEqualMem(v1, v2, l) \
+ test_assert_equal_mem(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (l), #l, NULL)
/*
* This would be simple with C99 variadic macros, but I don't want to
@@ -129,11 +104,50 @@
void failure(const char *fmt, ...);
void skipping_setup(const char *, int);
void test_skipping(const char *fmt, ...);
-void test_assert(const char *, int, int, const char *, struct archive *);
-void test_assert_equal_int(const char *, int, int, const char *, int, const char *, struct archive *);
-void test_assert_equal_string(const char *, int, const char *v1, const char *, const char *v2, const char *, struct archive *);
-void test_assert_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, struct archive *);
+void test_assert(const char *, int, int, const char *, void *);
+void test_assert_equal_int(const char *, int, int, const char *, int, const char *, void *);
+void test_assert_equal_string(const char *, int, const char *v1, const char *, const char *v2, const char *, void *);
+void test_assert_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *);
+void test_assert_equal_mem(const char *, int, const char *, const char *, const char *, const char *, size_t, const char *, void *);
+
+/* Like sprintf, then system() */
+int systemf(const char * fmt, ...);
+
+/* Suck file into string allocated via malloc(). Call free() when done. */
+/* Supports printf-style args: slurpfile(NULL, "%s/myfile", refdir); */
+char *slurpfile(size_t *, const char *fmt, ...);
+
+/*
+ * Global vars
+ */
+
+/* Directory holding reference files. */
+char *refdir;
+
+/*
+ * Special interfaces for libarchive test harness.
+ */
+
+#include "archive.h"
+#include "archive_entry.h"
/* Special customized read-from-memory interface. */
int read_open_memory(struct archive *, void *, size_t, size_t);
-int read_open_memory(struct archive *, void *, size_t, size_t);
+
+/*
+ * ARCHIVE_VERSION_STAMP first appeared in 1.9 and libarchive 2.2.4.
+ * We can approximate it for earlier versions, though.
+ * This is used to disable tests of features not present in the current
+ * version.
+ */
+#ifndef ARCHIVE_VERSION_STAMP
+#define ARCHIVE_VERSION_STAMP \
+ (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000)
+#endif
+
+/* Versions of above that accept an archive argument for additional info. */
+#define assertA(e) test_assert(__FILE__, __LINE__, (e), #e, (a))
+#define assertEqualIntA(a,v1,v2) \
+ test_assert_equal_int(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (a))
+#define assertEqualStringA(a,v1,v2) \
+ test_assert_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (a))
diff --git a/archivers/libarchive/files/libarchive/test/test_entry_strmode.c b/archivers/libarchive/files/libarchive/test/test_entry_strmode.c
new file mode 100644
index 00000000000..43b01b42232
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_entry_strmode.c
@@ -0,0 +1,48 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD$");
+
+DEFINE_TEST(test_entry_strmode)
+{
+ struct archive_entry *entry;
+
+ assert((entry = archive_entry_new()) != NULL);
+
+ archive_entry_set_mode(entry, S_IFREG | 0642);
+ assertEqualString(archive_entry_strmode(entry), "-rw-r---w- ");
+
+ archive_entry_set_mode(entry, S_IFBLK | 03642);
+ assertEqualString(archive_entry_strmode(entry), "brw-r-S-wT ");
+
+ archive_entry_set_mode(entry, S_IFCHR | 05777);
+ assertEqualString(archive_entry_strmode(entry), "crwsrwxrwt ");
+
+ archive_entry_set_mode(entry, S_IFLNK | 04000);
+ assertEqualString(archive_entry_strmode(entry), "l--S------ ");
+
+ /* Release the experimental entry. */
+ archive_entry_free(entry);
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_cpio_odc.c b/archivers/libarchive/files/libarchive/test/test_read_format_cpio_odc.c
index d722c5eb930..c6eb8312165 100644
--- a/archivers/libarchive/files/libarchive/test/test_read_format_cpio_odc.c
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_cpio_odc.c
@@ -54,7 +54,7 @@ DEFINE_TEST(test_read_format_cpio_odc)
assertA(0 == archive_read_support_compression_all(a));
assertA(0 == archive_read_support_format_all(a));
assertA(0 == archive_read_open_memory(a, archive, sizeof(archive)));
- assertA(0 == archive_read_next_header(a, &ae));
+ assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
assertA(archive_compression(a) == ARCHIVE_COMPRESSION_NONE);
assertA(archive_format(a) == ARCHIVE_FORMAT_CPIO_POSIX);
assert(0 == archive_read_close(a));
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse.c b/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse.c
index 7f8e01eba9d..60ad5ba64cd 100644
--- a/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse.c
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse.c
@@ -29,7 +29,7 @@ __FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_gtar_sparse.c,v 1.6
struct contents {
off_t o;
size_t s;
- char *d;
+ const char *d;
};
struct contents archive_contents_sparse[] = {
@@ -226,59 +226,6 @@ static unsigned char archive_old_gtar_1_13[] = {
235,237,249,250,'t',185,'l',207,31,'?','=','|',221,207,254,14,0,0,0,0,0,0,
0,255,'1',255,0,178,'s',140,'2',0,240,0,0};
-/* Old GNU tar sparse format, as created by gtar 1.17 */
-static unsigned char archive_old_gtar_1_17[] = {
-31,139,8,0,30,'%',193,'F',0,3,237,215,']','r',19,'G',20,134,'a','e','\'',
-218,'@',170,186,'O',255,'-','$','+',208,5,23,'\\','@','(',203,236,'?','g',
-134,216,'8',232,139,160,248,'P','M',170,242,'>',20,'%',211,'6',214,153,158,
-'W','#',205,245,211,229,233,250,238,244,'P','%',205,222,183,199,186,'F','y',
-251,184,137,252,'{',170,'e',206,18,17,189,205,'S','~','w',197,'<',157,255,
-'x',236,'X','_','|',190,'>','_',158,206,231,211,243,251,15,'w',127,238,'{',
-223,255,'i',219,22,180,217,235,182,11,127,239,200,235,215,185,'K','!',214,
-'k',255,242,239,151,245,253,235,'{','O',240,250,31,'~',185,203,175,255,149,
-248,31,161,159,'c',']',247,235,127,'<',244,'9',238,'^',255,'k',143,'V',234,
-'?',175,255,17,'5',127,156,235,255,191,'^',255,'[',235,'M',173,175,'(',253,
-219,245,223,'J',25,171,142,186,182,'m','V',207,158,251,223,135,248,'m','1',
-'W',153,'b',189,197,232,'K',173,231,'A',168,163,232,17,'C',29,'E',159,181,
-170,163,200,'Q',199,205,'Q','l',235,'c','V','5',231,172,'}',168,'9',231,'h',
-'U',205,185,'j',157,'E',173,231,'f',139,'9',243,'a','N','1','g',205,']',11,
-'1','g',238,'A',155,'b',206,154,165,135,152,179,230,'s','N','1','g',141,182,
-154,152,179,198,202,243,')',214,183,'(',212,156,'m',197,186,173,226,245,252,
-215,222,'j','S',243,246,185,150,154,'w',196,'l','j',222,177,31,245,237,250,
-140,166,234,174,'s',134,170,'{',143,'X',237,'k',30,'v',17,'s','F','>','s',
-23,'s','F',201,138,196,156,'Q','k',12,'1','g',228,'k','D',245,155,'M',',',
-213,'o','^',171,166,234,'w',127,'9',169,'9',243,244,'T','5','g',207,3,'P',
-'s',230,'&',132,154,179,175,'9',213,156,163,13,213,'o',140,213,'n',251,253,
-'z',254,243,'l',134,234,'x',127,249,171,'y',215,246,'G',173,207,253,'0',190,
-']','o','9','q',19,243,182,'2',243,23,137,245,26,'U','u',220,'r',151,'n',
-';',222,'.','G','u',170,'~',247,203,148,152,179,'e',238,']',205,153,219,'W',
-212,156,25,'o','W','s',246,188,10,170,'9','G',134,167,230,220,'V',213,156,
-249,190,167,250,'}',185,156,222,174,175,'5',212,156,'y',154,171,154,'3','w',
-'m',220,'9',255,'}',219,17,'1','o',190,'x',170,234,184,'g',244,170,227,158,
-'/','h',213,241,'~',249,23,243,246,12,'o',138,'y','{',230,24,'b','_',243,
-147,'A','~',138,16,235,'=',175,24,'j',206,'|',21,170,'~',251,200,11,177,154,
-'s',140,'P',253,238,'o','S','j',206,153,'y',169,'9',243,'e',211,212,156,'+',
-131,17,'s',142,'-','=','1',231,200,29,'U',253,'n',231,'^',245,';',242,'B',
-175,250,221,223,'N',239,156,255,145,23,166,219,'O',13,219,250,10,245,185,
-'`','d','.',234,'s',193,200,'0',213,231,130,145,'\'','Z','u',156,23,237,174,
-':',206,211,208,'T',199,251,219,191,154,'s','n',239,0,'j','}',251,'#',214,
-247,15,'C','o',214,139,252,'`',132,31,194,253,27,28,244,3,7,253,192,'A','?',
-'p',208,15,28,244,3,135,219,15,253,193,'A','?','p',208,15,28,244,3,7,253,
-192,'A','?','p',208,15,28,220,255,227,'H',244,3,7,253,192,'A','?','p',208,
-15,28,244,3,7,253,192,193,253,'?',142,'D','?','p',208,15,28,244,3,7,253,192,
-'A','?','p',208,15,28,220,255,227,'H',244,3,7,253,192,'A','?','p',208,15,
-28,244,3,7,253,192,193,253,'?',142,'D','?','p',208,15,28,244,3,7,253,192,
-'A','?','p',208,15,28,220,255,227,'H',244,3,7,253,192,'A','?','p',208,15,
-28,244,3,7,253,192,193,253,'?',142,'D','?','p',208,15,28,244,3,7,253,192,
-'A','?','p',208,15,28,220,255,227,'H',244,3,7,253,192,'A','?','p',208,15,
-28,244,3,7,253,192,193,253,'?',142,'D','?','p',208,15,28,244,3,7,253,192,
-'A','?','p',208,15,28,220,255,227,'H',244,3,7,253,192,'A','?','p',208,15,
-28,244,3,7,253,192,193,253,'?',142,'D','?','p',208,15,28,244,3,7,253,192,
-'A','?','p',208,15,28,220,255,227,'H',244,3,7,253,192,'A','?',158,143,127,
-'~',252,253,250,233,242,'t','}',247,184,231,'(','i',246,190,'=',214,'5',202,
-219,199,23,167,'Z',230,',',17,209,219,'<',149,'Z','#',234,233,'\\',30,'7',
-210,'W',159,175,207,151,167,243,249,244,252,254,195,221,159,251,222,247,1,
-0,0,0,0,0,0,0,248,15,249,11,162,'$',218,227,0,240,0,0};
#if ARCHIVE_VERSION_STAMP >= 1009000
/* libarchive < 1.9 does not support this. */
@@ -831,7 +778,7 @@ _verify_archive(void *buffer, size_t length, const char *name,
(const void **)&actual.d,
&actual.s, &actual.o))) {
while (actual.s > 0) {
- char c = *(char *)actual.d;
+ char c = *(const char *)actual.d;
if(actual.o < expect.o) {
/*
* Any byte before the expected
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_isorr_bz2.c b/archivers/libarchive/files/libarchive/test/test_read_format_isorr_bz2.c
index f9a70768471..2a888af3586 100644
--- a/archivers/libarchive/files/libarchive/test/test_read_format_isorr_bz2.c
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_isorr_bz2.c
@@ -110,6 +110,9 @@ DEFINE_TEST(test_read_format_isorr_bz2)
assertEqualInt(1, archive_entry_ctime(ae));
assertEqualInt(0, archive_entry_stat(ae)->st_nlink);
assertEqualInt(0, archive_entry_uid(ae));
+ assertEqualIntA(a, ARCHIVE_EOF,
+ archive_read_data_block(a, &p, &size, &offset));
+ assertEqualInt(size, 0);
/* A directory. */
assert(0 == archive_read_next_header(a, &ae));
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_zip.c b/archivers/libarchive/files/libarchive/test/test_read_format_zip.c
index 08a4d6f5529..ce065097e42 100644
--- a/archivers/libarchive/files/libarchive/test/test_read_format_zip.c
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_zip.c
@@ -48,6 +48,9 @@ DEFINE_TEST(test_read_format_zip)
struct archive_entry *ae;
struct archive *a;
char *buff[128];
+ const void *pv;
+ size_t s;
+ off_t o;
assert((a = archive_read_new()) != NULL);
assertA(0 == archive_read_support_compression_all(a));
@@ -57,6 +60,9 @@ DEFINE_TEST(test_read_format_zip)
assertEqualString("dir/", archive_entry_pathname(ae));
assertEqualInt(1179604249, archive_entry_mtime(ae));
assertEqualInt(0, archive_entry_size(ae));
+ assertEqualIntA(a, ARCHIVE_EOF,
+ archive_read_data_block(a, &pv, &s, &o));
+ assertEqualInt(s, 0);
assertA(0 == archive_read_next_header(a, &ae));
assertEqualString("file1", archive_entry_pathname(ae));
assertEqualInt(1179604289, archive_entry_mtime(ae));
diff --git a/archivers/libarchive/files/libarchive/test/test_read_pax_truncated.c b/archivers/libarchive/files/libarchive/test/test_read_pax_truncated.c
index c8873d84372..2b169c83900 100644
--- a/archivers/libarchive/files/libarchive/test/test_read_pax_truncated.c
+++ b/archivers/libarchive/files/libarchive/test/test_read_pax_truncated.c
@@ -29,9 +29,9 @@ DEFINE_TEST(test_read_pax_truncated)
{
struct archive_entry *ae;
struct archive *a;
- size_t used, i;
+ ssize_t used, i;
size_t buff_size = 1000000;
- size_t filedata_size = 100000;
+ ssize_t filedata_size = 100000;
char *buff = malloc(buff_size);
char *buff2 = malloc(buff_size);
char *filedata = malloc(filedata_size);
diff --git a/archivers/libarchive/files/libarchive/test/test_tar_filenames.c b/archivers/libarchive/files/libarchive/test/test_tar_filenames.c
index b75ac7f0cae..de0b1d0351e 100644
--- a/archivers/libarchive/files/libarchive/test/test_tar_filenames.c
+++ b/archivers/libarchive/files/libarchive/test/test_tar_filenames.c
@@ -41,7 +41,7 @@ test_filename(const char *prefix, int dlen, int flen)
struct archive *a;
size_t used;
size_t prefix_length = 0;
- int i = 0;
+ unsigned i = 0;
if (prefix) {
strcpy(filename, prefix);
diff --git a/archivers/libarchive/files/libarchive/test/test_tar_large.c b/archivers/libarchive/files/libarchive/test/test_tar_large.c
new file mode 100644
index 00000000000..29e0c833562
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_tar_large.c
@@ -0,0 +1,307 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD$");
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+/*
+ * This is a somewhat tricky test that verifies the ability to
+ * write and read very large entries to tar archives. It
+ * writes entries from 2GB up to 1TB to an archive in memory.
+ * The memory storage here carefully avoids actually storing
+ * any part of the file bodies, so it runs very quickly and requires
+ * very little memory. If you're willing to wait a few minutes,
+ * you should be able to exercise petabyte entries with this code.
+ */
+
+/*
+ * Each file is built up by duplicating the following block.
+ */
+static size_t filedatasize;
+static void *filedata;
+
+/*
+ * We store the archive as blocks of data generated by libarchive,
+ * each possibly followed by bytes of file data.
+ */
+struct memblock {
+ struct memblock *next;
+ size_t size;
+ void *buff;
+ off_t filebytes;
+};
+
+/*
+ * The total memory store is just a list of memblocks plus
+ * some accounting overhead.
+ */
+struct memdata {
+ off_t filebytes;
+ void *buff;
+ struct memblock *first;
+ struct memblock *last;
+};
+
+/* The following size definitions simplify things below. */
+#define KB ((off_t)1024)
+#define MB ((off_t)1024 * KB)
+#define GB ((off_t)1024 * MB)
+#define TB ((off_t)1024 * GB)
+
+#if ARCHIVE_API_VERSION < 2
+static ssize_t memory_read_skip(struct archive *, void *, size_t request);
+#else
+static off_t memory_read_skip(struct archive *, void *, off_t request);
+#endif
+static ssize_t memory_read(struct archive *, void *, const void **buff);
+static ssize_t memory_write(struct archive *, void *, const void *, size_t);
+
+
+static ssize_t
+memory_write(struct archive *a, void *_private, const void *buff, size_t size)
+{
+ struct memdata *private = _private;
+ struct memblock *block;
+
+ (void)a;
+
+ /*
+ * Since libarchive has zero-copy behavior, if you give a pointer
+ * to filedata to the library, a pointer into that data will
+ * pop out here. This way, we can tell the difference between
+ * filedata and library header and metadata.
+ */
+ if ((const char *)filedata <= (const char *)buff
+ && (const char *)buff < (const char *)filedata + filedatasize) {
+ /* We don't need to store a block of file data. */
+ private->last->filebytes += size;
+ } else {
+ /* Yes, we're assuming the very first write is metadata. */
+ /* It's header or metadata, copy and save it. */
+ block = (struct memblock *)malloc(sizeof(*block));
+ memset(block, 0, sizeof(*block));
+ block->size = size;
+ block->buff = malloc(size);
+ memcpy(block->buff, buff, size);
+ if (private->last == NULL) {
+ private->first = private->last = block;
+ } else {
+ private->last->next = block;
+ private->last = block;
+ }
+ block->next = NULL;
+ }
+ return (size);
+}
+
+static ssize_t
+memory_read(struct archive *a, void *_private, const void **buff)
+{
+ struct memdata *private = _private;
+ struct memblock *block;
+ ssize_t size;
+
+ (void)a;
+
+ free(private->buff);
+ private->buff = NULL;
+ if (private->first == NULL) {
+ private->last = NULL;
+ return (ARCHIVE_EOF);
+ }
+ if (private->filebytes > 0) {
+ /*
+ * We're returning file bytes, simulate it by
+ * passing blocks from the template data.
+ */
+ if (private->filebytes > (off_t)filedatasize)
+ size = filedatasize;
+ else
+ size = (ssize_t)private->filebytes;
+ private->filebytes -= size;
+ *buff = filedata;
+ } else {
+ /*
+ * We need to get some real data to return.
+ */
+ block = private->first;
+ private->first = block->next;
+ size = block->size;
+ if (block->buff != NULL) {
+ private->buff = block->buff;
+ *buff = block->buff;
+ } else {
+ private->buff = NULL;
+ *buff = filedata;
+ }
+ private->filebytes = block->filebytes;
+ free(block);
+ }
+ return (size);
+}
+
+
+#if ARCHIVE_API_VERSION < 2
+static ssize_t
+memory_read_skip(struct archive *a, void *private, size_t skip)
+{
+ (void)a; /* UNUSED */
+ (void)private; /* UNUSED */
+ (void)skip; /* UNUSED */
+ return (0);
+}
+#else
+static off_t
+memory_read_skip(struct archive *a, void *_private, off_t skip)
+#endif
+{
+ struct memdata *private = _private;
+
+ (void)a;
+
+ if (private->first == NULL) {
+ private->last = NULL;
+ return (0);
+ }
+ if (private->filebytes > 0) {
+ if (private->filebytes < skip)
+ skip = private->filebytes;
+ private->filebytes -= skip;
+ } else {
+ skip = 0;
+ }
+ return (skip);
+}
+
+DEFINE_TEST(test_tar_large)
+{
+ /* The sizes of the entries we're going to generate. */
+ static off_t tests[] = {
+ /* Test for 32-bit signed overflow. */
+ 2 * GB - 1, 2 * GB, 2 * GB + 1,
+ /* Test for 32-bit unsigned overflow. */
+ 4 * GB - 1, 4 * GB, 4 * GB + 1,
+ /* 8GB is the "official" max for ustar. */
+ 8 * GB - 1, 8 * GB, 8 * GB + 1,
+ /* Bend ustar a tad and you can get 64GB (12 octal digits). */
+ 64 * GB - 1, 64 * GB,
+ /* And larger entries that require non-ustar extensions. */
+ 256 * GB, 1 * TB, 0 };
+ int i;
+ char namebuff[64];
+ struct memdata memdata;
+ struct archive_entry *ae;
+ struct archive *a;
+ off_t filesize, writesize;
+
+ filedatasize = 1 * MB;
+ filedata = malloc(filedatasize);
+ memset(filedata, 0xAA, filedatasize);
+ memset(&memdata, 0, sizeof(memdata));
+
+ /*
+ * Open an archive for writing.
+ */
+ a = archive_write_new();
+ archive_write_set_format_pax_restricted(a);
+ archive_write_set_bytes_per_block(a, 0); /* No buffering. */
+ archive_write_open(a, &memdata, NULL, memory_write, NULL);
+
+ /*
+ * Write a series of large files to it.
+ */
+ for (i = 0; tests[i] > 0; i++) {
+ assert((ae = archive_entry_new()) != NULL);
+ sprintf(namebuff, "file_%d", i);
+ archive_entry_copy_pathname(ae, namebuff);
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ filesize = tests[i];
+ archive_entry_set_size(ae, filesize);
+
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+
+ /*
+ * Write the actual data to the archive.
+ */
+ while (filesize > 0) {
+ writesize = filedatasize;
+ if (writesize > filesize)
+ writesize = filesize;
+ assertA(writesize == archive_write_data(a, filedata, writesize));
+ filesize -= writesize;
+ }
+ }
+
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "lastfile");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+
+
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+#if ARCHIVE_API_VERSION > 1
+ assertA(0 == archive_write_finish(a));
+#else
+ archive_write_finish(a);
+#endif
+
+ /*
+ * Open the same archive for reading.
+ */
+ a = archive_read_new();
+ archive_read_support_format_tar(a);
+ archive_read_open2(a, &memdata, NULL,
+ memory_read, memory_read_skip, NULL);
+
+ /*
+ * Read entries back.
+ */
+ for (i = 0; tests[i] > 0; i++) {
+ assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
+ sprintf(namebuff, "file_%d", i);
+ assertEqualString(namebuff, archive_entry_pathname(ae));
+ assert(tests[i] == archive_entry_size(ae));
+ }
+ assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
+ assertEqualString("lastfile", archive_entry_pathname(ae));
+
+ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
+
+ /* Close out the archive. */
+ assertA(0 == archive_read_close(a));
+#if ARCHIVE_API_VERSION > 1
+ assertA(0 == archive_read_finish(a));
+#else
+ archive_read_finish(a);
+#endif
+
+ free(filedata);
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_write_disk.c b/archivers/libarchive/files/libarchive/test/test_write_disk.c
index 1d8f32e0adf..4cac97681a7 100644
--- a/archivers/libarchive/files/libarchive/test/test_write_disk.c
+++ b/archivers/libarchive/files/libarchive/test/test_write_disk.c
@@ -23,7 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk.c,v 1.3 2007/07/06 15:43:11 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk.c,v 1.6 2007/09/21 04:52:43 kientzle Exp $");
#if ARCHIVE_VERSION_STAMP >= 1009000
@@ -50,6 +50,74 @@ static void create(struct archive_entry *ae, const char *msg)
st.st_mode, archive_entry_mode(ae));
assert(st.st_mode == (archive_entry_mode(ae) & ~UMASK));
}
+
+static void create_reg_file(struct archive_entry *ae, const char *msg)
+{
+ static const char data[]="abcdefghijklmnopqrstuvwxyz";
+ struct archive *ad;
+ struct stat st;
+
+ /* Write the entry to disk. */
+ assert((ad = archive_write_disk_new()) != NULL);
+ failure("%s", msg);
+ assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+ assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data)));
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+#if ARCHIVE_API_VERSION > 1
+ assertEqualInt(0, archive_write_finish(ad));
+#else
+ archive_write_finish(ad);
+#endif
+ /* Test the entries on disk. */
+ assert(0 == stat(archive_entry_pathname(ae), &st));
+ failure("st.st_mode=%o archive_entry_mode(ae)=%o",
+ st.st_mode, archive_entry_mode(ae));
+ assertEqualInt(st.st_mode, (archive_entry_mode(ae) & ~UMASK));
+ assertEqualInt(st.st_size, sizeof(data));
+}
+
+static void create_reg_file2(struct archive_entry *ae, const char *msg)
+{
+ const int datasize = 100000;
+ char *data;
+ char *compare;
+ struct archive *ad;
+ struct stat st;
+ int i, fd;
+
+ data = malloc(datasize);
+ for (i = 0; i < datasize; i++)
+ data[i] = (char)(i % 256);
+
+ /* Write the entry to disk. */
+ assert((ad = archive_write_disk_new()) != NULL);
+ failure("%s", msg);
+ assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+ for (i = 0; i < datasize - 999; i += 1000) {
+ assertEqualIntA(ad, ARCHIVE_OK,
+ archive_write_data_block(ad, data + i, 1000, i));
+ }
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+#if ARCHIVE_API_VERSION > 1
+ assertEqualInt(0, archive_write_finish(ad));
+#else
+ archive_write_finish(ad);
+#endif
+ /* Test the entries on disk. */
+ assert(0 == stat(archive_entry_pathname(ae), &st));
+ failure("st.st_mode=%o archive_entry_mode(ae)=%o",
+ st.st_mode, archive_entry_mode(ae));
+ assertEqualInt(st.st_mode, (archive_entry_mode(ae) & ~UMASK));
+ assertEqualInt(st.st_size, i);
+
+ compare = malloc(datasize);
+ fd = open(archive_entry_pathname(ae), O_RDONLY);
+ assertEqualInt(datasize, read(fd, compare, datasize));
+ close(fd);
+ assert(memcmp(compare, data, datasize) == 0);
+ free(compare);
+ free(data);
+}
#endif
DEFINE_TEST(test_write_disk)
@@ -66,7 +134,14 @@ DEFINE_TEST(test_write_disk)
assert((ae = archive_entry_new()) != NULL);
archive_entry_copy_pathname(ae, "file");
archive_entry_set_mode(ae, S_IFREG | 0755);
- create(ae, "Test creating a regular file");
+ create_reg_file(ae, "Test creating a regular file");
+ archive_entry_free(ae);
+
+ /* Another regular file. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file2");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ create_reg_file2(ae, "Test creating another regular file");
archive_entry_free(ae);
/* A regular file over an existing file */
diff --git a/archivers/libarchive/files/libarchive/test/test_write_format_cpio.c b/archivers/libarchive/files/libarchive/test/test_write_format_cpio.c
index 6677b5e1b57..7319d0c3cec 100644
--- a/archivers/libarchive/files/libarchive/test/test_write_format_cpio.c
+++ b/archivers/libarchive/files/libarchive/test/test_write_format_cpio.c
@@ -23,7 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_format_cpio.c,v 1.2 2007/07/06 15:43:11 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_format_cpio.c,v 1.3 2007/10/12 04:11:31 kientzle Exp $");
/* The version stamp macro was introduced after cpio write support. */
#if ARCHIVE_VERSION_STAMP >= 1009000
@@ -37,6 +37,7 @@ test_format(int (*set_format)(struct archive *))
size_t used;
size_t buffsize = 1000000;
char *buff;
+ int damaged = 0;
buff = malloc(buffsize);
@@ -66,6 +67,41 @@ test_format(int (*set_format)(struct archive *))
archive_entry_free(ae);
assertA(8 == archive_write_data(a, "12345678", 9));
+ /*
+ * Write another file to it.
+ */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(ae, 1, 10);
+ assert(1 == archive_entry_mtime(ae));
+ assert(10 == archive_entry_mtime_nsec(ae));
+ p = strdup("file2");
+ archive_entry_copy_pathname(ae, p);
+ strcpy(p, "XXXX");
+ free(p);
+ assertEqualString("file2", archive_entry_pathname(ae));
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ assert((S_IFREG | 0755) == archive_entry_mode(ae));
+ archive_entry_set_size(ae, 4);
+
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+ assertA(4 == archive_write_data(a, "1234", 5));
+
+ /*
+ * Write a directory to it.
+ */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(ae, 11, 110);
+ archive_entry_copy_pathname(ae, "dir");
+ archive_entry_set_mode(ae, S_IFDIR | 0755);
+ archive_entry_set_size(ae, 512);
+
+ assertA(0 == archive_write_header(a, ae));
+ assertEqualInt(0, archive_entry_size(ae));
+ archive_entry_free(ae);
+ assertEqualIntA(a, 0, archive_write_data(a, "12345678", 9));
+
+
/* Close out the archive. */
assertA(0 == archive_write_close(a));
#if ARCHIVE_API_VERSION > 1
@@ -75,6 +111,22 @@ test_format(int (*set_format)(struct archive *))
#endif
/*
+ * Damage the second entry to test the search-ahead recovery.
+ */
+ {
+ int i;
+ for (i = 80; i < 150; i++) {
+ if (memcmp(buff + i, "07070", 5) == 0) {
+ damaged = 1;
+ buff[i] = 'X';
+ break;
+ }
+ }
+ }
+ failure("Unable to locate the second header for damage-recovery test.");
+ assert(damaged = 1);
+
+ /*
* Now, read the data back.
*/
assert((a = archive_read_new()) != NULL);
@@ -82,21 +134,53 @@ test_format(int (*set_format)(struct archive *))
assertA(0 == archive_read_support_compression_all(a));
assertA(0 == archive_read_open_memory(a, buff, used));
- assertA(0 == archive_read_next_header(a, &ae));
+ assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
- assert(1 == archive_entry_mtime(ae));
+ assertEqualInt(1, archive_entry_mtime(ae));
/* Not the same as above: cpio doesn't store hi-res times. */
assert(0 == archive_entry_mtime_nsec(ae));
assert(0 == archive_entry_atime(ae));
assert(0 == archive_entry_ctime(ae));
assertEqualString("file", archive_entry_pathname(ae));
- assert((S_IFREG | 0755) == archive_entry_mode(ae));
- assert(8 == archive_entry_size(ae));
+ assertEqualInt((S_IFREG | 0755), archive_entry_mode(ae));
+ assertEqualInt(8, archive_entry_size(ae));
assertA(8 == archive_read_data(a, filedata, 10));
assert(0 == memcmp(filedata, "12345678", 8));
+ /*
+ * Read the second file back.
+ */
+ if (!damaged) {
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualInt(1, archive_entry_mtime(ae));
+ /* Not the same as above: cpio doesn't store hi-res times. */
+ assert(0 == archive_entry_mtime_nsec(ae));
+ assert(0 == archive_entry_atime(ae));
+ assert(0 == archive_entry_ctime(ae));
+ assertEqualString("file2", archive_entry_pathname(ae));
+ assert((S_IFREG | 0755) == archive_entry_mode(ae));
+ assertEqualInt(4, archive_entry_size(ae));
+ assertEqualIntA(a, 4, archive_read_data(a, filedata, 10));
+ assert(0 == memcmp(filedata, "1234", 4));
+ }
+
+ /*
+ * Read the dir entry back.
+ */
+ assertEqualIntA(a,
+ damaged ? ARCHIVE_WARN : ARCHIVE_OK,
+ archive_read_next_header(a, &ae));
+ assertEqualInt(11, archive_entry_mtime(ae));
+ assert(0 == archive_entry_mtime_nsec(ae));
+ assert(0 == archive_entry_atime(ae));
+ assert(0 == archive_entry_ctime(ae));
+ assertEqualString("dir", archive_entry_pathname(ae));
+ assertEqualInt((S_IFDIR | 0755), archive_entry_mode(ae));
+ assertEqualInt(0, archive_entry_size(ae));
+ assertEqualIntA(a, 0, archive_read_data(a, filedata, 10));
+
/* Verify the end of the archive. */
- assert(1 == archive_read_next_header(a, &ae));
+ assertEqualIntA(a, 1, archive_read_next_header(a, &ae));
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
diff --git a/archivers/libarchive/files/libarchive/test/test_write_format_cpio_newc.c b/archivers/libarchive/files/libarchive/test/test_write_format_cpio_newc.c
new file mode 100644
index 00000000000..733e4ab26cd
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_write_format_cpio_newc.c
@@ -0,0 +1,172 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD$");
+
+
+static int
+is_hex(const char *p, size_t l)
+{
+ while (l > 0) {
+ if (*p >= 0 && *p <= '9') {
+ /* Ascii digit */
+ } else if (*p >= 'a' && *p <= 'f') {
+ /* lowercase letter a-f */
+ } else {
+ /* Not hex. */
+ return (0);
+ }
+ --l;
+ ++p;
+ }
+ return (1);
+}
+
+/*
+ * Detailed verification that cpio 'newc' archives are written with
+ * the correct format.
+ */
+DEFINE_TEST(test_write_format_cpio_newc)
+{
+ struct archive *a;
+ struct archive_entry *entry;
+ char *buff, *e;
+ size_t buffsize = 100000;
+ size_t used;
+
+ buff = malloc(buffsize);
+
+ /* Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertEqualIntA(a, 0, archive_write_set_format_cpio_newc(a));
+ assertEqualIntA(a, 0, archive_write_set_compression_none(a));
+ assertEqualIntA(a, 0, archive_write_open_memory(a, buff, buffsize, &used));
+
+ /*
+ * Add various files to it.
+ * TODO: Extend this to cover more filetypes.
+ */
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(entry, 1, 10);
+ archive_entry_set_pathname(entry, "file");
+ archive_entry_set_mode(entry, S_IFREG | 0664);
+ archive_entry_set_size(entry, 10);
+ archive_entry_set_uid(entry, 80);
+ archive_entry_set_gid(entry, 90);
+ archive_entry_set_dev(entry, 12);
+ archive_entry_set_ino(entry, 89);
+ archive_entry_set_nlink(entry, 1);
+ assertEqualIntA(a, 0, archive_write_header(a, entry));
+ archive_entry_free(entry);
+ assertEqualIntA(a, 10, archive_write_data(a, "1234567890", 10));
+
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(entry, 2, 20);
+ archive_entry_set_pathname(entry, "dir");
+ archive_entry_set_mode(entry, S_IFDIR | 0775);
+ archive_entry_set_size(entry, 10);
+ archive_entry_set_nlink(entry, 2);
+ assertEqualIntA(a, 0, archive_write_header(a, entry));
+ archive_entry_free(entry);
+ assertEqualIntA(a, 0, archive_write_data(a, "1234567890", 10));
+
+#if ARCHIVE_API_VERSION > 1
+ assert(0 == archive_write_finish(a));
+#else
+ archive_write_finish(a);
+#endif
+
+ /*
+ * Verify the archive format.
+ */
+ e = buff;
+
+ /* First entry is "file" */
+ assert(is_hex(e, 110)); /* Entire header is hex digits. */
+ assertEqualMem(e + 0, "070701", 6); /* Magic */
+ assertEqualMem(e + 6, "00000059", 8); /* ino */
+ assertEqualMem(e + 14, "000081b4", 8); /* Mode */
+ assertEqualMem(e + 22, "00000050", 8); /* uid */
+ assertEqualMem(e + 30, "0000005a", 8); /* gid */
+ assertEqualMem(e + 38, "00000001", 8); /* nlink */
+ assertEqualMem(e + 46, "00000001", 8); /* mtime */
+ assertEqualMem(e + 54, "0000000a", 8); /* File size */
+ assertEqualMem(e + 62, "00000000", 8); /* devmajor */
+ assertEqualMem(e + 70, "0000000c", 8); /* devminor */
+ assertEqualMem(e + 78, "00000000", 8); /* rdevmajor */
+ assertEqualMem(e + 86, "00000000", 8); /* rdevminor */
+ assertEqualMem(e + 94, "00000005", 8); /* Name size */
+ assertEqualMem(e + 102, "00000000", 8); /* CRC */
+ assertEqualMem(e + 110, "file\0\0", 6); /* Name contents */
+ assertEqualMem(e + 116, "1234567890", 10); /* File body */
+ assertEqualMem(e + 126, "\0\0", 2); /* Pad to multiple of 4 */
+ e += 128;
+
+ /* Second entry is "dir" */
+ assert(is_hex(e, 110));
+ assertEqualMem(e + 0, "070701", 6); /* Magic */
+ assertEqualMem(e + 6, "00000000", 8); /* ino */
+ assertEqualMem(e + 14, "000041fd", 8); /* Mode */
+ assertEqualMem(e + 22, "00000000", 8); /* uid */
+ assertEqualMem(e + 30, "00000000", 8); /* gid */
+ assertEqualMem(e + 38, "00000002", 8); /* nlink */
+ assertEqualMem(e + 46, "00000002", 8); /* mtime */
+ assertEqualMem(e + 54, "00000000", 8); /* File size */
+ assertEqualMem(e + 62, "00000000", 8); /* devmajor */
+ assertEqualMem(e + 70, "00000000", 8); /* devminor */
+ assertEqualMem(e + 78, "00000000", 8); /* rdevmajor */
+ assertEqualMem(e + 86, "00000000", 8); /* rdevminor */
+ assertEqualMem(e + 94, "00000004", 8); /* Name size */
+ assertEqualMem(e + 102, "00000000", 8); /* CRC */
+ assertEqualMem(e + 110, "dir\0", 4); /* name */
+ assertEqualMem(e + 114, "\0\0", 2); /* Pad to multiple of 4 */
+ e += 116;
+
+ /* TODO: Verify other types of entries. */
+
+ /* Last entry is end-of-archive marker. */
+ assert(is_hex(e, 76));
+ assertEqualMem(e + 0, "070701", 6); /* Magic */
+ assertEqualMem(e + 6, "00000000", 8); /* ino */
+ assertEqualMem(e + 14, "00000000", 8); /* Mode */
+ assertEqualMem(e + 22, "00000000", 8); /* uid */
+ assertEqualMem(e + 30, "00000000", 8); /* gid */
+ assertEqualMem(e + 38, "00000001", 8); /* nlink */
+ assertEqualMem(e + 46, "00000000", 8); /* mtime */
+ assertEqualMem(e + 54, "00000000", 8); /* File size */
+ assertEqualMem(e + 62, "00000000", 8); /* devmajor */
+ assertEqualMem(e + 70, "00000000", 8); /* devminor */
+ assertEqualMem(e + 78, "00000000", 8); /* rdevmajor */
+ assertEqualMem(e + 86, "00000000", 8); /* rdevminor */
+ assertEqualMem(e + 94, "0000000b", 8); /* Name size */
+ assertEqualMem(e + 102, "00000000", 8); /* CRC */
+ assertEqualMem(e + 110, "TRAILER!!!\0", 11); /* Name */
+ assertEqualMem(e + 121, "\0\0\0", 3); /* Pad to multiple of 4 bytes */
+ e += 124;
+
+ assertEqualInt(used, e - buff);
+
+ free(buff);
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_write_format_cpio_odc.c b/archivers/libarchive/files/libarchive/test/test_write_format_cpio_odc.c
new file mode 100644
index 00000000000..796dd7eace9
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_write_format_cpio_odc.c
@@ -0,0 +1,224 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD$");
+
+
+static int
+is_octal(const char *p, size_t l)
+{
+ while (l > 0) {
+ if (*p < '0' || *p > '7')
+ return (0);
+ --l;
+ ++p;
+ }
+ return (1);
+}
+
+/*
+ * Detailed verification that cpio 'odc' archives are written with
+ * the correct format.
+ */
+DEFINE_TEST(test_write_format_cpio_odc)
+{
+ struct archive *a;
+ struct archive_entry *entry;
+ char *buff, *e;
+ size_t buffsize = 100000;
+ size_t used;
+
+ buff = malloc(buffsize);
+
+ /* Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertEqualIntA(a, 0, archive_write_set_format_cpio(a));
+ assertEqualIntA(a, 0, archive_write_set_compression_none(a));
+ assertEqualIntA(a, 0, archive_write_open_memory(a, buff, buffsize, &used));
+
+ /*
+ * Add various files to it.
+ * TODO: Extend this to cover more filetypes.
+ */
+
+ /* "file" with 10 bytes of content */
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(entry, 1, 10);
+ archive_entry_set_pathname(entry, "file");
+ archive_entry_set_mode(entry, S_IFREG | 0664);
+ archive_entry_set_size(entry, 10);
+ archive_entry_set_uid(entry, 80);
+ archive_entry_set_gid(entry, 90);
+ archive_entry_set_dev(entry, 12);
+ archive_entry_set_ino(entry, 89);
+ archive_entry_set_nlink(entry, 2);
+ assertEqualIntA(a, 0, archive_write_header(a, entry));
+ archive_entry_free(entry);
+ assertEqualIntA(a, 10, archive_write_data(a, "1234567890", 10));
+
+ /* Hardlink to "file" with 10 bytes of content */
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(entry, 1, 10);
+ archive_entry_set_pathname(entry, "linkfile");
+ archive_entry_set_mode(entry, S_IFREG | 0664);
+ archive_entry_set_size(entry, 10);
+ archive_entry_set_uid(entry, 80);
+ archive_entry_set_gid(entry, 90);
+ archive_entry_set_dev(entry, 12);
+ archive_entry_set_ino(entry, 89);
+ archive_entry_set_nlink(entry, 2);
+ assertEqualIntA(a, 0, archive_write_header(a, entry));
+ archive_entry_free(entry);
+ assertEqualIntA(a, 10, archive_write_data(a, "1234567890", 10));
+
+ /* "dir" */
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(entry, 2, 20);
+ archive_entry_set_pathname(entry, "dir");
+ archive_entry_set_mode(entry, S_IFDIR | 0775);
+ archive_entry_set_size(entry, 10);
+ archive_entry_set_nlink(entry, 2);
+ assertEqualIntA(a, 0, archive_write_header(a, entry));
+ archive_entry_free(entry);
+ /* Write of data to dir should fail == zero bytes get written. */
+ assertEqualIntA(a, 0, archive_write_data(a, "1234567890", 10));
+
+ /* "symlink" pointing to "file" */
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(entry, 3, 30);
+ archive_entry_set_pathname(entry, "symlink");
+ archive_entry_set_mode(entry, S_IFLNK | 0664);
+ archive_entry_set_symlink(entry,"file");
+ archive_entry_set_size(entry, 0);
+ archive_entry_set_uid(entry, 88);
+ archive_entry_set_gid(entry, 98);
+ archive_entry_set_dev(entry, 12);
+ archive_entry_set_ino(entry, 90);
+ archive_entry_set_nlink(entry, 1);
+ assertEqualIntA(a, 0, archive_write_header(a, entry));
+ archive_entry_free(entry);
+ /* Write of data to symlink should fail == zero bytes get written. */
+ assertEqualIntA(a, 0, archive_write_data(a, "1234567890", 10));
+
+#if ARCHIVE_API_VERSION > 1
+ assert(0 == archive_write_finish(a));
+#else
+ archive_write_finish(a);
+#endif
+
+ /*
+ * Verify the archive format.
+ */
+ e = buff;
+
+ /* "file" */
+ assert(is_octal(e, 76)); /* Entire header is octal digits. */
+ assertEqualMem(e + 0, "070707", 6); /* Magic */
+ assertEqualMem(e + 6, "000014", 6); /* dev */
+ assertEqualMem(e + 12, "000131", 6); /* ino */
+ assertEqualMem(e + 18, "100664", 6); /* Mode */
+ assertEqualMem(e + 24, "000120", 6); /* uid */
+ assertEqualMem(e + 30, "000132", 6); /* gid */
+ assertEqualMem(e + 36, "000002", 6); /* nlink */
+ assertEqualMem(e + 42, "000000", 6); /* rdev */
+ assertEqualMem(e + 48, "00000000001", 11); /* mtime */
+ assertEqualMem(e + 59, "000005", 6); /* Name size */
+ assertEqualMem(e + 65, "00000000012", 11); /* File size */
+ assertEqualMem(e + 76, "file\0", 5); /* Name contents */
+ assertEqualMem(e + 81, "1234567890", 10); /* File contents */
+ e += 91;
+
+ /* hardlink to "file" */
+ assert(is_octal(e, 76)); /* Entire header is octal digits. */
+ assertEqualMem(e + 0, "070707", 6); /* Magic */
+ assertEqualMem(e + 6, "000014", 6); /* dev */
+ assertEqualMem(e + 12, "000131", 6); /* ino */
+ assertEqualMem(e + 18, "100664", 6); /* Mode */
+ assertEqualMem(e + 24, "000120", 6); /* uid */
+ assertEqualMem(e + 30, "000132", 6); /* gid */
+ assertEqualMem(e + 36, "000002", 6); /* nlink */
+ assertEqualMem(e + 42, "000000", 6); /* rdev */
+ assertEqualMem(e + 48, "00000000001", 11); /* mtime */
+ assertEqualMem(e + 59, "000011", 6); /* Name size */
+ assertEqualMem(e + 65, "00000000012", 11); /* File size */
+ assertEqualMem(e + 76, "linkfile\0", 9); /* Name contents */
+ assertEqualMem(e + 85, "1234567890", 10); /* File contents */
+ e += 95;
+
+ /* "dir" */
+ assert(is_octal(e, 76));
+ assertEqualMem(e + 0, "070707", 6); /* Magic */
+ assertEqualMem(e + 6, "000000", 6); /* dev */
+ assertEqualMem(e + 12, "000000", 6); /* ino */
+ assertEqualMem(e + 18, "040775", 6); /* Mode */
+ assertEqualMem(e + 24, "000000", 6); /* uid */
+ assertEqualMem(e + 30, "000000", 6); /* gid */
+ assertEqualMem(e + 36, "000002", 6); /* Nlink */
+ assertEqualMem(e + 42, "000000", 6); /* rdev */
+ assertEqualMem(e + 48, "00000000002", 11); /* mtime */
+ assertEqualMem(e + 59, "000004", 6); /* Name size */
+ assertEqualMem(e + 65, "00000000000", 11); /* File size */
+ assertEqualMem(e + 76, "dir\0", 4); /* name */
+ e += 80;
+
+ /* "symlink" pointing to "file" */
+ assert(is_octal(e, 76)); /* Entire header is octal digits. */
+ assertEqualMem(e + 0, "070707", 6); /* Magic */
+ assertEqualMem(e + 6, "000014", 6); /* dev */
+ assertEqualMem(e + 12, "000132", 6); /* ino */
+ assertEqualMem(e + 18, "120664", 6); /* Mode */
+ assertEqualMem(e + 24, "000130", 6); /* uid */
+ assertEqualMem(e + 30, "000142", 6); /* gid */
+ assertEqualMem(e + 36, "000001", 6); /* nlink */
+ assertEqualMem(e + 42, "000000", 6); /* rdev */
+ assertEqualMem(e + 48, "00000000003", 11); /* mtime */
+ assertEqualMem(e + 59, "000010", 6); /* Name size */
+ assertEqualMem(e + 65, "00000000004", 11); /* File size */
+ assertEqualMem(e + 76, "symlink\0", 8); /* Name contents */
+ assertEqualMem(e + 84, "file", 4); /* File contents == link target */
+ e += 88;
+
+ /* TODO: Verify other types of entries. */
+
+ /* Last entry is end-of-archive marker. */
+ assert(is_octal(e, 76));
+ assertEqualMem(e + 0, "070707", 6); /* Magic */
+ assertEqualMem(e + 6, "000000", 6); /* dev */
+ assertEqualMem(e + 12, "000000", 6); /* ino */
+ assertEqualMem(e + 18, "000000", 6); /* Mode */
+ assertEqualMem(e + 24, "000000", 6); /* uid */
+ assertEqualMem(e + 30, "000000", 6); /* gid */
+ assertEqualMem(e + 36, "000001", 6); /* Nlink */
+ assertEqualMem(e + 42, "000000", 6); /* rdev */
+ assertEqualMem(e + 48, "00000000000", 11); /* mtime */
+ assertEqualMem(e + 59, "000013", 6); /* Name size */
+ assertEqualMem(e + 65, "00000000000", 11); /* File size */
+ assertEqualMem(e + 76, "TRAILER!!!\0", 11); /* Name */
+ e += 87;
+
+ assertEqualInt(used, e - buff);
+
+ free(buff);
+}
diff --git a/archivers/libarchive/files/tar/bsdtar.1 b/archivers/libarchive/files/tar/bsdtar.1
index 44b7909fc7a..db6a10aa1ca 100644
--- a/archivers/libarchive/files/tar/bsdtar.1
+++ b/archivers/libarchive/files/tar/bsdtar.1
@@ -664,7 +664,7 @@ for the pax command.
.Sh HISTORY
A
.Nm tar
-command appeared in Seventh Edition Unix.
+command appeared in Seventh Edition Unix, which was released in January, 1979.
There have been numerous other implementations,
many of which extended the file format.
John Gilmore's
diff --git a/archivers/libarchive/files/tar/bsdtar.c b/archivers/libarchive/files/tar/bsdtar.c
index a1105fbd15c..d20a60dffa6 100644
--- a/archivers/libarchive/files/tar/bsdtar.c
+++ b/archivers/libarchive/files/tar/bsdtar.c
@@ -792,7 +792,9 @@ usage(struct bsdtar *bsdtar)
static void
version(void)
{
- printf("bsdtar %s - %s\n", PACKAGE_VERSION, archive_version());
+ printf("bsdtar %s - %s\n",
+ BSDTAR_VERSION_STRING,
+ archive_version());
exit(1);
}
diff --git a/archivers/libarchive/files/tar/bsdtar.h b/archivers/libarchive/files/tar/bsdtar.h
index 3117d6664f1..50f61681a82 100644
--- a/archivers/libarchive/files/tar/bsdtar.h
+++ b/archivers/libarchive/files/tar/bsdtar.h
@@ -99,7 +99,6 @@ struct bsdtar {
void bsdtar_errc(struct bsdtar *, int _eval, int _code,
const char *fmt, ...);
-void bsdtar_strmode(struct archive_entry *entry, char *bp);
void bsdtar_warnc(struct bsdtar *, int _code, const char *fmt, ...);
void cleanup_exclusions(struct bsdtar *);
void do_chdir(struct bsdtar *);
diff --git a/archivers/libarchive/files/tar/bsdtar_platform.h b/archivers/libarchive/files/tar/bsdtar_platform.h
index 707abcbda20..66852ca7525 100644
--- a/archivers/libarchive/files/tar/bsdtar_platform.h
+++ b/archivers/libarchive/files/tar/bsdtar_platform.h
@@ -49,7 +49,8 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h> /* For __FBSDID */
#else
-#define __FBSDID(a) /* null */
+/* Just leaving this macro replacement empty leads to a dangling semicolon. */
+#define __FBSDID(a) struct _undefined_hack
#endif
#ifdef HAVE_LIBARCHIVE
diff --git a/archivers/libarchive/files/tar/read.c b/archivers/libarchive/files/tar/read.c
index b52c1ee0d54..a942e85b189 100644
--- a/archivers/libarchive/files/tar/read.c
+++ b/archivers/libarchive/files/tar/read.c
@@ -291,8 +291,9 @@ list_item_verbose(struct bsdtar *bsdtar, FILE *out, struct archive_entry *entry)
}
if (!now)
time(&now);
- bsdtar_strmode(entry, tmp);
- fprintf(out, "%s %d ", tmp, (int)(st->st_nlink));
+ fprintf(out, "%s %d ",
+ archive_entry_strmode(entry),
+ (int)(st->st_nlink));
/* Use uname if it's present, else uid. */
p = archive_entry_uname(entry);
diff --git a/archivers/libarchive/files/tar/test/config.sh b/archivers/libarchive/files/tar/test/config.sh
index c983d83e571..2d884f84096 100755
--- a/archivers/libarchive/files/tar/test/config.sh
+++ b/archivers/libarchive/files/tar/test/config.sh
@@ -71,4 +71,5 @@ echo CPIO=$CPIO '('`$CPIO --version`')'
rm -rf $TESTDIR
mkdir -p $TESTDIR || exit 1
cd $TESTDIR || exit 1
+echo TESTDIR=$TESTDIR
diff --git a/archivers/libarchive/files/tar/test/test-basic.sh b/archivers/libarchive/files/tar/test/test-basic.sh
index 65ac7f52151..0564bc7220b 100755
--- a/archivers/libarchive/files/tar/test/test-basic.sh
+++ b/archivers/libarchive/files/tar/test/test-basic.sh
@@ -295,7 +295,7 @@ cd ..
echo " bsdtar -c | bsdtar -x"
mkdir copy-default
(cd original && ${BSDTAR} -cf - .) | (cd copy-default; ${BSDTAR} -xf -)
-diff -r original copy-default || echo XXX FAILED XXX
+(diff -r original copy-default || echo XXX FAILED XXX 1>&2) | head
# Exercise gzip compression (test compressed output with gunzip -t
echo " bsdtar -cz | gunzip -t"
@@ -305,59 +305,59 @@ echo " bsdtar -cz | gunzip -t"
echo " bsdtar -cz | gunzip | bsdtar -x"
mkdir copy-gzip2
(cd original && ${BSDTAR} -czf - .) | gunzip -q | (cd copy-gzip2; ${BSDTAR} -xf -)
-diff -r original copy-gzip2 || echo XXX FAILED XXX
+(diff -r original copy-gzip2 || echo XXX FAILED XXX 1>&2) | head
# Ensure our decompression works with gzip program
echo " bsdtar -c | gzip | bsdtar -x"
mkdir copy-gunzip
(cd original && ${BSDTAR} -cf - .) | gzip | (cd copy-gunzip; ${BSDTAR} -xf -)
-diff -r original copy-gunzip || echo XXX FAILED XXX
+(diff -r original copy-gunzip || echo XXX FAILED XXX 1>&2) | head
# Ensure our gzip compression/decompression work with each other
echo " bsdtar -cz | bsdtar -x"
mkdir copy-gzip-gunzip
(cd original && ${BSDTAR} -czf - .) | (cd copy-gzip-gunzip; ${BSDTAR} -xf -)
-diff -r original copy-gzip-gunzip || echo XXX FAILED XXX
+(diff -r original copy-gzip-gunzip || echo XXX FAILED XXX 1>&2) | head
# Ensure our decompression works with bzip2 program
echo " bsdtar -c | bzip2 | bsdtar -x"
mkdir copy-bunzip
(cd original && ${BSDTAR} -cf - .) | bzip2 | (cd copy-bunzip; ${BSDTAR} -xf -)
-diff -r original copy-bunzip || echo XXX FAILED XXX
+(diff -r original copy-bunzip || echo XXX FAILED XXX 1>&2) | head
# Ensure our compression works with bunzip2 program
echo " bsdtar -cy | bunzip2 | bsdtar -x"
mkdir copy-bzip2
(cd original && ${BSDTAR} -cyf - .) | bunzip2 -q | (cd copy-bzip2; ${BSDTAR} -xf -)
-diff -r original copy-bzip2 || echo XXX FAILED XXX
+(diff -r original copy-bzip2 || echo XXX FAILED XXX 1>&2) | head
# Ensure our bzip2 compression/decompression work with each other
echo " bsdtar -cy | bsdtar -x"
mkdir copy-bzip2-bunzip2
(cd original && ${BSDTAR} -cyf - .) | (cd copy-bzip2-bunzip2; ${BSDTAR} -xf -)
-diff -r original copy-bzip2-bunzip2 || echo XXX FAILED XXX
+(diff -r original copy-bzip2-bunzip2 || echo XXX FAILED XXX 1>&2) | head
# Ensure that archive listing works
echo " bsdtar -c | bsdtar -t"
(cd original && find .) | sort > list-original
(cd original && ${BSDTAR} -cf - .) | ${BSDTAR} -tf - | sed 's|/$||' | sort > list-default
-diff list-original list-default || echo XXX FAILED XXX
+(diff list-original list-default || echo XXX FAILED XXX 1>&2) | head
# Ensure that listing of deflated archives works
echo " bsdtar -cz | bsdtar -t"
(cd original && ${BSDTAR} -czf - .) | ${BSDTAR} -tf - | sed 's|/$||' | sort > list-gzip
-diff list-original list-gzip || echo XXX FAILED XXX
+(diff list-original list-gzip || echo XXX FAILED XXX 1>&2) | head
# Ensure that listing of bzip2ed archives works
echo " bsdtar -cy | bsdtar -t"
(cd original && ${BSDTAR} -cyf - .) | ${BSDTAR} -tf - | sed 's|/$||' | sort > list-bzip2
-diff list-original list-bzip2 || echo XXX FAILED XXX
+(diff list-original list-bzip2 || echo XXX FAILED XXX 1>&2) | head
# Filtering exercises different areas of the library.
echo " Convert tar archive to a tar archive"
mkdir filter-tar-tar
(cd original && ${BSDTAR} -cf - .) | ${BSDTAR} -cf - @- | (cd filter-tar-tar; ${BSDTAR} -xf -)
-diff -r original filter-tar-tar || echo XXX FAILED XXX
+(diff -r original filter-tar-tar || echo XXX FAILED XXX 1>&2) | head
# Make sure that reading and writing a tar archive doesn't change it.
echo " bsdtar -cf- @- | cmp"
@@ -368,13 +368,13 @@ ${BSDTAR} -cf - @- < original.tar | cmp - original.tar || echo XXX FAILED XXX
echo " Convert tar archive to cpio archive"
mkdir filter-tar-cpio
(cd original && ${BSDTAR} -cf - .) | ${BSDTAR} -cf - --format=cpio @- | (cd filter-tar-cpio; ${BSDTAR} -xf -)
-diff -r original filter-tar-cpio || echo XXX FAILED XXX
+(diff -r original filter-tar-cpio || echo XXX FAILED XXX 1>&2) | head
# Test basic --include selection logic
echo " Convert tar to cpio with selection"
mkdir filter-tar-selected
(cd original && ${BSDTAR} -cf - .) | ${BSDTAR} -cf - --format=cpio --include=./f3 @- | (cd filter-tar-selected; ${BSDTAR} -xf -)
-diff -r original/f3 filter-tar-selected/f3 || echo XXX FAILED XXX
+(diff -r original/f3 filter-tar-selected/f3 || echo XXX FAILED XXX 1>&2) | head
# Should be no files in copy except for 'f3'
(cd filter-tar-selected ; ls | grep -v f3 | grep .) && echo XXX FAILED XXX
@@ -383,7 +383,7 @@ echo " Convert tar to cpio selecting with wildcards"
mkdir filter-tar-selected2
(cd original && ${BSDTAR} -cf - .) | ${BSDTAR} -cf - --format=cpio --include='./f*' @- | (cd filter-tar-selected2; ${BSDTAR} -xf -)
for f in f1 f2 f3 f4 f5 f6 f7 f8 f9; do
- diff -r original/$f filter-tar-selected2/$f || echo XXX FAILED XXX
+ (diff -r original/$f filter-tar-selected2/$f || echo XXX FAILED XXX 1>&2) | head
done
# Should be no files in copy except for 'f[0-9]'
(cd filter-tar-selected2 ; ls | grep -v 'f[0-9]' | grep .) && echo XXX FAILED XXX
@@ -392,32 +392,32 @@ done
echo " bsdtar -c --format=cpio | bsdtar -x"
mkdir copy-cpio
(cd original && ${BSDTAR} -cf - --format cpio .) | (cd copy-cpio; ${BSDTAR} -xf -)
-diff -r original copy-cpio || echo XXX FAILED XXX
+(diff -r original copy-cpio || echo XXX FAILED XXX 1>&2) | head
# Ensure we can read gtar archives
echo " gtar -c | bsdtar -x"
mkdir copy-gtar
(cd original && ${GTAR} -cf - .) | (cd copy-gtar; ${BSDTAR} -xf -)
-diff -r original copy-gtar || echo XXX FAILED XXX
+(diff -r original copy-gtar || echo XXX FAILED XXX 1>&2) | head
# Ensure we can read svr4crc cpio archives
echo " cpio -H crc | bsdtar -x"
mkdir copy-svr4crc
(cd original && find . | ${CPIO} -o -H crc 2>/dev/null) | (cd copy-svr4crc; ${BSDTAR} -xf -)
-diff -r original copy-svr4crc || echo XXX FAILED XXX
+(diff -r original copy-svr4crc || echo XXX FAILED XXX 1>&2) | head
# Ensure we generate proper shar output
echo " bsdtar -c --format=shar | /bin/sh"
mkdir copy-shar
(cd original && ${BSDTAR} -cf - --format=shar --exclude=sparse .) | (cd copy-shar; /bin/sh >/dev/null)
-diff -r --exclude=sparse original copy-shar || echo XXX FAILED XXX
+(diff -r --exclude=sparse original copy-shar || echo XXX FAILED XXX 1>&2) | head
# Check that -u (update) picks up no new files
echo " bsdtar -u doesn't pick up unchanged files"
(cd original && ${BSDTAR} -cf ../test-u.tar -b 1 .)
cp test-u.tar test-u1.tar
(cd original && ${BSDTAR} -uf ../test-u1.tar .)
-diff test-u.tar test-u1.tar || echo XXX FAILED XXX
+(diff test-u.tar test-u1.tar || echo XXX FAILED XXX 1>&2) | head
# Check that -u (update) does pick up actual changed files
echo " bsdtar -u does pick up changed files"
@@ -429,4 +429,4 @@ cmp -s test-u.tar test-u2.tar && echo XXX FAILED XXX
# Now, unpack the archive and verify the contents (including the change to f0)
mkdir copy-u-test2
(cd copy-u-test2 && ${BSDTAR} -xf ../test-u2.tar)
-diff -r original copy-u-test2 || echo XXX FAILED XXX
+(diff -r original copy-u-test2 || echo XXX FAILED XXX 1>&2) | head
diff --git a/archivers/libarchive/files/tar/util.c b/archivers/libarchive/files/tar/util.c
index d4a92c9befe..c43e461eb29 100644
--- a/archivers/libarchive/files/tar/util.c
+++ b/archivers/libarchive/files/tar/util.c
@@ -199,56 +199,6 @@ yes(const char *fmt, ...)
return (0);
}
-void
-bsdtar_strmode(struct archive_entry *entry, char *bp)
-{
- static const char *perms = "?rwxrwxrwx ";
- static const mode_t permbits[] =
- { S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP,
- S_IROTH, S_IWOTH, S_IXOTH };
- mode_t mode;
- int i;
-
- /* Fill in a default string, then selectively override. */
- strcpy(bp, perms);
-
- mode = archive_entry_mode(entry);
- switch (mode & S_IFMT) {
- case S_IFREG: bp[0] = '-'; break;
- case S_IFBLK: bp[0] = 'b'; break;
- case S_IFCHR: bp[0] = 'c'; break;
- case S_IFDIR: bp[0] = 'd'; break;
- case S_IFLNK: bp[0] = 'l'; break;
- case S_IFSOCK: bp[0] = 's'; break;
-#ifdef S_IFIFO
- case S_IFIFO: bp[0] = 'p'; break;
-#endif
-#ifdef S_IFWHT
- case S_IFWHT: bp[0] = 'w'; break;
-#endif
- }
-
- for (i = 0; i < 9; i++)
- if (!(mode & permbits[i]))
- bp[i+1] = '-';
-
- if (mode & S_ISUID) {
- if (mode & S_IXUSR) bp[3] = 's';
- else bp[3] = 'S';
- }
- if (mode & S_ISGID) {
- if (mode & S_IXGRP) bp[6] = 's';
- else bp[6] = 'S';
- }
- if (mode & S_ISVTX) {
- if (mode & S_IXOTH) bp[9] = 't';
- else bp[9] = 'T';
- }
- if (archive_entry_acl_count(entry, ARCHIVE_ENTRY_ACL_TYPE_ACCESS))
- bp[10] = '+';
-}
-
-
/*
* Read lines from file and do something with each one. If option_null
* is set, lines are terminated with zero bytes; otherwise, they're
diff --git a/archivers/libarchive/files/version b/archivers/libarchive/files/version
index eb430cbb1e6..9183195ace7 100644
--- a/archivers/libarchive/files/version
+++ b/archivers/libarchive/files/version
@@ -1 +1 @@
-2.2.8 \ No newline at end of file
+2.4.0 \ No newline at end of file