diff options
91 files changed, 2973 insertions, 1375 deletions
diff --git a/archivers/libarchive/files/Makefile.am b/archivers/libarchive/files/Makefile.am index ca8a7aa516e..db075c0b461 100644 --- a/archivers/libarchive/files/Makefile.am +++ b/archivers/libarchive/files/Makefile.am @@ -8,7 +8,7 @@ AUTOMAKE_OPTIONS= foreign subdir-objects 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 tar/test/list.h cpio/test/list.h $(libarchive_test_REFFILES) $(bsdcpio_test_REFFILES) +BUILT_SOURCES= libarchive/test/list.h tar/test/list.h cpio/test/list.h # # What to test: We always test libarchive, test bsdtar and bsdcpio only @@ -48,14 +48,13 @@ dist-hook: # # Extra rules for cleanup # -CLEANFILES=$(libarchive_test_REFFILES) $(bsdcpio_test_REFFILES) - DISTCLEANFILES= tar/getdate.c tar/getdate.h \ libarchive/test/list.h \ tar/test/list.h \ cpio/test/list.h distclean-local: + -rm -rf .ref -rm -rf autom4te.cache/ -rm -f *~ @@ -118,6 +117,7 @@ libarchive_la_SOURCES= \ libarchive/archive_write_open_memory.c \ libarchive/archive_write_private.h \ libarchive/archive_write_set_compression_bzip2.c \ + libarchive/archive_write_set_compression_compress.c \ libarchive/archive_write_set_compression_gzip.c \ libarchive/archive_write_set_compression_none.c \ libarchive/archive_write_set_compression_program.c \ @@ -208,6 +208,7 @@ libarchive_test_SOURCES= \ libarchive/test/test_read_truncated.c \ libarchive/test/test_tar_filenames.c \ libarchive/test/test_tar_large.c \ + libarchive/test/test_write_compress.c \ libarchive/test/test_write_compress_program.c \ libarchive/test/test_write_disk.c \ libarchive/test/test_write_disk_hardlink.c \ @@ -223,7 +224,7 @@ libarchive_test_SOURCES= \ libarchive/test/test_write_format_tar_empty.c \ libarchive/test/test_write_open_memory.c -libarchive_test_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_builddir)/libarchive/test +libarchive_test_CPPFLAGS= -I$(top_builddir)/libarchive -I$(top_srcdir)/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 @@ -231,12 +232,13 @@ libarchive_test_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_builddir)/libarchiv libarchive/test/list.h: Makefile cat $(top_srcdir)/libarchive/test/test_*.c | grep DEFINE_TEST > libarchive/test/list.h -libarchive_TESTS_ENVIRONMENT= LIBARCHIVE_TEST_FILES=`cd $(top_builddir);/bin/pwd` +libarchive_TESTS_ENVIRONMENT= LIBARCHIVE_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/libarchive/test libarchive_test_EXTRA_DIST=\ libarchive/test/test_compat_gtar_1.tgz.uu \ libarchive/test/test_compat_tar_hardlink_1.tar.uu \ libarchive/test/test_compat_zip_1.zip.uu \ + libarchive/test/test_pax_filename_encoding.tar.gz.uu \ libarchive/test/test_read_format_gtar_sparse_1_13.tgz.uu \ libarchive/test/test_read_format_gtar_sparse_1_17.tgz.uu \ libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tgz.uu \ @@ -244,45 +246,6 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tgz.uu \ libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu -libarchive_test_REFFILES=\ - test_compat_gtar_1.tgz \ - test_compat_tar_hardlink_1.tar \ - test_compat_zip_1.zip \ - test_read_format_gtar_sparse_1_13.tgz \ - test_read_format_gtar_sparse_1_17.tgz \ - test_read_format_gtar_sparse_1_17_posix00.tgz \ - test_read_format_gtar_sparse_1_17_posix01.tgz \ - test_read_format_gtar_sparse_1_17_posix10.tgz \ - test_read_format_gtar_sparse_1_17_posix10_modified.tar - -# BSD make prefers $> here, GNU make prefers $<; $? works for both. -test_compat_gtar_1.tgz: libarchive/test/test_compat_gtar_1.tgz.uu - cat $? | uudecode - -test_compat_tar_hardlink_1.tar: libarchive/test/test_compat_tar_hardlink_1.tar.uu - cat $? | uudecode - -test_compat_zip_1.zip: libarchive/test/test_compat_zip_1.zip.uu - cat $? | uudecode - -test_read_format_gtar_sparse_1_13.tgz: libarchive/test/test_read_format_gtar_sparse_1_13.tgz.uu - cat $? | uudecode - -test_read_format_gtar_sparse_1_17.tgz: libarchive/test/test_read_format_gtar_sparse_1_17.tgz.uu - cat $? | uudecode - -test_read_format_gtar_sparse_1_17_posix00.tgz: libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tgz.uu - cat $? | uudecode - -test_read_format_gtar_sparse_1_17_posix01.tgz: libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tgz.uu - cat $? | uudecode - -test_read_format_gtar_sparse_1_17_posix10.tgz: libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tgz.uu - cat $? | uudecode - -test_read_format_gtar_sparse_1_17_posix10_modified.tar: libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu - cat $? | uudecode - # # # bsdtar source, docs, etc. @@ -343,14 +306,14 @@ bsdtar_test_SOURCES= \ bsdtar_test_EXTRA_DIST= \ tar/test/old -bsdtar_test_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_builddir)/tar/test +bsdtar_test_CPPFLAGS= -I$(top_builddir)/tar/test tar/test/list.h: Makefile cat $(top_srcdir)/tar/test/test_*.c | grep DEFINE_TEST > tar/test/list.h if BUILD_BSDTAR bsdtar_test_programs= bsdtar_test -bsdtar_TESTS_ENVIRONMENT= BSDTAR=`cd $(top_builddir);/bin/pwd`/bsdtar BSDTAR_TEST_FILES=`cd $(top_builddir);/bin/pwd` +bsdtar_TESTS_ENVIRONMENT= BSDTAR=`cd $(top_builddir);/bin/pwd`/bsdtar BSDTAR_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/tar/test else bsdtar_test_programs= bsdtar_TESTS_ENVIRONMENT= @@ -431,30 +394,19 @@ bsdcpio_test_SOURCES= \ cpio/test/test_owner_parse.c \ cpio/test/test_pathmatch.c -bsdcpio_test_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_builddir)/cpio/test +bsdcpio_test_CPPFLAGS= -I$(top_builddir)/libarchive -I$(top_srcdir)/libarchive -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_builddir);/bin/pwd` +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 -bsdcpio_test_REFFILES=\ - test_gcpio_compat_ref.bin \ - test_gcpio_compat_ref.crc \ - test_gcpio_compat_ref.newc \ - test_gcpio_compat_ref.ustar \ - test_option_f.cpio \ - test_option_m.cpio \ - test_option_t.cpio \ - test_option_t.stdout \ - test_option_tv.stdout - bsdcpio_test_EXTRA_DIST= \ cpio/test/test_gcpio_compat_ref.bin.uu \ cpio/test/test_gcpio_compat_ref.crc.uu \ @@ -465,31 +417,3 @@ bsdcpio_test_EXTRA_DIST= \ cpio/test/test_option_t.cpio.uu \ cpio/test/test_option_t.stdout.uu \ cpio/test/test_option_tv.stdout.uu - -test_gcpio_compat_ref.bin: cpio/test/test_gcpio_compat_ref.bin.uu - cat $? | uudecode - -test_gcpio_compat_ref.crc: cpio/test/test_gcpio_compat_ref.crc.uu - cat $? | uudecode - -test_gcpio_compat_ref.newc: cpio/test/test_gcpio_compat_ref.newc.uu - cat $? | uudecode - -test_gcpio_compat_ref.ustar: cpio/test/test_gcpio_compat_ref.ustar.uu - cat $? | uudecode - -test_option_f.cpio: cpio/test/test_option_f.cpio.uu - cat $? | uudecode - -test_option_m.cpio: cpio/test/test_option_m.cpio.uu - cat $? | uudecode - -test_option_t.cpio: cpio/test/test_option_t.cpio.uu - cat $? | uudecode - -test_option_t.stdout: cpio/test/test_option_t.stdout.uu - cat $? | uudecode - -test_option_tv.stdout: cpio/test/test_option_tv.stdout.uu - cat $? | uudecode - diff --git a/archivers/libarchive/files/Makefile.in b/archivers/libarchive/files/Makefile.in index 6960f4c7a2e..0bcc34d87f2 100644 --- a/archivers/libarchive/files/Makefile.in +++ b/archivers/libarchive/files/Makefile.in @@ -48,7 +48,7 @@ DIST_COMMON = README $(am__configure_deps) $(include_HEADERS) \ config.aux/ltmain.sh config.aux/missing config.aux/ylwrap \ tar/getdate.c ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/version $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ @@ -110,6 +110,7 @@ am_libarchive_la_OBJECTS = \ libarchive/libarchive_la-archive_write_open_filename.lo \ libarchive/libarchive_la-archive_write_open_memory.lo \ libarchive/libarchive_la-archive_write_set_compression_bzip2.lo \ + libarchive/libarchive_la-archive_write_set_compression_compress.lo \ libarchive/libarchive_la-archive_write_set_compression_gzip.lo \ libarchive/libarchive_la-archive_write_set_compression_none.lo \ libarchive/libarchive_la-archive_write_set_compression_program.lo \ @@ -223,6 +224,7 @@ am__objects_1 = \ libarchive/libarchive_test-archive_write_open_filename.$(OBJEXT) \ libarchive/libarchive_test-archive_write_open_memory.$(OBJEXT) \ libarchive/libarchive_test-archive_write_set_compression_bzip2.$(OBJEXT) \ + libarchive/libarchive_test-archive_write_set_compression_compress.$(OBJEXT) \ libarchive/libarchive_test-archive_write_set_compression_gzip.$(OBJEXT) \ libarchive/libarchive_test-archive_write_set_compression_none.$(OBJEXT) \ libarchive/libarchive_test-archive_write_set_compression_program.$(OBJEXT) \ @@ -279,6 +281,7 @@ am_libarchive_test_OBJECTS = $(am__objects_1) \ 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.$(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_hardlink.$(OBJEXT) \ @@ -376,7 +379,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ -LIBARCHIVE_VERSION = @LIBARCHIVE_VERSION@ +LIBARCHIVE_VERSION_NUMBER = @LIBARCHIVE_VERSION_NUMBER@ LIBARCHIVE_VERSION_STRING = @LIBARCHIVE_VERSION_STRING@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ @@ -458,7 +461,7 @@ AUTOMAKE_OPTIONS = foreign subdir-objects # lib_LTLIBRARIES = libarchive.la man_MANS = $(libarchive_man_MANS) $(bsdtar_man_MANS) $(bsdcpio_man_MANS) -BUILT_SOURCES = libarchive/test/list.h tar/test/list.h cpio/test/list.h $(libarchive_test_REFFILES) $(bsdcpio_test_REFFILES) +BUILT_SOURCES = libarchive/test/list.h tar/test/list.h cpio/test/list.h TESTS_ENVIRONMENT = $(libarchive_TESTS_ENVIRONMENT) $(bsdtar_TESTS_ENVIRONMENT) $(bsdcpio_TESTS_ENVIRONMENT) # Always build and test both bsdtar and bsdcpio as part of 'distcheck' DISTCHECK_CONFIGURE_FLAGS = --enable-bsdtar --enable-bsdcpio @@ -481,7 +484,6 @@ EXTRA_DIST = version \ # # Extra rules for cleanup # -CLEANFILES = $(libarchive_test_REFFILES) $(bsdcpio_test_REFFILES) DISTCLEANFILES = tar/getdate.c tar/getdate.h \ libarchive/test/list.h \ tar/test/list.h \ @@ -545,6 +547,7 @@ libarchive_la_SOURCES = \ libarchive/archive_write_open_memory.c \ libarchive/archive_write_private.h \ libarchive/archive_write_set_compression_bzip2.c \ + libarchive/archive_write_set_compression_compress.c \ libarchive/archive_write_set_compression_gzip.c \ libarchive/archive_write_set_compression_none.c \ libarchive/archive_write_set_compression_program.c \ @@ -638,6 +641,7 @@ libarchive_test_SOURCES = \ libarchive/test/test_read_truncated.c \ libarchive/test/test_tar_filenames.c \ libarchive/test/test_tar_large.c \ + libarchive/test/test_write_compress.c \ libarchive/test/test_write_compress_program.c \ libarchive/test/test_write_disk.c \ libarchive/test/test_write_disk_hardlink.c \ @@ -653,12 +657,13 @@ libarchive_test_SOURCES = \ libarchive/test/test_write_format_tar_empty.c \ libarchive/test/test_write_open_memory.c -libarchive_test_CPPFLAGS = -I$(top_srcdir)/libarchive -I$(top_builddir)/libarchive/test -libarchive_TESTS_ENVIRONMENT = LIBARCHIVE_TEST_FILES=`cd $(top_builddir);/bin/pwd` +libarchive_test_CPPFLAGS = -I$(top_builddir)/libarchive -I$(top_srcdir)/libarchive -I$(top_builddir)/libarchive/test +libarchive_TESTS_ENVIRONMENT = LIBARCHIVE_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/libarchive/test libarchive_test_EXTRA_DIST = \ libarchive/test/test_compat_gtar_1.tgz.uu \ libarchive/test/test_compat_tar_hardlink_1.tar.uu \ libarchive/test/test_compat_zip_1.zip.uu \ + libarchive/test/test_pax_filename_encoding.tar.gz.uu \ libarchive/test/test_read_format_gtar_sparse_1_13.tgz.uu \ libarchive/test/test_read_format_gtar_sparse_1_17.tgz.uu \ libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tgz.uu \ @@ -666,17 +671,6 @@ libarchive_test_EXTRA_DIST = \ libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tgz.uu \ libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu -libarchive_test_REFFILES = \ - test_compat_gtar_1.tgz \ - test_compat_tar_hardlink_1.tar \ - test_compat_zip_1.zip \ - test_read_format_gtar_sparse_1_13.tgz \ - test_read_format_gtar_sparse_1_17.tgz \ - test_read_format_gtar_sparse_1_17_posix00.tgz \ - test_read_format_gtar_sparse_1_17_posix01.tgz \ - test_read_format_gtar_sparse_1_17_posix10.tgz \ - test_read_format_gtar_sparse_1_17_posix10_modified.tar - # # @@ -729,11 +723,11 @@ bsdtar_test_SOURCES = \ bsdtar_test_EXTRA_DIST = \ tar/test/old -bsdtar_test_CPPFLAGS = -I$(top_srcdir)/libarchive -I$(top_builddir)/tar/test +bsdtar_test_CPPFLAGS = -I$(top_builddir)/tar/test @BUILD_BSDTAR_FALSE@bsdtar_test_programs = @BUILD_BSDTAR_TRUE@bsdtar_test_programs = bsdtar_test @BUILD_BSDTAR_FALSE@bsdtar_TESTS_ENVIRONMENT = -@BUILD_BSDTAR_TRUE@bsdtar_TESTS_ENVIRONMENT = BSDTAR=`cd $(top_builddir);/bin/pwd`/bsdtar BSDTAR_TEST_FILES=`cd $(top_builddir);/bin/pwd` +@BUILD_BSDTAR_TRUE@bsdtar_TESTS_ENVIRONMENT = BSDTAR=`cd $(top_builddir);/bin/pwd`/bsdtar BSDTAR_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/tar/test # # @@ -800,22 +794,11 @@ bsdcpio_test_SOURCES = \ cpio/test/test_owner_parse.c \ cpio/test/test_pathmatch.c -bsdcpio_test_CPPFLAGS = -I$(top_srcdir)/libarchive -I$(top_builddir)/cpio/test +bsdcpio_test_CPPFLAGS = -I$(top_builddir)/libarchive -I$(top_srcdir)/libarchive -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_builddir);/bin/pwd` -bsdcpio_test_REFFILES = \ - test_gcpio_compat_ref.bin \ - test_gcpio_compat_ref.crc \ - test_gcpio_compat_ref.newc \ - test_gcpio_compat_ref.ustar \ - test_option_f.cpio \ - test_option_m.cpio \ - test_option_t.cpio \ - test_option_t.stdout \ - test_option_tv.stdout - +@BUILD_BSDCPIO_TRUE@bsdcpio_TESTS_ENVIRONMENT = BSDCPIO=`cd $(top_builddir);/bin/pwd`/bsdcpio BSDCPIO_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/cpio/test bsdcpio_test_EXTRA_DIST = \ cpio/test/test_gcpio_compat_ref.bin.uu \ cpio/test/test_gcpio_compat_ref.crc.uu \ @@ -1030,6 +1013,9 @@ libarchive/libarchive_la-archive_write_open_memory.lo: \ libarchive/libarchive_la-archive_write_set_compression_bzip2.lo: \ libarchive/$(am__dirstamp) \ libarchive/$(DEPDIR)/$(am__dirstamp) +libarchive/libarchive_la-archive_write_set_compression_compress.lo: \ + libarchive/$(am__dirstamp) \ + libarchive/$(DEPDIR)/$(am__dirstamp) libarchive/libarchive_la-archive_write_set_compression_gzip.lo: \ libarchive/$(am__dirstamp) \ libarchive/$(DEPDIR)/$(am__dirstamp) @@ -1341,6 +1327,9 @@ libarchive/libarchive_test-archive_write_open_memory.$(OBJEXT): \ libarchive/libarchive_test-archive_write_set_compression_bzip2.$(OBJEXT): \ libarchive/$(am__dirstamp) \ libarchive/$(DEPDIR)/$(am__dirstamp) +libarchive/libarchive_test-archive_write_set_compression_compress.$(OBJEXT): \ + libarchive/$(am__dirstamp) \ + libarchive/$(DEPDIR)/$(am__dirstamp) libarchive/libarchive_test-archive_write_set_compression_gzip.$(OBJEXT): \ libarchive/$(am__dirstamp) \ libarchive/$(DEPDIR)/$(am__dirstamp) @@ -1512,6 +1501,9 @@ libarchive/test/libarchive_test-test_tar_filenames.$(OBJEXT): \ libarchive/test/libarchive_test-test_tar_large.$(OBJEXT): \ libarchive/test/$(am__dirstamp) \ libarchive/test/$(DEPDIR)/$(am__dirstamp) +libarchive/test/libarchive_test-test_write_compress.$(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) @@ -1666,6 +1658,8 @@ mostlyclean-compile: -rm -f libarchive/libarchive_la-archive_write_open_memory.lo -rm -f libarchive/libarchive_la-archive_write_set_compression_bzip2.$(OBJEXT) -rm -f libarchive/libarchive_la-archive_write_set_compression_bzip2.lo + -rm -f libarchive/libarchive_la-archive_write_set_compression_compress.$(OBJEXT) + -rm -f libarchive/libarchive_la-archive_write_set_compression_compress.lo -rm -f libarchive/libarchive_la-archive_write_set_compression_gzip.$(OBJEXT) -rm -f libarchive/libarchive_la-archive_write_set_compression_gzip.lo -rm -f libarchive/libarchive_la-archive_write_set_compression_none.$(OBJEXT) @@ -1729,6 +1723,7 @@ mostlyclean-compile: -rm -f libarchive/libarchive_test-archive_write_open_filename.$(OBJEXT) -rm -f libarchive/libarchive_test-archive_write_open_memory.$(OBJEXT) -rm -f libarchive/libarchive_test-archive_write_set_compression_bzip2.$(OBJEXT) + -rm -f libarchive/libarchive_test-archive_write_set_compression_compress.$(OBJEXT) -rm -f libarchive/libarchive_test-archive_write_set_compression_gzip.$(OBJEXT) -rm -f libarchive/libarchive_test-archive_write_set_compression_none.$(OBJEXT) -rm -f libarchive/libarchive_test-archive_write_set_compression_program.$(OBJEXT) @@ -1784,6 +1779,7 @@ mostlyclean-compile: -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.$(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_hardlink.$(OBJEXT) @@ -1884,6 +1880,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_la-archive_write_open_filename.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_la-archive_write_open_memory.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_la-archive_write_set_compression_bzip2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_la-archive_write_set_compression_compress.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_la-archive_write_set_compression_gzip.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_la-archive_write_set_compression_none.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_la-archive_write_set_compression_program.Plo@am__quote@ @@ -1935,6 +1932,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_open_filename.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_open_memory.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_bzip2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_compress.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_gzip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_none.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_program.Po@am__quote@ @@ -1990,6 +1988,7 @@ distclean-compile: @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.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_hardlink.Po@am__quote@ @@ -2317,6 +2316,13 @@ libarchive/libarchive_la-archive_write_set_compression_bzip2.lo: libarchive/arch @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_write_set_compression_bzip2.lo `test -f 'libarchive/archive_write_set_compression_bzip2.c' || echo '$(srcdir)/'`libarchive/archive_write_set_compression_bzip2.c +libarchive/libarchive_la-archive_write_set_compression_compress.lo: libarchive/archive_write_set_compression_compress.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_write_set_compression_compress.lo -MD -MP -MF libarchive/$(DEPDIR)/libarchive_la-archive_write_set_compression_compress.Tpo -c -o libarchive/libarchive_la-archive_write_set_compression_compress.lo `test -f 'libarchive/archive_write_set_compression_compress.c' || echo '$(srcdir)/'`libarchive/archive_write_set_compression_compress.c +@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_la-archive_write_set_compression_compress.Tpo libarchive/$(DEPDIR)/libarchive_la-archive_write_set_compression_compress.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_compression_compress.c' object='libarchive/libarchive_la-archive_write_set_compression_compress.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_write_set_compression_compress.lo `test -f 'libarchive/archive_write_set_compression_compress.c' || echo '$(srcdir)/'`libarchive/archive_write_set_compression_compress.c + libarchive/libarchive_la-archive_write_set_compression_gzip.lo: libarchive/archive_write_set_compression_gzip.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_write_set_compression_gzip.lo -MD -MP -MF libarchive/$(DEPDIR)/libarchive_la-archive_write_set_compression_gzip.Tpo -c -o libarchive/libarchive_la-archive_write_set_compression_gzip.lo `test -f 'libarchive/archive_write_set_compression_gzip.c' || echo '$(srcdir)/'`libarchive/archive_write_set_compression_gzip.c @am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_la-archive_write_set_compression_gzip.Tpo libarchive/$(DEPDIR)/libarchive_la-archive_write_set_compression_gzip.Plo @@ -3549,6 +3555,20 @@ libarchive/libarchive_test-archive_write_set_compression_bzip2.obj: libarchive/a @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_write_set_compression_bzip2.obj `if test -f 'libarchive/archive_write_set_compression_bzip2.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_compression_bzip2.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_compression_bzip2.c'; fi` +libarchive/libarchive_test-archive_write_set_compression_compress.o: libarchive/archive_write_set_compression_compress.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_compression_compress.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_compress.Tpo -c -o libarchive/libarchive_test-archive_write_set_compression_compress.o `test -f 'libarchive/archive_write_set_compression_compress.c' || echo '$(srcdir)/'`libarchive/archive_write_set_compression_compress.c +@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_compress.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_compress.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_compression_compress.c' object='libarchive/libarchive_test-archive_write_set_compression_compress.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_write_set_compression_compress.o `test -f 'libarchive/archive_write_set_compression_compress.c' || echo '$(srcdir)/'`libarchive/archive_write_set_compression_compress.c + +libarchive/libarchive_test-archive_write_set_compression_compress.obj: libarchive/archive_write_set_compression_compress.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_compression_compress.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_compress.Tpo -c -o libarchive/libarchive_test-archive_write_set_compression_compress.obj `if test -f 'libarchive/archive_write_set_compression_compress.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_compression_compress.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_compression_compress.c'; fi` +@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_compress.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_compress.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_compression_compress.c' object='libarchive/libarchive_test-archive_write_set_compression_compress.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_write_set_compression_compress.obj `if test -f 'libarchive/archive_write_set_compression_compress.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_compression_compress.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_compression_compress.c'; fi` + libarchive/libarchive_test-archive_write_set_compression_gzip.o: libarchive/archive_write_set_compression_gzip.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_compression_gzip.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_gzip.Tpo -c -o libarchive/libarchive_test-archive_write_set_compression_gzip.o `test -f 'libarchive/archive_write_set_compression_gzip.c' || echo '$(srcdir)/'`libarchive/archive_write_set_compression_gzip.c @am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_gzip.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_gzip.Po @@ -4319,6 +4339,20 @@ libarchive/test/libarchive_test-test_tar_large.obj: libarchive/test/test_tar_lar @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.o: libarchive/test/test_write_compress.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_compress.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress.Tpo -c -o libarchive/test/libarchive_test-test_write_compress.o `test -f 'libarchive/test/test_write_compress.c' || echo '$(srcdir)/'`libarchive/test/test_write_compress.c +@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_compress.c' object='libarchive/test/libarchive_test-test_write_compress.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_compress.o `test -f 'libarchive/test/test_write_compress.c' || echo '$(srcdir)/'`libarchive/test/test_write_compress.c + +libarchive/test/libarchive_test-test_write_compress.obj: libarchive/test/test_write_compress.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_compress.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress.Tpo -c -o libarchive/test/libarchive_test-test_write_compress.obj `if test -f 'libarchive/test/test_write_compress.c'; then $(CYGPATH_W) 'libarchive/test/test_write_compress.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_compress.c'; fi` +@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_compress.c' object='libarchive/test/libarchive_test-test_write_compress.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_compress.obj `if test -f 'libarchive/test/test_write_compress.c'; then $(CYGPATH_W) 'libarchive/test/test_write_compress.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_compress.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 @@ -4977,7 +5011,6 @@ install-strip: mostlyclean-generic: clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -5104,6 +5137,7 @@ dist-hook: cd $(distdir)/doc && ./update.sh distclean-local: + -rm -rf .ref -rm -rf autom4te.cache/ -rm -f *~ @@ -5113,66 +5147,11 @@ distclean-local: libarchive/test/list.h: Makefile cat $(top_srcdir)/libarchive/test/test_*.c | grep DEFINE_TEST > libarchive/test/list.h -# BSD make prefers $> here, GNU make prefers $<; $? works for both. -test_compat_gtar_1.tgz: libarchive/test/test_compat_gtar_1.tgz.uu - cat $? | uudecode - -test_compat_tar_hardlink_1.tar: libarchive/test/test_compat_tar_hardlink_1.tar.uu - cat $? | uudecode - -test_compat_zip_1.zip: libarchive/test/test_compat_zip_1.zip.uu - cat $? | uudecode - -test_read_format_gtar_sparse_1_13.tgz: libarchive/test/test_read_format_gtar_sparse_1_13.tgz.uu - cat $? | uudecode - -test_read_format_gtar_sparse_1_17.tgz: libarchive/test/test_read_format_gtar_sparse_1_17.tgz.uu - cat $? | uudecode - -test_read_format_gtar_sparse_1_17_posix00.tgz: libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tgz.uu - cat $? | uudecode - -test_read_format_gtar_sparse_1_17_posix01.tgz: libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tgz.uu - cat $? | uudecode - -test_read_format_gtar_sparse_1_17_posix10.tgz: libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tgz.uu - cat $? | uudecode - -test_read_format_gtar_sparse_1_17_posix10_modified.tar: libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu - cat $? | uudecode - tar/test/list.h: Makefile cat $(top_srcdir)/tar/test/test_*.c | grep DEFINE_TEST > tar/test/list.h cpio/test/list.h: Makefile cat $(top_srcdir)/cpio/test/test_*.c | grep DEFINE_TEST > cpio/test/list.h - -test_gcpio_compat_ref.bin: cpio/test/test_gcpio_compat_ref.bin.uu - cat $? | uudecode - -test_gcpio_compat_ref.crc: cpio/test/test_gcpio_compat_ref.crc.uu - cat $? | uudecode - -test_gcpio_compat_ref.newc: cpio/test/test_gcpio_compat_ref.newc.uu - cat $? | uudecode - -test_gcpio_compat_ref.ustar: cpio/test/test_gcpio_compat_ref.ustar.uu - cat $? | uudecode - -test_option_f.cpio: cpio/test/test_option_f.cpio.uu - cat $? | uudecode - -test_option_m.cpio: cpio/test/test_option_m.cpio.uu - cat $? | uudecode - -test_option_t.cpio: cpio/test/test_option_t.cpio.uu - cat $? | uudecode - -test_option_t.stdout: cpio/test/test_option_t.stdout.uu - cat $? | uudecode - -test_option_tv.stdout: cpio/test/test_option_tv.stdout.uu - cat $? | uudecode # 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 991509e47d8..eff863517ba 100644 --- a/archivers/libarchive/files/NEWS +++ b/archivers/libarchive/files/NEWS @@ -1,9 +1,19 @@ -Mar 14, 2008: libarchive 2.4.14 released. This is identical to 2.4.13 - except it contains a one-line fix to the uname/gname problem - introduced by the Feb 25 UTF-8 fix. This bug makes libarchive - refuse to add a file to a pax archive if it has a valid gname - but not a valid uname. In some cases, it can also cause the - uname to be stored for the gname. + +Mar 15, 2008: libarchive 2.5.0b released +Mar 15, 2008: bsdcpio now seems to correctly write hardlinks into newc, + ustar, and old cpio archives. Just a little more testing before + bsdcpio 1.0 becomes a reality. +Mar 15, 2008: I think the new linkify() interface is finally handling + all known hardlink strategies. +Mar 15, 2008: Mtree read fixes from Joerg Sonnenberger. +Mar 15, 2008: Many new bsdtar and bsdcpio options from Joerg Sonnenberger. +Mar 15, 2008: test harnesses no longer require uudecode; they + now have built-in decoding logic that decodes the reference + files as they are needed. + +Mar 14, 2008: libarchive 2.4.14 released; identical to 2.4.13 except for + a point fix for gname/uname mixup in pax format that was introduced + with the UTF-8 fixes. Feb 26, 2008: libarchive 2.4.13 released Feb 25, 2008: Handle path, linkname, gname, or uname that can't be converted diff --git a/archivers/libarchive/files/config.h.in b/archivers/libarchive/files/config.h.in index 87536d5d664..6226b894f2e 100644 --- a/archivers/libarchive/files/config.h.in +++ b/archivers/libarchive/files/config.h.in @@ -129,6 +129,9 @@ /* Define to 1 if you have the `fsetxattr' function. */ #undef HAVE_FSETXATTR +/* Define to 1 if you have the `fstat' function. */ +#undef HAVE_FSTAT + /* Define to 1 if you have the `ftruncate' function. */ #undef HAVE_FTRUNCATE @@ -141,6 +144,9 @@ /* Define to 1 if you have the `getopt_long' function. */ #undef HAVE_GETOPT_LONG +/* Define to 1 if you have the `getpid' function. */ +#undef HAVE_GETPID + /* Define to 1 if you have the `getxattr' function. */ #undef HAVE_GETXATTR @@ -398,7 +404,7 @@ #undef HAVE_ZLIB_H /* Version number of libarchive as a single integer */ -#undef LIBARCHIVE_VERSION +#undef LIBARCHIVE_VERSION_NUMBER /* Version number of libarchive */ #undef LIBARCHIVE_VERSION_STRING diff --git a/archivers/libarchive/files/configure b/archivers/libarchive/files/configure index 63e707eb91b..b902548d282 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.4.14. +# Generated by GNU Autoconf 2.61 for libarchive 2.5.0b. # # 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.4.14' -PACKAGE_STRING='libarchive 2.4.14' +PACKAGE_VERSION='2.5.0b' +PACKAGE_STRING='libarchive 2.5.0b' PACKAGE_BUGREPORT='kientzle@freebsd.org' ac_unique_file="libarchive" @@ -832,7 +832,7 @@ ARCHIVE_LIBTOOL_VERSION BSDCPIO_VERSION_STRING BSDTAR_VERSION_STRING LIBARCHIVE_VERSION_STRING -LIBARCHIVE_VERSION +LIBARCHIVE_VERSION_NUMBER CC CFLAGS LDFLAGS @@ -1408,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.4.14 to adapt to many kinds of systems. +\`configure' configures libarchive 2.5.0b to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1478,7 +1478,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libarchive 2.4.14:";; + short | recursive ) echo "Configuration of libarchive 2.5.0b:";; esac cat <<\_ACEOF @@ -1596,7 +1596,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libarchive configure 2.4.14 +libarchive configure 2.5.0b generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1610,7 +1610,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.4.14, which was +It was created by libarchive $as_me 2.5.0b, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -2304,7 +2304,7 @@ fi # Define the identity of the package. PACKAGE='libarchive' - VERSION='2.4.14' + VERSION='2.5.0b' cat >>confdefs.h <<_ACEOF @@ -2451,11 +2451,49 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' -# Shell magic to compute Major/minor/etc from full version stamp. -# This gets a little hairy... +# Libtool versioning uses different conventions on different +# platforms. At least on FreeBSD, libtool uses an overly complex +# convention that attempts to solve problems that most people just +# don't have and which just causes confusion for most end users. +ARCHIVE_MAJOR=$(( 2005000 / 1000000 )) +ARCHIVE_MINOR=$(( (2005000 / 1000) % 1000 )) +ARCHIVE_REVISION=$(( 2005000 % 1000 )) +ARCHIVE_LIBTOOL_MAJOR=`echo $((${ARCHIVE_MAJOR} + ${ARCHIVE_MINOR}))` +ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_LIBTOOL_MAJOR:$ARCHIVE_REVISION:$ARCHIVE_MINOR + +# Stick the version numbers into config.h + +cat >>confdefs.h <<\_ACEOF +#define LIBARCHIVE_VERSION_STRING "2.5.0b" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define LIBARCHIVE_VERSION_NUMBER "2005000" +_ACEOF + +cat >>confdefs.h <<\_ACEOF +#define BSDCPIO_VERSION_STRING "0.9.9a" +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define BSDTAR_VERSION_STRING "2.5.0b" +_ACEOF + + +# The shell variables here must be the same as the AC_SUBST() variables +# below, but the shell variable names apparently cannot be the same as +# the m4 macro names above. Why? Ask autoconf. +BSDCPIO_VERSION_STRING=0.9.9a +BSDTAR_VERSION_STRING=2.5.0b +LIBARCHIVE_VERSION_STRING=2.5.0b +LIBARCHIVE_VERSION_NUMBER=2005000 # Substitute the above version numbers into the various files below. +# Yes, I believe this is the fourth time we define what are essentially +# the same symbols. Why? Ask autoconf. @@ -4524,7 +4562,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4527 "configure"' > conftest.$ac_ext + echo '#line 4565 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7255,11 +7293,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:7296: $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:7300: \$? = $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 +7561,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:7564: $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:7568: \$? = $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 +7665,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:7668: $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:7672: \$? = $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 +9973,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 9976 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10035,7 +10073,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 10076 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12371,11 +12409,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:12412: $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:12416: \$? = $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 +12513,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:12516: $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:12520: \$? = $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 +14083,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:14086: $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:14090: \$? = $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 +14187,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:14190: $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:14194: \$? = $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 +16385,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:16388: $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:16392: \$? = $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 +16653,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:16656: $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:16660: \$? = $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 +16757,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:16760: $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:16764: \$? = $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 @@ -24817,7 +24855,7 @@ done -for ac_func in chflags chown fchdir fchflags fchmod fchown futimes +for ac_func in chflags chown fchdir fchflags fchmod fchown fstat do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -24913,7 +24951,9 @@ done -for ac_func in ftruncate geteuid getopt_long + + +for ac_func in ftruncate futimes geteuid getopt_long getpid do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -27394,48 +27434,6 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs - -# Autoconf assigns the version above to 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.9.0 - -# Peel off first three numbers major.minor.revision -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 -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 - -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 @@ -27785,7 +27783,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.4.14, which was +This file was extended by libarchive $as_me 2.5.0b, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -27838,7 +27836,7 @@ Report bugs to <bug-autoconf@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -libarchive config.status 2.4.14 +libarchive config.status 2.5.0b configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" @@ -28081,7 +28079,7 @@ 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 +LIBARCHIVE_VERSION_NUMBER!$LIBARCHIVE_VERSION_NUMBER$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim diff --git a/archivers/libarchive/files/configure.ac b/archivers/libarchive/files/configure.ac index eae9bebae98..5baf9e8c202 100644 --- a/archivers/libarchive/files/configure.ac +++ b/archivers/libarchive/files/configure.ac @@ -1,10 +1,22 @@ -#Process this file with autoconf to produce a configure script. +dnl Process this file with autoconf to produce a configure script. -# M4 magic to pull in the version from a separate file -# so we don't have to edit this file for routine version updates -m4_define([ARCHIVE_VERS],m4_include([version])) +dnl First, define all of the version numbers up front. +dnl In particular, this allows the version macro to be used in AC_INIT -AC_INIT([libarchive],ARCHIVE_VERS(),[kientzle@freebsd.org]) +dnl These first two version numbers are updated automatically on each release. +m4_define([LIBARCHIVE_VERSION_S],[2.5.0b]) +m4_define([LIBARCHIVE_VERSION_N],[2005000]) + +dnl bsdtar versioning tracks libarchive +m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S()) +dnl bsdcpio is still versioning separately +m4_define([BSDCPIO_VERSION_S],[0.9.9a]) + +# +# Now starts the "real" configure script. +# + +AC_INIT([libarchive],LIBARCHIVE_VERSION_S(),[kientzle@freebsd.org]) # Make sure the srcdir contains "libarchive" directory AC_CONFIG_SRCDIR([libarchive]) # Use auxiliary subscripts from this subdirectory (cleans up root) @@ -12,49 +24,42 @@ AC_CONFIG_AUX_DIR([config.aux]) # Must follow AC_CONFIG macros above... AM_INIT_AUTOMAKE() -# Shell magic to compute Major/minor/etc from full version stamp. -# This gets a little hairy... -AC_CONFIG_COMMANDS_PRE([ -# Autoconf assigns the version above to 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.9.0 - -# Peel off first three numbers major.minor.revision -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 -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. +# Libtool versioning uses different conventions on different +# platforms. At least on FreeBSD, libtool uses an overly complex +# convention that attempts to solve problems that most people just +# don't have and which just causes confusion for most end users. +ARCHIVE_MAJOR=$(( LIBARCHIVE_VERSION_N() / 1000000 )) +ARCHIVE_MINOR=$(( (LIBARCHIVE_VERSION_N() / 1000) % 1000 )) +ARCHIVE_REVISION=$(( LIBARCHIVE_VERSION_N() % 1000 )) 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", +# Stick the version numbers into config.h +AC_DEFINE([LIBARCHIVE_VERSION_STRING],"LIBARCHIVE_VERSION_S()", [Version number of libarchive]) -AC_DEFINE_UNQUOTED([LIBARCHIVE_VERSION], - "$LIBARCHIVE_VERSION", +AC_DEFINE_UNQUOTED([LIBARCHIVE_VERSION_NUMBER],"LIBARCHIVE_VERSION_N()", [Version number of libarchive as a single integer]) -AC_DEFINE_UNQUOTED([BSDCPIO_VERSION_STRING], - "$BSDCPIO_VERSION_STRING", +AC_DEFINE([BSDCPIO_VERSION_STRING],"BSDCPIO_VERSION_S()", [Version number of bsdcpio]) -AC_DEFINE_UNQUOTED([BSDTAR_VERSION_STRING], - "$BSDTAR_VERSION_STRING", +AC_DEFINE([BSDTAR_VERSION_STRING],"BSDTAR_VERSION_S()", [Version number of bsdtar]) -]) + +# The shell variables here must be the same as the AC_SUBST() variables +# below, but the shell variable names apparently cannot be the same as +# the m4 macro names above. Why? Ask autoconf. +BSDCPIO_VERSION_STRING=BSDCPIO_VERSION_S() +BSDTAR_VERSION_STRING=BSDTAR_VERSION_S() +LIBARCHIVE_VERSION_STRING=LIBARCHIVE_VERSION_S() +LIBARCHIVE_VERSION_NUMBER=LIBARCHIVE_VERSION_N() # Substitute the above version numbers into the various files below. +# Yes, I believe this is the fourth time we define what are essentially +# the same symbols. Why? Ask autoconf. 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_SUBST(LIBARCHIVE_VERSION_NUMBER) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile]) @@ -235,8 +240,8 @@ AC_FUNC_STAT AC_FUNC_STRERROR_R AC_FUNC_STRFTIME AC_FUNC_VPRINTF -AC_CHECK_FUNCS([chflags chown fchdir fchflags fchmod fchown futimes]) -AC_CHECK_FUNCS([ftruncate geteuid getopt_long]) +AC_CHECK_FUNCS([chflags chown fchdir fchflags fchmod fchown fstat]) +AC_CHECK_FUNCS([ftruncate futimes geteuid getopt_long getpid]) AC_CHECK_FUNCS([lchflags lchmod lchown]) AC_CHECK_FUNCS([lutimes memmove memset mkdir mkfifo mknod]) AC_CHECK_FUNCS([nl_langinfo poll select setenv setlocale]) diff --git a/archivers/libarchive/files/cpio/bsdcpio.1 b/archivers/libarchive/files/cpio/bsdcpio.1 index 70889dfe036..d4a18578528 100644 --- a/archivers/libarchive/files/cpio/bsdcpio.1 +++ b/archivers/libarchive/files/cpio/bsdcpio.1 @@ -59,8 +59,8 @@ 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 +Read an archive from standard input (unless overriden) and extract the +contents to disk or (if the .Fl t option is specified) list the contents to standard output. @@ -69,7 +69,7 @@ one of the patterns will be extracted. .It Fl o Output. Read a list of filenames from standard input and produce a new archive -on standard output containing the specified items. +on standard output (unless overriden) containing the specified items. .It Fl p Pass-through. Read a list of filenames from standard input and copy the files to the @@ -80,12 +80,21 @@ specified directory. Unless specifically stated otherwise, options are applicable in all operating modes. .Bl -tag -width indent +.It Fl A +(o mode only) +Append to the specified archive. +(Not yet implemented.) .It Fl a (o and p modes) Reset access times on files after they are read. .It Fl B (o mode only) Block output to records of 5120 bytes. +.It Fl C Ar size +(o mode only) +Block output to records of +.Ar size +bytes. .It Fl c (o mode only) Use the old POSIX portable character format. @@ -94,6 +103,14 @@ Equivalent to .It Fl d (i and p modes) Create directories as necessary. +.It Fl E Ar file +(i mode only) +Read list of file name patterns from +.Ar file +to list and extract. +.It Fl F Ar file +Read archive from or write archive to +.Ar file . .It Fl f Ar pattern (i mode only) Ignore files that match @@ -125,9 +142,18 @@ for more complete information about the formats currently supported by the underlying .Xr libarchive 3 library. +.It Fl I Ar file +Read archive from +.Ar file . .It Fl i Input mode. See above for description. +.It Fl -insecure +(i and p mode only) +Disable security checks during extraction or copying. +This allows extraction via symbolic links and path names containing +.Sq .. +in the name. .It Fl L (o and p modes) All symbolic links will be followed. @@ -141,6 +167,9 @@ instead of copying. (i and p modes) Set file modification time on created files to match those in the source. +.It Fl O Ar file +Write archive to +.Ar file . .It Fl o Output mode. See above for description. @@ -194,14 +223,17 @@ provide a detailed listing of each file. Print the program version information and exit. .It Fl y (o mode only) -Compress the archive with bzip2-compatible compression before -writing to stdout. +Compress the archive with bzip2-compatible compression before writing it. In input mode, this option is ignored; bzip2 compression is recognized automatically on input. +.It Fl Z +(o mode only) +Compress the archive with compress-compatible compression before writing it. +In input mode, this option is ignored; +compression is recognized automatically on input. .It Fl z (o mode only) -Compress the archive with gzip-compatible compression before writing -it to stdout. +Compress the archive with gzip-compatible compression before writing it. In input mode, this option is ignored; gzip compression is recognized automatically on input. .El diff --git a/archivers/libarchive/files/cpio/cmdline.c b/archivers/libarchive/files/cpio/cmdline.c index 06689325707..eb232e255d2 100644 --- a/archivers/libarchive/files/cpio/cmdline.c +++ b/archivers/libarchive/files/cpio/cmdline.c @@ -66,7 +66,7 @@ struct option { */ -static const char *cpio_opts = "aBcdf:H:hijLlmopR:rtuvW:yz"; +static const char *cpio_opts = "AaBC:F:O:cdE:f:H:hijLlmopR:rtuvW:yZz"; /* * On systems that lack getopt_long, long options can be specified @@ -82,8 +82,10 @@ static const char *cpio_opts = "aBcdf:H:hijLlmopR:rtuvW:yz"; * sorted, as the -W logic below relies on it. */ static const struct option cpio_longopts[] = { + { "file", required_argument, NULL, 'F' }, { "format", required_argument, NULL, 'H' }, { "help", no_argument, NULL, 'h' }, + { "insecure", no_argument, NULL, OPTION_INSECURE }, { "owner", required_argument, NULL, 'R' }, { "quiet", no_argument, NULL, OPTION_QUIET }, { "verbose", no_argument, NULL, 'v' }, diff --git a/archivers/libarchive/files/cpio/cpio.c b/archivers/libarchive/files/cpio/cpio.c index 9f24d9c4626..c806e4f151f 100644 --- a/archivers/libarchive/files/cpio/cpio.c +++ b/archivers/libarchive/files/cpio/cpio.c @@ -60,15 +60,13 @@ __FBSDID("$FreeBSD$"); 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 int entry_to_archive(struct cpio *, struct archive_entry *); +static int file_to_archive(struct cpio *, const char *); 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 int process_lines(struct cpio *cpio, const char *pathname, - int (*process)(struct cpio *, const char *)); static void restore_time(struct cpio *, struct archive_entry *, const char *, int fd); static void usage(void); @@ -77,6 +75,7 @@ static void version(FILE *); int main(int argc, char *argv[]) { + static char buff[16384]; struct cpio _cpio; /* Allocated on stack. */ struct cpio *cpio; int uid, gid; @@ -84,6 +83,8 @@ main(int argc, char *argv[]) cpio = &_cpio; memset(cpio, 0, sizeof(*cpio)); + cpio->buff = buff; + cpio->buff_size = sizeof(buff); /* Need cpio_progname before calling cpio_warnc. */ if (*argv == NULL) @@ -107,37 +108,60 @@ main(int argc, char *argv[]) cpio->format = "odc"; /* Default format */ cpio->extract_flags = ARCHIVE_EXTRACT_NO_AUTODIR; cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER; + cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS; + cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT; /* TODO: If run by root, set owner as well. */ cpio->bytes_per_block = 512; cpio->filename = NULL; while ((opt = cpio_getopt(cpio)) != -1) { switch (opt) { + case 'A': /* NetBSD/OpenBSD */ + cpio->option_append = 1; + break; case 'a': /* POSIX 1997 */ cpio->option_atime_restore = 1; break; case 'B': /* POSIX 1997 */ cpio->bytes_per_block = 5120; break; + case 'C': /* NetBSD/OpenBSD */ + cpio->bytes_per_block = atoi(optarg); + if (cpio->bytes_per_block <= 0) + cpio_errc(1, 0, "Invalid blocksize %s", optarg); + break; case 'c': /* POSIX 1997 */ cpio->format = "odc"; break; case 'd': /* POSIX 1997 */ cpio->extract_flags &= ~ARCHIVE_EXTRACT_NO_AUTODIR; break; + case 'E': /* NetBSD/OpenBSD */ + include_from_file(cpio, optarg); + break; + case 'F': /* NetBSD/OpenBSD/GNU cpio */ + cpio->filename = optarg; + break; case 'f': /* POSIX 1997 */ exclude(cpio, optarg); break; - case 'H': /* GNU cpio, also --format */ + case 'H': /* GNU cpio (also --format) */ cpio->format = optarg; break; case 'h': long_help(); break; + case 'I': /* NetBSD/OpenBSD */ + cpio->filename = optarg; + break; case 'i': /* POSIX 1997 */ cpio->mode = opt; break; - case 'L': /* GNU cpio, BSD convention */ + case OPTION_INSECURE: + cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_SYMLINKS; + cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT; + break; + case 'L': /* GNU cpio */ cpio->option_follow_links = 1; break; case 'l': /* POSIX 1997 */ @@ -146,6 +170,9 @@ main(int argc, char *argv[]) case 'm': /* POSIX 1997 */ cpio->extract_flags |= ARCHIVE_EXTRACT_TIME; break; + case 'O': /* GNU cpio */ + cpio->filename = optarg; + break; case 'o': /* POSIX 1997 */ cpio->mode = opt; break; @@ -190,6 +217,9 @@ main(int argc, char *argv[]) case 'y': /* tar convention */ cpio->compress = opt; break; + case 'Z': /* tar convention */ + cpio->compress = opt; + break; case 'z': /* tar convention */ cpio->compress = opt; break; @@ -311,9 +341,12 @@ version(FILE *out) static void mode_out(struct cpio *cpio) { + struct archive_entry *entry, *spare; unsigned long blocks; int r; + if (cpio->option_append) + cpio_errc(1, 0, "Append mode not yet supported."); cpio->archive = archive_write_new(); if (cpio->archive == NULL) cpio_errc(1, 0, "Failed to allocate archive object"); @@ -324,6 +357,9 @@ mode_out(struct cpio *cpio) case 'z': archive_write_set_compression_gzip(cpio->archive); break; + case 'Z': + archive_write_set_compression_compress(cpio->archive); + break; default: archive_write_set_compression_none(cpio->archive); break; @@ -333,11 +369,26 @@ mode_out(struct cpio *cpio) 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(); + archive_entry_linkresolver_set_strategy(cpio->linkresolver, + archive_format(cpio->archive)); r = archive_write_open_file(cpio->archive, cpio->filename); if (r != ARCHIVE_OK) cpio_errc(1, 0, archive_error_string(cpio->archive)); - process_lines(cpio, "-", out_file); + process_lines(cpio, "-", file_to_archive); + + /* + * The hardlink detection may have queued up a couple of entries + * that can now be flushed. + */ + entry = NULL; + archive_entry_linkify(cpio->linkresolver, &entry, &spare); + while (entry != NULL) { + entry_to_archive(cpio, entry); + archive_entry_free(entry); + entry = NULL; + archive_entry_linkify(cpio->linkresolver, &entry, &spare); + } r = archive_write_close(cpio->archive); if (r != ARCHIVE_OK) @@ -352,83 +403,125 @@ mode_out(struct cpio *cpio) archive_write_finish(cpio->archive); } -static int -out_file(struct cpio *cpio, const char *path) -{ - const char *destpath; - - if (cpio->option_rename) - destpath = cpio_rename(path); - else - destpath = path; - if (destpath == NULL) - return (0); - return (file_to_archive(cpio, path, destpath)); -} - /* * This is used by both out mode (to copy objects from disk into * an archive) and pass mode (to copy objects from disk to * an archive_write_disk "archive"). */ static int -file_to_archive(struct cpio *cpio, const char *srcpath, const char *destpath) +file_to_archive(struct cpio *cpio, const char *srcpath) { - static char buff[16384]; struct stat st; - struct archive_entry *entry; - const char *linkname; - int fd = -1; - ssize_t len; + struct archive_entry *entry, *spare; + int lnklen; int r; - if (cpio->verbose) - fprintf(stderr,"%s", destpath); - + /* + * Create an archive_entry describing the source file. + */ entry = archive_entry_new(); if (entry == NULL) cpio_errc(1, 0, "Couldn't allocate entry"); - archive_entry_set_pathname(entry, destpath); - - /* TODO: pathname editing. */ + archive_entry_set_pathname(entry, srcpath); + /* Get stat information. */ if (cpio->option_follow_links) r = stat(srcpath, &st); else r = lstat(srcpath, &st); if (r != 0) { cpio_warnc(errno, "Couldn't stat \"%s\"", srcpath); - goto cleanup; + archive_entry_free(entry); + return (0); } - /* 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 (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); + /* If its a symlink, pull the target. */ if (S_ISLNK(st.st_mode)) { - int lnklen; - - lnklen = readlink(srcpath, buff, sizeof(buff)); + lnklen = readlink(srcpath, cpio->buff, cpio->buff_size); if (lnklen < 0) { cpio_warnc(errno, "%s: Couldn't read symbolic link", srcpath); - goto cleanup; + archive_entry_free(entry); + return (0); } - buff[lnklen] = 0; - archive_entry_set_symlink(entry, buff); + cpio->buff[lnklen] = 0; + archive_entry_set_symlink(entry, cpio->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); + /* + * If we're trying to preserve hardlinks, match them here. + */ + spare = NULL; + if (cpio->linkresolver != NULL + && !S_ISDIR(st.st_mode)) { + archive_entry_linkify(cpio->linkresolver, &entry, &spare); + } + + if (entry != NULL) { + r = entry_to_archive(cpio, entry); + archive_entry_free(entry); + } + if (spare != NULL) { + if (r == 0) + r = entry_to_archive(cpio, spare); + archive_entry_free(spare); + } + return (r); +} + +static int +entry_to_archive(struct cpio *cpio, struct archive_entry *entry) +{ + const char *destpath, *srcpath; + int fd = -1; + ssize_t bytes_read; + size_t len; + const char *p; + int r; + + /* + * Generate a target path for this entry. + */ + destpath = srcpath = archive_entry_pathname(entry); + if (cpio->destdir) { + len = strlen(cpio->destdir) + strlen(srcpath) + 8; + if (len >= cpio->pass_destpath_alloc) { + while (len >= cpio->pass_destpath_alloc) { + cpio->pass_destpath_alloc += 512; + cpio->pass_destpath_alloc *= 2; + } + free(cpio->pass_destpath); + cpio->pass_destpath = malloc(cpio->pass_destpath_alloc); + if (cpio->pass_destpath == NULL) + cpio_errc(1, ENOMEM, + "Can't allocate path buffer"); + } + strcpy(cpio->pass_destpath, cpio->destdir); + p = srcpath; + while (p[0] == '/') + ++p; + strcat(cpio->pass_destpath, p); + destpath = cpio->pass_destpath; + } + if (cpio->option_rename) + destpath = cpio_rename(destpath); + if (destpath == NULL) + return (0); + archive_entry_copy_pathname(entry, destpath); + + /* Print out the destination name to the user. */ + if (cpio->verbose) + fprintf(stderr,"%s", destpath); - /* Obviously, this only gets invoked in pass mode. */ + /* + * Obviously, this only gets invoked in pass mode. + */ if (cpio->option_link) { /* Note: link(2) doesn't create parent directories. */ archive_entry_set_hardlink(entry, srcpath); @@ -446,17 +539,18 @@ file_to_archive(struct cpio *cpio, const char *srcpath, const char *destpath) * 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 (archive_entry_filetype(entry) == AE_IFREG) { + if (archive_entry_size(entry) > 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)) + } else { archive_entry_set_size(entry, 0); + } r = archive_write_header(cpio->archive, entry); @@ -471,17 +565,18 @@ file_to_archive(struct cpio *cpio, const char *srcpath, const char *destpath) 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); + bytes_read = read(fd, cpio->buff, cpio->buff_size); + while (bytes_read > 0) { + r = archive_write_data(cpio->archive, + cpio->buff, bytes_read); if (r < 0) cpio_errc(1, archive_errno(cpio->archive), archive_error_string(cpio->archive)); - if (r < len) { + if (r < bytes_read) { cpio_warnc(0, "Truncated write; file may have grown while being archived."); } - len = read(fd, buff, sizeof(buff)); + bytes_read = read(fd, cpio->buff, cpio->buff_size); } } @@ -492,9 +587,6 @@ cleanup: fprintf(stderr,"\n"); if (fd >= 0) close(fd); - if (entry != NULL) - archive_entry_free(entry); - return (0); } @@ -695,49 +787,16 @@ mode_list(struct cpio *cpio) exit(0); } -/* - * TODO: Fix hardlink handling. - */ -static int -pass_file(struct cpio *cpio, const char *pathname) -{ - size_t len; - const char *destpath; - - len = strlen(cpio->pass_destdir) + strlen(pathname) + 8; - if (len >= cpio->pass_destpath_alloc) { - while (len >= cpio->pass_destpath_alloc) { - cpio->pass_destpath_alloc += 512; - cpio->pass_destpath_alloc *= 2; - } - free(cpio->pass_destpath); - cpio->pass_destpath = malloc(cpio->pass_destpath_alloc); - if (cpio->pass_destpath == NULL) - cpio_errc(1, ENOMEM, - "Can't allocate path buffer"); - } - if (pathname[0] == '/') - pathname++; - strcpy(cpio->pass_destpath, cpio->pass_destdir); - strcat(cpio->pass_destpath, pathname); - destpath = cpio->pass_destpath; - if (cpio->option_rename) - destpath = cpio_rename(destpath); - if (destpath != NULL) - file_to_archive(cpio, pathname, destpath); - return (0); -} - static void mode_pass(struct cpio *cpio, const char *destdir) { int r; /* Ensure target dir has a trailing '/' to simplify path surgery. */ - cpio->pass_destdir = malloc(strlen(destdir) + 8); - strcpy(cpio->pass_destdir, destdir); + cpio->destdir = malloc(strlen(destdir) + 8); + strcpy(cpio->destdir, destdir); if (destdir[strlen(destdir) - 1] != '/') - strcat(cpio->pass_destdir, "/"); + strcat(cpio->destdir, "/"); cpio->archive = archive_write_disk_new(); if (cpio->archive == NULL) @@ -747,7 +806,7 @@ mode_pass(struct cpio *cpio, const char *destdir) 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); + process_lines(cpio, "-", file_to_archive); archive_entry_linkresolver_free(cpio->linkresolver); r = archive_write_close(cpio->archive); @@ -810,7 +869,7 @@ cpio_rename(const char *name) * function will return non-zero after attempting to process all * remaining lines. */ -static int +int process_lines(struct cpio *cpio, const char *pathname, int (*process)(struct cpio *, const char *)) { diff --git a/archivers/libarchive/files/cpio/cpio.h b/archivers/libarchive/files/cpio/cpio.h index a928d595b1e..ecec2eeec8e 100644 --- a/archivers/libarchive/files/cpio/cpio.h +++ b/archivers/libarchive/files/cpio/cpio.h @@ -53,13 +53,14 @@ struct cpio { int extract_flags; /* Flags for extract operation */ char symlink_mode; /* H or L, per BSD conventions */ const char *compress_program; + int option_append; /* -A, only relevant for -o */ int option_atime_restore; /* -a */ int option_follow_links; /* -L */ int option_link; /* -l */ int option_list; /* -t */ int option_null; /* -0 --null */ int option_rename; /* -r */ - char *pass_destdir; + char *destdir; size_t pass_destpath_alloc; char *pass_destpath; int uid_override; @@ -75,7 +76,10 @@ struct cpio { int return_value; /* Value returned by main() */ struct archive_entry_linkresolver *linkresolver; + /* Work data. */ struct matching *matching; + char *buff; + size_t buff_size; }; /* Name of this program; used in error reporting, initialized in main(). */ @@ -89,10 +93,14 @@ int owner_parse(const char *, int *, int *); /* Fake short equivalents for long options that otherwise lack them. */ enum { - OPTION_QUIET = 1, + OPTION_INSECURE = 1, + OPTION_QUIET, OPTION_VERSION }; int cpio_getopt(struct cpio *cpio); +int process_lines(struct cpio *cpio, const char *pathname, + int (*process)(struct cpio *, const char *)); +int include_from_file(struct cpio *, const char *); #endif diff --git a/archivers/libarchive/files/cpio/matching.c b/archivers/libarchive/files/cpio/matching.c index d949ea8949b..f98421e2df4 100644 --- a/archivers/libarchive/files/cpio/matching.c +++ b/archivers/libarchive/files/cpio/matching.c @@ -104,13 +104,11 @@ include(struct cpio *cpio, const char *pattern) return (0); } -#if 0 int include_from_file(struct cpio *cpio, const char *pathname) { return (process_lines(cpio, pathname, &include)); } -#endif static void add_pattern(struct match **list, const char *pattern) diff --git a/archivers/libarchive/files/cpio/test/main.c b/archivers/libarchive/files/cpio/test/main.c index 373238fa2fb..1f8bac53a0d 100644 --- a/archivers/libarchive/files/cpio/test/main.c +++ b/archivers/libarchive/files/cpio/test/main.c @@ -24,25 +24,26 @@ */ /* - * This same file is used pretty much verbatim for all test harnesses. - * - * The next line is used to define various environment variables, etc. - * - * The tar and cpio test harnesses are identical except for this line; - * the libarchive test harness omits some code that is needed only for - * testing standalone executables. - */ -#define PROGRAM "BSDCPIO" - -/* * Various utility routines useful for test programs. * Each test program is linked against this file. */ #include <errno.h> +#include <locale.h> #include <stdarg.h> #include <time.h> #include "test.h" + +/* + * This same file is used pretty much verbatim for all test harnesses. + * + * The next few lines are the only differences. + */ +#define PROGRAM "bsdcpio" /* Program being tested. */ +#define ENVBASE "BSDCPIO" /* Prefix for environment variables. */ +#undef EXTRA_DUMP /* How to dump extra data */ +/* How to generate extra version info. */ +#define EXTRA_VERSION (systemf("%s --version", testprog) ? "" : "") __FBSDID("$FreeBSD$"); /* @@ -74,6 +75,9 @@ static int skips = 0; /* Cumulative count of assertions. */ static int assertions = 0; +/* Directory where uuencoded reference files can be found. */ +static char *refdir; + /* * My own implementation of the standard assert() macro emits the * message in the same format as GCC (file:line: message). @@ -167,7 +171,12 @@ report_failure(void *extra) msg[0] = '\0'; } +#ifdef EXTRA_DUMP + if (extra != NULL) + fprintf(stderr, " detail: %s\n", EXTRA_DUMP(extra)); +#else (void)extra; /* UNUSED */ +#endif if (dump_on_failure) { fprintf(stderr, @@ -231,15 +240,15 @@ test_assert(const char *file, int line, int value, const char *condition, void * ++assertions; if (value) { msg[0] = '\0'; - return (1); + return (value); } failures ++; if (previous_failures(file, line)) - return (0); + return (value); fprintf(stderr, "%s:%d: Assertion failed\n", file, line); fprintf(stderr, " Condition: %s\n", condition); report_failure(extra); - return (0); + return (value); } /* assertEqualInt() displays the values of the two integers. */ @@ -502,7 +511,6 @@ test_assert_file_contents(const void *buff, int s, const char *fpattern, ...) return (0); } - /* * Call standard system() call, but build up the command line using * sprintf() conventions. @@ -620,6 +628,8 @@ static int test_run(int i, const char *tmpdir) tests[i].name); exit(1); } + /* Explicitly reset the locale before each test. */ + setlocale(LC_ALL, "C"); /* Run the actual test. */ (*tests[i].func)(); /* Summarize the results of this test. */ @@ -639,8 +649,10 @@ static void usage(const char *program) printf("Options:\n"); printf(" -k Keep running after failures.\n"); printf(" Default: Core dump after any failure.\n"); +#ifdef PROGRAM printf(" -p <path> Path to executable to be tested.\n"); - printf(" Default: path taken from " PROGRAM " environment variable.\n"); + printf(" Default: path taken from " ENVBASE " environment variable.\n"); +#endif printf(" -q Quiet.\n"); printf(" -r <dir> Path to dir containing reference files.\n"); printf(" Default: Current directory.\n"); @@ -650,6 +662,66 @@ static void usage(const char *program) exit(1); } +#define uudecode(c) (((c) - 0x20) & 0x3f) + +void +extract_reference_file(const char *name) +{ + char buff[1024]; + FILE *in, *out; + + sprintf(buff, "%s/%s.uu", refdir, name); + in = fopen(buff, "r"); + failure("Couldn't open reference file %s", buff); + assert(in != NULL); + if (in == NULL) + return; + /* Read up to and including the 'begin' line. */ + for (;;) { + if (fgets(buff, sizeof(buff), in) == NULL) { + /* TODO: This is a failure. */ + return; + } + if (memcmp(buff, "begin ", 6) == 0) + break; + } + /* Now, decode the rest and write it. */ + /* Not a lot of error checking here; the input better be right. */ + out = fopen(name, "w"); + while (fgets(buff, sizeof(buff), in) != NULL) { + char *p = buff; + int bytes; + + if (memcmp(buff, "end", 3) == 0) + break; + + bytes = uudecode(*p++); + while (bytes > 0) { + int n = 0; + /* Write out 1-3 bytes from that. */ + if (bytes > 0) { + n = uudecode(*p++) << 18; + n |= uudecode(*p++) << 12; + fputc(n >> 16, out); + --bytes; + } + if (bytes > 0) { + n |= uudecode(*p++) << 6; + fputc((n >> 8) & 0xFF, out); + --bytes; + } + if (bytes > 0) { + n |= uudecode(*p++); + fputc(n & 0xFF, out); + --bytes; + } + } + } + fclose(out); + fclose(in); +} + + int main(int argc, char **argv) { static const int limit = sizeof(tests) / sizeof(tests[0]); @@ -671,15 +743,17 @@ int main(int argc, char **argv) ++p; } +#ifdef PROGRAM /* Get the target program from environment, if available. */ - testprog = getenv(PROGRAM); + testprog = getenv(ENVBASE); +#endif /* Allow -k to be controlled through the environment. */ - if (getenv(PROGRAM "_KEEP_GOING") != NULL) + if (getenv(ENVBASE "_KEEP_GOING") != NULL) dump_on_failure = 0; /* Get the directory holding test files from environment. */ - refdir = getenv(PROGRAM "_TEST_FILES"); + refdir = getenv(ENVBASE "_TEST_FILES"); /* * Parse options. @@ -690,7 +764,11 @@ int main(int argc, char **argv) dump_on_failure = 0; break; case 'p': +#ifdef PROGRAM testprog = optarg; +#else + usage(progname); +#endif break; case 'q': quiet_flag++; @@ -709,9 +787,10 @@ int main(int argc, char **argv) /* * Sanity-check that our options make sense. */ +#ifdef PROGRAM if (testprog == NULL) usage(progname); - +#endif /* * Create a temp directory for the following tests. @@ -753,7 +832,12 @@ int main(int argc, char **argv) if (!quiet_flag) { printf("Running tests in: %s\n", tmpdir); printf("Reference files will be read from: %s\n", refdir); +#ifdef PROGRAM printf("Running tests on: %s\n", testprog); +#endif + printf("Exercising: "); + fflush(stdout); + printf("%s\n", EXTRA_VERSION); } /* diff --git a/archivers/libarchive/files/cpio/test/test.h b/archivers/libarchive/files/cpio/test/test.h index fcd3304d4ef..06e6d903fc8 100644 --- a/archivers/libarchive/files/cpio/test/test.h +++ b/archivers/libarchive/files/cpio/test/test.h @@ -22,7 +22,7 @@ * (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 $ + * $FreeBSD$ */ /* Every test program should #include "test.h" as the first thing. */ @@ -31,16 +31,20 @@ * The goal of this file (and the matching test.c) is to * simplify the very repetitive test-*.c test programs. */ - +#ifndef _FILE_OFFSET_BITS #define _FILE_OFFSET_BITS 64 +#endif +#include <dirent.h> #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> +#ifndef _WIN32 #include <unistd.h> +#endif #include <wchar.h> #ifdef USE_DMALLOC @@ -99,7 +103,7 @@ #define assertEmptyFile \ test_setup(__FILE__, __LINE__);test_assert_empty_file /* Assert that file contents match a string; supports printf-style arguments. */ -#define assertFileContents \ +#define assertFileContents \ test_setup(__FILE__, __LINE__);test_assert_file_contents /* @@ -131,15 +135,11 @@ int systemf(const char * fmt, ...); /* Supports printf-style args: slurpfile(NULL, "%s/myfile", refdir); */ char *slurpfile(size_t *, const char *fmt, ...); -/* - * Global vars - */ - -/* Directory holding reference files. */ -char *refdir; +/* Extracts named reference file to the current directory. */ +void extract_reference_file(const char *); /* - * Special interfaces for bsdcpio test harness. + * Special interfaces for program test harness. */ /* Pathname of exe to be tested. */ diff --git a/archivers/libarchive/files/cpio/test/test_basic.c b/archivers/libarchive/files/cpio/test/test_basic.c index 3a9982b8e1c..449d90e67b9 100644 --- a/archivers/libarchive/files/cpio/test/test_basic.c +++ b/archivers/libarchive/files/cpio/test/test_basic.c @@ -53,6 +53,7 @@ basic_cpio(const char *target, const char *pack_options, const char *unpack_opti assertEqualInt(r, 0); /* Verify stderr. */ + failure("Error invoking %s -i %s in dir %s", testprog, unpack_options, target); assertEmptyFile("unpack.err"); /* diff --git a/archivers/libarchive/files/cpio/test/test_format_newc.c b/archivers/libarchive/files/cpio/test/test_format_newc.c index 8d24ad5f020..68cc193cf2a 100644 --- a/archivers/libarchive/files/cpio/test/test_format_newc.c +++ b/archivers/libarchive/files/cpio/test/test_format_newc.c @@ -90,6 +90,9 @@ DEFINE_TEST(test_format_newc) assertEqualInt(0, link("file1", "hardlink")); assertEqualInt(9, write(list, "hardlink\n", 9)); + /* Another hardlink, but this one won't be archived. */ + assertEqualInt(0, link("file1", "hardlink2")); + /* "symlink" */ assertEqualInt(0, symlink("file1", "symlink")); assertEqualInt(8, write(list, "symlink\n", 8)); @@ -105,7 +108,8 @@ DEFINE_TEST(test_format_newc) close(list); r = systemf("%s -o --format=newc --quiet <list >newc.out 2>newc.err", testprog); - assertEqualInt(r, 0); + if (!assertEqualInt(r, 0)) + return; /* Verify that nothing went to stderr. */ assertEmptyFile("newc.err"); @@ -127,21 +131,16 @@ DEFINE_TEST(test_format_newc) assertEqualInt(0x81a4, from_hex(e + 14, 8)); /* Mode */ assertEqualInt(from_hex(e + 22, 8), getuid()); /* uid */ gid = from_hex(e + 30, 8); /* gid */ - assertEqualMem(e + 38, "00000002", 8); /* nlink */ + assertEqualMem(e + 38, "00000003", 8); /* nlink */ t = from_hex(e + 46, 8); /* mtime */ failure("t=0x%08x now=0x%08x=%d", t, now, now); assert(t <= now); /* File wasn't created in future. */ failure("t=0x%08x now - 2=0x%08x = %d", t, now - 2, now - 2); assert(t >= now - 2); /* File was created w/in last 2 secs. */ -#if 0 - /* TODO: FIX THIS!!! */ failure("newc format stores body only with last appearance of a link\n" " first appearance should be empty, so this file size\n" " field should be zero"); assertEqualInt(0, from_hex(e + 54, 8)); /* File size */ -#else - skipping("Known bug in writing hardlinks to newc files.\n This bug will be fixed before bsdcpio 1.0 is released.\n Note that this is not a bug in libarchive's implementation of newc format,\n it is a bug in bsdcpio not properly marking subsequent links to a file."); -#endif devmajor = from_hex(e + 62, 8); /* devmajor */ devminor = from_hex(e + 70, 8); /* devminor */ assert(is_hex(e + 78, 8)); /* rdevmajor */ @@ -152,27 +151,6 @@ DEFINE_TEST(test_format_newc) /* Since there's another link, no file contents here. */ /* But add in file size so that an error here doesn't cascade. */ e += 116 + from_hex(e + 54, 8) + (3 & -from_hex(e + 54, 8)); - - /* Hardlink identical to "file1" */ - assert(is_hex(e, 110)); - assertEqualMem(e + 0, "070701", 6); /* Magic */ - assertEqualInt(ino, from_hex(e + 6, 8)); /* ino */ - assertEqualInt(0x81a4, from_hex(e + 14, 8)); /* Mode */ - assertEqualInt(from_hex(e + 22, 8), getuid()); /* uid */ - assertEqualInt(gid, from_hex(e + 30, 8)); /* gid */ - assertEqualMem(e + 38, "00000002", 8); /* nlink */ - assertEqualInt(t, from_hex(e + 46, 8)); /* mtime */ - assertEqualInt(10, from_hex(e + 54, 8)); /* File size */ - assertEqualInt(devmajor, from_hex(e + 62, 8)); /* devmajor */ - assertEqualInt(devminor, from_hex(e + 70, 8)); /* devminor */ - assert(is_hex(e + 78, 8)); /* rdevmajor */ - assert(is_hex(e + 86, 8)); /* rdevminor */ - assertEqualMem(e + 94, "00000009", 8); /* Name size */ - assertEqualInt(0, from_hex(e + 102, 8)); /* check field */ - assertEqualMem(e + 110, "hardlink\0\0", 10); /* Name contents */ - assertEqualMem(e + 120, "123456789\0\0\0", 12); /* File contents */ - e += 120 + from_hex(e + 54, 8) + (3 & -from_hex(e + 54, 8)); - /* "symlink" pointing to "file1" */ assert(is_hex(e, 110)); assertEqualMem(e + 0, "070701", 6); /* Magic */ @@ -214,6 +192,29 @@ DEFINE_TEST(test_format_newc) /* TODO: Verify other types of entries. */ + /* Hardlink identical to "file1" */ + /* Since we only wrote two of the three links to this + * file, this link should get deferred by the hardlink logic. */ + assert(is_hex(e, 110)); + assertEqualMem(e + 0, "070701", 6); /* Magic */ + failure("If these aren't the same, then the hardlink detection failed to match them."); + assertEqualInt(ino, from_hex(e + 6, 8)); /* ino */ + assertEqualInt(0x81a4, from_hex(e + 14, 8)); /* Mode */ + assertEqualInt(from_hex(e + 22, 8), getuid()); /* uid */ + assertEqualInt(gid, from_hex(e + 30, 8)); /* gid */ + assertEqualMem(e + 38, "00000003", 8); /* nlink */ + assertEqualInt(t, from_hex(e + 46, 8)); /* mtime */ + assertEqualInt(10, from_hex(e + 54, 8)); /* File size */ + assertEqualInt(devmajor, from_hex(e + 62, 8)); /* devmajor */ + assertEqualInt(devminor, from_hex(e + 70, 8)); /* devminor */ + assert(is_hex(e + 78, 8)); /* rdevmajor */ + assert(is_hex(e + 86, 8)); /* rdevminor */ + assertEqualMem(e + 94, "00000009", 8); /* Name size */ + assertEqualInt(0, from_hex(e + 102, 8)); /* check field */ + assertEqualMem(e + 110, "hardlink\0\0", 10); /* Name contents */ + assertEqualMem(e + 120, "123456789\0\0\0", 12); /* File contents */ + e += 120 + from_hex(e + 54, 8) + (3 & -from_hex(e + 54, 8)); + /* Last entry is end-of-archive marker. */ assert(is_hex(e, 110)); assertEqualMem(e + 0, "070701", 6); /* Magic */ diff --git a/archivers/libarchive/files/cpio/test/test_gcpio_compat.c b/archivers/libarchive/files/cpio/test/test_gcpio_compat.c index 32f4b6b3103..61c9878b11e 100644 --- a/archivers/libarchive/files/cpio/test/test_gcpio_compat.c +++ b/archivers/libarchive/files/cpio/test/test_gcpio_compat.c @@ -40,10 +40,11 @@ unpack_test(const char *from, const char *options) /* * Use cpio to unpack the sample archive */ - r = systemf("%s -i --quiet %s < %s/%s >unpack.out 2>unpack.err", - testprog, options, refdir, from); - failure("Error invoking %s -i --quiet %s < %s/%s", - testprog, options, refdir, from); + extract_reference_file(from); + r = systemf("%s -i --quiet %s < %s >unpack.out 2>unpack.err", + testprog, options, from); + failure("Error invoking %s -i --quiet %s < %s", + testprog, options, from); assertEqualInt(r, 0); /* Verify that nothing went to stderr. */ diff --git a/archivers/libarchive/files/cpio/test/test_option_c.c b/archivers/libarchive/files/cpio/test/test_option_c.c index 7596ba9de88..9c422c97058 100644 --- a/archivers/libarchive/files/cpio/test/test_option_c.c +++ b/archivers/libarchive/files/cpio/test/test_option_c.c @@ -89,11 +89,14 @@ DEFINE_TEST(test_option_c) /* Use the cpio program to create an archive. */ close(filelist); r = systemf("%s -oc --quiet <filelist >basic.out 2>basic.err", testprog); - assertEqualInt(r, 0); - /* Verify that nothing went to stderr. */ assertEmptyFile("basic.err"); + /* Assert that the program finished. */ + failure("%s -oc crashed", testprog); + if (!assertEqualInt(r, 0)) + return; + /* Verify that stdout is a well-formed cpio file in "odc" format. */ p = slurpfile(&s, "basic.out"); assertEqualInt(s, 512); diff --git a/archivers/libarchive/files/cpio/test/test_option_f.c b/archivers/libarchive/files/cpio/test/test_option_f.c index c1fefd9c804..37aba7fa41d 100644 --- a/archivers/libarchive/files/cpio/test/test_option_f.c +++ b/archivers/libarchive/files/cpio/test/test_option_f.c @@ -35,7 +35,8 @@ unpack(const char *dirname, const char *option) assertEqualInt(0, mkdir(dirname, 0755)); assertEqualInt(0, chdir(dirname)); - r = systemf("%s -i --quiet %s < %s/test_option_f.cpio > copy-no-a.out 2>copy-no-a.err", testprog, option, refdir); + extract_reference_file("test_option_f.cpio"); + r = systemf("%s -i --quiet %s < test_option_f.cpio > copy-no-a.out 2>copy-no-a.err", testprog, option); assertEqualInt(0, r); assertEqualInt(0, chdir("..")); } diff --git a/archivers/libarchive/files/cpio/test/test_option_m.c b/archivers/libarchive/files/cpio/test/test_option_m.c index e43d259277a..d5bbad2e902 100644 --- a/archivers/libarchive/files/cpio/test/test_option_m.c +++ b/archivers/libarchive/files/cpio/test/test_option_m.c @@ -40,7 +40,8 @@ DEFINE_TEST(test_option_m) /* 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); + extract_reference_file("test_option_m.cpio"); + r = systemf("%s -i < test_option_m.cpio >out 2>err", testprog); now = time(NULL); assertEqualInt(r, 0); assertEmptyFile("out"); @@ -54,7 +55,8 @@ DEFINE_TEST(test_option_m) 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); + extract_reference_file("test_option_m.cpio"); + r = systemf("%s -im < test_option_m.cpio >out 2>err", testprog); now = time(NULL); assertEqualInt(r, 0); assertEmptyFile("out"); diff --git a/archivers/libarchive/files/cpio/test/test_option_t.c b/archivers/libarchive/files/cpio/test/test_option_t.c index 1bb993461f7..c9cdd0bc8a2 100644 --- a/archivers/libarchive/files/cpio/test/test_option_t.c +++ b/archivers/libarchive/files/cpio/test/test_option_t.c @@ -31,14 +31,17 @@ 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); + extract_reference_file("test_option_t.cpio"); + r = systemf("%s -it < test_option_t.cpio >t.out 2>t.err", testprog); assertEqualInt(r, 0); assertFileContents("1 block\n", 8, "t.err"); - assertEqualFile("t.out", "%s/test_option_t.stdout", refdir); + extract_reference_file("test_option_t.stdout"); + assertEqualFile("t.out", "test_option_t.stdout"); /* 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); + r = systemf("%s -itv < test_option_t.cpio >tv.out 2>tv.err", testprog); assertEqualInt(r, 0); assertFileContents("1 block\n", 8, "tv.err"); - assertEqualFile("tv.out", "%s/test_option_tv.stdout", refdir); + extract_reference_file("test_option_tv.stdout"); + assertEqualFile("tv.out", "test_option_tv.stdout"); } diff --git a/archivers/libarchive/files/cpio/test/test_option_version.c b/archivers/libarchive/files/cpio/test/test_option_version.c index 06df47a171c..ff90dfd824e 100644 --- a/archivers/libarchive/files/cpio/test/test_option_version.c +++ b/archivers/libarchive/files/cpio/test/test_option_version.c @@ -30,13 +30,15 @@ __FBSDID("$FreeBSD$"); */ static void -verify(const char *q, size_t s) +verify(const char *p, size_t s) { + const char *q = p; + /* Version message should start with name of program, then space. */ - failure("version message too short"); + failure("version message too short:", p); if (!assert(s > 6)) return; - failure("Version message should begin with 'bsdcpio'"); + failure("Version message should begin with 'bsdcpio': %s", p); if (!assertEqualMem(q, "bsdcpio ", 8)) /* If we're not testing bsdcpio, don't keep going. */ return; @@ -47,14 +49,21 @@ verify(const char *q, size_t s) --s; } /* Version number terminated by space. */ + failure("Version: %s", p); assert(s > 1); + /* Skip a single trailing a,b,c, or d. */ + if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd') + ++q; + failure("Version: %s", p); assert(*q == ' '); ++q; --s; /* Separator. */ + failure("Version: %s", p); assertEqualMem(q, "-- ", 3); q += 3; s -= 3; /* libarchive name and version number */ assert(s > 11); + failure("Version: %s", p); assertEqualMem(q, "libarchive ", 11); q += 11; s -= 11; /* Version number is a series of digits and periods. */ @@ -62,8 +71,12 @@ verify(const char *q, size_t s) ++q; --s; } + /* Skip a single trailing a,b,c, or d. */ + if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd') + ++q; /* All terminated by a newline. */ assert(s >= 1); + failure("Version: %s", p); assertEqualMem(q, "\n", 1); } diff --git a/archivers/libarchive/files/doc/man/archive_entry.3 b/archivers/libarchive/files/doc/man/archive_entry.3 index a3548c2f414..02261c50cf6 100644 --- a/archivers/libarchive/files/doc/man/archive_entry.3 +++ b/archivers/libarchive/files/doc/man/archive_entry.3 @@ -17,6 +17,8 @@ \fBarchive_entry_copy_gname_w\fP, \fBarchive_entry_copy_hardlink\fP, \fBarchive_entry_copy_hardlink_w\fP, +\fBarchive_entry_copy_link\fP, +\fBarchive_entry_copy_link_w\fP, \fBarchive_entry_copy_pathname_w\fP, \fBarchive_entry_copy_stat\fP, \fBarchive_entry_copy_symlink\fP, @@ -75,16 +77,24 @@ .br \fIvoid\fP .RE -.nh -\fBarchive_entry_acl_add_entry\fP -.hy -("struct archive_entry *" "int type" "int permset" "int tag" "int qual" "const char *name"); +Fo archive_entry_acl_add_entry +Fa "struct archive_entry *" +Fa "int type" +Fa "int permset" +Fa "int tag" +Fa "int qual" +Fa "const char *name" +Fc \fIvoid\fP .RE -.nh -\fBarchive_entry_acl_add_entry_w\fP -.hy -("struct archive_entry *" "int type" "int permset" "int tag" "int qual" "const wchar_t *name"); +Fo archive_entry_acl_add_entry_w +Fa "struct archive_entry *" +Fa "int type" +Fa "int permset" +Fa "int tag" +Fa "int qual" +Fa "const wchar_t *name" +Fc \fIvoid\fP .RE .nh @@ -99,16 +109,26 @@ ("struct archive_entry *" "int type"); \fIint\fP .RE -.nh -\fBarchive_entry_acl_next\fP -.hy -("struct archive_entry *" "int want_type" "int *type" "int *permset" "int *tag" "int *qual" "const char **name"); +Fo archive_entry_acl_next +Fa "struct archive_entry *" +Fa "int want_type" +Fa "int *type" +Fa "int *permset" +Fa "int *tag" +Fa "int *qual" +Fa "const char **name" +Fc \fIint\fP .RE -.nh -\fBarchive_entry_acl_next_w\fP -.hy -("struct archive_entry *" "int want_type" "int *type" "int *permset" "int *tag" "int *qual" "const wchar_t **name"); +Fo archive_entry_acl_next_w +Fa "struct archive_entry *" +Fa "int want_type" +Fa "int *type" +Fa "int *permset" +Fa "int *tag" +Fa "int *qual" +Fa "const wchar_t **name" +Fc \fIint\fP .RE .nh @@ -237,10 +257,11 @@ ("struct archive_entry *"); \fIvoid\fP .RE -.nh -\fBarchive_entry_fflags\fP -.hy -("struct archive_entry *" "unsigned long *set" "unsigned long *clear"); +Fo archive_entry_fflags +Fa "struct archive_entry *" +Fa "unsigned long *set" +Fa "unsigned long *clear" +Fc \fIconst char *\fP .RE .nh @@ -357,10 +378,11 @@ ("struct archive_entry *" "unsigned int"); \fIvoid\fP .RE -.nh -\fBarchive_entry_set_fflags\fP -.hy -("struct archive_entry *" "unsigned long set" "unsigned long clear"); +Fo archive_entry_set_fflags +Fa "struct archive_entry *" +Fa "unsigned long set" +Fa "unsigned long clear" +Fc \fIvoid\fP .RE .nh diff --git a/archivers/libarchive/files/doc/man/archive_read.3 b/archivers/libarchive/files/doc/man/archive_read.3 index 524c5a8d79d..9548c5403a1 100644 --- a/archivers/libarchive/files/doc/man/archive_read.3 +++ b/archivers/libarchive/files/doc/man/archive_read.3 @@ -71,10 +71,10 @@ ("struct archive *"); \fIint\fP .RE -.nh -\fBarchive_read_support_compression_program\fP -.hy -("struct archive *" "const char *cmd"); +Fo archive_read_support_compression_program +Fa "struct archive *" +Fa "const char *cmd" +Fc \fIint\fP .RE .nh @@ -113,16 +113,23 @@ ("struct archive *"); \fIint\fP .RE -.nh -\fBarchive_read_open\fP -.hy -("struct archive *" "void *client_data" "archive_open_callback *" "archive_read_callback *" "archive_close_callback *"); +Fo archive_read_open +Fa "struct archive *" +Fa "void *client_data" +Fa "archive_open_callback *" +Fa "archive_read_callback *" +Fa "archive_close_callback *" +Fc \fIint\fP .RE -.nh -\fBarchive_read_open2\fP -.hy -("struct archive *" "void *client_data" "archive_open_callback *" "archive_read_callback *" "archive_skip_callback *" "archive_close_callback *"); +Fo archive_read_open2 +Fa "struct archive *" +Fa "void *client_data" +Fa "archive_open_callback *" +Fa "archive_read_callback *" +Fa "archive_skip_callback *" +Fa "archive_close_callback *" +Fc \fIint\fP .RE .nh @@ -137,10 +144,11 @@ ("struct archive *" "int fd" "size_t block_size"); \fIint\fP .RE -.nh -\fBarchive_read_open_filename\fP -.hy -("struct archive *" "const char *filename" "size_t block_size"); +Fo archive_read_open_filename +Fa "struct archive *" +Fa "const char *filename" +Fa "size_t block_size" +Fc \fIint\fP .RE .nh @@ -161,10 +169,12 @@ ("struct archive *" "void *buff" "size_t len"); \fIint\fP .RE -.nh -\fBarchive_read_data_block\fP -.hy -("struct archive *" "const void **buff" "size_t *len" "off_t *offset"); +Fo archive_read_data_block +Fa "struct archive *" +Fa "const void **buff" +Fa "size_t *len" +Fa "off_t *offset" +Fc \fIint\fP .RE .nh @@ -185,16 +195,18 @@ ("struct archive *" "int fd"); \fIint\fP .RE -.nh -\fBarchive_read_extract\fP -.hy -("struct archive *" "struct archive_entry *" "int flags"); +Fo archive_read_extract +Fa "struct archive *" +Fa "struct archive_entry *" +Fa "int flags" +Fc \fIvoid\fP .RE -.nh -\fBarchive_read_extract_set_progress_callback\fP -.hy -("struct archive *" "void (*func)(void *)" "void *user_data"); +Fo archive_read_extract_set_progress_callback +Fa "struct archive *" +Fa "void (*func)(void *)" +Fa "void *user_data" +Fc \fIint\fP .RE .nh @@ -225,22 +237,28 @@ Allocates and initializes a Tn struct archive object suitable for reading from an archive. .TP +Xo .nh \fBarchive_read_support_compression_all\fP .hy -(, .nh); +(,); +.nh \fBarchive_read_support_compression_bzip2\fP .hy -(, .nh); +(,); +.nh \fBarchive_read_support_compression_compress\fP .hy -(, .nh); +(,); +.nh \fBarchive_read_support_compression_gzip\fP .hy -(, .nh); +(,); +.nh \fBarchive_read_support_compression_none\fP .hy (); +Xc Enables auto-detection code and decompression support for the specified compression. Note that @@ -262,25 +280,32 @@ 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. .TP +Xo .nh \fBarchive_read_support_format_all\fP .hy -(, .nh); +(,); +.nh \fBarchive_read_support_format_cpio\fP .hy -(, .nh); +(,); +.nh \fBarchive_read_support_format_empty\fP .hy -(, .nh); +(,); +.nh \fBarchive_read_support_format_iso9660\fP .hy -(, .nh); -\fBarchive_read_support_format_tar,\fP +(,); +.nh +\fBarchive_read_support_format_tar\fP .hy -(.nh); +(,); +.nh \fBarchive_read_support_format_zip\fP .hy (); +Xc Enables support---including auto-detection code---for the specified archive format. For example, @@ -572,17 +597,19 @@ The callback functions must match the following prototypes: .IP \fItypedef ssize_t\fP .RE -.nh -\fBarchive_read_callback\fP -.hy -("struct archive *" "void *client_data" "const void **buffer"); +Fo archive_read_callback +Fa "struct archive *" +Fa "void *client_data" +Fa "const void **buffer" +Fc .IP \fItypedef int\fP .RE -.nh -\fBarchive_skip_callback\fP -.hy -("struct archive *" "void *client_data" "size_t request"); +Fo archive_skip_callback +Fa "struct archive *" +Fa "void *client_data" +Fa "size_t request" +Fc .IP \fItypedef int\fP .RE diff --git a/archivers/libarchive/files/doc/man/archive_util.3 b/archivers/libarchive/files/doc/man/archive_util.3 index e41c59f56e8..6a9b7f562b2 100644 --- a/archivers/libarchive/files/doc/man/archive_util.3 +++ b/archivers/libarchive/files/doc/man/archive_util.3 @@ -63,10 +63,12 @@ ("struct archive *"); \fIvoid\fP .RE -.nh -\fBarchive_set_error\fP -.hy -("struct archive *" "int error_code" "const char *fmt" "..."); +Fo archive_set_error +Fa "struct archive *" +Fa "int error_code" +Fa "const char *fmt" +Fa "..." +Fc .SH DESCRIPTION These functions provide access to various information about the Tn struct archive diff --git a/archivers/libarchive/files/doc/man/archive_write.3 b/archivers/libarchive/files/doc/man/archive_write.3 index c4b93958177..32a3e17198e 100644 --- a/archivers/libarchive/files/doc/man/archive_write.3 +++ b/archivers/libarchive/files/doc/man/archive_write.3 @@ -72,10 +72,10 @@ ("struct archive *"); \fIint\fP .RE -.nh -\fBarchive_write_set_compression_program\fP -.hy -("struct archive *" "const char * cmd"); +Fo archive_write_set_compression_program +Fa "struct archive *" +Fa "const char * cmd" +Fc \fIint\fP .RE .nh @@ -114,10 +114,13 @@ ("struct archive *"); \fIint\fP .RE -.nh -\fBarchive_write_open\fP -.hy -("struct archive *" "void *client_data" "archive_open_callback *" "archive_write_callback *" "archive_close_callback *"); +Fo archive_write_open +Fa "struct archive *" +Fa "void *client_data" +Fa "archive_open_callback *" +Fa "archive_write_callback *" +Fa "archive_close_callback *" +Fc \fIint\fP .RE .nh @@ -138,10 +141,12 @@ ("struct archive *" "const char *filename"); \fIint\fP .RE -.nh -\fBarchive_write_open_memory\fP -.hy -("struct archive *" "void *buffer" "size_t bufferSize" "size_t *outUsed"); +Fo archive_write_open_memory +Fa "struct archive *" +Fa "void *buffer" +Fa "size_t bufferSize" +Fa "size_t *outUsed" +Fc \fIint\fP .RE .nh @@ -242,25 +247,32 @@ functions, this function can be called after the archive is opened. Retrieve the currently-set value for last block size. A value of -1 here indicates that the library should use default values. .TP +Xo .nh \fBarchive_write_set_format_cpio\fP .hy -(, .nh); +(,); +.nh \fBarchive_write_set_format_pax\fP .hy -(, .nh); +(,); +.nh \fBarchive_write_set_format_pax_restricted\fP .hy -(, .nh); +(,); +.nh \fBarchive_write_set_format_shar\fP .hy -(, .nh); +(,); +.nh \fBarchive_write_set_format_shar_binary\fP .hy -(, .nh); +(,); +.nh \fBarchive_write_set_format_ustar\fP .hy (); +Xc Sets the format that will be used for the archive. The library can write POSIX octet-oriented cpio format archives, @@ -285,16 +297,20 @@ 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. .TP +Xo .nh \fBarchive_write_set_compression_bzip2\fP .hy -(, .nh); +(,); +.nh \fBarchive_write_set_compression_gzip\fP .hy -(, .nh); +(,); +.nh \fBarchive_write_set_compression_none\fP .hy (); +Xc The resulting archive will be compressed as specified. Note that the compressed output is always properly blocked. .TP @@ -538,10 +554,12 @@ to register an error code and message and return .IP \fItypedef ssize_t\fP .RE -.nh -\fBarchive_write_callback\fP -.hy -("struct archive *" "void *client_data" "void *buffer" "size_t length"); +Fo archive_write_callback +Fa "struct archive *" +Fa "void *client_data" +Fa "void *buffer" +Fa "size_t length" +Fc 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 diff --git a/archivers/libarchive/files/doc/man/archive_write_disk.3 b/archivers/libarchive/files/doc/man/archive_write_disk.3 index 4e81e1caec8..f6f23b4ddb5 100644 --- a/archivers/libarchive/files/doc/man/archive_write_disk.3 +++ b/archivers/libarchive/files/doc/man/archive_write_disk.3 @@ -35,10 +35,12 @@ ("struct archive *" "dev_t" "ino_t"); \fIint\fP .RE -.nh -\fBarchive_write_disk_set_group_lookup\fP -.hy -("struct archive *" "void *" "gid_t (*)(void *, const char *gname, gid_t gid)" "void (*cleanup)(void *)"); +Fo archive_write_disk_set_group_lookup +Fa "struct archive *" +Fa "void *" +Fa "gid_t (*)(void *, const char *gname, gid_t gid)" +Fa "void (*cleanup)(void *)" +Fc \fIint\fP .RE .nh @@ -47,10 +49,12 @@ ("struct archive *"); \fIint\fP .RE -.nh -\fBarchive_write_disk_set_user_lookup\fP -.hy -("struct archive *" "void *" "uid_t (*)(void *, const char *uname, uid_t uid)" "void (*cleanup)(void *)"); +Fo archive_write_disk_set_user_lookup +Fa "struct archive *" +Fa "void *" +Fa "uid_t (*)(void *, const char *uname, uid_t uid)" +Fa "void (*cleanup)(void *)" +Fc \fIint\fP .RE .nh @@ -206,13 +210,16 @@ Note that paths ending in \fI\& ..\fP always cause an error, regardless of this flag. .TP +Xo .nh \fBarchive_write_disk_set_group_lookup\fP .hy -(, .nh); +(,); +.nh \fBarchive_write_disk_set_user_lookup\fP .hy (); +Xc The Tn struct archive_entry objects contain both names and ids that can be used to identify users diff --git a/archivers/libarchive/files/doc/man/bsdcpio.1 b/archivers/libarchive/files/doc/man/bsdcpio.1 index 26c5c1d36fc..fa1bd729c86 100644 --- a/archivers/libarchive/files/doc/man/bsdcpio.1 +++ b/archivers/libarchive/files/doc/man/bsdcpio.1 @@ -33,8 +33,8 @@ is a mode indicator from the following list: .TP \fB\-i\fP Input. -Read an archive from standard input and extract the contents to disk or -(if the +Read an archive from standard input (unless overriden) and extract the +contents to disk or (if the \fB\-t\fP option is specified) list the contents to standard output. @@ -44,7 +44,7 @@ one of the patterns will be extracted. \fB\-o\fP Output. Read a list of filenames from standard input and produce a new archive -on standard output containing the specified items. +on standard output (unless overriden) containing the specified items. .TP \fB\-p\fP Pass-through. @@ -54,6 +54,11 @@ specified directory. Unless specifically stated otherwise, options are applicable in all operating modes. .TP +\fB\-A\fP +(o mode only) +Append to the specified archive. +(Not yet implemented.) +.TP \fB\-a\fP (o and p modes) Reset access times on files after they are read. @@ -62,6 +67,12 @@ Reset access times on files after they are read. (o mode only) Block output to records of 5120 bytes. .TP +\fB\-C\fP \fIsize\fP +(o mode only) +Block output to records of +\fIsize\fP +bytes. +.TP \fB\-c\fP (o mode only) Use the old POSIX portable character format. @@ -72,6 +83,16 @@ Equivalent to (i and p modes) Create directories as necessary. .TP +\fB\-E\fP \fIfile\fP +(i mode only) +Read list of file name patterns from +\fIfile\fP +to list and extract. +.TP +\fB\-F\fP \fIfile\fP +Read archive from or write archive to +\fIfile\fP. +.TP \fB\-f\fP \fIpattern\fP (i mode only) Ignore files that match @@ -106,10 +127,21 @@ formats currently supported by the underlying \fBlibarchive\fP(3) library. .TP +\fB\-I\fP \fIfile\fP +Read archive from +\fIfile\fP. +.TP \fB\-i\fP Input mode. See above for description. .TP +\fB\--insecure\fP +(i and p mode only) +Disable security checks during extraction or copying. +This allows extraction via symbolic links and path names containing +Sq .. +in the name. +.TP \fB\-L\fP (o and p modes) All symbolic links will be followed. @@ -126,6 +158,10 @@ instead of copying. Set file modification time on created files to match those in the source. .TP +\fB\-O\fP \fIfile\fP +Write archive to +\fIfile\fP. +.TP \fB\-o\fP Output mode. See above for description. @@ -188,15 +224,19 @@ Print the program version information and exit. .TP \fB\-y\fP (o mode only) -Compress the archive with bzip2-compatible compression before -writing to stdout. +Compress the archive with bzip2-compatible compression before writing it. In input mode, this option is ignored; bzip2 compression is recognized automatically on input. .TP +\fB\-Z\fP +(o mode only) +Compress the archive with compress-compatible compression before writing it. +In input mode, this option is ignored; +compression is recognized automatically on input. +.TP \fB\-z\fP (o mode only) -Compress the archive with gzip-compatible compression before writing -it to stdout. +Compress the archive with gzip-compatible compression before writing it. In input mode, this option is ignored; gzip compression is recognized automatically on input. .SH ENVIRONMENT diff --git a/archivers/libarchive/files/doc/man/bsdtar.1 b/archivers/libarchive/files/doc/man/bsdtar.1 index b0e452347cc..d1cc8ddad04 100644 --- a/archivers/libarchive/files/doc/man/bsdtar.1 +++ b/archivers/libarchive/files/doc/man/bsdtar.1 @@ -132,6 +132,16 @@ but before extracting entries from the archive. (c and r modes only) Issue a warning message unless all links to each file are archived. .TP +\fB\--chroot\fP (\fB\-W\fP \fBchroot\fP) +(x mode only) +.nh +\fBchroot\fP +.hy +(); +to the current directory after processing any +\fB\-C\fP +options and before extracting any files. +.TP \fB\--exclude\fP \fIpattern\fP (\fB\-W\fP \fBexclude\fP=\fIpattern\fP) Do not process files or directories that match the specified pattern. @@ -162,16 +172,6 @@ FreeBSD, the default tape device is \fI/dev/sa0\fP.) .TP -\fB\--fast-read\fP (\fB\-W\fP \fBfast-read\fP) -(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. -.TP \fB\-H\fP (c and r mode only) Symbolic links named on the command line will be followed; the @@ -331,6 +331,16 @@ is being run by root, the default is to restore the owner unless the \fB\-o\fP option is also specified. .TP +\fB\-q\fP (\fB\--fast-read\fP) +(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. +.TP \fB\--strip-components\fP \fIcount\fP (\fB\-W\fP \fBstrip-components\fP=\fIcount\fP) (x and t mode only) Remove the specified number of leading path elements. @@ -426,6 +436,16 @@ Note that, unlike other \fBtar\fP implementations, this implementation recognizes gzip compression automatically when reading archives. +.TP +\fB\-Z\fP +(c mode only) +Compress the resulting archive with +\fBcompress\fP(1). +In extract or list modes, this option is ignored. +Note that, unlike other +\fBtar\fP +implementations, this implementation recognizes compress compression +automatically when reading archives. .SH ENVIRONMENT The following environment variables affect the execution of \fB:\fP @@ -655,6 +675,7 @@ an archive while preserving any absolute pathnames, components, or symlinks to other directories. .SH SEE ALSO \fBbzip2\fP(1), +\fBcompress\fP(1), \fBcpio\fP(1), \fBgzip\fP(1), \fBmt\fP(1), diff --git a/archivers/libarchive/files/doc/man/mtree.5 b/archivers/libarchive/files/doc/man/mtree.5 index 10ad85b2158..7b7d74afe7a 100644 --- a/archivers/libarchive/files/doc/man/mtree.5 +++ b/archivers/libarchive/files/doc/man/mtree.5 @@ -91,7 +91,7 @@ separated by whitespace. .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 +Each such definition consists of a key from the following list immediately followed by an '=' sign and a value. Software programs reading mtree files should warn about @@ -117,15 +117,18 @@ If no flags are to be set the string ``none'' may be used to override the current default. .TP -\fBignore\fP -Ignore any file hierarchy below this file. -.TP \fBgid\fP The file group as a numeric value. .TP \fBgname\fP The file group as a symbolic name. .TP +\fBignore\fP +Ignore any file hierarchy below this file. +.TP +\fBlink\fP +The file the symbolic link is expected to reference. +.TP \fBmd5\fP The MD5 message digest of the file. .TP @@ -133,6 +136,29 @@ The MD5 message digest of the file. A synonym for \fBmd5\fP. .TP +\fBmode\fP +The current file's permissions as a numeric (octal) or symbolic +value. +.TP +\fBnlink\fP +The number of hard links the file is expected to have. +.TP +\fBnochange\fP +Make sure this file or directory exists but otherwise ignore all attributes. +.TP +\fBripemd160digest\fP +The +Tn RIPEMD160 +message digest of the file. +.TP +\fBrmd160\fP +A synonym for +\fBripemd160digest\fP. +.TP +\fBrmd160digest\fP +A synonym for +\fBripemd160digest\fP. +.TP \fBsha1\fP The Tn FIPS @@ -155,41 +181,9 @@ message digest of the file. A synonym for \fBsha256\fP. .TP -\fBripemd160digest\fP -The -Tn RIPEMD160 -message digest of the file. -.TP -\fBrmd160\fP -A synonym for -\fBripemd160digest\fP. -.TP -\fBrmd160digest\fP -A synonym for -\fBripemd160digest\fP. -.TP -\fBmode\fP -The current file's permissions as a numeric (octal) or symbolic -value. -.TP -\fBnlink\fP -The number of hard links the file is expected to have. -.TP -\fBnochange\fP -Make sure this file or directory exists but otherwise ignore all attributes. -.TP -\fBuid\fP -The file owner as a numeric value. -.TP -\fBuname\fP -The file owner as a symbolic name. -.TP \fBsize\fP The size, in bytes, of the file. .TP -\fBlink\fP -The file the symbolic link is expected to reference. -.TP \fBtime\fP The last modification time of the file. .TP @@ -216,6 +210,12 @@ symbolic link .TP \fBsocket\fP socket +.TP +\fBuid\fP +The file owner as a numeric value. +.TP +\fBuname\fP +The file owner as a symbolic name. .SH SEE ALSO \fBcksum\fP(1), \fBfind\fP(1), diff --git a/archivers/libarchive/files/doc/text/archive_entry.3 b/archivers/libarchive/files/doc/text/archive_entry.3 index 5201c4f6d5b..2982b86aeff 100644 --- a/archivers/libarchive/files/doc/text/archive_entry.3 +++ b/archivers/libarchive/files/doc/text/archive_entry.3 @@ -8,7 +8,8 @@ NAME 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_hardlink_w, archive_entry_copy_link, + archive_entry_copy_link_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, diff --git a/archivers/libarchive/files/doc/text/archive_read.3 b/archivers/libarchive/files/doc/text/archive_read.3 index 95b86866b06..e189852d51b 100644 --- a/archivers/libarchive/files/doc/text/archive_read.3 +++ b/archivers/libarchive/files/doc/text/archive_read.3 @@ -145,7 +145,7 @@ DESCRIPTION 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_tar(), archive_read_support_format_zip() Enables support---including auto-detection code---for the speci- fied archive format. For example, @@ -254,11 +254,11 @@ DESCRIPTION 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 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_skip_callback(struct archive *, + void *client_data, size_t request) typedef int archive_open_callback(struct archive *, void *client_data) diff --git a/archivers/libarchive/files/doc/text/archive_write.3 b/archivers/libarchive/files/doc/text/archive_write.3 index a16d36419bd..397f9326cfc 100644 --- a/archivers/libarchive/files/doc/text/archive_write.3 +++ b/archivers/libarchive/files/doc/text/archive_write.3 @@ -257,8 +257,8 @@ CLIENT CALLBACKS 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) + 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- diff --git a/archivers/libarchive/files/doc/text/bsdcpio.1 b/archivers/libarchive/files/doc/text/bsdcpio.1 index d8f7102636f..6df6c43401f 100644 --- a/archivers/libarchive/files/doc/text/bsdcpio.1 +++ b/archivers/libarchive/files/doc/text/bsdcpio.1 @@ -14,12 +14,14 @@ DESCRIPTION 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. If one or more file patterns are spec- - ified, only files matching one of the patterns will be extracted. + -i Input. Read an archive from standard input (unless overriden) + and extract the contents to disk or (if the -t option is speci- + fied) list the contents to standard output. If one or more file + patterns are specified, only files matching one of the patterns + will be extracted. -o Output. Read a list of filenames from standard input and produce - a new archive on standard output containing the specified items. + a new archive on standard output (unless overriden) containing + the specified items. -p Pass-through. Read a list of filenames from standard input and copy the files to the specified directory. @@ -27,15 +29,28 @@ OPTIONS Unless specifically stated otherwise, options are applicable in all oper- ating modes. + -A (o mode only) Append to the specified archive. (Not yet imple- + mented.) + -a (o and p modes) Reset access times on files after they are read. -B (o mode only) Block output to records of 5120 bytes. + -C size + (o mode only) Block output to records of size 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. + -E file + (i mode only) Read list of file name patterns from file to list + and extract. + + -F file + Read archive from or write archive to file. + -f pattern (i mode only) Ignore files that match pattern. @@ -54,8 +69,16 @@ OPTIONS complete information about the formats currently supported by the underlying libarchive(3) library. + -I file + Read archive from file. + -i Input mode. See above for description. + --insecure + (i and p mode only) Disable security checks during extraction or + copying. This allows extraction via symbolic links and path + names containing `..' in the name. + -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 @@ -67,6 +90,9 @@ OPTIONS -m (i and p modes) Set file modification time on created files to match those in the source. + -O file + Write archive to file. + -o Output mode. See above for description. -p Pass-through mode. See above for description. @@ -105,12 +131,16 @@ OPTIONS 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. + sion before writing it. In input mode, this option is ignored; + bzip2 compression is recognized automatically on input. + + -Z (o mode only) Compress the archive with compress-compatible com- + pression before writing it. In input mode, this option is + ignored; 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. + sion before writing it. In input mode, this option is ignored; + gzip compression is recognized automatically on input. ENVIRONMENT The following environment variables affect the execution of cpio: diff --git a/archivers/libarchive/files/doc/text/bsdtar.1 b/archivers/libarchive/files/doc/text/bsdtar.1 index 9a6275349ea..34205faa2f8 100644 --- a/archivers/libarchive/files/doc/text/bsdtar.1 +++ b/archivers/libarchive/files/doc/text/bsdtar.1 @@ -77,6 +77,10 @@ OPTIONS (c and r modes only) Issue a warning message unless all links to each file are archived. + --chroot (-W chroot) + (x mode only) chroot() to the current directory after processing + any -C options and before extracting any files. + --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 @@ -95,15 +99,6 @@ OPTIONS 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. @@ -200,6 +195,15 @@ OPTIONS is being run by root, the default is to restore the owner unless the -o option is also specified. + -q (--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. + --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 @@ -252,6 +256,11 @@ OPTIONS other tar implementations, this implementation recognizes gzip compression automatically when reading archives. + -Z (c mode only) Compress the resulting archive with compress(1). + In extract or list modes, this option is ignored. Note that, + unlike other tar implementations, this implementation recognizes + compress compression automatically when reading archives. + ENVIRONMENT The following environment variables affect the execution of tar: @@ -363,8 +372,8 @@ SECURITY ries. SEE ALSO - bzip2(1), cpio(1), gzip(1), mt(1), pax(1), shar(1), libarchive(3), - libarchive-formats(5), tar(5) + bzip2(1), compress(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 diff --git a/archivers/libarchive/files/doc/text/mtree.5 b/archivers/libarchive/files/doc/text/mtree.5 index 1e5eb4f42b0..89a0850f962 100644 --- a/archivers/libarchive/files/doc/text/mtree.5 +++ b/archivers/libarchive/files/doc/text/mtree.5 @@ -66,7 +66,7 @@ DESCRIPTION Keywords After the filename, a full or relative entry consists of zero or more - whitespace-separated keyword definitions. Each such definitions consists + whitespace-separated keyword definitions. Each such definition 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. @@ -83,24 +83,25 @@ DESCRIPTION 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. + ignore Ignore any file hierarchy below this file. + + link The file the symbolic link is expected to reference. + 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. + mode The current file's permissions as a numeric (octal) or sym- + bolic value. - sha256 The FIPS 180-2 (``SHA-256'') message digest of the file. + nlink The number of hard links the file is expected to have. - sha256digest - A synonym for sha256. + nochange Make sure this file or directory exists but otherwise ignore + all attributes. ripemd160digest The RIPEMD160 message digest of the file. @@ -110,22 +111,17 @@ DESCRIPTION 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. + sha1 The FIPS 160-1 (``SHA-1'') message digest of the file. - nochange Make sure this file or directory exists but otherwise ignore - all attributes. + sha1digest A synonym for sha1. - uid The file owner as a numeric value. + sha256 The FIPS 180-2 (``SHA-256'') message digest of the file. - uname The file owner as a symbolic name. + sha256digest + A synonym for sha256. 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: @@ -138,6 +134,10 @@ DESCRIPTION link symbolic link socket socket + uid The file owner as a numeric value. + + uname The file owner as a symbolic name. + SEE ALSO cksum(1), find(1), mtree(8) diff --git a/archivers/libarchive/files/libarchive/archive.h.in b/archivers/libarchive/files/libarchive/archive.h.in index d76c85e51bd..c6d0c1c0e0e 100644 --- a/archivers/libarchive/files/libarchive/archive.h.in +++ b/archivers/libarchive/files/libarchive/archive.h.in @@ -22,18 +22,12 @@ * (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.h.in,v 1.47 2007/12/30 04:58:21 kientzle Exp $ + * $FreeBSD: src/lib/libarchive/archive.h.in,v 1.49 2008/03/14 22:19:50 kientzle Exp $ */ #ifndef ARCHIVE_H_INCLUDED #define ARCHIVE_H_INCLUDED -/* - * This header file corresponds to: - * Library version @ARCHIVE_VERSION@ - * Shared library version @SHLIB_MAJOR@ - */ - #include <sys/types.h> /* Linux requires this for off_t */ @ARCHIVE_H_INCLUDE_INTTYPES_H@ #include <stdio.h> /* For FILE * */ @@ -51,58 +45,60 @@ extern "C" { #endif /* - * Each of the version identifiers comes as a macro and a function. + * The version number is provided as both a macro and a function. * The macro identifies the installed header; the function identifies * the library version (which may not be the same if you're using a * dynamically-linked version of the library). */ /* - * Textual name/version of the library, useful for version displays. - */ -#define ARCHIVE_LIBRARY_VERSION "libarchive @LIBARCHIVE_VERSION_STRING@" -const char * archive_version(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 - * version stamp 2012108. + * The version number is expressed as a single integer that makes it + * easy to compare versions at build time: for version a.b.c, the + * version number is printf("%d%03d%03d",a,b,c). For example, if you + * know your application requires version 2.12.108 or later, you can + * assert that ARCHIVE_VERSION >= 2012108. * - * 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 (which defined API_VERSION and API_FEATURE): + * This single-number format 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 (which defined + * ARCHIVE_API_VERSION and ARCHIVE_API_FEATURE instead): * - * #ifndef ARCHIVE_VERSION_STAMP - * #define ARCHIVE_VERSION_STAMP \ + * #ifndef ARCHIVE_VERSION_NUMBER + * #define ARCHIVE_VERSION_NUMBER \ * (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000) * #endif */ -#define ARCHIVE_VERSION_STAMP @LIBARCHIVE_VERSION@ -int archive_version_stamp(void); +#define ARCHIVE_VERSION_NUMBER @LIBARCHIVE_VERSION_NUMBER@ +int archive_version_number(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. + * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_API_VERSION (ARCHIVE_VERSION_STAMP / 1000000) -int archive_api_version(void); +#define ARCHIVE_VERSION_STRING "libarchive @LIBARCHIVE_VERSION_STRING@" +const char * archive_version_string(void); +#if ARCHIVE_VERSION_NUMBER < 3000000 /* - * Minor version number. This is deprecated and will be removed. - * Use ARCHIVE_VERSION_STAMP to adapt to libarchive API variations. + * Deprecated; these are older names that will be removed in favor of + * the simpler definitions above. */ -#define ARCHIVE_API_FEATURE ((ARCHIVE_VERSION_STAMP / 1000) % 1000) +#define ARCHIVE_VERSION_STAMP ARCHIVE_VERSION_NUMBER +int archive_version_stamp(void); +#define ARCHIVE_LIBRARY_VERSION ARCHIVE_VERSION_STRING +const char * archive_version(void); +#define ARCHIVE_API_VERSION (ARCHIVE_VERSION_NUMBER / 1000000) +int archive_api_version(void); +#define ARCHIVE_API_FEATURE ((ARCHIVE_VERSION_NUMBER / 1000) % 1000) int archive_api_feature(void); +#endif - +#if ARCHIVE_VERSION_NUMBER < 3000000 +/* This should never have been here in the first place. */ +/* Legacy of old tar assumptions, will be removed in libarchive 3.0. */ #define ARCHIVE_BYTES_PER_RECORD 512 #define ARCHIVE_DEFAULT_BYTES_PER_BLOCK 10240 +#endif /* Declare our basic types. */ struct archive; @@ -119,6 +115,7 @@ struct archive_entry; #define ARCHIVE_WARN (-20) /* Partial success. */ /* For example, if write_header "fails", then you can't push data. */ #define ARCHIVE_FAILED (-25) /* Current operation cannot complete. */ +/* But if write_header is "fatal," then this archive is dead and useless. */ #define ARCHIVE_FATAL (-30) /* No more operations are possible. */ /* @@ -146,7 +143,7 @@ struct archive_entry; typedef ssize_t archive_read_callback(struct archive *, void *_client_data, const void **_buffer); /* Skips at most request bytes from archive and returns the skipped amount */ -#if ARCHIVE_API_VERSION < 2 +#if ARCHIVE_VERSION_NUMBER < 2000000 typedef ssize_t archive_skip_callback(struct archive *, void *_client_data, size_t request); #else @@ -370,7 +367,7 @@ void archive_read_extract_set_skip_file(struct archive *, int archive_read_close(struct archive *); /* Release all resources and destroy the object. */ /* Note that archive_read_finish will call archive_read_close for you. */ -#if ARCHIVE_API_VERSION > 1 +#if ARCHIVE_VERSION_NUMBER >= 2000000 int archive_read_finish(struct archive *); #else /* Temporarily allow library to compile with either 1.x or 2.0 API. */ @@ -407,6 +404,7 @@ int archive_write_get_bytes_in_last_block(struct archive *); int archive_write_set_skip_file(struct archive *, dev_t, ino_t); int archive_write_set_compression_bzip2(struct archive *); +int archive_write_set_compression_compress(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 *, @@ -445,7 +443,7 @@ int archive_write_open_memory(struct archive *, */ int archive_write_header(struct archive *, struct archive_entry *); -#if ARCHIVE_API_VERSION > 1 +#if ARCHIVE_VERSION_NUMBER >= 2000000 ssize_t archive_write_data(struct archive *, const void *, size_t); #else /* Temporarily allow library to compile with either 1.x or 2.0 API. */ @@ -455,7 +453,7 @@ int archive_write_data(struct archive *, const void *, size_t); ssize_t archive_write_data_block(struct archive *, const void *, size_t, off_t); int archive_write_finish_entry(struct archive *); int archive_write_close(struct archive *); -#if ARCHIVE_API_VERSION > 1 +#if ARCHIVE_VERSION_NUMBER >= 2000000 int archive_write_finish(struct archive *); #else /* Temporarily allow library to compile with either 1.x or 2.0 API. */ diff --git a/archivers/libarchive/files/libarchive/archive_entry.3 b/archivers/libarchive/files/libarchive/archive_entry.3 index 6b1b270f1a5..8d96de1fbf4 100644 --- a/archivers/libarchive/files/libarchive/archive_entry.3 +++ b/archivers/libarchive/files/libarchive/archive_entry.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_entry.3,v 1.15 2007/07/15 19:10:34 kientzle Exp $ +.\" $FreeBSD: src/lib/libarchive/archive_entry.3,v 1.17 2008/03/14 23:00:53 kientzle Exp $ .\" .Dd December 15, 2003 .Dt archive_entry 3 @@ -45,6 +45,8 @@ .Nm archive_entry_copy_gname_w , .Nm archive_entry_copy_hardlink , .Nm archive_entry_copy_hardlink_w , +.Nm archive_entry_copy_link , +.Nm archive_entry_copy_link_w , .Nm archive_entry_copy_pathname_w , .Nm archive_entry_copy_stat , .Nm archive_entry_copy_symlink , @@ -101,17 +103,47 @@ .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" +.Fo archive_entry_acl_add_entry +.Fa "struct archive_entry *" +.Fa "int type" +.Fa "int permset" +.Fa "int tag" +.Fa "int qual" +.Fa "const char *name" +.Fc +.Ft void +.Fo archive_entry_acl_add_entry_w +.Fa "struct archive_entry *" +.Fa "int type" +.Fa "int permset" +.Fa "int tag" +.Fa "int qual" +.Fa "const wchar_t *name" +.Fc .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" +.Fo archive_entry_acl_next +.Fa "struct archive_entry *" +.Fa "int want_type" +.Fa "int *type" +.Fa "int *permset" +.Fa "int *tag" +.Fa "int *qual" +.Fa "const char **name" +.Fc .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" +.Fo archive_entry_acl_next_w +.Fa "struct archive_entry *" +.Fa "int want_type" +.Fa "int *type" +.Fa "int *permset" +.Fa "int *tag" +.Fa "int *qual" +.Fa "const wchar_t **name" +.Fc .Ft int .Fn archive_entry_acl_reset "struct archive_entry *" "int want_type" .Ft const wchar_t * @@ -155,7 +187,11 @@ .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" +.Fo archive_entry_fflags +.Fa "struct archive_entry *" +.Fa "unsigned long *set" +.Fa "unsigned long *clear" +.Fc .Ft const char * .Fn archive_entry_fflags_text "struct archive_entry *" .Ft void @@ -195,7 +231,11 @@ .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" +.Fo archive_entry_set_fflags +.Fa "struct archive_entry *" +.Fa "unsigned long set" +.Fa "unsigned long clear" +.Fc .Ft void .Fn archive_entry_set_gid "struct archive_entry *" "gid_t" .Ft void diff --git a/archivers/libarchive/files/libarchive/archive_entry.c b/archivers/libarchive/files/libarchive/archive_entry.c index a6c9b4496c1..5f9e39a6674 100644 --- a/archivers/libarchive/files/libarchive/archive_entry.c +++ b/archivers/libarchive/files/libarchive/archive_entry.c @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry.c,v 1.45 2007/12/30 04:58:21 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry.c,v 1.51 2008/03/14 23:19:46 kientzle Exp $"); #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> @@ -1155,6 +1155,11 @@ archive_entry_acl_next(struct archive_entry *entry, int want_type, int *type, entry->acl_p = entry->acl_p->next; if (entry->acl_p == NULL) { entry->acl_state = 0; + *type = 0; + *permset = 0; + *tag = 0; + *id = -1; + *name = NULL; return (ARCHIVE_EOF); /* End of ACL entries. */ } *type = entry->acl_p->type; @@ -1536,7 +1541,7 @@ archive_entry_xattr_next(struct archive_entry * entry, return (ARCHIVE_OK); } else { *name = NULL; - *name = NULL; + *value = NULL; *size = (size_t)0; return (ARCHIVE_WARN); } diff --git a/archivers/libarchive/files/libarchive/archive_entry.h b/archivers/libarchive/files/libarchive/archive_entry.h index cebd55ba8ae..69d7702a533 100644 --- a/archivers/libarchive/files/libarchive/archive_entry.h +++ b/archivers/libarchive/files/libarchive/archive_entry.h @@ -22,7 +22,7 @@ * (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.h,v 1.24 2007/12/30 04:58:21 kientzle Exp $ + * $FreeBSD: src/lib/libarchive/archive_entry.h,v 1.26 2008/03/14 23:00:53 kientzle Exp $ */ #ifndef ARCHIVE_ENTRY_H_INCLUDED @@ -31,7 +31,15 @@ #include <sys/types.h> #include <stddef.h> /* for wchar_t */ #include <time.h> +#ifndef _WIN32 #include <unistd.h> +#else +typedef unsigned int uid_t; +typedef unsigned int gid_t; +typedef unsigned int ino_t; +typedef unsigned int dev_t; +typedef unsigned short mode_t; +#endif #ifdef __cplusplus extern "C" { @@ -317,12 +325,12 @@ int archive_entry_xattr_next(struct archive_entry *, const char ** /* name */, const void ** /* value */, size_t *); /* - * Utility to detect hardlinks. + * Utility to match up hardlinks. * * The 'struct archive_entry_linkresolver' is a cache of archive entries * for files with multiple links. Here's how to use it: * 1. Create a lookup object with archive_entry_linkresolver_new() - * 2. Set the appropriate strategy. + * 2. Tell it the archive format you're using. * 3. Hand each archive_entry to archive_entry_linkify(). * That function will return 0, 1, or 2 entries that should * be written. @@ -347,8 +355,8 @@ int archive_entry_xattr_next(struct archive_entry *, struct archive_entry_linkresolver; /* - * This machine supports three different strategies for marking - * hardlinks. The names come from the best-known + * There are three different strategies for marking hardlinks. + * The descriptions below name them after the best-known * formats that rely on each strategy: * * "Old cpio" is the simplest, it always returns any entry unmodified. @@ -357,7 +365,7 @@ struct archive_entry_linkresolver; * to detect and properly link the files as they are restored. * "tar" is also pretty simple; it caches a copy the first time it sees * any link. Subsequent appearances are modified to be hardlink - * references without any body to the first one. Used by all tar + * references to the first one without any body. Used by all tar * formats, although the newest tar formats permit the "old cpio" strategy * as well. This strategy is very simple for the dearchiver, * and reasonably straightforward for the archiver. @@ -385,26 +393,14 @@ struct archive_entry_linkresolver; * strategy requires you to rescan the archive from the beginning to * correctly extract an arbitrary link. */ -#define ARCHIVE_ENTRY_LINKIFY_LIKE_TAR 0 -#define ARCHIVE_ENTRY_LINKIFY_LIKE_OLD_CPIO 1 -#define ARCHIVE_ENTRY_LINKIFY_LIKE_NEW_CPIO 2 struct archive_entry_linkresolver *archive_entry_linkresolver_new(void); void archive_entry_linkresolver_set_strategy( - struct archive_entry_linkresolver *, int /* strategy */); + struct archive_entry_linkresolver *, int /* format_code */); void archive_entry_linkresolver_free(struct archive_entry_linkresolver *); void archive_entry_linkify(struct archive_entry_linkresolver *, struct archive_entry **, struct archive_entry **); -/* - * DEPRECATED: This will be removed in libarchive 3.0. It was an - * early attempt at providing library-level hardlink recognition - * support, but it only handles the tar strategy and cannot easily - * be extended, so it's being replaced with the "linkify" function. - */ -const char *archive_entry_linkresolve(struct archive_entry_linkresolver *, - struct archive_entry *); - #ifdef __cplusplus } #endif diff --git a/archivers/libarchive/files/libarchive/archive_entry_link_resolver.c b/archivers/libarchive/files/libarchive/archive_entry_link_resolver.c index 37131ff325d..0df9ff92e68 100644 --- a/archivers/libarchive/files/libarchive/archive_entry_link_resolver.c +++ b/archivers/libarchive/files/libarchive/archive_entry_link_resolver.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_entry_link_resolver.c,v 1.1 2007/ #include <string.h> #endif +#include "archive.h" #include "archive_entry.h" /* @@ -57,6 +58,11 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_entry_link_resolver.c,v 1.1 2007/ * below. */ +/* Users pass us a format code, we translate that into a strategy here. */ +#define ARCHIVE_ENTRY_LINKIFY_LIKE_TAR 0 +#define ARCHIVE_ENTRY_LINKIFY_LIKE_OLD_CPIO 1 +#define ARCHIVE_ENTRY_LINKIFY_LIKE_NEW_CPIO 2 + /* Initial size of link cache. */ #define links_cache_initial_size 1024 @@ -65,6 +71,7 @@ struct links_entry { struct links_entry *previous; int links; /* # links not yet seen */ int hash; + struct archive_entry *canonical; struct archive_entry *entry; }; @@ -79,8 +86,9 @@ struct archive_entry_linkresolver { static struct links_entry *find_entry(struct archive_entry_linkresolver *, struct archive_entry *); static void grow_hash(struct archive_entry_linkresolver *); -static void insert_entry(struct archive_entry_linkresolver *, +static struct links_entry *insert_entry(struct archive_entry_linkresolver *, struct archive_entry *); +static struct links_entry *next_entry(struct archive_entry_linkresolver *); struct archive_entry_linkresolver * archive_entry_linkresolver_new(void) @@ -106,49 +114,43 @@ archive_entry_linkresolver_new(void) void archive_entry_linkresolver_set_strategy(struct archive_entry_linkresolver *res, - int strategy) + int fmt) { - res->strategy = strategy; -} - -void -archive_entry_linkresolver_free(struct archive_entry_linkresolver *res) -{ - size_t i; - - if (res->buckets == NULL) - return; - - for (i = 0; i < res->number_buckets; i++) { - while (res->buckets[i] != NULL) { - struct links_entry *lp = res->buckets[i]->next; - archive_entry_free(res->buckets[i]->entry); - free(res->buckets[i]); - res->buckets[i] = lp; + int fmtbase = fmt & ARCHIVE_FORMAT_BASE_MASK; + + switch (fmtbase) { + case ARCHIVE_FORMAT_CPIO: + switch (fmt) { + case ARCHIVE_FORMAT_CPIO_SVR4_NOCRC: + case ARCHIVE_FORMAT_CPIO_SVR4_CRC: + res->strategy = ARCHIVE_ENTRY_LINKIFY_LIKE_NEW_CPIO; + break; + default: + res->strategy = ARCHIVE_ENTRY_LINKIFY_LIKE_OLD_CPIO; + break; } + break; + case ARCHIVE_FORMAT_TAR: + res->strategy = ARCHIVE_ENTRY_LINKIFY_LIKE_TAR; + break; + default: + res->strategy = ARCHIVE_ENTRY_LINKIFY_LIKE_TAR; + break; } - free(res->buckets); - res->buckets = NULL; } -/* Always uses tar-like semantics. */ -const char * -archive_entry_linkresolve(struct archive_entry_linkresolver *res, - struct archive_entry *entry) +void +archive_entry_linkresolver_free(struct archive_entry_linkresolver *res) { struct links_entry *le; - /* If it has only one link, then we're done. */ - if (archive_entry_nlink(entry) == 1) - return (NULL); - - /* Look it up in the hash. */ - le = find_entry(res, entry); - if (le != NULL) - return (archive_entry_pathname(le->entry)); - /* If it's not there, insert it. */ - insert_entry(res, entry); - return (NULL); + if (res->buckets != NULL) { + while ((le = next_entry(res)) != NULL) + archive_entry_free(le->entry); + free(res->buckets); + res->buckets = NULL; + } + free(res); } void @@ -160,6 +162,13 @@ archive_entry_linkify(struct archive_entry_linkresolver *res, *f = NULL; /* Default: Don't return a second entry. */ + if (*e == NULL) { + le = next_entry(res); + if (le != NULL) + *e = le->entry; + return; + } + /* If it has only one link, then we're done. */ if (archive_entry_nlink(*e) == 1) return; @@ -170,7 +179,7 @@ archive_entry_linkify(struct archive_entry_linkresolver *res, if (le != NULL) { archive_entry_set_size(*e, 0); archive_entry_set_hardlink(*e, - archive_entry_pathname(le->entry)); + archive_entry_pathname(le->canonical)); } else insert_entry(res, *e); return; @@ -180,17 +189,28 @@ archive_entry_linkify(struct archive_entry_linkresolver *res, case ARCHIVE_ENTRY_LINKIFY_LIKE_NEW_CPIO: le = find_entry(res, *e); if (le != NULL) { + /* + * Put the new entry in le, return the + * old entry from le. + */ t = *e; *e = le->entry; le->entry = t; + /* Make the old entry into a hardlink. */ archive_entry_set_size(*e, 0); archive_entry_set_hardlink(*e, - archive_entry_pathname(le->entry)); - if (le->links == 0) { + archive_entry_pathname(le->canonical)); + /* If we ran out of links, return the + * final entry as well. */ + if (le->links == 0) *f = le->entry; - } } else { - insert_entry(res, *e); + /* + * If we haven't seen it, tuck it away + * for future use. + */ + le = insert_entry(res, *e); + le->entry = *e; *e = NULL; } return; @@ -211,7 +231,7 @@ find_entry(struct archive_entry_linkresolver *res, /* Free a held entry. */ if (res->spare != NULL) { - archive_entry_free(res->spare->entry); + archive_entry_free(res->spare->canonical); free(res->spare); res->spare = NULL; } @@ -255,7 +275,41 @@ find_entry(struct archive_entry_linkresolver *res, return (NULL); } -static void +static struct links_entry * +next_entry(struct archive_entry_linkresolver *res) +{ + struct links_entry *le; + size_t bucket; + + /* Free a held entry. */ + if (res->spare != NULL) { + archive_entry_free(res->spare->canonical); + free(res->spare); + res->spare = NULL; + } + + /* If the links cache overflowed and got flushed, don't bother. */ + if (res->buckets == NULL) + return (NULL); + + /* Look for next non-empty bucket in the links cache. */ + for (bucket = 0; bucket < res->number_buckets; bucket++) { + le = res->buckets[bucket]; + if (le != NULL) { + /* Remove it from this hash bucket. */ + if (le->next != NULL) + le->next->previous = le->previous; + res->buckets[bucket] = le->next; + res->number_entries--; + /* Defer freeing this entry. */ + res->spare = le; + return (le); + } + } + return (NULL); +} + +static struct links_entry * insert_entry(struct archive_entry_linkresolver *res, struct archive_entry *entry) { @@ -265,12 +319,8 @@ insert_entry(struct archive_entry_linkresolver *res, /* Add this entry to the links cache. */ le = malloc(sizeof(struct links_entry)); if (le == NULL) - return; - le->entry = archive_entry_clone(entry); - if (le->entry == NULL) { - free(le); - return; - } + return (NULL); + le->entry = entry; /* If the links cache is getting too full, enlarge the hash table. */ if (res->number_entries > res->number_buckets * 2) @@ -288,6 +338,8 @@ insert_entry(struct archive_entry_linkresolver *res, res->buckets[bucket] = le; le->hash = hash; le->links = archive_entry_nlink(entry) - 1; + le->canonical = archive_entry_clone(entry); + return (le); } static void diff --git a/archivers/libarchive/files/libarchive/archive_read.3 b/archivers/libarchive/files/libarchive/archive_read.3 index 6daba3f3d11..e15c904a712 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.35 2007/09/19 16:37:45 kientzle Exp $ +.\" $FreeBSD: src/lib/libarchive/archive_read.3,v 1.36 2008/03/10 14:45:29 jkoshy Exp $ .\" .Dd August 19, 2006 .Dt archive_read 3 @@ -75,7 +75,10 @@ .Ft int .Fn archive_read_support_compression_none "struct archive *" .Ft int -.Fn archive_read_support_compression_program "struct archive *" "const char *cmd" +.Fo archive_read_support_compression_program +.Fa "struct archive *" +.Fa "const char *cmd" +.Fc .Ft int .Fn archive_read_support_format_all "struct archive *" .Ft int @@ -89,15 +92,32 @@ .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 *" +.Fo archive_read_open +.Fa "struct archive *" +.Fa "void *client_data" +.Fa "archive_open_callback *" +.Fa "archive_read_callback *" +.Fa "archive_close_callback *" +.Fc .Ft int -.Fn archive_read_open2 "struct archive *" "void *client_data" "archive_open_callback *" "archive_read_callback *" "archive_skip_callback *" "archive_close_callback *" +.Fo archive_read_open2 +.Fa "struct archive *" +.Fa "void *client_data" +.Fa "archive_open_callback *" +.Fa "archive_read_callback *" +.Fa "archive_skip_callback *" +.Fa "archive_close_callback *" +.Fc .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" +.Fo archive_read_open_filename +.Fa "struct archive *" +.Fa "const char *filename" +.Fa "size_t block_size" +.Fc .Ft int .Fn archive_read_open_memory "struct archive *" "void *buff" "size_t size" .Ft int @@ -105,7 +125,12 @@ .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" +.Fo archive_read_data_block +.Fa "struct archive *" +.Fa "const void **buff" +.Fa "size_t *len" +.Fa "off_t *offset" +.Fc .Ft int .Fn archive_read_data_skip "struct archive *" .\" #if ARCHIVE_API_VERSION < 3 @@ -115,9 +140,17 @@ .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" +.Fo archive_read_extract +.Fa "struct archive *" +.Fa "struct archive_entry *" +.Fa "int flags" +.Fc .Ft void -.Fn archive_read_extract_set_progress_callback "struct archive *" "void (*func)(void *)" "void *user_data" +.Fo archive_read_extract_set_progress_callback +.Fa "struct archive *" +.Fa "void (*func)(void *)" +.Fa "void *user_data" +.Fc .Ft int .Fn archive_read_close "struct archive *" .Ft int @@ -136,7 +169,13 @@ order they would be used: 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 +.It Xo +.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 +.Xc Enables auto-detection code and decompression support for the specified compression. Note that @@ -150,7 +189,14 @@ 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 +.It Xo +.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 +.Xc Enables support---including auto-detection code---for the specified archive format. For example, @@ -311,14 +357,26 @@ 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" +.Fo archive_read_callback +.Fa "struct archive *" +.Fa "void *client_data" +.Fa "const void **buffer" +.Fc .It .\" #if ARCHIVE_API_VERSION < 2 .Ft typedef int -.Fn archive_skip_callback "struct archive *" "void *client_data" "size_t request" +.Fo archive_skip_callback +.Fa "struct archive *" +.Fa "void *client_data" +.Fa "size_t request" +.Fc .\" #else .\" .Ft typedef off_t -.\" .Fn archive_skip_callback "struct archive *" "void *client_data" "off_t request" +.\" .Fo archive_skip_callback +.\" .Fa "struct archive *" +.\" .Fa "void *client_data" +.\" .Fa "off_t request" +.\" .Fc .\" #endif .It .Ft typedef int diff --git a/archivers/libarchive/files/libarchive/archive_read.c b/archivers/libarchive/files/libarchive/archive_read.c index 19be77569c1..327969f4185 100644 --- a/archivers/libarchive/files/libarchive/archive_read.c +++ b/archivers/libarchive/files/libarchive/archive_read.c @@ -32,7 +32,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read.c,v 1.37 2008/01/03 17:54:26 des Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read.c,v 1.38 2008/03/12 04:58:32 kientzle Exp $"); #ifdef HAVE_ERRNO_H #include <errno.h> @@ -64,25 +64,12 @@ struct archive * archive_read_new(void) { struct archive_read *a; - unsigned char *nulls; a = (struct archive_read *)malloc(sizeof(*a)); if (a == NULL) return (NULL); memset(a, 0, sizeof(*a)); a->archive.magic = ARCHIVE_READ_MAGIC; - a->bytes_per_block = ARCHIVE_DEFAULT_BYTES_PER_BLOCK; - - a->null_length = 1024; - nulls = (unsigned char *)malloc(a->null_length); - if (nulls == NULL) { - archive_set_error(&a->archive, ENOMEM, - "Can't allocate archive object 'nulls' element"); - free(a); - return (NULL); - } - memset(nulls, 0, a->null_length); - a->nulls = nulls; a->archive.state = ARCHIVE_STATE_NEW; a->entry = archive_entry_new(); @@ -660,8 +647,6 @@ archive_read_finish(struct archive *_a) (a->formats[i].cleanup)(a); } - /* Casting a pointer to int allows us to remove 'const.' */ - free((void *)(uintptr_t)(const void *)a->nulls); archive_string_free(&a->archive.error_string); if (a->entry) archive_entry_free(a->entry); diff --git a/archivers/libarchive/files/libarchive/archive_read_private.h b/archivers/libarchive/files/libarchive/archive_read_private.h index 90fb7db12e6..f4d0274b509 100644 --- a/archivers/libarchive/files/libarchive/archive_read_private.h +++ b/archivers/libarchive/files/libarchive/archive_read_private.h @@ -22,7 +22,7 @@ * (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_private.h,v 1.4 2008/01/03 17:54:26 des Exp $ + * $FreeBSD: src/lib/libarchive/archive_read_private.h,v 1.6 2008/03/15 11:09:16 kientzle Exp $ */ #ifndef ARCHIVE_READ_PRIVATE_H_INCLUDED @@ -41,10 +41,6 @@ struct archive_read { dev_t skip_file_dev; ino_t skip_file_ino; - /* Utility: Pointer to a block of nulls. */ - const unsigned char *nulls; - size_t null_length; - /* * Used by archive_read_data() to track blocks and copy * data to client buffers, filling gaps with zero bytes. @@ -58,30 +54,9 @@ struct archive_read { archive_open_callback *client_opener; archive_read_callback *client_reader; archive_skip_callback *client_skipper; - archive_write_callback *client_writer; archive_close_callback *client_closer; void *client_data; - /* - * Blocking information. Note that bytes_in_last_block is - * misleadingly named; I should find a better name. These - * control the final output from all compressors, including - * compression_none. - */ - int bytes_per_block; - int bytes_in_last_block; - - /* - * These control whether data within a gzip/bzip2 compressed - * stream gets padded or not. If pad_uncompressed is set, - * the data will be padded to a full block before being - * compressed. The pad_uncompressed_byte determines the value - * that will be used for padding. Note that these have no - * effect on compression "none." - */ - int pad_uncompressed; - int pad_uncompressed_byte; /* TODO: Support this. */ - /* File offset of beginning of most recently-read header. */ off_t header_position; @@ -118,17 +93,10 @@ struct archive_read { /* * Format detection is mostly the same as compression - * detection, with two significant differences: The bidders + * detection, with one significant difference: The bidders * use the read_ahead calls above to examine the stream rather * than having the supervisor hand them a block of data to - * examine, and the auction is repeated for every header. - * Winning bidders should set the archive_format and - * archive_format_name appropriately. Bid routines should - * check archive_format and decline to bid if the format of - * the last header was incompatible. - * - * Again, write support is considerably simpler because there's - * no need for an auction. + * examine. */ struct archive_format_descriptor { @@ -142,18 +110,6 @@ struct archive_read { struct archive_format_descriptor *format; /* Active format. */ /* - * Pointers to format-specific functions for writing. They're - * initialized by archive_write_set_format_XXX() calls. - */ - int (*format_init)(struct archive *); /* Only used on write. */ - int (*format_finish)(struct archive *); - int (*format_finish_entry)(struct archive *); - int (*format_write_header)(struct archive *, - struct archive_entry *); - ssize_t (*format_write_data)(struct archive *, - const void *buff, size_t); - - /* * Various information needed by archive_extract. */ struct extract *extract; 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 a74791c6dae..f6e4cc7e2ab 100644 --- a/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c +++ b/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c @@ -26,7 +26,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_ar.c,v 1.8 2008/02/19 05:54:24 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_ar.c,v 1.9 2008/03/12 21:10:26 kaiw Exp $"); #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> @@ -83,8 +83,7 @@ static int archive_read_format_ar_read_header(struct archive_read *a, struct archive_entry *e); static uint64_t ar_atol8(const char *p, unsigned char_cnt); static uint64_t ar_atol10(const char *p, unsigned char_cnt); -static int ar_parse_gnu_filename_table(struct archive_read *, struct ar *, - const void *, size_t); +static int ar_parse_gnu_filename_table(struct archive_read *a); static int ar_parse_common_header(struct ar *ar, struct archive_entry *, const char *h); @@ -167,8 +166,8 @@ archive_read_format_ar_read_header(struct archive_read *a, struct ar *ar; uint64_t number; /* Used to hold parsed numbers before validation. */ ssize_t bytes_read; - size_t bsd_name_length, entry_size; - char *p; + size_t bsd_name_length, entry_size, s; + char *p, *st; const void *b; const char *h; int r; @@ -277,22 +276,42 @@ archive_read_format_ar_read_header(struct archive_read *a, return (ARCHIVE_FATAL); } entry_size = (size_t)number; + if (entry_size == 0) { + archive_set_error(&a->archive, EINVAL, + "Invalid string table"); + return (ARCHIVE_WARN); + } + if (ar->strtab != NULL) { + archive_set_error(&a->archive, EINVAL, + "More than one string tables exist"); + return (ARCHIVE_WARN); + } + /* Read the filename table into memory. */ - bytes_read = (a->decompressor->read_ahead)(a, &b, entry_size); - if (bytes_read <= 0) - return (ARCHIVE_FATAL); - if ((size_t)bytes_read < entry_size) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Truncated input file"); + st = malloc(entry_size); + if (st == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Can't allocate filename table buffer"); return (ARCHIVE_FATAL); } - /* - * Don't consume the contents, so the client will - * also get a shot at reading it. - */ + ar->strtab = st; + ar->strtab_size = entry_size; + for (s = entry_size; s > 0; s -= bytes_read) { + bytes_read = (a->decompressor->read_ahead)(a, &b, s); + if (bytes_read <= 0) + return (ARCHIVE_FATAL); + if (bytes_read > (ssize_t)s) + bytes_read = s; + memcpy(st, b, bytes_read); + st += bytes_read; + (a->decompressor->consume)(a, bytes_read); + } + /* All contents are consumed. */ + ar->entry_bytes_remaining = 0; + archive_entry_set_size(entry, ar->entry_bytes_remaining); /* Parse the filename table. */ - return (ar_parse_gnu_filename_table(a, ar, b, entry_size)); + return (ar_parse_gnu_filename_table(a)); } /* @@ -492,31 +511,15 @@ archive_read_format_ar_skip(struct archive_read *a) } static int -ar_parse_gnu_filename_table(struct archive_read *a, struct ar *ar, - const void *h, size_t size) +ar_parse_gnu_filename_table(struct archive_read *a) { + struct ar *ar; char *p; + size_t size; - if (ar->strtab != NULL) { - archive_set_error(&a->archive, EINVAL, - "More than one string tables exist"); - return (ARCHIVE_WARN); - } - - if (size == 0) { - archive_set_error(&a->archive, EINVAL, "Invalid string table"); - return (ARCHIVE_WARN); - } - - ar->strtab_size = size; - ar->strtab = malloc(size); - if (ar->strtab == NULL) { - archive_set_error(&a->archive, ENOMEM, - "Can't allocate string table buffer"); - return (ARCHIVE_FATAL); - } + ar = (struct ar*)(a->format->data); + size = ar->strtab_size; - (void)memcpy(ar->strtab, h, size); for (p = ar->strtab; p < ar->strtab + size - 1; ++p) { if (*p == '/') { *p++ = '\0'; 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 7db6db3377a..f1980e6bd10 100644 --- a/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c +++ b/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_mtree.c,v 1.2 2008/02/19 06:07:10 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_mtree.c,v 1.4 2008/03/15 11:02:47 kientzle Exp $"); #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> @@ -76,12 +76,18 @@ struct mtree { struct mtree_entry *this_entry; struct archive_string current_dir; struct archive_string contents_name; + + off_t cur_size, cur_offset; }; static int cleanup(struct archive_read *); static int mtree_bid(struct archive_read *); +static int parse_file(struct archive_read *, struct archive_entry *, + struct mtree *, struct mtree_entry *); static void parse_escapes(char *, struct mtree_entry *); -static int parse_setting(struct archive_read *, struct mtree *, +static int parse_line(struct archive_read *, struct archive_entry *, + struct mtree *, struct mtree_entry *); +static int parse_keyword(struct archive_read *, struct mtree *, struct archive_entry *, char *, char *); static int read_data(struct archive_read *a, const void **buff, size_t *size, off_t *offset); @@ -252,14 +258,16 @@ read_mtree(struct archive_read *a, struct mtree *mtree) } } +/* + * Read in the entire mtree file into memory on the first request. + * Then use the next unused file to satisfy each header request. + */ static int read_header(struct archive_read *a, struct archive_entry *entry) { - struct stat st; struct mtree *mtree; - struct mtree_entry *mentry, *mentry2; - char *p, *q; - int r = ARCHIVE_OK, r1; + char *p; + int r; mtree = (struct mtree *)(a->format->data); @@ -278,16 +286,10 @@ read_header(struct archive_read *a, struct archive_entry *entry) a->archive.archive_format_name = mtree->archive_format_name; for (;;) { - mentry = mtree->this_entry; - if (mentry == NULL) { - mtree->this_entry = NULL; + if (mtree->this_entry == NULL) return (ARCHIVE_EOF); - } - mtree->this_entry = mentry->next; - if (mentry->used) - continue; - mentry->used = 1; - if (strcmp(mentry->name, "..") == 0) { + if (strcmp(mtree->this_entry->name, "..") == 0) { + mtree->this_entry->used = 1; if (archive_strlen(&mtree->current_dir) > 0) { /* Roll back current path. */ p = mtree->current_dir.s @@ -299,117 +301,165 @@ read_header(struct archive_read *a, struct archive_entry *entry) mtree->current_dir.length = p - mtree->current_dir.s + 1; } - continue; } + if (!mtree->this_entry->used) { + r = parse_file(a, entry, mtree, mtree->this_entry); + return (r); + } + mtree->this_entry = mtree->this_entry->next; + } +} + +/* + * A single file can have multiple lines contribute specifications. + * Parse as many lines as necessary, then pull additional information + * from a backing file on disk as necessary. + */ +static int +parse_file(struct archive_read *a, struct archive_entry *entry, + struct mtree *mtree, struct mtree_entry *mentry) +{ + struct stat st; + struct mtree_entry *mp; + int r = ARCHIVE_OK, r1; - mtree->filetype = AE_IFREG; + mentry->used = 1; - /* Parse options. */ - p = mentry->option_start; - while (p < mentry->option_end) { - q = p + strlen(p); - r1 = parse_setting(a, mtree, entry, p, q); - if (r1 != ARCHIVE_OK) - r = r1; - p = q + 1; - } + /* Initialize reasonable defaults. */ + mtree->filetype = AE_IFREG; + archive_entry_set_size(entry, 0); - if (mentry->full) { - archive_entry_copy_pathname(entry, mentry->name); - /* - * "Full" entries are allowed to have multiple - * lines and those lines aren't required to be - * adjacent. We don't support multiple lines - * for "relative" entries nor do we make any - * attempt to merge data from separate - * "relative" and "full" entries. (Merging - * "relative" and "full" entries would require - * dealing with pathname canonicalization, - * which is a very tricky subject.) - */ - mentry2 = mentry->next; - while (mentry2 != NULL) { - if (mentry2->full - && !mentry2->used - && strcmp(mentry->name, mentry2->name) == 0) { - /* - * Add those options as well; - * later lines override - * earlier ones. - */ - p = mentry2->option_start; - while (p < mentry2->option_end) { - q = p + strlen(p); - r1 = parse_setting(a, mtree, entry, p, q); - if (r1 != ARCHIVE_OK) - r = r1; - p = q + 1; - } - mentry2->used = 1; - } - mentry2 = mentry2->next; - } - } else { - /* - * Relative entries require us to construct - * the full path and possibly update the - * current directory. - */ - size_t n = archive_strlen(&mtree->current_dir); - if (n > 0) - archive_strcat(&mtree->current_dir, "/"); - archive_strcat(&mtree->current_dir, mentry->name); - archive_entry_copy_pathname(entry, mtree->current_dir.s); - if (archive_entry_filetype(entry) != AE_IFDIR) - mtree->current_dir.length = n; - } + /* Parse options from this line. */ + r = parse_line(a, entry, mtree, mentry); + if (mentry->full) { + archive_entry_copy_pathname(entry, mentry->name); /* - * Try to open and stat the file to get the real size. - * It would be nice to avoid this here so that getting - * a listing of an mtree wouldn't require opening - * every referenced contents file. But then we - * wouldn't know the actual contents size, so I don't - * see a really viable way around this. (Also, we may - * want to someday pull other unspecified info from - * the contents file on disk.) + * "Full" entries are allowed to have multiple lines + * and those lines aren't required to be adjacent. We + * don't support multiple lines for "relative" entries + * nor do we make any attempt to merge data from + * separate "relative" and "full" entries. (Merging + * "relative" and "full" entries would require dealing + * with pathname canonicalization, which is a very + * tricky subject.) */ - if (archive_strlen(&mtree->contents_name) > 0) { - mtree->fd = open(mtree->contents_name.s, - O_RDONLY | O_BINARY); - if (mtree->fd < 0) { - archive_set_error(&a->archive, errno, - "Can't open content=\"%s\"", - mtree->contents_name.s); - r = ARCHIVE_WARN; + for (mp = mentry->next; mp != NULL; mp = mp->next) { + if (mp->full && !mp->used + && strcmp(mentry->name, mp->name) == 0) { + /* Later lines override earlier ones. */ + mp->used = 1; + r1 = parse_line(a, entry, mtree, mp); + if (r1 < r) + r = r1; } - } else { - /* If the specified path opens, use it. */ - mtree->fd = open(mtree->current_dir.s, - O_RDONLY | O_BINARY); - /* But don't fail if it's not there. */ } - + } else { /* - * If there is a contents file on disk, use that size; - * otherwise leave it as-is (it might have been set from - * the mtree size= keyword). + * Relative entries require us to construct + * the full path and possibly update the + * current directory. */ - if (mtree->fd >= 0) { - fstat(mtree->fd, &st); + size_t n = archive_strlen(&mtree->current_dir); + if (n > 0) + archive_strcat(&mtree->current_dir, "/"); + archive_strcat(&mtree->current_dir, mentry->name); + archive_entry_copy_pathname(entry, mtree->current_dir.s); + if (archive_entry_filetype(entry) != AE_IFDIR) + mtree->current_dir.length = n; + } + + /* + * Try to open and stat the file to get the real size + * and other file info. It would be nice to avoid + * this here so that getting a listing of an mtree + * wouldn't require opening every referenced contents + * file. But then we wouldn't know the actual + * contents size, so I don't see a really viable way + * around this. (Also, we may want to someday pull + * other unspecified info from the contents file on + * disk.) + */ + mtree->fd = -1; + if (archive_strlen(&mtree->contents_name) > 0) { + mtree->fd = open(mtree->contents_name.s, + O_RDONLY | O_BINARY); + if (mtree->fd < 0) { + archive_set_error(&a->archive, errno, + "Can't open content=\"%s\"", + mtree->contents_name.s); + r = ARCHIVE_WARN; + } + } else if (archive_entry_filetype(entry) == AE_IFREG) { + mtree->fd = open(archive_entry_pathname(entry), + O_RDONLY | O_BINARY); + } + + /* + * If there is a contents file on disk, use that size; + * otherwise leave it as-is (it might have been set from + * the mtree size= keyword). + */ + if (mtree->fd >= 0) { + if (fstat(mtree->fd, &st) != 0) { + archive_set_error(&a->archive, errno, + "could not stat %s", + archive_entry_pathname(entry)); + r = ARCHIVE_WARN; + /* If we can't stat it, don't keep it open. */ + close(mtree->fd); + mtree->fd = -1; + } else if ((st.st_mode & S_IFMT) != S_IFREG) { + archive_set_error(&a->archive, errno, + "%s is not a regular file", + archive_entry_pathname(entry)); + r = ARCHIVE_WARN; + /* Don't hold a non-regular file open. */ + close(mtree->fd); + mtree->fd = -1; + } else { archive_entry_set_size(entry, st.st_size); + archive_entry_set_ino(entry, st.st_ino); + archive_entry_set_dev(entry, st.st_dev); + archive_entry_set_nlink(entry, st.st_nlink); } + } + mtree->cur_size = archive_entry_size(entry); + mtree->offset = 0; - return r; + return r; +} + +/* + * Each line contains a sequence of keywords. + */ +static int +parse_line(struct archive_read *a, struct archive_entry *entry, + struct mtree *mtree, struct mtree_entry *mp) +{ + char *p, *q; + int r = ARCHIVE_OK, r1; + + p = mp->option_start; + while (p < mp->option_end) { + q = p + strlen(p); + r1 = parse_keyword(a, mtree, entry, p, q); + if (r1 < r) + r = r1; + p = q + 1; } + return (r); } +/* + * Parse a single keyword and its value. + */ static int -parse_setting(struct archive_read *a, struct mtree *mtree, struct archive_entry *entry, char *key, char *end) +parse_keyword(struct archive_read *a, struct mtree *mtree, + struct archive_entry *entry, char *key, char *end) { char *val; - if (end == key) return (ARCHIVE_OK); if (*key == '\0') @@ -427,7 +477,8 @@ parse_setting(struct archive_read *a, struct mtree *mtree, struct archive_entry switch (key[0]) { case 'c': - if (strcmp(key, "content") == 0) { + if (strcmp(key, "content") == 0 + || strcmp(key, "contents") == 0) { parse_escapes(val, NULL); archive_strcpy(&mtree->contents_name, val); break; @@ -441,6 +492,11 @@ parse_setting(struct archive_read *a, struct mtree *mtree, struct archive_entry archive_entry_copy_gname(entry, val); break; } + case 'l': + if (strcmp(key, "link") == 0) { + archive_entry_set_link(entry, val); + break; + } case 'm': if (strcmp(key, "mode") == 0) { if (val[0] == '0') { @@ -452,6 +508,11 @@ parse_setting(struct archive_read *a, struct mtree *mtree, struct archive_entry "Symbolic mode \"%s\" unsupported", val); break; } + case 's': + if (strcmp(key, "size") == 0) { + archive_entry_set_size(entry, mtree_atol10(&val)); + break; + } case 't': if (strcmp(key, "type") == 0) { switch (val[0]) { @@ -517,6 +578,7 @@ parse_setting(struct archive_read *a, struct mtree *mtree, struct archive_entry static int read_data(struct archive_read *a, const void **buff, size_t *size, off_t *offset) { + size_t bytes_to_read; ssize_t bytes_read; struct mtree *mtree; @@ -538,7 +600,11 @@ read_data(struct archive_read *a, const void **buff, size_t *size, off_t *offset *buff = mtree->buff; *offset = mtree->offset; - bytes_read = read(mtree->fd, mtree->buff, mtree->buffsize); + if ((off_t)mtree->buffsize > mtree->cur_size - mtree->offset) + bytes_to_read = mtree->cur_size - mtree->offset; + else + bytes_to_read = mtree->buffsize; + bytes_read = read(mtree->fd, mtree->buff, bytes_to_read); if (bytes_read < 0) { archive_set_error(&a->archive, errno, "Can't read"); return (ARCHIVE_WARN); @@ -548,7 +614,7 @@ read_data(struct archive_read *a, const void **buff, size_t *size, off_t *offset return (ARCHIVE_EOF); } mtree->offset += bytes_read; - *size = (size_t)bytes_read; + *size = bytes_read; return (ARCHIVE_OK); } 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 26b2abbe578..76fda2d63c2 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.65 2008/01/31 07:41:45 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_tar.c,v 1.67 2008/03/15 01:43:58 kientzle Exp $"); #ifdef HAVE_ERRNO_H #include <errno.h> @@ -714,7 +714,7 @@ archive_block_is_null(const unsigned char *p) { unsigned i; - for (i = 0; i < ARCHIVE_BYTES_PER_RECORD / sizeof(*p); i++) + for (i = 0; i < 512; i++) if (*p++) return (0); return (1); @@ -1258,9 +1258,11 @@ pax_header(struct archive_read *a, struct tar *tar, archive_entry_copy_gname(entry, value); else { wp = utf8_decode(tar, value, strlen(value)); - if (wp == NULL) + if (wp == NULL) { archive_entry_copy_gname(entry, value); - else + if (err > ARCHIVE_WARN) + err = ARCHIVE_WARN; + } else archive_entry_copy_gname_w(entry, wp); } } @@ -1270,9 +1272,11 @@ pax_header(struct archive_read *a, struct tar *tar, archive_entry_copy_link(entry, value); else { wp = utf8_decode(tar, value, strlen(value)); - if (wp == NULL) + if (wp == NULL) { archive_entry_copy_link(entry, value); - else + if (err > ARCHIVE_WARN) + err = ARCHIVE_WARN; + } else archive_entry_copy_link_w(entry, wp); } } @@ -1282,9 +1286,11 @@ pax_header(struct archive_read *a, struct tar *tar, archive_entry_copy_pathname(entry, value); else { wp = utf8_decode(tar, value, strlen(value)); - if (wp == NULL) + if (wp == NULL) { archive_entry_copy_pathname(entry, value); - else + if (err > ARCHIVE_WARN) + err = ARCHIVE_WARN; + } else archive_entry_copy_pathname_w(entry, wp); } } @@ -1294,9 +1300,11 @@ pax_header(struct archive_read *a, struct tar *tar, archive_entry_copy_uname(entry, value); else { wp = utf8_decode(tar, value, strlen(value)); - if (wp == NULL) + if (wp == NULL) { archive_entry_copy_uname(entry, value); - else + if (err > ARCHIVE_WARN) + err = ARCHIVE_WARN; + } else archive_entry_copy_uname_w(entry, wp); } } 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 09e7411be86..a105297ad4f 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.21 2008/02/26 07:17:47 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_zip.c,v 1.22 2008/02/27 06:05:59 kientzle Exp $"); #ifdef HAVE_ERRNO_H #include <errno.h> @@ -743,7 +743,7 @@ archive_read_format_zip_read_data_skip(struct archive_read *a) { struct zip *zip; const void *buff = NULL; - ssize_t bytes_avail; + off_t bytes_skipped; zip = (struct zip *)(a->format->data); @@ -766,19 +766,10 @@ archive_read_format_zip_read_data_skip(struct archive_read *a) * If the length is at the beginning, we can skip the * compressed data much more quickly. */ - while (zip->entry_bytes_remaining > 0) { - bytes_avail = (a->decompressor->read_ahead)(a, &buff, 1); - if (bytes_avail <= 0) { - archive_set_error(&a->archive, - ARCHIVE_ERRNO_FILE_FORMAT, - "Truncated ZIP file body"); - return (ARCHIVE_FATAL); - } - if (bytes_avail > zip->entry_bytes_remaining) - bytes_avail = zip->entry_bytes_remaining; - (a->decompressor->consume)(a, bytes_avail); - zip->entry_bytes_remaining -= bytes_avail; - } + bytes_skipped = (a->decompressor->skip)(a, zip->entry_bytes_remaining); + if (bytes_skipped < 0) + return (ARCHIVE_FATAL); + /* This entry is finished and done. */ zip->end_of_entry_cleanup = zip->end_of_entry = 1; return (ARCHIVE_OK); diff --git a/archivers/libarchive/files/libarchive/archive_string.h b/archivers/libarchive/files/libarchive/archive_string.h index 596db9a1482..f56c50fe42a 100644 --- a/archivers/libarchive/files/libarchive/archive_string.h +++ b/archivers/libarchive/files/libarchive/archive_string.h @@ -22,7 +22,7 @@ * (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_string.h,v 1.9 2007/05/29 01:00:19 kientzle Exp $ + * $FreeBSD: src/lib/libarchive/archive_string.h,v 1.10 2008/03/14 22:00:09 kientzle Exp $ * */ @@ -116,4 +116,7 @@ void __archive_string_vsprintf(struct archive_string *, const char *, va_list); #define archive_string_vsprintf __archive_string_vsprintf +void __archive_string_sprintf(struct archive_string *, const char *, ...); +#define archive_string_sprintf __archive_string_sprintf + #endif diff --git a/archivers/libarchive/files/libarchive/archive_string_sprintf.c b/archivers/libarchive/files/libarchive/archive_string_sprintf.c index 763e75dcd84..6f77a36a1b8 100644 --- a/archivers/libarchive/files/libarchive/archive_string_sprintf.c +++ b/archivers/libarchive/files/libarchive/archive_string_sprintf.c @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_string_sprintf.c,v 1.9 2007/07/15 19:13:59 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_string_sprintf.c,v 1.10 2008/03/14 22:00:09 kientzle Exp $"); /* * The use of printf()-family functions can be troublesome @@ -44,6 +44,16 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_string_sprintf.c,v 1.9 2007/07/15 #include "archive_string.h" #include "archive_private.h" +void +__archive_string_sprintf(struct archive_string *as, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + archive_string_vsprintf(as, fmt, ap); + va_end(ap); +} + /* * Like 'vsprintf', but ensures the target is big enough, resizing if * necessary. diff --git a/archivers/libarchive/files/libarchive/archive_util.3 b/archivers/libarchive/files/libarchive/archive_util.3 index b8a030e4932..b315c55e515 100644 --- a/archivers/libarchive/files/libarchive/archive_util.3 +++ b/archivers/libarchive/files/libarchive/archive_util.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_util.3,v 1.7 2007/05/29 01:00:19 kientzle Exp $ +.\" $FreeBSD: src/lib/libarchive/archive_util.3,v 1.8 2008/03/10 14:44:40 jkoshy Exp $ .\" .Dd January 8, 2005 .Dt archive_util 3 @@ -57,7 +57,12 @@ .Ft const char * .Fn archive_format_name "struct archive *" .Ft void -.Fn archive_set_error "struct archive *" "int error_code" "const char *fmt" "..." +.Fo archive_set_error +.Fa "struct archive *" +.Fa "int error_code" +.Fa "const char *fmt" +.Fa "..." +.Fc .Sh DESCRIPTION These functions provide access to various information about the .Tn struct archive diff --git a/archivers/libarchive/files/libarchive/archive_util.c b/archivers/libarchive/files/libarchive/archive_util.c index 413199a360f..55dd1fa10c3 100644 --- a/archivers/libarchive/files/libarchive/archive_util.c +++ b/archivers/libarchive/files/libarchive/archive_util.c @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_util.c,v 1.16 2007/12/30 04:58:21 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_util.c,v 1.17 2008/03/14 22:31:57 kientzle Exp $"); #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> @@ -38,29 +38,49 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_util.c,v 1.16 2007/12/30 04:58:21 #include "archive.h" #include "archive_private.h" +#include "archive_string.h" +#if ARCHIVE_VERSION_NUMBER < 3000000 +/* These disappear in libarchive 3.0 */ +/* Deprecated. */ int archive_api_feature(void) { return (ARCHIVE_API_FEATURE); } +/* Deprecated. */ int archive_api_version(void) { return (ARCHIVE_API_VERSION); } +/* Deprecated synonym for archive_version_number() */ int archive_version_stamp(void) { - return (ARCHIVE_VERSION_STAMP); + return (archive_version_number()); } +/* Deprecated synonym for archive_version_string() */ const char * archive_version(void) { - return (ARCHIVE_LIBRARY_VERSION); + return (archive_version_string()); +} +#endif + +int +archive_version_number(void) +{ + return (ARCHIVE_VERSION_NUMBER); +} + +const char * +archive_version_string(void) +{ + return (ARCHIVE_VERSION_STRING); } int diff --git a/archivers/libarchive/files/libarchive/archive_write.3 b/archivers/libarchive/files/libarchive/archive_write.3 index c07b6b570ea..253b39e7826 100644 --- a/archivers/libarchive/files/libarchive/archive_write.3 +++ b/archivers/libarchive/files/libarchive/archive_write.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_write.3,v 1.22 2007/05/29 01:00:19 kientzle Exp $ +.\" $FreeBSD: src/lib/libarchive/archive_write.3,v 1.23 2008/03/10 14:44:41 jkoshy Exp $ .\" .Dd August 19, 2006 .Dt archive_write 3 @@ -70,7 +70,10 @@ .Ft int .Fn archive_write_set_compression_none "struct archive *" .Ft int -.Fn archive_write_set_compression_program "struct archive *" "const char * cmd" +.Fo archive_write_set_compression_program +.Fa "struct archive *" +.Fa "const char * cmd" +.Fc .Ft int .Fn archive_write_set_format_cpio "struct archive *" .Ft int @@ -84,7 +87,13 @@ .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 *" +.Fo archive_write_open +.Fa "struct archive *" +.Fa "void *client_data" +.Fa "archive_open_callback *" +.Fa "archive_write_callback *" +.Fa "archive_close_callback *" +.Fc .Ft int .Fn archive_write_open_fd "struct archive *" "int fd" .Ft int @@ -92,7 +101,12 @@ .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" +.Fo archive_write_open_memory +.Fa "struct archive *" +.Fa "void *buffer" +.Fa "size_t bufferSize" +.Fa "size_t *outUsed" +.Fc .Ft int .Fn archive_write_header "struct archive *" "struct archive_entry *" .Ft ssize_t @@ -150,7 +164,14 @@ 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 +.It Xo +.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 +.Xc Sets the format that will be used for the archive. The library can write POSIX octet-oriented cpio format archives, @@ -174,7 +195,11 @@ filenames, linknames, uids, sizes, etc. 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 +.It Xo +.Fn archive_write_set_compression_bzip2 , +.Fn archive_write_set_compression_gzip , +.Fn archive_write_set_compression_none +.Xc The resulting archive will be compressed as specified. Note that the compressed output is always properly blocked. .It Fn archive_write_set_compression_program @@ -310,7 +335,12 @@ to register an error code and message and return .Bl -item -offset indent .It .Ft typedef ssize_t -.Fn archive_write_callback "struct archive *" "void *client_data" "void *buffer" "size_t length" +.Fo archive_write_callback +.Fa "struct archive *" +.Fa "void *client_data" +.Fa "void *buffer" +.Fa "size_t length" +.Fc .El .Pp The write callback is invoked whenever the library diff --git a/archivers/libarchive/files/libarchive/archive_write.c b/archivers/libarchive/files/libarchive/archive_write.c index 2977063979d..1a3ddc9a5e6 100644 --- a/archivers/libarchive/files/libarchive/archive_write.c +++ b/archivers/libarchive/files/libarchive/archive_write.c @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_write.c,v 1.26 2007/05/29 01:00:19 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write.c,v 1.27 2008/03/14 23:09:02 kientzle Exp $"); /* * This file contains the "essential" portions of the write API, that @@ -97,7 +97,12 @@ archive_write_new(void) a->archive.magic = ARCHIVE_WRITE_MAGIC; a->archive.state = ARCHIVE_STATE_NEW; a->archive.vtable = archive_write_vtable(); - a->bytes_per_block = ARCHIVE_DEFAULT_BYTES_PER_BLOCK; + /* + * The value 10240 here matches the traditional tar default, + * but is otherwise arbitrary. + * TODO: Set the default block size from the format selected. + */ + a->bytes_per_block = 10240; a->bytes_in_last_block = -1; /* Default */ /* Initialize a block of nulls for padding purposes. */ diff --git a/archivers/libarchive/files/libarchive/archive_write_disk.3 b/archivers/libarchive/files/libarchive/archive_write_disk.3 index 880a399b949..5d836e105e3 100644 --- a/archivers/libarchive/files/libarchive/archive_write_disk.3 +++ b/archivers/libarchive/files/libarchive/archive_write_disk.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_write_disk.3,v 1.1 2007/03/03 07:37:36 kientzle Exp $ +.\" $FreeBSD: src/lib/libarchive/archive_write_disk.3,v 1.2 2008/03/10 14:44:41 jkoshy Exp $ .\" .Dd March 2, 2007 .Dt archive_write_disk 3 @@ -49,11 +49,21 @@ .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 *)" +.Fo archive_write_disk_set_group_lookup +.Fa "struct archive *" +.Fa "void *" +.Fa "gid_t (*)(void *, const char *gname, gid_t gid)" +.Fa "void (*cleanup)(void *)" +.Fc .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 *)" +.Fo archive_write_disk_set_user_lookup +.Fa "struct archive *" +.Fa "void *" +.Fa "uid_t (*)(void *, const char *uname, uid_t uid)" +.Fa "void (*cleanup)(void *)" +.Fc .Ft int .Fn archive_write_header "struct archive *" "struct archive_entry *" .Ft ssize_t @@ -160,7 +170,10 @@ 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 +.It Xo +.Fn archive_write_disk_set_group_lookup , +.Fn archive_write_disk_set_user_lookup +.Xc The .Tn struct archive_entry objects contain both names and ids that can be used to identify users diff --git a/archivers/libarchive/files/libarchive/archive_write_disk.c b/archivers/libarchive/files/libarchive/archive_write_disk.c index dfb6d35aec8..620beac48ed 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.22 2008/02/19 05:39:35 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.24 2008/03/15 04:20:50 kientzle Exp $"); #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> @@ -1167,7 +1167,7 @@ check_symlinks(struct archive_write_disk *a) struct stat st; /* - * Gaurd against symlink tricks. Reject any archive entry whose + * Guard against symlink tricks. Reject any archive entry whose * destination would be altered by a symlink. */ /* Whatever we checked last time doesn't need to be re-checked. */ @@ -1611,7 +1611,7 @@ set_mode(struct archive_write_disk *a, int mode) if (a->pst != NULL) { /* Already have stat() data available. */ #ifdef HAVE_FSTAT - } else if (fd >= 0 && fstat(fd, &a->st) == 0) { + } else if (a->fd >= 0 && fstat(a->fd, &a->st) == 0) { a->pst = &a->st; #endif } else if (stat(a->name, &a->st) == 0) { diff --git a/archivers/libarchive/files/libarchive/archive_write_private.h b/archivers/libarchive/files/libarchive/archive_write_private.h index 82935f4627a..55c24ad96ca 100644 --- a/archivers/libarchive/files/libarchive/archive_write_private.h +++ b/archivers/libarchive/files/libarchive/archive_write_private.h @@ -22,7 +22,7 @@ * (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_private.h,v 1.2 2007/05/29 01:00:19 kientzle Exp $ + * $FreeBSD: src/lib/libarchive/archive_write_private.h,v 1.3 2008/03/15 11:04:45 kientzle Exp $ */ #ifndef ARCHIVE_WRITE_PRIVATE_H_INCLUDED @@ -82,13 +82,6 @@ struct archive_write { } compressor; /* - * Again, write support is considerably simpler because there's - * no need for an auction. - */ - int archive_format; - const char *archive_format_name; - - /* * Pointers to format-specific functions for writing. They're * initialized by archive_write_set_format_XXX() calls. */ diff --git a/archivers/libarchive/files/libarchive/archive_write_set_compression_compress.c b/archivers/libarchive/files/libarchive/archive_write_set_compression_compress.c new file mode 100644 index 00000000000..f913a23c53b --- /dev/null +++ b/archivers/libarchive/files/libarchive/archive_write_set_compression_compress.c @@ -0,0 +1,494 @@ +/*- + * Copyright (c) 2008 Joerg Sonnenberger + * 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. + */ + +/*- + * Copyright (c) 1985, 1986, 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Diomidis Spinellis and James A. Woods, derived from original + * work by Spencer Thomas and Joseph Orost. + * + * 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. + * 3. 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. + */ + +#include "archive_platform.h" + +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_compression_compress.c,v 1.1 2008/03/14 20:35:37 kientzle Exp $"); + +#ifdef HAVE_ERRNO_H +#include <errno.h> +#endif +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif +#ifdef HAVE_STRING_H +#include <string.h> +#endif + +#include "archive.h" +#include "archive_private.h" +#include "archive_write_private.h" + +#define HSIZE 69001 /* 95% occupancy */ +#define HSHIFT 8 /* 8 - trunc(log2(HSIZE / 65536)) */ +#define CHECK_GAP 10000 /* Ratio check interval. */ + +#define MAXCODE(bits) ((1 << (bits)) - 1) + +/* + * the next two codes should not be changed lightly, as they must not + * lie within the contiguous general code space. + */ +#define FIRST 257 /* First free entry. */ +#define CLEAR 256 /* Table clear output code. */ + +struct private_data { + off_t in_count, out_count, checkpoint; + + int code_len; /* Number of bits/code. */ + int cur_maxcode; /* Maximum code, given n_bits. */ + int max_maxcode; /* Should NEVER generate this code. */ + int hashtab [HSIZE]; + unsigned short codetab [HSIZE]; + int first_free; /* First unused entry. */ + int compress_ratio; + + int cur_code, cur_fcode; + + int bit_offset; + unsigned char bit_buf; + + unsigned char *compressed; + size_t compressed_buffer_size; + size_t compressed_offset; +}; + +static int archive_compressor_compress_finish(struct archive_write *); +static int archive_compressor_compress_init(struct archive_write *); +static int archive_compressor_compress_write(struct archive_write *, + const void *, size_t); + +/* + * Allocate, initialize and return a archive object. + */ +int +archive_write_set_compression_compress(struct archive *_a) +{ + struct archive_write *a = (struct archive_write *)_a; + __archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC, + ARCHIVE_STATE_NEW, "archive_write_set_compression_compress"); + a->compressor.init = &archive_compressor_compress_init; + a->archive.compression_code = ARCHIVE_COMPRESSION_COMPRESS; + a->archive.compression_name = "compress"; + return (ARCHIVE_OK); +} + +/* + * Setup callback. + */ +static int +archive_compressor_compress_init(struct archive_write *a) +{ + int ret; + struct private_data *state; + + a->archive.compression_code = ARCHIVE_COMPRESSION_COMPRESS; + a->archive.compression_name = "compress"; + + if (a->bytes_per_block < 4) { + archive_set_error(&a->archive, EINVAL, + "Can't write Compress header as single block"); + return (ARCHIVE_FATAL); + } + + if (a->client_opener != NULL) { + ret = (a->client_opener)(&a->archive, a->client_data); + if (ret != ARCHIVE_OK) + return (ret); + } + + state = (struct private_data *)malloc(sizeof(*state)); + if (state == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Can't allocate data for compression"); + return (ARCHIVE_FATAL); + } + memset(state, 0, sizeof(*state)); + + state->compressed_buffer_size = a->bytes_per_block; + state->compressed = malloc(state->compressed_buffer_size); + + if (state->compressed == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Can't allocate data for compression buffer"); + free(state); + return (ARCHIVE_FATAL); + } + + a->compressor.write = archive_compressor_compress_write; + a->compressor.finish = archive_compressor_compress_finish; + + state->max_maxcode = 0x10000; /* Should NEVER generate this code. */ + state->in_count = 0; /* Length of input. */ + state->bit_buf = 0; + state->bit_offset = 0; + state->out_count = 3; /* Includes 3-byte header mojo. */ + state->compress_ratio = 0; + state->checkpoint = CHECK_GAP; + state->code_len = 9; + state->cur_maxcode = MAXCODE(state->code_len); + state->first_free = FIRST; + + memset(state->hashtab, 0xff, sizeof(state->hashtab)); + + /* Prime output buffer with a gzip header. */ + state->compressed[0] = 0x1f; /* Compress */ + state->compressed[1] = 0x9d; + state->compressed[2] = 0x90; /* Block mode, 16bit max */ + state->compressed_offset = 3; + + a->compressor.data = state; + return (0); +} + +/*- + * Output the given code. + * Inputs: + * code: A n_bits-bit integer. If == -1, then EOF. This assumes + * that n_bits =< (long)wordsize - 1. + * Outputs: + * Outputs code to the file. + * Assumptions: + * Chars are 8 bits long. + * Algorithm: + * Maintain a BITS character long buffer (so that 8 codes will + * fit in it exactly). Use the VAX insv instruction to insert each + * code in turn. When the buffer fills up empty it and start over. + */ + +static unsigned char rmask[9] = + {0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff}; + +static int +output_byte(struct archive_write *a, unsigned char c) +{ + struct private_data *state = a->compressor.data; + ssize_t bytes_written; + + state->compressed[state->compressed_offset++] = c; + ++state->out_count; + + if (state->compressed_buffer_size == state->compressed_offset) { + bytes_written = (a->client_writer)(&a->archive, + a->client_data, + state->compressed, state->compressed_buffer_size); + if (bytes_written <= 0) + return ARCHIVE_FATAL; + a->archive.raw_position += bytes_written; + state->compressed_offset = 0; + } + + return ARCHIVE_OK; +} + +static int +output_code(struct archive_write *a, int ocode) +{ + struct private_data *state = a->compressor.data; + int bits, ret, clear_flg, bit_offset; + + clear_flg = ocode == CLEAR; + bits = state->code_len; + + /* + * Since ocode is always >= 8 bits, only need to mask the first + * hunk on the left. + */ + bit_offset = state->bit_offset % 8; + state->bit_buf |= (ocode << bit_offset) & 0xff; + output_byte(a, state->bit_buf); + + bits = state->code_len - (8 - bit_offset); + ocode >>= 8 - bit_offset; + /* Get any 8 bit parts in the middle (<=1 for up to 16 bits). */ + if (bits >= 8) { + output_byte(a, ocode & 0xff); + ocode >>= 8; + bits -= 8; + } + /* Last bits. */ + state->bit_offset += state->code_len; + state->bit_buf = ocode & rmask[bits]; + if (state->bit_offset == state->code_len * 8) + state->bit_offset = 0; + + /* + * If the next entry is going to be too big for the ocode size, + * then increase it, if possible. + */ + if (clear_flg || state->first_free > state->cur_maxcode) { + /* + * Write the whole buffer, because the input side won't + * discover the size increase until after it has read it. + */ + if (state->bit_offset > 0) { + while (state->bit_offset < state->code_len * 8) { + ret = output_byte(a, state->bit_buf); + if (ret != ARCHIVE_OK) + return ret; + state->bit_offset += 8; + state->bit_buf = 0; + } + } + state->bit_buf = 0; + state->bit_offset = 0; + + if (clear_flg) { + state->code_len = 9; + state->cur_maxcode = MAXCODE(state->code_len); + } else { + state->code_len++; + if (state->code_len == 16) + state->cur_maxcode = state->max_maxcode; + else + state->cur_maxcode = MAXCODE(state->code_len); + } + } + + return (ARCHIVE_OK); +} + +static int +output_flush(struct archive_write *a) +{ + struct private_data *state = a->compressor.data; + int ret; + + /* At EOF, write the rest of the buffer. */ + if (state->bit_offset % 8) { + state->code_len = (state->bit_offset % 8 + 7) / 8; + ret = output_byte(a, state->bit_buf); + if (ret != ARCHIVE_OK) + return ret; + } + + return (ARCHIVE_OK); +} + +/* + * Write data to the compressed stream. + */ +static int +archive_compressor_compress_write(struct archive_write *a, const void *buff, + size_t length) +{ + struct private_data *state; + int i; + int ratio; + int c, disp, ret; + const unsigned char *bp; + + state = (struct private_data *)a->compressor.data; + if (a->client_writer == NULL) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER, + "No write callback is registered? " + "This is probably an internal programming error."); + return (ARCHIVE_FATAL); + } + + if (length == 0) + return ARCHIVE_OK; + + bp = buff; + + if (state->in_count == 0) { + state->cur_code = *bp++; + ++state->in_count; + --length; + } + + while (length--) { + c = *bp++; + state->in_count++; + state->cur_fcode = (c << 16) + state->cur_code; + i = ((c << HSHIFT) ^ state->cur_code); /* Xor hashing. */ + + if (state->hashtab[i] == state->cur_fcode) { + state->cur_code = state->codetab[i]; + continue; + } + if (state->hashtab[i] < 0) /* Empty slot. */ + goto nomatch; + /* Secondary hash (after G. Knott). */ + if (i == 0) + disp = 1; + else + disp = HSIZE - i; + probe: + if ((i -= disp) < 0) + i += HSIZE; + + if (state->hashtab[i] == state->cur_fcode) { + state->cur_code = state->codetab[i]; + continue; + } + if (state->hashtab[i] >= 0) + goto probe; + nomatch: + ret = output_code(a, state->cur_code); + if (ret != ARCHIVE_OK) + return ret; + state->cur_code = c; + if (state->first_free < state->max_maxcode) { + state->codetab[i] = state->first_free++; /* code -> hashtable */ + state->hashtab[i] = state->cur_fcode; + continue; + } + if (state->in_count < state->checkpoint) + continue; + + state->checkpoint = state->in_count + CHECK_GAP; + + if (state->in_count <= 0x007fffff) + ratio = state->in_count * 256 / state->out_count; + else if ((ratio = state->out_count / 256) == 0) + ratio = 0x7fffffff; + else + ratio = state->in_count / ratio; + + if (ratio > state->compress_ratio) + state->compress_ratio = ratio; + else { + state->compress_ratio = 0; + memset(state->hashtab, 0xff, sizeof(state->hashtab)); + state->first_free = FIRST; + ret = output_code(a, CLEAR); + if (ret != ARCHIVE_OK) + return ret; + } + } + + return (ARCHIVE_OK); +} + + +/* + * Finish the compression... + */ +static int +archive_compressor_compress_finish(struct archive_write *a) +{ + ssize_t block_length, target_block_length, bytes_written; + int ret; + struct private_data *state; + unsigned tocopy; + + state = (struct private_data *)a->compressor.data; + ret = 0; + if (a->client_writer == NULL) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER, + "No write callback is registered? " + "This is probably an internal programming error."); + ret = ARCHIVE_FATAL; + goto cleanup; + } + + /* By default, always pad the uncompressed data. */ + if (a->pad_uncompressed) { + while (state->in_count % a->bytes_per_block != 0) { + tocopy = a->bytes_per_block - + (state->in_count % a->bytes_per_block); + if (tocopy > a->null_length) + tocopy = a->null_length; + ret = archive_compressor_compress_write(a, a->nulls, + tocopy); + if (ret != ARCHIVE_OK) + goto cleanup; + } + } + + ret = output_code(a, state->cur_code); + if (ret != ARCHIVE_OK) + goto cleanup; + ret = output_flush(a); + if (ret != ARCHIVE_OK) + goto cleanup; + + /* Optionally, pad the final compressed block. */ + block_length = state->compressed_offset; + + /* Tricky calculation to determine size of last block. */ + if (a->bytes_in_last_block <= 0) + /* Default or Zero: pad to full block */ + target_block_length = a->bytes_per_block; + else + /* Round length to next multiple of bytes_in_last_block. */ + target_block_length = a->bytes_in_last_block * + ( (block_length + a->bytes_in_last_block - 1) / + a->bytes_in_last_block); + if (target_block_length > a->bytes_per_block) + target_block_length = a->bytes_per_block; + if (block_length < target_block_length) { + memset(state->compressed + state->compressed_offset, 0, + target_block_length - block_length); + block_length = target_block_length; + } + + /* Write the last block */ + bytes_written = (a->client_writer)(&a->archive, a->client_data, + state->compressed, block_length); + if (bytes_written <= 0) + ret = ARCHIVE_FATAL; + else + a->archive.raw_position += bytes_written; + +cleanup: + free(state->compressed); + free(state); + return (ret); +} diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format_ar.c b/archivers/libarchive/files/libarchive/archive_write_set_format_ar.c index 2e77f1bd89a..313d0b390f9 100644 --- a/archivers/libarchive/files/libarchive/archive_write_set_format_ar.c +++ b/archivers/libarchive/files/libarchive/archive_write_set_format_ar.c @@ -26,7 +26,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_ar.c,v 1.5 2008/01/31 08:11:01 kaiw Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_ar.c,v 1.6 2008/03/15 11:04:45 kientzle Exp $"); #ifdef HAVE_ERRNO_H #include <errno.h> @@ -87,8 +87,8 @@ archive_write_set_format_ar_bsd(struct archive *_a) struct archive_write *a = (struct archive_write *)_a; int r = archive_write_set_format_ar(a); if (r == ARCHIVE_OK) { - a->archive_format = ARCHIVE_FORMAT_AR_BSD; - a->archive_format_name = "ar (BSD)"; + a->archive.archive_format = ARCHIVE_FORMAT_AR_BSD; + a->archive.archive_format_name = "ar (BSD)"; } return (r); } @@ -99,8 +99,8 @@ archive_write_set_format_ar_svr4(struct archive *_a) struct archive_write *a = (struct archive_write *)_a; int r = archive_write_set_format_ar(a); if (r == ARCHIVE_OK) { - a->archive_format = ARCHIVE_FORMAT_AR_GNU; - a->archive_format_name = "ar (GNU/SVR4)"; + a->archive.archive_format = ARCHIVE_FORMAT_AR_GNU; + a->archive.archive_format_name = "ar (GNU/SVR4)"; } return (r); } @@ -204,7 +204,7 @@ archive_write_ar_header(struct archive_write *a, struct archive_entry *entry) return (ARCHIVE_WARN); } - if (a->archive_format == ARCHIVE_FORMAT_AR_GNU) { + if (a->archive.archive_format == ARCHIVE_FORMAT_AR_GNU) { /* * SVR4/GNU variant use a "/" to mark then end of the filename, * make it possible to have embedded spaces in the filename. @@ -261,7 +261,7 @@ archive_write_ar_header(struct archive_write *a, struct archive_entry *entry) return (ARCHIVE_WARN); } } - } else if (a->archive_format == ARCHIVE_FORMAT_AR_BSD) { + } else if (a->archive.archive_format == ARCHIVE_FORMAT_AR_BSD) { /* * BSD variant: for any file name which is more than * 16 chars or contains one or more embedded space(s), the 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 45cb4e74b64..61042999efa 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.13 2007/12/30 04:58:22 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_cpio.c,v 1.14 2008/03/15 11:04:45 kientzle Exp $"); #ifdef HAVE_ERRNO_H #include <errno.h> @@ -97,8 +97,8 @@ archive_write_set_format_cpio(struct archive *_a) a->format_finish_entry = archive_write_cpio_finish_entry; a->format_finish = archive_write_cpio_finish; a->format_destroy = archive_write_cpio_destroy; - a->archive_format = ARCHIVE_FORMAT_CPIO_POSIX; - a->archive_format_name = "POSIX cpio"; + a->archive.archive_format = ARCHIVE_FORMAT_CPIO_POSIX; + a->archive.archive_format_name = "POSIX cpio"; return (ARCHIVE_OK); } 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 d11176c1c1e..b5a2a028419 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.3 2008/01/23 05:43:25 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_cpio_newc.c,v 1.4 2008/03/15 11:04:45 kientzle Exp $"); #ifdef HAVE_ERRNO_H #include <errno.h> @@ -102,8 +102,8 @@ archive_write_set_format_cpio_newc(struct archive *_a) a->format_finish_entry = archive_write_newc_finish_entry; a->format_finish = archive_write_newc_finish; a->format_destroy = archive_write_newc_destroy; - a->archive_format = ARCHIVE_FORMAT_CPIO_SVR4_NOCRC; - a->archive_format_name = "SVR4 cpio nocrc"; + a->archive.archive_format = ARCHIVE_FORMAT_CPIO_SVR4_NOCRC; + a->archive.archive_format_name = "SVR4 cpio nocrc"; return (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 a1bd6881156..d6e3e6c4b03 100644 --- a/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c +++ b/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_pax.c,v 1.42 2007/12/30 04:58:22 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_pax.c,v 1.46 2008/03/15 11:04:45 kientzle Exp $"); #ifdef HAVE_ERRNO_H #include <errno.h> @@ -85,8 +85,8 @@ archive_write_set_format_pax_restricted(struct archive *_a) struct archive_write *a = (struct archive_write *)_a; int r; r = archive_write_set_format_pax(&a->archive); - a->archive_format = ARCHIVE_FORMAT_TAR_PAX_RESTRICTED; - a->archive_format_name = "restricted POSIX pax interchange"; + a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_RESTRICTED; + a->archive.archive_format_name = "restricted POSIX pax interchange"; return (r); } @@ -116,8 +116,8 @@ archive_write_set_format_pax(struct archive *_a) a->format_finish = archive_write_pax_finish; a->format_destroy = archive_write_pax_destroy; a->format_finish_entry = archive_write_pax_finish_entry; - a->archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE; - a->archive_format_name = "POSIX pax interchange"; + a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE; + a->archive.archive_format_name = "POSIX pax interchange"; return (ARCHIVE_OK); } @@ -701,7 +701,7 @@ archive_write_pax_header(struct archive_write *a, * already set (we're already generating an extended header, so * may as well include these). */ - if (a->archive_format != ARCHIVE_FORMAT_TAR_PAX_RESTRICTED || + if (a->archive.archive_format != ARCHIVE_FORMAT_TAR_PAX_RESTRICTED || need_extension) { if (archive_entry_mtime(entry_main) < 0 || @@ -764,7 +764,7 @@ archive_write_pax_header(struct archive_write *a, * Pax-restricted does not store data for hardlinks, in order * to improve compatibility with ustar. */ - if (a->archive_format != ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE && + if (a->archive.archive_format != ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE && hardlink != NULL) archive_entry_set_size(entry_main, 0); @@ -1060,7 +1060,13 @@ build_ustar_entry_name(char *dest, const char *src, size_t src_length, /* * The ustar header for the pax extended attributes must have a - * reasonable name: SUSv3 suggests 'dirname'/PaxHeader/'filename' + * reasonable name: SUSv3 requires 'dirname'/PaxHeader.'pid'/'filename' + * where 'pid' is the PID of the archiving process. Unfortunately, + * that makes testing a pain since the output varies for each run, + * so I'm sticking with the simpler 'dirname'/PaxHeader/'filename' + * for now. (Someday, I'll make this settable. Then I can use the + * SUS recommendation as default and test harnesses can override it + * to get predictable results.) * * Joerg Schilling has argued that this is unnecessary because, in * practice, if the pax extended attributes get extracted as regular @@ -1071,19 +1077,14 @@ build_ustar_entry_name(char *dest, const char *src, size_t src_length, * recommendation, but I'm not entirely convinced. I'm also * uncomfortable with the fact that "/tmp" is a Unix-ism. * - * GNU tar uses 'dirname'/PaxHeader.<pid>/'filename', where the PID is - * the PID of the archiving process. This seems unnecessarily complex - * to me, as I don't see much value to separating the headers from - * extracting multiple versions of an archive. - * - * The following routine implements the SUSv3 recommendation, and is - * much simpler because build_ustar_entry_name() above already does - * most of the work (we just need to give it an extra path element to - * insert and handle a few pathological cases). + * The following routine leverages build_ustar_entry_name() above and + * so is simpler than you might think. It just needs to provide the + * additional path element and handle a few pathological cases). */ static char * build_pax_attribute_name(char *dest, const char *src) { + char buff[64]; const char *p; /* Handle the null filename case. */ @@ -1122,8 +1123,19 @@ build_pax_attribute_name(char *dest, const char *src) return (dest); } + /* + * TODO: Push this string into the 'pax' structure to avoid + * recomputing it every time. That will also open the door + * to having clients override it. + */ +#if HAVE_GETPID && 0 /* Disable this for now; see above comment. */ + sprintf(buff, "PaxHeader.%d", getpid()); +#else + /* If the platform can't fetch the pid, don't include it. */ + strcpy(buff, "PaxHeader"); +#endif /* General case: build a ustar-compatible name adding "/PaxHeader/". */ - build_ustar_entry_name(dest, src, p - src, "PaxHeader"); + build_ustar_entry_name(dest, src, p - src, buff); return (dest); } diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format_shar.c b/archivers/libarchive/files/libarchive/archive_write_set_format_shar.c index f26ba028ea5..b5d16e09d13 100644 --- a/archivers/libarchive/files/libarchive/archive_write_set_format_shar.c +++ b/archivers/libarchive/files/libarchive/archive_write_set_format_shar.c @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_shar.c,v 1.18 2007/05/29 01:00:19 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_shar.c,v 1.19 2008/03/15 11:04:45 kientzle Exp $"); #ifdef HAVE_ERRNO_H #include <errno.h> @@ -113,8 +113,8 @@ archive_write_set_format_shar(struct archive *_a) a->format_destroy = archive_write_shar_destroy; a->format_write_data = archive_write_shar_data_sed; a->format_finish_entry = archive_write_shar_finish_entry; - a->archive_format = ARCHIVE_FORMAT_SHAR_BASE; - a->archive_format_name = "shar"; + a->archive.archive_format = ARCHIVE_FORMAT_SHAR_BASE; + a->archive.archive_format_name = "shar"; return (ARCHIVE_OK); } @@ -134,8 +134,8 @@ archive_write_set_format_shar_dump(struct archive *_a) shar = (struct shar *)a->format_data; shar->dump = 1; a->format_write_data = archive_write_shar_data_uuencode; - a->archive_format = ARCHIVE_FORMAT_SHAR_DUMP; - a->archive_format_name = "shar dump"; + a->archive.archive_format = ARCHIVE_FORMAT_SHAR_DUMP; + a->archive.archive_format_name = "shar dump"; return (ARCHIVE_OK); } 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 a7d26c90579..c2c0011aee2 100644 --- a/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c +++ b/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_ustar.c,v 1.25 2007/12/30 04:58:22 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_ustar.c,v 1.26 2008/03/15 11:04:45 kientzle Exp $"); #ifdef HAVE_ERRNO_H @@ -186,8 +186,8 @@ archive_write_set_format_ustar(struct archive *_a) a->format_finish = archive_write_ustar_finish; a->format_destroy = archive_write_ustar_destroy; a->format_finish_entry = archive_write_ustar_finish_entry; - a->archive_format = ARCHIVE_FORMAT_TAR_USTAR; - a->archive_format_name = "POSIX ustar"; + a->archive.archive_format = ARCHIVE_FORMAT_TAR_USTAR; + a->archive.archive_format_name = "POSIX ustar"; return (ARCHIVE_OK); } diff --git a/archivers/libarchive/files/libarchive/config_freebsd.h b/archivers/libarchive/files/libarchive/config_freebsd.h index 83a85996a84..97127a19be8 100644 --- a/archivers/libarchive/files/libarchive/config_freebsd.h +++ b/archivers/libarchive/files/libarchive/config_freebsd.h @@ -22,7 +22,7 @@ * (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/config_freebsd.h,v 1.6 2008/02/19 05:40:28 kientzle Exp $ + * $FreeBSD: src/lib/libarchive/config_freebsd.h,v 1.8 2008/03/15 04:20:50 kientzle Exp $ */ /* FreeBSD 5.0 and later have ACL support. */ @@ -53,8 +53,10 @@ #define HAVE_FCHOWN 1 #define HAVE_FCNTL_H 1 #define HAVE_FSEEKO 1 +#define HAVE_FSTAT 1 #define HAVE_FUTIMES 1 #define HAVE_GETEUID 1 +#define HAVE_GETPID 1 #define HAVE_GRP_H 1 #define HAVE_INTTYPES_H 1 #define HAVE_LCHFLAGS 1 diff --git a/archivers/libarchive/files/libarchive/config_windows.h b/archivers/libarchive/files/libarchive/config_windows.h index c5200655b14..64eb15f3317 100644 --- a/archivers/libarchive/files/libarchive/config_windows.h +++ b/archivers/libarchive/files/libarchive/config_windows.h @@ -4,10 +4,10 @@ #define CONFIG_H_INCLUDED /* Version number of bsdcpio */ -#define BSDCPIO_VERSION_STRING "0.3.0" +#define BSDCPIO_VERSION_STRING "0.9.9" /* Version number of bsdtar */ -#define BSDTAR_VERSION_STRING "2.4.12" +#define BSDTAR_VERSION_STRING "2.5.0" /* Define to 1 if you have the `acl_create_entry' function. */ /* #undef HAVE_ACL_CREATE_ENTRY */ @@ -396,10 +396,10 @@ /* #undef HAVE_ZLIB_H */ /* Version number of libarchive as a single integer */ -#define LIBARCHIVE_VERSION "2004012" +#define LIBARCHIVE_VERSION_NUMBER "2005000" /* Version number of libarchive */ -#define LIBARCHIVE_VERSION_STRING "2.4.12" +#define LIBARCHIVE_VERSION_STRING "2.5.0b" /* Define to 1 if `lstat' dereferences a symlink specified with a trailing slash. */ @@ -464,7 +464,7 @@ /* #undef const */ /* Define to `int' if <sys/types.h> doesn't define. */ -//#define gid_t int +#define gid_t int /* Define to `unsigned long' if <sys/types.h> does not define. */ #define id_t int @@ -478,7 +478,7 @@ #define intmax_t long long /* Define to `int' if <sys/types.h> does not define. */ -//#define mode_t unsigned short +#define mode_t unsigned short /* Define to `long long' if <sys/types.h> does not define. */ /* #undef off_t */ @@ -487,7 +487,7 @@ /* #undef size_t */ /* Define to `int' if <sys/types.h> doesn't define. */ -//#define uid_t int +#define uid_t int /* Define to the type of an unsigned integer type of width exactly 64 bits if such a type exists and the standard includes do not define it. */ @@ -505,6 +505,6 @@ #define uint32_t unsigned long #define uint16_t unsigned short -//#define ssize_t long +#define ssize_t long #endif /* CONFIG_H_INCLUDED */ diff --git a/archivers/libarchive/files/libarchive/mtree.5 b/archivers/libarchive/files/libarchive/mtree.5 index 613de6a5dae..2341626d877 100644 --- a/archivers/libarchive/files/libarchive/mtree.5 +++ b/archivers/libarchive/files/libarchive/mtree.5 @@ -121,7 +121,7 @@ separated by whitespace. .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 +Each such definition consists of a key from the following list immediately followed by an '=' sign and a value. Software programs reading mtree files should warn about @@ -145,17 +145,36 @@ 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 ignore +Ignore any file hierarchy below this file. +.It Cm link +The file the symbolic link is expected to reference. .It Cm md5 The MD5 message digest of the file. .It Cm md5digest A synonym for .Cm md5 . +.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 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 sha1 The .Tn FIPS @@ -174,31 +193,8 @@ 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 @@ -220,6 +216,10 @@ symbolic link .It Cm socket socket .El +.It Cm uid +The file owner as a numeric value. +.It Cm uname +The file owner as a symbolic name. .El .Pp .Sh SEE ALSO diff --git a/archivers/libarchive/files/libarchive/test/list.h b/archivers/libarchive/files/libarchive/test/list.h index fdd56335dc9..c44dcfce831 100644 --- a/archivers/libarchive/files/libarchive/test/list.h +++ b/archivers/libarchive/files/libarchive/test/list.h @@ -39,6 +39,7 @@ 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) DEFINE_TEST(test_write_compress_program) DEFINE_TEST(test_write_disk) DEFINE_TEST(test_write_disk_hardlink) diff --git a/archivers/libarchive/files/libarchive/test/main.c b/archivers/libarchive/files/libarchive/test/main.c index 0b56cc64156..3977803278f 100644 --- a/archivers/libarchive/files/libarchive/test/main.c +++ b/archivers/libarchive/files/libarchive/test/main.c @@ -24,23 +24,26 @@ */ /* - * This same file is used pretty much verbatim for all test harnesses. - * - * The next line is used to define various environment variables, etc. - * - * The tar and cpio test harnesses are identical except for this line; - * the libarchive test harness omits some code that is needed only for - * testing standalone executables. + * Various utility routines useful for test programs. + * Each test program is linked against this file. */ -#define PROGRAM "LIBARCHIVE" - #include <errno.h> #include <locale.h> #include <stdarg.h> #include <time.h> #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/main.c,v 1.10 2008/02/19 05:52:30 kientzle Exp $"); + +/* + * This same file is used pretty much verbatim for all test harnesses. + * + * The next few lines are the only differences. + */ +#undef PROGRAM /* Testing a library, not a program. */ +#define ENVBASE "LIBARCHIVE" /* Prefix for environment variables. */ +#define EXTRA_DUMP(x) archive_error_string((struct archive *)(x)) +#define EXTRA_VERSION archive_version() +__FBSDID("$FreeBSD: src/lib/libarchive/test/main.c,v 1.11 2008/03/12 05:12:23 kientzle Exp $"); /* * "list.h" is simply created by "grep DEFINE_TEST"; it has @@ -51,7 +54,7 @@ __FBSDID("$FreeBSD: src/lib/libarchive/test/main.c,v 1.10 2008/02/19 05:52:30 ki * test functions. */ #undef DEFINE_TEST -#define DEFINE_TEST(name) void name(void); +#define DEFINE_TEST(name) void name(void); #include "list.h" /* Interix doesn't define these in a standard header. */ @@ -71,6 +74,9 @@ static int skips = 0; /* Cumulative count of assertions. */ static int assertions = 0; +/* Directory where uuencoded reference files can be found. */ +static char *refdir; + /* * My own implementation of the standard assert() macro emits the * message in the same format as GCC (file:line: message). @@ -90,7 +96,7 @@ static char msg[4096]; * For each test source file, we remember how many times each * failure was reported. */ -static const char *failed_filename; +static const char *failed_filename = NULL; static struct line { int line; int count; @@ -163,9 +169,13 @@ report_failure(void *extra) fprintf(stderr, " Description: %s\n", msg); msg[0] = '\0'; } - if (extra != NULL) { - fprintf(stderr, " archive error: %s\n", archive_error_string((struct archive *)extra)); - } + +#ifdef EXTRA_DUMP + if (extra != NULL) + fprintf(stderr, " detail: %s\n", EXTRA_DUMP(extra)); +#else + (void)extra; /* UNUSED */ +#endif if (dump_on_failure) { fprintf(stderr, @@ -241,27 +251,28 @@ test_assert(const char *file, int line, int value, const char *condition, void * } /* assertEqualInt() displays the values of the two integers. */ -void +int test_assert_equal_int(const char *file, int line, int v1, const char *e1, int v2, const char *e2, void *extra) { ++assertions; if (v1 == v2) { msg[0] = '\0'; - return; + return (1); } failures ++; if (previous_failures(file, line)) - return; + return (0); 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); + return (0); } /* assertEqualString() displays the values of the two strings. */ -void +int test_assert_equal_string(const char *file, int line, const char *v1, const char *e1, const char *v2, const char *e2, @@ -271,24 +282,25 @@ test_assert_equal_string(const char *file, int line, if (v1 == NULL || v2 == NULL) { if (v1 == v2) { msg[0] = '\0'; - return; + return (1); } } else if (strcmp(v1, v2) == 0) { msg[0] = '\0'; - return; + return (1); } failures ++; if (previous_failures(file, line)) - return; + return (0); 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); + return (0); } /* assertEqualWString() displays the values of the two strings. */ -void +int test_assert_equal_wstring(const char *file, int line, const wchar_t *v1, const char *e1, const wchar_t *v2, const char *e2, @@ -297,16 +309,17 @@ test_assert_equal_wstring(const char *file, int line, ++assertions; if (wcscmp(v1, v2) == 0) { msg[0] = '\0'; - return; + return (1); } failures ++; if (previous_failures(file, line)) - return; + return (0); 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); + return (0); } /* @@ -326,7 +339,7 @@ hexdump(const char *p, const char *ref, size_t l, size_t offset) 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]); + fprintf(stderr, "%c%02x", sep, 0xff & (int)p[i+j]); if (ref != NULL && p[i + j] == ref[i + j]) sep = ' '; } @@ -348,7 +361,7 @@ hexdump(const char *p, const char *ref, size_t l, size_t offset) /* assertEqualMem() displays the values of the two memory blocks. */ /* TODO: For long blocks, hexdump the first bytes that actually differ. */ -void +int test_assert_equal_mem(const char *file, int line, const char *v1, const char *e1, const char *v2, const char *e2, @@ -358,15 +371,15 @@ test_assert_equal_mem(const char *file, int line, if (v1 == NULL || v2 == NULL) { if (v1 == v2) { msg[0] = '\0'; - return; + return (1); } } else if (memcmp(v1, v2, l) == 0) { msg[0] = '\0'; - return; + return (1); } failures ++; if (previous_failures(file, line)) - return; + return (0); fprintf(stderr, "%s:%d: Assertion failed: memory not equal\n", file, line); fprintf(stderr, " size %s = %d\n", ld, (int)l); @@ -376,14 +389,19 @@ test_assert_equal_mem(const char *file, int line, hexdump(v2, v1, l < 32 ? l : 32, 0); fprintf(stderr, "\n"); report_failure(extra); + return (0); } -void +int test_assert_empty_file(const char *f1fmt, ...) { + char buff[1024]; char f1[1024]; struct stat st; va_list ap; + ssize_t s; + int fd; + va_start(ap, f1fmt); vsprintf(f1, f1fmt, ap); @@ -392,16 +410,32 @@ test_assert_empty_file(const char *f1fmt, ...) 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); } + if (st.st_size == 0) + return (1); + + failures ++; + if (previous_failures(test_filename, test_line)) + return (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); + fprintf(stderr, " Contents:\n"); + fd = open(f1, O_RDONLY); + if (fd < 0) { + fprintf(stderr, " Unable to open %s\n", f1); + } else { + s = sizeof(buff) < st.st_size ? sizeof(buff) : st.st_size; + s = read(fd, buff, s); + hexdump(buff, NULL, s, 0); + } + report_failure(NULL); + return (0); } /* assertEqualFile() asserts that two files have the same contents. */ /* TODO: hexdump the first bytes that actually differ. */ -void +int test_assert_equal_file(const char *f1, const char *f2pattern, ...) { char f2[1024]; @@ -423,16 +457,58 @@ test_assert_equal_file(const char *f1, const char *f2pattern, ...) if (n1 != n2) break; if (n1 == 0 && n2 == 0) - return; + return (1); if (memcmp(buff1, buff2, n1) != 0) break; } - fprintf(stderr, "%s:%d: Files are not identical\n", test_filename, test_line); + failures ++; + if (previous_failures(test_filename, test_line)) + return (0); + 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); + return (0); } +/* assertFileContents() asserts the contents of a file. */ +int +test_assert_file_contents(const void *buff, int s, const char *fpattern, ...) +{ + char f[1024]; + va_list ap; + char *contents; + int fd; + int n; + + va_start(ap, fpattern); + vsprintf(f, fpattern, ap); + va_end(ap); + + fd = open(f, O_RDONLY); + contents = malloc(s * 2); + n = read(fd, contents, s * 2); + if (n == s && memcmp(buff, contents, s) == 0) { + free(contents); + return (1); + } + failures ++; + if (!previous_failures(test_filename, test_line)) { + fprintf(stderr, "%s:%d: File contents don't match\n", + test_filename, test_line); + fprintf(stderr, " file=\"%s\"\n", f); + if (n > 0) + hexdump(contents, buff, n, 0); + else { + fprintf(stderr, " File empty, contents should be:\n"); + hexdump(buff, NULL, s, 0); + } + report_failure(test_extra); + } + free(contents); + return (0); +} /* * Call standard system() call, but build up the command line using @@ -510,7 +586,7 @@ slurpfile(size_t * sizep, const char *fmt, ...) * We reuse it here to define a list of all tests (functions and names). */ #undef DEFINE_TEST -#define DEFINE_TEST(n) { n, #n }, +#define DEFINE_TEST(n) { n, #n }, struct { void (*func)(void); const char *name; } tests[] = { #include "list.h" }; @@ -572,6 +648,10 @@ static void usage(const char *program) printf("Options:\n"); printf(" -k Keep running after failures.\n"); printf(" Default: Core dump after any failure.\n"); +#ifdef PROGRAM + printf(" -p <path> Path to executable to be tested.\n"); + printf(" Default: path taken from " ENVBASE " environment variable.\n"); +#endif printf(" -q Quiet.\n"); printf(" -r <dir> Path to dir containing reference files.\n"); printf(" Default: Current directory.\n"); @@ -581,6 +661,66 @@ static void usage(const char *program) exit(1); } +#define UUDECODE(c) (((c) - 0x20) & 0x3f) + +void +extract_reference_file(const char *name) +{ + char buff[1024]; + FILE *in, *out; + + sprintf(buff, "%s/%s.uu", refdir, name); + in = fopen(buff, "r"); + failure("Couldn't open reference file %s", buff); + assert(in != NULL); + if (in == NULL) + return; + /* Read up to and including the 'begin' line. */ + for (;;) { + if (fgets(buff, sizeof(buff), in) == NULL) { + /* TODO: This is a failure. */ + return; + } + if (memcmp(buff, "begin ", 6) == 0) + break; + } + /* Now, decode the rest and write it. */ + /* Not a lot of error checking here; the input better be right. */ + out = fopen(name, "w"); + while (fgets(buff, sizeof(buff), in) != NULL) { + char *p = buff; + int bytes; + + if (memcmp(buff, "end", 3) == 0) + break; + + bytes = UUDECODE(*p++); + while (bytes > 0) { + int n = 0; + /* Write out 1-3 bytes from that. */ + if (bytes > 0) { + n = UUDECODE(*p++) << 18; + n |= UUDECODE(*p++) << 12; + fputc(n >> 16, out); + --bytes; + } + if (bytes > 0) { + n |= UUDECODE(*p++) << 6; + fputc((n >> 8) & 0xFF, out); + --bytes; + } + if (bytes > 0) { + n |= UUDECODE(*p++); + fputc(n & 0xFF, out); + --bytes; + } + } + } + fclose(out); + fclose(in); +} + + int main(int argc, char **argv) { static const int limit = sizeof(tests) / sizeof(tests[0]); @@ -602,17 +742,33 @@ int main(int argc, char **argv) ++p; } +#ifdef PROGRAM + /* Get the target program from environment, if available. */ + testprog = getenv(ENVBASE); +#endif + + /* Allow -k to be controlled through the environment. */ + if (getenv(ENVBASE "_KEEP_GOING") != NULL) + dump_on_failure = 0; + /* Get the directory holding test files from environment. */ - refdir = getenv(PROGRAM "_TEST_FILES"); + refdir = getenv(ENVBASE "_TEST_FILES"); /* * Parse options. */ - while ((opt = getopt(argc, argv, "kqr:")) != -1) { + while ((opt = getopt(argc, argv, "kp:qr:")) != -1) { switch (opt) { case 'k': dump_on_failure = 0; break; + case 'p': +#ifdef PROGRAM + testprog = optarg; +#else + usage(progname); +#endif + break; case 'q': quiet_flag++; break; @@ -628,6 +784,14 @@ int main(int argc, char **argv) argv += optind; /* + * Sanity-check that our options make sense. + */ +#ifdef PROGRAM + if (testprog == NULL) + usage(progname); +#endif + + /* * 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. @@ -667,7 +831,12 @@ int main(int argc, char **argv) if (!quiet_flag) { printf("Running tests in: %s\n", tmpdir); printf("Reference files will be read from: %s\n", refdir); - printf("Exercising %s\n", archive_version()); +#ifdef PROGRAM + printf("Running tests on: %s\n", testprog); +#endif + printf("Exercising: "); + fflush(stdout); + printf("%s\n", EXTRA_VERSION); } /* diff --git a/archivers/libarchive/files/libarchive/test/test.h b/archivers/libarchive/files/libarchive/test/test.h index 72d611d77d1..dcb190ff3fe 100644 --- a/archivers/libarchive/files/libarchive/test/test.h +++ b/archivers/libarchive/files/libarchive/test/test.h @@ -22,7 +22,7 @@ * (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.8 2008/02/19 05:52:30 kientzle Exp $ + * $FreeBSD: src/lib/libarchive/test/test.h,v 1.9 2008/03/12 05:12:23 kientzle Exp $ */ /* Every test program should #include "test.h" as the first thing. */ @@ -35,6 +35,7 @@ #define _FILE_OFFSET_BITS 64 #endif +#include <dirent.h> #include <errno.h> #include <fcntl.h> #include <stdio.h> @@ -116,12 +117,13 @@ void failure(const char *fmt, ...); void test_setup(const char *, int); void test_skipping(const char *fmt, ...); int 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 *); +int test_assert_empty_file(const char *, ...); +int test_assert_equal_file(const char *, const char *, ...); +int test_assert_equal_int(const char *, int, int, const char *, int, const char *, void *); +int test_assert_equal_string(const char *, int, const char *v1, const char *, const char *v2, const char *, void *); +int test_assert_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *); +int test_assert_equal_mem(const char *, int, const char *, const char *, const char *, const char *, size_t, const char *, void *); +int test_assert_file_contents(const void *, int, const char *, ...); /* Like sprintf, then system() */ int systemf(const char * fmt, ...); @@ -130,12 +132,8 @@ int systemf(const char * fmt, ...); /* Supports printf-style args: slurpfile(NULL, "%s/myfile", refdir); */ char *slurpfile(size_t *, const char *fmt, ...); -/* - * Global vars - */ - -/* Directory holding reference files. */ -char *refdir; +/* Extracts named reference file to the current directory. */ +void extract_reference_file(const char *); /* * Special interfaces for libarchive test harness. diff --git a/archivers/libarchive/files/libarchive/test/test_archive_api_feature.c b/archivers/libarchive/files/libarchive/test/test_archive_api_feature.c index 432d902b6a5..a22bdcc7961 100644 --- a/archivers/libarchive/files/libarchive/test/test_archive_api_feature.c +++ b/archivers/libarchive/files/libarchive/test/test_archive_api_feature.c @@ -23,10 +23,34 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_archive_api_feature.c,v 1.3 2007/07/06 15:43:11 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_archive_api_feature.c,v 1.4 2008/03/14 22:31:57 kientzle Exp $"); DEFINE_TEST(test_archive_api_feature) { + char buff[128]; + char *p; + + /* This is the (hopefully) final versioning API. */ + assertEqualInt(ARCHIVE_VERSION_NUMBER, archive_version_number()); + sprintf(buff, "libarchive %d.%d.%d", + archive_version_number() / 1000000, + (archive_version_number() / 1000) % 1000, + archive_version_number() % 1000); + failure("Version string is: %s, computed is: %s", + archive_version_string(), buff); + assert(memcmp(buff, archive_version_string(), strlen(buff)) == 0); + if (strlen(buff) < strlen(archive_version_string())) { + p = archive_version_string() + strlen(buff); + failure("Version string is: %s", archive_version_string()); + assert(*p == 'a' || *p == 'b' || *p == 'c' || *p == 'd'); + ++p; + failure("Version string is: %s", archive_version_string()); + assert(*p == '\0'); + } + +/* This is all scheduled to disappear in libarchive 3.0 */ +#if ARCHIVE_VERSION_NUMBER < 3000000 + assertEqualInt(ARCHIVE_VERSION_STAMP, ARCHIVE_VERSION_NUMBER); assertEqualInt(ARCHIVE_API_FEATURE, archive_api_feature()); assertEqualInt(ARCHIVE_API_VERSION, archive_api_version()); /* @@ -48,4 +72,5 @@ DEFINE_TEST(test_archive_api_feature) skipping("archive_version_stamp()"); #endif assertEqualString(ARCHIVE_LIBRARY_VERSION, archive_version()); +#endif } diff --git a/archivers/libarchive/files/libarchive/test/test_compat_gtar.c b/archivers/libarchive/files/libarchive/test/test_compat_gtar.c index 3451a76ebbc..66cd7b02e87 100644 --- a/archivers/libarchive/files/libarchive/test/test_compat_gtar.c +++ b/archivers/libarchive/files/libarchive/test/test_compat_gtar.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_compat_gtar.c,v 1.1 2008/01/01 22:28:04 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_compat_gtar.c,v 1.2 2008/03/12 05:12:23 kientzle Exp $"); /* * Verify our ability to read sample files created by GNU tar. @@ -40,14 +40,14 @@ __FBSDID("$FreeBSD: src/lib/libarchive/test/test_compat_gtar.c,v 1.1 2008/01/01 static void test_compat_gtar_1(void) { - char name[1024]; + char name[] = "test_compat_gtar_1.tgz"; struct archive_entry *ae; struct archive *a; assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); - sprintf(name, "%s/test_compat_gtar_1.tgz", refdir); + extract_reference_file(name); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240)); /* Read first entry. */ diff --git a/archivers/libarchive/files/libarchive/test/test_compat_tar_hardlink.c b/archivers/libarchive/files/libarchive/test/test_compat_tar_hardlink.c index 103b349da0e..ae71e9232c5 100644 --- a/archivers/libarchive/files/libarchive/test/test_compat_tar_hardlink.c +++ b/archivers/libarchive/files/libarchive/test/test_compat_tar_hardlink.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_compat_tar_hardlink.c,v 1.1 2008/01/31 07:47:38 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_compat_tar_hardlink.c,v 1.2 2008/03/12 05:12:23 kientzle Exp $"); /* * Background: There are two written standards for the tar file format. @@ -46,14 +46,14 @@ __FBSDID("$FreeBSD: src/lib/libarchive/test/test_compat_tar_hardlink.c,v 1.1 200 static void test_compat_tar_hardlink_1(void) { - char name[1024]; + char name[] = "test_compat_tar_hardlink_1.tar"; struct archive_entry *ae; struct archive *a; assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); - sprintf(name, "%s/test_compat_tar_hardlink_1.tar", refdir); + extract_reference_file(name); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240)); /* Read first entry, which is a regular file. */ diff --git a/archivers/libarchive/files/libarchive/test/test_compat_zip.c b/archivers/libarchive/files/libarchive/test/test_compat_zip.c index 0f6d1d00b1b..fdeb9c64ac1 100644 --- a/archivers/libarchive/files/libarchive/test/test_compat_zip.c +++ b/archivers/libarchive/files/libarchive/test/test_compat_zip.c @@ -23,20 +23,20 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_compat_zip.c,v 1.1 2008/01/01 22:28:04 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_compat_zip.c,v 1.2 2008/03/12 05:12:23 kientzle Exp $"); /* Copy this function for each test file and adjust it accordingly. */ static void test_compat_zip_1(void) { - char name[1024]; + char name[] = "test_compat_zip_1.zip"; struct archive_entry *ae; struct archive *a; assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); - sprintf(name, "%s/test_compat_zip_1.zip", refdir); + extract_reference_file(name); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240)); /* Read first entry. */ diff --git a/archivers/libarchive/files/libarchive/test/test_empty_write.c b/archivers/libarchive/files/libarchive/test/test_empty_write.c index 540ddf110ba..6a9f3f9c8d5 100644 --- a/archivers/libarchive/files/libarchive/test/test_empty_write.c +++ b/archivers/libarchive/files/libarchive/test/test_empty_write.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_empty_write.c,v 1.1 2008/01/01 22:28:04 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_empty_write.c,v 1.2 2008/03/15 11:06:15 kientzle Exp $"); DEFINE_TEST(test_empty_write) { @@ -47,6 +47,7 @@ DEFINE_TEST(test_empty_write) archive_entry_set_mode(ae, S_IFREG | 0755); archive_entry_set_size(ae, 0); assertA(0 == archive_write_header(a, ae)); + archive_entry_free(ae); /* THE TEST: write zero bytes to this entry. */ /* This used to crash. */ @@ -76,6 +77,7 @@ DEFINE_TEST(test_empty_write) archive_entry_set_mode(ae, S_IFREG | 0755); archive_entry_set_size(ae, 0); assertA(0 == archive_write_header(a, ae)); + archive_entry_free(ae); /* THE TEST: write zero bytes to this entry. */ assertEqualIntA(a, 0, archive_write_data(a, "", 0)); @@ -104,6 +106,7 @@ DEFINE_TEST(test_empty_write) archive_entry_set_mode(ae, S_IFREG | 0755); archive_entry_set_size(ae, 0); assertA(0 == archive_write_header(a, ae)); + archive_entry_free(ae); /* THE TEST: write zero bytes to this entry. */ assertEqualIntA(a, 0, archive_write_data(a, "", 0)); diff --git a/archivers/libarchive/files/libarchive/test/test_entry.c b/archivers/libarchive/files/libarchive/test/test_entry.c index bf41aac4891..29edae7ffd8 100644 --- a/archivers/libarchive/files/libarchive/test/test_entry.c +++ b/archivers/libarchive/files/libarchive/test/test_entry.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_entry.c,v 1.2 2007/07/06 15:43:11 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_entry.c,v 1.5 2008/03/14 23:19:46 kientzle Exp $"); #include <locale.h> @@ -122,8 +122,37 @@ DEFINE_TEST(test_entry) #else skipping("archive_entry_ino()"); #endif + /* link */ - /* TODO: implement these tests. */ + archive_entry_set_hardlink(e, "hardlinkname"); + archive_entry_set_symlink(e, NULL); + archive_entry_set_link(e, "link"); + assertEqualString(archive_entry_hardlink(e), "link"); + assertEqualString(archive_entry_symlink(e), NULL); + archive_entry_copy_link(e, "link2"); + assertEqualString(archive_entry_hardlink(e), "link2"); + assertEqualString(archive_entry_symlink(e), NULL); + archive_entry_copy_link_w(e, L"link3"); + assertEqualString(archive_entry_hardlink(e), "link3"); + assertEqualString(archive_entry_symlink(e), NULL); + archive_entry_set_hardlink(e, NULL); + archive_entry_set_symlink(e, "symlink"); + archive_entry_set_link(e, "link"); + assertEqualString(archive_entry_hardlink(e), NULL); + assertEqualString(archive_entry_symlink(e), "link"); + archive_entry_copy_link(e, "link2"); + assertEqualString(archive_entry_hardlink(e), NULL); + assertEqualString(archive_entry_symlink(e), "link2"); + archive_entry_copy_link_w(e, L"link3"); + assertEqualString(archive_entry_hardlink(e), NULL); + assertEqualString(archive_entry_symlink(e), "link3"); + /* Arbitrarily override hardlink if both hardlink and symlink set. */ + archive_entry_set_hardlink(e, "hardlink"); + archive_entry_set_symlink(e, "symlink"); + archive_entry_set_link(e, "link"); + assertEqualString(archive_entry_hardlink(e), "hardlink"); + assertEqualString(archive_entry_symlink(e), "link"); + /* mode */ archive_entry_set_mode(e, 0123456); assertEqualInt(archive_entry_mode(e), 0123456); @@ -215,10 +244,16 @@ DEFINE_TEST(test_entry) assertEqualInt(1, archive_entry_xattr_count(e)); assertEqualInt(ARCHIVE_WARN, archive_entry_xattr_next(e, &xname, &xval, &xsize)); + assertEqualString(xname, NULL); + assertEqualString(xval, NULL); + assertEqualInt(xsize, 0); archive_entry_xattr_clear(e); assertEqualInt(0, archive_entry_xattr_reset(e)); assertEqualInt(ARCHIVE_WARN, archive_entry_xattr_next(e, &xname, &xval, &xsize)); + assertEqualString(xname, NULL); + assertEqualString(xval, NULL); + assertEqualInt(xsize, 0); archive_entry_xattr_add_entry(e, "xattr1", "xattrvalue1", 12); assertEqualInt(1, archive_entry_xattr_reset(e)); archive_entry_xattr_add_entry(e, "xattr2", "xattrvalue2", 12); @@ -227,6 +262,9 @@ DEFINE_TEST(test_entry) assertEqualInt(0, archive_entry_xattr_next(e, &xname, &xval, &xsize)); assertEqualInt(ARCHIVE_WARN, archive_entry_xattr_next(e, &xname, &xval, &xsize)); + assertEqualString(xname, NULL); + assertEqualString(xval, NULL); + assertEqualInt(xsize, 0); /* @@ -350,6 +388,11 @@ DEFINE_TEST(test_entry) assertEqualString(xname, "xattr1"); assertEqualString(xval, "xattrvalue"); assertEqualInt(xsize, 11); + assertEqualInt(ARCHIVE_WARN, + archive_entry_xattr_next(e2, &xname, &xval, &xsize)); + assertEqualString(xname, NULL); + assertEqualString(xval, NULL); + assertEqualInt(xsize, 0); #endif /* Change the original */ @@ -455,6 +498,14 @@ DEFINE_TEST(test_entry) assertEqualInt(tag, ARCHIVE_ENTRY_ACL_USER); assertEqualInt(qual, 77); assertEqualString(name, "user77"); + assertEqualInt(1, archive_entry_acl_next(e2, + ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + &type, &permset, &tag, &qual, &name)); + assertEqualInt(type, 0); + assertEqualInt(permset, 0); + assertEqualInt(tag, 0); + assertEqualInt(qual, -1); + assertEqualString(name, NULL); #endif #if ARCHIVE_VERSION_STAMP < 1009000 skipping("xattr preserved in archive_entry copy"); diff --git a/archivers/libarchive/files/libarchive/test/test_link_resolver.c b/archivers/libarchive/files/libarchive/test/test_link_resolver.c index 24827b0f222..a51e4a4ddc9 100644 --- a/archivers/libarchive/files/libarchive/test/test_link_resolver.c +++ b/archivers/libarchive/files/libarchive/test/test_link_resolver.c @@ -25,40 +25,6 @@ #include "test.h" __FBSDID("$FreeBSD$"); -static void test_link_resolver_basic(void) -{ - struct archive_entry *entry; - struct archive_entry_linkresolver *resolver; - - /* Initialize the resolver. */ - assert(NULL != (resolver = archive_entry_linkresolver_new())); - - /* Create an entry with only 1 link and try to register it. */ - assert(NULL != (entry = archive_entry_new())); - archive_entry_set_pathname(entry, "test1"); - archive_entry_set_ino(entry, 1); - archive_entry_set_dev(entry, 2); - archive_entry_set_nlink(entry, 1); - - /* Shouldn't match anything. */ - assertEqualString(NULL, archive_entry_linkresolve(resolver, entry)); - /* Still shouldn't match anything. */ - assertEqualString(NULL, archive_entry_linkresolve(resolver, entry)); - - archive_entry_set_nlink(entry, 2); - archive_entry_set_ino(entry, 2); - /* Shouldn't match, since we haven't seen it before. */ - assertEqualString(NULL, archive_entry_linkresolve(resolver, entry)); - /* Should match, since we have seen it once before. */ - archive_entry_set_pathname(entry, "test2"); - assertEqualString("test1", archive_entry_linkresolve(resolver, entry)); - /* Should not match, since we've seen both links. */ - assertEqualString(NULL, archive_entry_linkresolve(resolver, entry)); - - archive_entry_free(entry); - archive_entry_linkresolver_free(resolver); -} - static void test_linkify_tar(void) { struct archive_entry *entry, *e2; @@ -67,7 +33,7 @@ static void test_linkify_tar(void) /* Initialize the resolver. */ assert(NULL != (resolver = archive_entry_linkresolver_new())); archive_entry_linkresolver_set_strategy(resolver, - ARCHIVE_ENTRY_LINKIFY_LIKE_TAR); + ARCHIVE_FORMAT_TAR_USTAR); /* Create an entry with only 1 link and try to linkify it. */ assert(NULL != (entry = archive_entry_new())); @@ -114,7 +80,7 @@ static void test_linkify_old_cpio(void) /* Initialize the resolver. */ assert(NULL != (resolver = archive_entry_linkresolver_new())); archive_entry_linkresolver_set_strategy(resolver, - ARCHIVE_ENTRY_LINKIFY_LIKE_OLD_CPIO); + ARCHIVE_FORMAT_CPIO_POSIX); /* Create an entry with 2 link and try to linkify it. */ assert(NULL != (entry = archive_entry_new())); @@ -149,7 +115,7 @@ static void test_linkify_new_cpio(void) /* Initialize the resolver. */ assert(NULL != (resolver = archive_entry_linkresolver_new())); archive_entry_linkresolver_set_strategy(resolver, - ARCHIVE_ENTRY_LINKIFY_LIKE_NEW_CPIO); + ARCHIVE_FORMAT_CPIO_SVR4_NOCRC); /* Create an entry with only 1 link and try to linkify it. */ assert(NULL != (entry = archive_entry_new())); @@ -215,7 +181,6 @@ static void test_linkify_new_cpio(void) DEFINE_TEST(test_link_resolver) { - test_link_resolver_basic(); test_linkify_tar(); test_linkify_old_cpio(); test_linkify_new_cpio(); diff --git a/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c b/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c index 770c6e3b136..b11be58a07e 100644 --- a/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c +++ b/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_pax_filename_encoding.c,v 1.1 2008/03/15 01:43:59 kientzle Exp $"); #include <locale.h> @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); DEFINE_TEST(test_pax_filename_encoding) { + static const char testname[] = "test_pax_filename_encoding.tar.gz"; char buff[65536]; /* * \314\214 is a valid 2-byte UTF-8 sequence. @@ -55,6 +56,34 @@ DEFINE_TEST(test_pax_filename_encoding) struct archive_entry *entry; /* + * Read an archive that has non-UTF8 pax filenames in it. + */ + extract_reference_file(testname); + a = archive_read_new(); + assertEqualInt(ARCHIVE_OK, archive_read_support_format_tar(a)); + assertEqualInt(ARCHIVE_OK, archive_read_support_compression_gzip(a)); + assertEqualInt(ARCHIVE_OK, + archive_read_open_filename(a, testname, 10240)); + /* + * First entry in this test archive has an invalid UTF-8 sequence + * in it, but the header is not marked as hdrcharset=BINARY, so that + * requires a warning. + */ + failure("An invalid UTF8 pathname in a pax archive should be read\n" + " without conversion but with a warning"); + assertEqualInt(ARCHIVE_WARN, archive_read_next_header(a, &entry)); + assertEqualString(filename, archive_entry_pathname(entry)); + /* + * Second entry is identical except that it does have + * hdrcharset=BINARY, so no warning should be generated. + */ + failure("A pathname with hdrcharset=BINARY can have invalid UTF8\n" + " characters in it without generating a warning"); + assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &entry)); + assertEqualString(filename, archive_entry_pathname(entry)); + archive_read_finish(a); + + /* * We need a starting locale which has invalid sequences. * de_DE.UTF-8 seems to be commonly supported. */ diff --git a/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.tar.gz.uu b/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.tar.gz.uu new file mode 100644 index 00000000000..7191aac5849 --- /dev/null +++ b/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.tar.gz.uu @@ -0,0 +1,10 @@ +begin 644 test_pax_filename_encoding.tar.gz +M'XL(`)4;VT<``^V6STK#0!#&<\Y3[!/HS/Z-ASVHEQ1$BE[L<4T6$DP32:-$ +MG\%'\Y%Z,*7$UEJLE"91NK_+P.P>OF'X^&9LZM":V):GYCYZ?YOFQ5W]\NH= +M%`"0G).FHA*P7I>@E`1!22E!`9,$4#"0'JD/*V,[3[/*E(V4*IW^^&_7^W(4 +M\EG_"13)HZD2W6Y_WFS?IT"B9EZKD8(0+)"!6/3,EQZ5/BIR>QF.KB8GL7W6 +M0>!3VC;2O-"<H>#\S,>@[>99FC]H](>>VM'2G>M7[/(_@-CP/V-4>`2Z$K3. +MD?L_M%E6#"W",1CC;_D_[SW_*;+-_!><N?SO@R;_D[B,$E/.;*4O1M?G-Q/_ +L%T<!1\7V/@IP\<T=!7^![ER_8H_\%PI=_O>!RW^'P^$X3CX`98.>C@`4```` +` +end diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_ar.c b/archivers/libarchive/files/libarchive/test/test_read_format_ar.c index 306da6fa1cb..0c01a2bb713 100644 --- a/archivers/libarchive/files/libarchive/test/test_read_format_ar.c +++ b/archivers/libarchive/files/libarchive/test/test_read_format_ar.c @@ -26,7 +26,7 @@ */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_ar.c,v 1.4 2007/07/06 15:43:11 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_ar.c,v 1.5 2008/03/12 21:10:26 kaiw Exp $"); #if ARCHIVE_VERSION_STAMP >= 1009000 /* @@ -75,9 +75,7 @@ DEFINE_TEST(test_read_format_ar) assertEqualInt(0, archive_entry_mtime(ae)); assertEqualInt(0, archive_entry_uid(ae)); assertEqualInt(0, archive_entry_gid(ae)); - assertEqualInt(40, archive_entry_size(ae)); - assertEqualIntA(a, 40, archive_read_data(a, buff, 50)); - assert(0 == memcmp(buff, "yyytttsssaaafff.o/\nhhhhjjjjkkkkllll.o/\n\n", 40)); + assertEqualInt(0, archive_entry_size(ae)); /* First Entry */ assertA(0 == archive_read_next_header(a, &ae)); 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 ef3c5d25d30..b7efea5b82a 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 @@ -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_read_format_gtar_sparse.c,v 1.7 2008/01/01 22:28:04 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_gtar_sparse.c,v 1.8 2008/03/12 05:12:23 kientzle Exp $"); struct contents { @@ -181,7 +181,6 @@ struct archive_contents { static void verify_archive_file(const char *name, struct archive_contents *ac) { - char path[512]; struct archive_entry *ae; int err; /* data, size, offset of next expected block. */ @@ -190,13 +189,13 @@ verify_archive_file(const char *name, struct archive_contents *ac) struct contents actual; struct archive *a; - sprintf(path, "%s/%s", refdir, name); + extract_reference_file(name); assert((a = archive_read_new()) != NULL); assert(0 == archive_read_support_compression_all(a)); assert(0 == archive_read_support_format_tar(a)); - failure("Can't open %s", path); - assert(0 == archive_read_open_filename(a, path, 3)); + failure("Can't open %s", name); + assert(0 == archive_read_open_filename(a, name, 3)); while (ac->filename != NULL) { struct contents *cts = ac->contents; diff --git a/archivers/libarchive/files/libarchive/test/test_write_compress.c b/archivers/libarchive/files/libarchive/test/test_write_compress.c new file mode 100644 index 00000000000..6f8ef3565fe --- /dev/null +++ b/archivers/libarchive/files/libarchive/test/test_write_compress.c @@ -0,0 +1,102 @@ +/*- + * 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 + * 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 "test.h" +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_compress.c,v 1.2 2008/03/15 11:05:49 kientzle Exp $"); + +/* + * A basic exercise of compress reading and writing. + * + * TODO: Add a reference file and make sure we can decompress that. + */ + +DEFINE_TEST(test_write_compress) +{ + struct archive_entry *ae; + struct archive* a; + char *buff, *data; + size_t buffsize, datasize; + char path[16]; + size_t used; + int i; + + buffsize = 1000000; + assert(NULL != (buff = (char *)malloc(buffsize))); + + datasize = 10000; + assert(NULL != (data = (char *)malloc(datasize))); + memset(data, 0, datasize); + + assert((a = archive_write_new()) != NULL); + assertA(0 == archive_write_set_format_ustar(a)); + assertA(0 == archive_write_set_compression_compress(a)); + assertA(0 == archive_write_open_memory(a, buff, buffsize, &used)); + + for (i = 0; i < 100; i++) { + sprintf(path, "file%03d", i); + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, path); + archive_entry_set_size(ae, datasize); + archive_entry_set_filetype(ae, AE_IFREG); + assertA(0 == archive_write_header(a, ae)); + assertA(datasize == (size_t)archive_write_data(a, data, datasize)); + archive_entry_free(ae); + } + + + archive_write_close(a); +#if ARCHIVE_API_VERSION > 1 + assert(0 == archive_write_finish(a)); +#else + archive_write_finish(a); +#endif + + /* + * Now, read the data back. + */ + assert((a = archive_read_new()) != NULL); + assertA(0 == archive_read_support_format_all(a)); + assertA(0 == archive_read_support_compression_all(a)); + assertA(0 == archive_read_open_memory(a, buff, used)); + + + for (i = 0; i < 100; i++) { + sprintf(path, "file%03d", i); + assertEqualInt(0, archive_read_next_header(a, &ae)); + assertEqualString(path, archive_entry_pathname(ae)); + assertEqualInt(datasize, archive_entry_size(ae)); + } + + assert(0 == archive_read_close(a)); +#if ARCHIVE_API_VERSION > 1 + assert(0 == archive_read_finish(a)); +#else + archive_read_finish(a); +#endif + + free(data); + free(buff); +} diff --git a/archivers/libarchive/files/libarchive/test/test_write_format_ar.c b/archivers/libarchive/files/libarchive/test/test_write_format_ar.c index 2de670f68ef..6c7a4462a90 100644 --- a/archivers/libarchive/files/libarchive/test/test_write_format_ar.c +++ b/archivers/libarchive/files/libarchive/test/test_write_format_ar.c @@ -26,7 +26,7 @@ */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_format_ar.c,v 1.5 2007/07/06 15:43:11 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_format_ar.c,v 1.6 2008/03/12 21:10:26 kaiw Exp $"); char buff[4096]; char buff2[64]; @@ -119,9 +119,7 @@ DEFINE_TEST(test_write_format_ar) assertA(0 == archive_read_next_header(a, &ae)); assertEqualInt(0, archive_entry_mtime(ae)); assertEqualString("//", archive_entry_pathname(ae)); - assertEqualInt(strlen(strtab), archive_entry_size(ae)); - assertEqualIntA(a, strlen(strtab), archive_read_data(a, buff2, 100)); - assert(0 == memcmp(buff2, strtab, strlen(strtab))); + assertEqualInt(0, archive_entry_size(ae)); assertA(0 == archive_read_next_header(a, &ae)); assert(1 == archive_entry_mtime(ae)); diff --git a/archivers/libarchive/files/tar/bsdtar.1 b/archivers/libarchive/files/tar/bsdtar.1 index ec22160d998..433f5b364d0 100644 --- a/archivers/libarchive/files/tar/bsdtar.1 +++ b/archivers/libarchive/files/tar/bsdtar.1 @@ -22,7 +22,7 @@ .\" 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.37 2008/01/22 07:23:44 kientzle Exp $ +.\" $FreeBSD: src/usr.bin/tar/bsdtar.1,v 1.40 2008/03/15 03:25:26 kientzle Exp $ .\" .Dd April 13, 2004 .Dt BSDTAR 1 @@ -147,6 +147,12 @@ 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 -chroot ( Fl W Cm chroot ) +(x mode only) +.Fn chroot +to the current directory after processing any +.Fl C +options and before extracting any files. .It Fl -exclude Ar pattern ( Fl W Cm exclude Ns = Ns Ar pattern ) Do not process files or directories that match the specified pattern. @@ -174,15 +180,6 @@ If not specified, the default tape device will be used. .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 @@ -319,6 +316,15 @@ If is being run by root, the default is to restore the owner unless the .Fl o option is also specified. +.It Fl q ( Fl -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 -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. @@ -405,6 +411,15 @@ Note that, unlike other .Nm tar implementations, this implementation recognizes gzip compression automatically when reading archives. +.It Fl Z +(c mode only) +Compress the resulting archive with +.Xr compress 1 . +In extract or list modes, this option is ignored. +Note that, unlike other +.Nm tar +implementations, this implementation recognizes compress compression +automatically when reading archives. .El .Sh ENVIRONMENT The following environment variables affect the execution of @@ -628,6 +643,7 @@ an archive while preserving any absolute pathnames, components, or symlinks to other directories. .Sh SEE ALSO .Xr bzip2 1 , +.Xr compress 1 , .Xr cpio 1 , .Xr gzip 1 , .Xr mt 1 , diff --git a/archivers/libarchive/files/tar/bsdtar.c b/archivers/libarchive/files/tar/bsdtar.c index fbc66c1d739..81d9841bd94 100644 --- a/archivers/libarchive/files/tar/bsdtar.c +++ b/archivers/libarchive/files/tar/bsdtar.c @@ -24,7 +24,7 @@ */ #include "bsdtar_platform.h" -__FBSDID("$FreeBSD: src/usr.bin/tar/bsdtar.c,v 1.79 2008/01/22 07:23:44 kientzle Exp $"); +__FBSDID("$FreeBSD: src/usr.bin/tar/bsdtar.c,v 1.86 2008/03/15 05:08:21 kientzle Exp $"); #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> @@ -136,9 +136,9 @@ static const char *tar_opts = "+Bb:C:cf:HhI:jkLlmnOoPprtT:UuvW:wX:xyZz"; /* Fake short equivalents for long options that otherwise lack them. */ enum { - OPTION_CHECK_LINKS=1, + OPTION_CHECK_LINKS = 1, + OPTION_CHROOT, OPTION_EXCLUDE, - OPTION_FAST_READ, OPTION_FORMAT, OPTION_HELP, OPTION_INCLUDE, @@ -171,6 +171,8 @@ static const struct option tar_longopts[] = { { "bzip2", no_argument, NULL, 'j' }, { "cd", required_argument, NULL, 'C' }, { "check-links", no_argument, NULL, OPTION_CHECK_LINKS }, + { "chroot", no_argument, NULL, OPTION_CHROOT }, + { "compress", no_argument, NULL, 'Z' }, { "confirmation", no_argument, NULL, 'w' }, { "create", no_argument, NULL, 'c' }, { "dereference", no_argument, NULL, 'L' }, @@ -178,7 +180,7 @@ static const struct option tar_longopts[] = { { "exclude", required_argument, NULL, OPTION_EXCLUDE }, { "exclude-from", required_argument, NULL, 'X' }, { "extract", no_argument, NULL, 'x' }, - { "fast-read", no_argument, NULL, OPTION_FAST_READ }, + { "fast-read", no_argument, NULL, 'q' }, { "file", required_argument, NULL, 'f' }, { "files-from", required_argument, NULL, 'T' }, { "format", required_argument, NULL, OPTION_FORMAT }, @@ -187,6 +189,7 @@ static const struct option tar_longopts[] = { { "help", no_argument, NULL, OPTION_HELP }, { "include", required_argument, NULL, OPTION_INCLUDE }, { "interactive", no_argument, NULL, 'w' }, + { "insecure", no_argument, NULL, 'P' }, { "keep-old-files", no_argument, NULL, 'k' }, { "list", no_argument, NULL, 't' }, { "modification-time", no_argument, NULL, 'm' }, @@ -210,6 +213,7 @@ static const struct option tar_longopts[] = { { "strip-components", required_argument, NULL, OPTION_STRIP_COMPONENTS }, { "to-stdout", no_argument, NULL, 'O' }, { "totals", no_argument, NULL, OPTION_TOTALS }, + { "uncompress", no_argument, NULL, 'Z' }, { "unlink", no_argument, NULL, 'U' }, { "unlink-first", no_argument, NULL, 'U' }, { "update", no_argument, NULL, 'u' }, @@ -321,6 +325,9 @@ main(int argc, char **argv) case OPTION_CHECK_LINKS: /* GNU tar */ bsdtar->option_warn_links = 1; break; + case OPTION_CHROOT: /* NetBSD */ + bsdtar->option_chroot = 1; + break; case OPTION_EXCLUDE: /* GNU tar */ if (exclude(bsdtar, optarg)) bsdtar_errc(bsdtar, 1, 0, @@ -334,9 +341,6 @@ main(int argc, char **argv) if (strcmp(bsdtar->filename, "-") == 0) bsdtar->filename = NULL; break; - case OPTION_FAST_READ: /* GNU tar */ - bsdtar->option_fast_read = 1; - break; case 'H': /* BSD convention */ bsdtar->symlink_mode = 'H'; break; @@ -484,6 +488,9 @@ main(int argc, char **argv) case OPTION_POSIX: /* GNU tar */ bsdtar->create_format = "pax"; break; + case 'q': /* FreeBSD GNU tar --fast-read, NetBSD -q */ + bsdtar->option_fast_read = 1; + break; case 'r': /* SUSv2 */ set_mode(bsdtar, opt); break; @@ -625,10 +632,6 @@ main(int argc, char **argv) only_mode(bsdtar, "--check-links", "cr"); /* Check other parameters only permitted in certain modes. */ - if (bsdtar->create_compression == 'Z' && bsdtar->mode == 'c') { - bsdtar_warnc(bsdtar, 0, ".Z compression not supported"); - usage(bsdtar); - } if (bsdtar->create_compression != '\0') { strcpy(buff, "-?"); buff[1] = bsdtar->create_compression; diff --git a/archivers/libarchive/files/tar/bsdtar.h b/archivers/libarchive/files/tar/bsdtar.h index fb10678702f..167b55235e9 100644 --- a/archivers/libarchive/files/tar/bsdtar.h +++ b/archivers/libarchive/files/tar/bsdtar.h @@ -22,7 +22,7 @@ * (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.h,v 1.29 2008/01/02 00:21:27 kientzle Exp $ + * $FreeBSD: src/usr.bin/tar/bsdtar.h,v 1.30 2008/03/15 03:06:46 kientzle Exp $ */ #include "bsdtar_platform.h" @@ -57,6 +57,7 @@ struct bsdtar { char create_compression; /* j, y, or z */ const char *compress_program; char option_absolute_paths; /* -P */ + char option_chroot; /* --chroot */ char option_dont_traverse_mounts; /* --one-file-system */ char option_fast_read; /* --fast-read */ char option_honor_nodump; /* --nodump */ diff --git a/archivers/libarchive/files/tar/read.c b/archivers/libarchive/files/tar/read.c index edda317b6af..279a10549d7 100644 --- a/archivers/libarchive/files/tar/read.c +++ b/archivers/libarchive/files/tar/read.c @@ -24,7 +24,7 @@ */ #include "bsdtar_platform.h" -__FBSDID("$FreeBSD: src/usr.bin/tar/read.c,v 1.35 2008/01/02 00:21:27 kientzle Exp $"); +__FBSDID("$FreeBSD: src/usr.bin/tar/read.c,v 1.36 2008/03/15 03:06:46 kientzle Exp $"); #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> @@ -118,6 +118,17 @@ read_archive(struct bsdtar *bsdtar, char mode) archive_error_string(a)); do_chdir(bsdtar); + + if (mode == 'x' && bsdtar->option_chroot) { +#if HAVE_CHROOT + if (chroot(".") != 0) + bsdtar_errc(bsdtar, 1, errno, "Can't chroot to \".\""); +#else + bsdtar_errc(bsdtar, 1, 0, + "chroot isn't supported on this platform"); +#endif + } + for (;;) { /* Support --fast-read option */ if (bsdtar->option_fast_read && diff --git a/archivers/libarchive/files/tar/test/main.c b/archivers/libarchive/files/tar/test/main.c index c8495c6c7ed..d035e8007e9 100644 --- a/archivers/libarchive/files/tar/test/main.c +++ b/archivers/libarchive/files/tar/test/main.c @@ -24,25 +24,26 @@ */ /* - * This same file is used pretty much verbatim for all test harnesses. - * - * The next line is used to define various environment variables, etc. - * - * The tar and cpio test harnesses are identical except for this line; - * the libarchive test harness omits some code that is needed only for - * testing standalone executables. - */ -#define PROGRAM "BSDTAR" - -/* * Various utility routines useful for test programs. * Each test program is linked against this file. */ #include <errno.h> +#include <locale.h> #include <stdarg.h> #include <time.h> #include "test.h" + +/* + * This same file is used pretty much verbatim for all test harnesses. + * + * The next few lines are the only differences. + */ +#define PROGRAM "bsdtar" /* Name of program we're testing. */ +#define ENVBASE "BSDTAR" /* Prefix for environment variables. */ +#undef EXTRA_DUMP /* How to dump extra data */ +/* How to generate extra version info. */ +#define EXTRA_VERSION (systemf("%s --version", testprog) ? "" : "") __FBSDID("$FreeBSD$"); /* @@ -74,6 +75,9 @@ static int skips = 0; /* Cumulative count of assertions. */ static int assertions = 0; +/* Directory where uuencoded reference files can be found. */ +static char *refdir; + /* * My own implementation of the standard assert() macro emits the * message in the same format as GCC (file:line: message). @@ -93,7 +97,7 @@ static char msg[4096]; * For each test source file, we remember how many times each * failure was reported. */ -static const char *failed_filename; +static const char *failed_filename = NULL; static struct line { int line; int count; @@ -167,7 +171,12 @@ report_failure(void *extra) msg[0] = '\0'; } +#ifdef EXTRA_DUMP + if (extra != NULL) + fprintf(stderr, " detail: %s\n", EXTRA_DUMP(extra)); +#else (void)extra; /* UNUSED */ +#endif if (dump_on_failure) { fprintf(stderr, @@ -225,44 +234,46 @@ failure(const char *fmt, ...) } /* Generic assert() just displays the failed condition. */ -void +int test_assert(const char *file, int line, int value, const char *condition, void *extra) { ++assertions; if (value) { msg[0] = '\0'; - return; + return (value); } failures ++; if (previous_failures(file, line)) - return; + return (value); fprintf(stderr, "%s:%d: Assertion failed\n", file, line); fprintf(stderr, " Condition: %s\n", condition); report_failure(extra); + return (value); } /* assertEqualInt() displays the values of the two integers. */ -void +int test_assert_equal_int(const char *file, int line, int v1, const char *e1, int v2, const char *e2, void *extra) { ++assertions; if (v1 == v2) { msg[0] = '\0'; - return; + return (1); } failures ++; if (previous_failures(file, line)) - return; + return (0); 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); + return (0); } /* assertEqualString() displays the values of the two strings. */ -void +int test_assert_equal_string(const char *file, int line, const char *v1, const char *e1, const char *v2, const char *e2, @@ -272,24 +283,25 @@ test_assert_equal_string(const char *file, int line, if (v1 == NULL || v2 == NULL) { if (v1 == v2) { msg[0] = '\0'; - return; + return (1); } } else if (strcmp(v1, v2) == 0) { msg[0] = '\0'; - return; + return (1); } failures ++; if (previous_failures(file, line)) - return; + return (0); 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); + return (0); } /* assertEqualWString() displays the values of the two strings. */ -void +int test_assert_equal_wstring(const char *file, int line, const wchar_t *v1, const char *e1, const wchar_t *v2, const char *e2, @@ -298,16 +310,17 @@ test_assert_equal_wstring(const char *file, int line, ++assertions; if (wcscmp(v1, v2) == 0) { msg[0] = '\0'; - return; + return (1); } failures ++; if (previous_failures(file, line)) - return; + return (0); 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); + return (0); } /* @@ -327,7 +340,7 @@ hexdump(const char *p, const char *ref, size_t l, size_t offset) 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]); + fprintf(stderr, "%c%02x", sep, 0xff & (int)p[i+j]); if (ref != NULL && p[i + j] == ref[i + j]) sep = ' '; } @@ -349,7 +362,7 @@ hexdump(const char *p, const char *ref, size_t l, size_t offset) /* assertEqualMem() displays the values of the two memory blocks. */ /* TODO: For long blocks, hexdump the first bytes that actually differ. */ -void +int test_assert_equal_mem(const char *file, int line, const char *v1, const char *e1, const char *v2, const char *e2, @@ -359,15 +372,15 @@ test_assert_equal_mem(const char *file, int line, if (v1 == NULL || v2 == NULL) { if (v1 == v2) { msg[0] = '\0'; - return; + return (1); } } else if (memcmp(v1, v2, l) == 0) { msg[0] = '\0'; - return; + return (1); } failures ++; if (previous_failures(file, line)) - return; + return (0); fprintf(stderr, "%s:%d: Assertion failed: memory not equal\n", file, line); fprintf(stderr, " size %s = %d\n", ld, (int)l); @@ -377,14 +390,19 @@ test_assert_equal_mem(const char *file, int line, hexdump(v2, v1, l < 32 ? l : 32, 0); fprintf(stderr, "\n"); report_failure(extra); + return (0); } -void +int test_assert_empty_file(const char *f1fmt, ...) { + char buff[1024]; char f1[1024]; struct stat st; va_list ap; + ssize_t s; + int fd; + va_start(ap, f1fmt); vsprintf(f1, f1fmt, ap); @@ -393,16 +411,32 @@ test_assert_empty_file(const char *f1fmt, ...) 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); } + if (st.st_size == 0) + return (1); + + failures ++; + if (previous_failures(test_filename, test_line)) + return (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); + fprintf(stderr, " Contents:\n"); + fd = open(f1, O_RDONLY); + if (fd < 0) { + fprintf(stderr, " Unable to open %s\n", f1); + } else { + s = sizeof(buff) < st.st_size ? sizeof(buff) : st.st_size; + s = read(fd, buff, s); + hexdump(buff, NULL, s, 0); + } + report_failure(NULL); + return (0); } /* assertEqualFile() asserts that two files have the same contents. */ /* TODO: hexdump the first bytes that actually differ. */ -void +int test_assert_equal_file(const char *f1, const char *f2pattern, ...) { char f2[1024]; @@ -424,16 +458,58 @@ test_assert_equal_file(const char *f1, const char *f2pattern, ...) if (n1 != n2) break; if (n1 == 0 && n2 == 0) - return; + return (1); if (memcmp(buff1, buff2, n1) != 0) break; } - fprintf(stderr, "%s:%d: Files are not identical\n", test_filename, test_line); + failures ++; + if (previous_failures(test_filename, test_line)) + return (0); + 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); + return (0); } +/* assertFileContents() asserts the contents of a file. */ +int +test_assert_file_contents(const void *buff, int s, const char *fpattern, ...) +{ + char f[1024]; + va_list ap; + char *contents; + int fd; + int n; + + va_start(ap, fpattern); + vsprintf(f, fpattern, ap); + va_end(ap); + + fd = open(f, O_RDONLY); + contents = malloc(s * 2); + n = read(fd, contents, s * 2); + if (n == s && memcmp(buff, contents, s) == 0) { + free(contents); + return (1); + } + failures ++; + if (!previous_failures(test_filename, test_line)) { + fprintf(stderr, "%s:%d: File contents don't match\n", + test_filename, test_line); + fprintf(stderr, " file=\"%s\"\n", f); + if (n > 0) + hexdump(contents, buff, n, 0); + else { + fprintf(stderr, " File empty, contents should be:\n"); + hexdump(buff, NULL, s, 0); + } + report_failure(test_extra); + } + free(contents); + return (0); +} /* * Call standard system() call, but build up the command line using @@ -552,6 +628,8 @@ static int test_run(int i, const char *tmpdir) tests[i].name); exit(1); } + /* Explicitly reset the locale before each test. */ + setlocale(LC_ALL, "C"); /* Run the actual test. */ (*tests[i].func)(); /* Summarize the results of this test. */ @@ -571,8 +649,10 @@ static void usage(const char *program) printf("Options:\n"); printf(" -k Keep running after failures.\n"); printf(" Default: Core dump after any failure.\n"); +#ifdef PROGRAM printf(" -p <path> Path to executable to be tested.\n"); - printf(" Default: path taken from " PROGRAM " environment variable.\n"); + printf(" Default: path taken from " ENVBASE " environment variable.\n"); +#endif printf(" -q Quiet.\n"); printf(" -r <dir> Path to dir containing reference files.\n"); printf(" Default: Current directory.\n"); @@ -582,6 +662,66 @@ static void usage(const char *program) exit(1); } +#define uudecode(c) (((c) - 0x20) & 0x3f) + +void +extract_reference_file(const char *name) +{ + char buff[1024]; + FILE *in, *out; + + sprintf(buff, "%s/%s.uu", refdir, name); + in = fopen(buff, "r"); + failure("Couldn't open reference file %s", buff); + assert(in != NULL); + if (in == NULL) + return; + /* Read up to and including the 'begin' line. */ + for (;;) { + if (fgets(buff, sizeof(buff), in) == NULL) { + /* TODO: This is a failure. */ + return; + } + if (memcmp(buff, "begin ", 6) == 0) + break; + } + /* Now, decode the rest and write it. */ + /* Not a lot of error checking here; the input better be right. */ + out = fopen(name, "w"); + while (fgets(buff, sizeof(buff), in) != NULL) { + char *p = buff; + int bytes; + + if (memcmp(buff, "end", 3) == 0) + break; + + bytes = uudecode(*p++); + while (bytes > 0) { + int n = 0; + /* Write out 1-3 bytes from that. */ + if (bytes > 0) { + n = uudecode(*p++) << 18; + n |= uudecode(*p++) << 12; + fputc(n >> 16, out); + --bytes; + } + if (bytes > 0) { + n |= uudecode(*p++) << 6; + fputc((n >> 8) & 0xFF, out); + --bytes; + } + if (bytes > 0) { + n |= uudecode(*p++); + fputc(n & 0xFF, out); + --bytes; + } + } + } + fclose(out); + fclose(in); +} + + int main(int argc, char **argv) { static const int limit = sizeof(tests) / sizeof(tests[0]); @@ -603,15 +743,17 @@ int main(int argc, char **argv) ++p; } +#ifdef PROGRAM /* Get the target program from environment, if available. */ - testprog = getenv(PROGRAM); + testprog = getenv(ENVBASE); +#endif /* Allow -k to be controlled through the environment. */ - if (getenv(PROGRAM "_KEEP_GOING") != NULL) + if (getenv(ENVBASE "_KEEP_GOING") != NULL) dump_on_failure = 0; /* Get the directory holding test files from environment. */ - refdir = getenv(PROGRAM "_TEST_FILES"); + refdir = getenv(ENVBASE "_TEST_FILES"); /* * Parse options. @@ -622,7 +764,11 @@ int main(int argc, char **argv) dump_on_failure = 0; break; case 'p': +#ifdef PROGRAM testprog = optarg; +#else + usage(progname); +#endif break; case 'q': quiet_flag++; @@ -641,9 +787,10 @@ int main(int argc, char **argv) /* * Sanity-check that our options make sense. */ +#ifdef PROGRAM if (testprog == NULL) usage(progname); - +#endif /* * Create a temp directory for the following tests. @@ -685,7 +832,12 @@ int main(int argc, char **argv) if (!quiet_flag) { printf("Running tests in: %s\n", tmpdir); printf("Reference files will be read from: %s\n", refdir); +#ifdef PROGRAM printf("Running tests on: %s\n", testprog); +#endif + printf("Exercising: "); + fflush(stdout); + printf("%s\n", EXTRA_VERSION); } /* diff --git a/archivers/libarchive/files/tar/test/test.h b/archivers/libarchive/files/tar/test/test.h index a19d44c2184..314fbebf7ea 100644 --- a/archivers/libarchive/files/tar/test/test.h +++ b/archivers/libarchive/files/tar/test/test.h @@ -22,7 +22,7 @@ * (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 $ + * $FreeBSD$ */ /* Every test program should #include "test.h" as the first thing. */ @@ -31,8 +31,9 @@ * The goal of this file (and the matching test.c) is to * simplify the very repetitive test-*.c test programs. */ - +#ifndef _FILE_OFFSET_BITS #define _FILE_OFFSET_BITS 64 +#endif #include <dirent.h> #include <errno.h> @@ -41,7 +42,9 @@ #include <stdlib.h> #include <string.h> #include <sys/stat.h> +#ifndef _WIN32 #include <unistd.h> +#endif #include <wchar.h> #ifdef USE_DMALLOC @@ -113,13 +116,14 @@ void failure(const char *fmt, ...); void test_setup(const char *, int); 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 *); +int test_assert(const char *, int, int, const char *, void *); +int test_assert_empty_file(const char *, ...); +int test_assert_equal_file(const char *, const char *, ...); +int test_assert_equal_int(const char *, int, int, const char *, int, const char *, void *); +int test_assert_equal_string(const char *, int, const char *v1, const char *, const char *v2, const char *, void *); +int test_assert_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *); +int test_assert_equal_mem(const char *, int, const char *, const char *, const char *, const char *, size_t, const char *, void *); +int test_assert_file_contents(const void *, int, const char *, ...); /* Like sprintf, then system() */ int systemf(const char * fmt, ...); @@ -128,15 +132,11 @@ int systemf(const char * fmt, ...); /* Supports printf-style args: slurpfile(NULL, "%s/myfile", refdir); */ char *slurpfile(size_t *, const char *fmt, ...); -/* - * Global vars - */ - -/* Directory holding reference files. */ -char *refdir; +/* Extracts named reference file to the current directory. */ +void extract_reference_file(const char *); /* - * Special interfaces for bsdtar test harness. + * Special interfaces for program test harness. */ /* Pathname of exe to be tested. */ diff --git a/archivers/libarchive/files/tar/test/test_version.c b/archivers/libarchive/files/tar/test/test_version.c index 5ac6f882f0b..de5e1100bd9 100644 --- a/archivers/libarchive/files/tar/test/test_version.c +++ b/archivers/libarchive/files/tar/test/test_version.c @@ -43,6 +43,7 @@ DEFINE_TEST(test_version) q = p = slurpfile(&s, "version.stdout"); /* Version message should start with name of program, then space. */ assert(s > 6); + failure("Version: %s", p); assertEqualMem(q, "bsdtar ", 7); q += 7; s -= 7; /* Version number is a series of digits and periods. */ @@ -51,14 +52,22 @@ DEFINE_TEST(test_version) --s; } /* Version number terminated by space. */ + failure("Version: %s", p); assert(s > 1); + /* Skip a single trailing a,b,c, or d. */ + if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd') + ++q; + failure("Version: %s", p); assert(*q == ' '); ++q; --s; /* Separator. */ + failure("Version: %s", p); assertEqualMem(q, "- ", 2); q += 2; s -= 2; /* libarchive name and version number */ + failure("Version: %s", p); assert(s > 11); + failure("Version: %s", p); assertEqualMem(q, "libarchive ", 11); q += 11; s -= 11; /* Version number is a series of digits and periods. */ @@ -66,6 +75,9 @@ DEFINE_TEST(test_version) ++q; --s; } + /* Skip a single trailing a,b,c, or d. */ + if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd') + ++q; /* All terminated by a newline. */ assert(s >= 1); assertEqualMem(q, "\n", 1); diff --git a/archivers/libarchive/files/tar/write.c b/archivers/libarchive/files/tar/write.c index 3b8cc51585d..82736afcd98 100644 --- a/archivers/libarchive/files/tar/write.c +++ b/archivers/libarchive/files/tar/write.c @@ -24,7 +24,7 @@ */ #include "bsdtar_platform.h" -__FBSDID("$FreeBSD: src/usr.bin/tar/write.c,v 1.64 2008/02/19 05:27:17 kientzle Exp $"); +__FBSDID("$FreeBSD: src/usr.bin/tar/write.c,v 1.65 2008/03/15 02:41:44 kientzle Exp $"); #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> @@ -220,6 +220,9 @@ tar_mode_c(struct bsdtar *bsdtar) archive_write_set_compression_gzip(a); break; #endif + case 'Z': + archive_write_set_compression_compress(a); + break; default: bsdtar_errc(bsdtar, 1, 0, "Unrecognized compression option -%c", diff --git a/archivers/libarchive/files/version b/archivers/libarchive/files/version index 3eb2ae3ef12..285c14da76e 100644 --- a/archivers/libarchive/files/version +++ b/archivers/libarchive/files/version @@ -1 +1 @@ -2.4.14
\ No newline at end of file +2005000b |