Imported Upstream version 3.5.2 upstream upstream/3.5.2
authorJinWang An <jinwang.an@samsung.com>
Mon, 20 Dec 2021 07:45:07 +0000 (16:45 +0900)
committerJinWang An <jinwang.an@samsung.com>
Mon, 20 Dec 2021 07:45:07 +0000 (16:45 +0900)
227 files changed:
CMakeLists.txt
Makefile.am
Makefile.in
NEWS
README.md
build/cmake/config.h.in
build/version
cat/test/list.h
config.h.in
configure
configure.ac
contrib/libarchive.spec
contrib/shar/shar.c
cpio/bsdcpio.1
cpio/cmdline.c
cpio/cpio.c
cpio/cpio.h
cpio/test/CMakeLists.txt
cpio/test/list.h
cpio/test/test_basic.c
doc/html/Makefile
doc/html/archive_entry.3.html
doc/html/archive_entry_acl.3.html
doc/html/archive_entry_linkify.3.html
doc/html/archive_entry_misc.3.html
doc/html/archive_entry_paths.3.html
doc/html/archive_entry_perms.3.html
doc/html/archive_entry_stat.3.html
doc/html/archive_entry_time.3.html
doc/html/archive_read.3.html
doc/html/archive_read_add_passphrase.3.html
doc/html/archive_read_data.3.html
doc/html/archive_read_disk.3.html
doc/html/archive_read_extract.3.html
doc/html/archive_read_filter.3.html
doc/html/archive_read_format.3.html
doc/html/archive_read_free.3.html
doc/html/archive_read_header.3.html
doc/html/archive_read_new.3.html
doc/html/archive_read_open.3.html
doc/html/archive_read_set_options.3.html
doc/html/archive_util.3.html
doc/html/archive_write.3.html
doc/html/archive_write_blocksize.3.html
doc/html/archive_write_data.3.html
doc/html/archive_write_disk.3.html
doc/html/archive_write_filter.3.html
doc/html/archive_write_finish_entry.3.html
doc/html/archive_write_format.3.html
doc/html/archive_write_free.3.html
doc/html/archive_write_header.3.html
doc/html/archive_write_new.3.html
doc/html/archive_write_open.3.html
doc/html/archive_write_set_options.3.html
doc/html/archive_write_set_passphrase.3.html
doc/html/bsdcpio.1.html
doc/html/bsdtar.1.html
doc/html/cpio.5.html
doc/html/libarchive-formats.5.html
doc/html/libarchive.3.html
doc/html/libarchive_changes.3.html
doc/html/libarchive_internals.3.html
doc/html/mtree.5.html
doc/html/tar.5.html
doc/man/Makefile
doc/man/archive_read_set_options.3
doc/man/archive_write_format.3
doc/man/archive_write_set_options.3
doc/man/bsdcpio.1
doc/man/cpio.5
doc/man/libarchive-formats.5
doc/man/libarchive.3
doc/pdf/Makefile
doc/pdf/archive_entry.3.pdf
doc/pdf/archive_entry_acl.3.pdf
doc/pdf/archive_entry_linkify.3.pdf
doc/pdf/archive_entry_misc.3.pdf
doc/pdf/archive_entry_paths.3.pdf
doc/pdf/archive_entry_perms.3.pdf
doc/pdf/archive_entry_stat.3.pdf
doc/pdf/archive_entry_time.3.pdf
doc/pdf/archive_read.3.pdf
doc/pdf/archive_read_add_passphrase.3.pdf
doc/pdf/archive_read_data.3.pdf
doc/pdf/archive_read_disk.3.pdf
doc/pdf/archive_read_extract.3.pdf
doc/pdf/archive_read_filter.3.pdf
doc/pdf/archive_read_format.3.pdf
doc/pdf/archive_read_free.3.pdf
doc/pdf/archive_read_header.3.pdf
doc/pdf/archive_read_new.3.pdf
doc/pdf/archive_read_open.3.pdf
doc/pdf/archive_read_set_options.3.pdf
doc/pdf/archive_util.3.pdf
doc/pdf/archive_write.3.pdf
doc/pdf/archive_write_blocksize.3.pdf
doc/pdf/archive_write_data.3.pdf
doc/pdf/archive_write_disk.3.pdf
doc/pdf/archive_write_filter.3.pdf
doc/pdf/archive_write_finish_entry.3.pdf
doc/pdf/archive_write_format.3.pdf
doc/pdf/archive_write_free.3.pdf
doc/pdf/archive_write_header.3.pdf
doc/pdf/archive_write_new.3.pdf
doc/pdf/archive_write_open.3.pdf
doc/pdf/archive_write_set_options.3.pdf
doc/pdf/archive_write_set_passphrase.3.pdf
doc/pdf/bsdcpio.1.pdf
doc/pdf/bsdtar.1.pdf
doc/pdf/cpio.5.pdf
doc/pdf/libarchive-formats.5.pdf
doc/pdf/libarchive.3.pdf
doc/pdf/libarchive_changes.3.pdf
doc/pdf/libarchive_internals.3.pdf
doc/pdf/mtree.5.pdf
doc/pdf/tar.5.pdf
doc/text/Makefile
doc/text/archive_entry.3.txt
doc/text/archive_entry_acl.3.txt
doc/text/archive_entry_linkify.3.txt
doc/text/archive_entry_misc.3.txt
doc/text/archive_entry_paths.3.txt
doc/text/archive_entry_perms.3.txt
doc/text/archive_entry_stat.3.txt
doc/text/archive_entry_time.3.txt
doc/text/archive_read.3.txt
doc/text/archive_read_add_passphrase.3.txt
doc/text/archive_read_data.3.txt
doc/text/archive_read_disk.3.txt
doc/text/archive_read_extract.3.txt
doc/text/archive_read_filter.3.txt
doc/text/archive_read_format.3.txt
doc/text/archive_read_free.3.txt
doc/text/archive_read_header.3.txt
doc/text/archive_read_new.3.txt
doc/text/archive_read_open.3.txt
doc/text/archive_read_set_options.3.txt
doc/text/archive_util.3.txt
doc/text/archive_write.3.txt
doc/text/archive_write_blocksize.3.txt
doc/text/archive_write_data.3.txt
doc/text/archive_write_disk.3.txt
doc/text/archive_write_filter.3.txt
doc/text/archive_write_finish_entry.3.txt
doc/text/archive_write_format.3.txt
doc/text/archive_write_free.3.txt
doc/text/archive_write_header.3.txt
doc/text/archive_write_new.3.txt
doc/text/archive_write_open.3.txt
doc/text/archive_write_set_options.3.txt
doc/text/archive_write_set_passphrase.3.txt
doc/text/bsdcpio.1.txt
doc/text/bsdtar.1.txt
doc/text/cpio.5.txt
doc/text/libarchive-formats.5.txt
doc/text/libarchive.3.txt
doc/text/libarchive_changes.3.txt
doc/text/libarchive_internals.3.txt
doc/text/mtree.5.txt
doc/text/tar.5.txt
doc/wiki/Makefile
doc/wiki/ManPageArchiveReadSetOptions3.wiki
doc/wiki/ManPageArchiveWriteFormat3.wiki
doc/wiki/ManPageArchiveWriteSetOptions3.wiki
doc/wiki/ManPageBsdcpio1.wiki
doc/wiki/ManPageCpio5.wiki
doc/wiki/ManPageLibarchive3.wiki
doc/wiki/ManPageLibarchiveFormats5.wiki
libarchive/CMakeLists.txt
libarchive/archive.h
libarchive/archive_disk_acl_freebsd.c
libarchive/archive_disk_acl_linux.c
libarchive/archive_disk_acl_sunos.c
libarchive/archive_entry.h
libarchive/archive_pathmatch.c
libarchive/archive_private.h
libarchive/archive_random.c
libarchive/archive_read_disk_posix.c
libarchive/archive_read_disk_windows.c
libarchive/archive_read_set_options.3
libarchive/archive_read_support_filter_rpm.c
libarchive/archive_read_support_filter_uu.c
libarchive/archive_read_support_format_7zip.c
libarchive/archive_read_support_format_cab.c
libarchive/archive_read_support_format_cpio.c
libarchive/archive_read_support_format_mtree.c
libarchive/archive_read_support_format_rar.c
libarchive/archive_read_support_format_rar5.c
libarchive/archive_read_support_format_tar.c
libarchive/archive_read_support_format_zip.c
libarchive/archive_write.c
libarchive/archive_write_disk_posix.c
libarchive/archive_write_format.3
libarchive/archive_write_set_format.c
libarchive/archive_write_set_format_7zip.c
libarchive/archive_write_set_format_by_name.c
libarchive/archive_write_set_format_cpio.c
libarchive/archive_write_set_format_cpio_binary.c [new file with mode: 0644]
libarchive/archive_write_set_format_cpio_odc.c [new file with mode: 0644]
libarchive/archive_write_set_options.3
libarchive/config_freebsd.h
libarchive/cpio.5
libarchive/libarchive-formats.5
libarchive/libarchive.3
libarchive/test/CMakeLists.txt
libarchive/test/list.h
libarchive/test/test_archive_pathmatch.c
libarchive/test/test_compat_lzma.c
libarchive/test/test_read_disk_directory_traversals.c
libarchive/test/test_read_format_zip.c
libarchive/test/test_read_format_zip_7z_deflate.zip.uu [new file with mode: 0644]
libarchive/test/test_read_set_format.c
libarchive/test/test_short_writes.c [new file with mode: 0644]
libarchive/test/test_sparse_basic.c
libarchive/test/test_write_disk_appledouble.c
libarchive/test/test_write_disk_fixup.c [new file with mode: 0644]
libarchive/test/test_write_disk_hardlink.c
libarchive/test/test_write_disk_hfs_compression.c
libarchive/test/test_write_disk_mac_metadata.c
libarchive/test/test_write_disk_no_hfs_compression.c
libarchive/test/test_write_format_cpio.c
libarchive/test/test_write_format_cpio_empty.c
libarchive/test/test_write_format_cpio_odc.c
libarchive/xxhash.c
tar/test/list.h
tar/test/test_option_safe_writes.c
test_utils/test_main.c

index 58b4c8d..6b00410 100644 (file)
@@ -77,7 +77,7 @@ math(EXPR INTERFACE_VERSION  "13 + ${_minor}")
 # ?? Should there be more here ??
 SET(SOVERSION "${INTERFACE_VERSION}")
 
-# Enalbe CMAKE_PUSH_CHECK_STATE() and CMAKE_POP_CHECK_STATE() macros
+# Enable CMAKE_PUSH_CHECK_STATE() and CMAKE_POP_CHECK_STATE() macros
 # saving and restoring the state of the variables.
 INCLUDE(CMakePushCheckState)
 
@@ -378,7 +378,7 @@ IF(WIN32 AND NOT CMAKE_CL_64 AND NOT CYGWIN)
   SET(__GNUWIN32PATH "C:/Program Files/GnuWin32")
 ENDIF(WIN32 AND NOT CMAKE_CL_64 AND NOT CYGWIN)
 IF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}")
-  # You have to add a path availabel DLL file into PATH environment variable.
+  # You have to add a path available DLL file into PATH environment variable.
   # Maybe DLL path is "C:/Program Files/GnuWin32/bin".
   # The zlib and the bzip2 Setup program have installed programs and DLLs into
   # "C:/Program Files/GnuWin32" by default.
@@ -1015,7 +1015,7 @@ MACRO(CHECK_ICONV LIB TRY_ICONV_CONST)
         CMAKE_C_COMPILER_ID MATCHES "^Clang$")
       #
       # During checking iconv proto type, we should use -Werror to avoid the
-      # success of iconv detection with a warnig which success is a miss
+      # success of iconv detection with a warning which success is a miss
       # detection. So this needs for all build mode(even it's a release mode).
       #
       SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror")
@@ -1352,6 +1352,7 @@ CHECK_FUNCTION_EXISTS_GLIBC(lchflags HAVE_LCHFLAGS)
 CHECK_FUNCTION_EXISTS_GLIBC(lchmod HAVE_LCHMOD)
 CHECK_FUNCTION_EXISTS_GLIBC(lchown HAVE_LCHOWN)
 CHECK_FUNCTION_EXISTS_GLIBC(link HAVE_LINK)
+CHECK_FUNCTION_EXISTS_GLIBC(linkat HAVE_LINKAT)
 CHECK_FUNCTION_EXISTS_GLIBC(localtime_r HAVE_LOCALTIME_R)
 CHECK_FUNCTION_EXISTS_GLIBC(lstat HAVE_LSTAT)
 CHECK_FUNCTION_EXISTS_GLIBC(lutimes HAVE_LUTIMES)
@@ -1421,6 +1422,10 @@ CHECK_C_SOURCE_COMPILES(
   "#include <sys/types.h>\n#include <sys/mount.h>\nint main(void) { struct xvfsconf v; return sizeof(v);}"
   HAVE_STRUCT_XVFSCONF)
 
+CHECK_C_SOURCE_COMPILES(
+  "#include <sys/types.h>\n#include <sys/mount.h>\nint main(void) { struct statfs s; return sizeof(s);}"
+  HAVE_STRUCT_STATFS)
+
 # Make sure we have the POSIX version of readdir_r, not the
 # older 2-argument version.
 CHECK_C_SOURCE_COMPILES(
@@ -1496,9 +1501,14 @@ CHECK_STRUCT_HAS_MEMBER("struct tm" tm_gmtoff
 CHECK_STRUCT_HAS_MEMBER("struct tm" __tm_gmtoff
     "time.h" HAVE_STRUCT_TM___TM_GMTOFF)
 
+IF(HAVE_STRUCT_STATFS)
 # Check for f_namemax in struct statfs
 CHECK_STRUCT_HAS_MEMBER("struct statfs" f_namemax
     "sys/param.h;sys/mount.h" HAVE_STRUCT_STATFS_F_NAMEMAX)
+# Check for f_iosize in struct statfs
+CHECK_STRUCT_HAS_MEMBER("struct statfs" f_iosize
+    "sys/param.h;sys/mount.h" HAVE_STRUCT_STATFS_F_IOSIZE)
+ENDIF(HAVE_STRUCT_STATFS)
 
 # Check for birthtime in struct stat
 CHECK_STRUCT_HAS_MEMBER("struct stat" st_birthtime
index 525ac0a..c93a82e 100644 (file)
@@ -224,7 +224,9 @@ libarchive_la_SOURCES= \
        libarchive/archive_write_set_format_ar.c \
        libarchive/archive_write_set_format_by_name.c \
        libarchive/archive_write_set_format_cpio.c \
+       libarchive/archive_write_set_format_cpio_binary.c \
        libarchive/archive_write_set_format_cpio_newc.c \
+       libarchive/archive_write_set_format_cpio_odc.c \
        libarchive/archive_write_set_format_filter_by_ext.c \
        libarchive/archive_write_set_format_iso9660.c \
        libarchive/archive_write_set_format_mtree.c \
@@ -548,6 +550,7 @@ libarchive_test_SOURCES= \
        libarchive/test/test_read_too_many_filters.c \
        libarchive/test/test_read_truncated.c \
        libarchive/test/test_read_truncated_filter.c \
+       libarchive/test/test_short_writes.c \
        libarchive/test/test_sparse_basic.c \
        libarchive/test/test_tar_filenames.c \
        libarchive/test/test_tar_large.c \
@@ -557,6 +560,7 @@ libarchive_test_SOURCES= \
        libarchive/test/test_write_disk.c \
        libarchive/test/test_write_disk_appledouble.c \
        libarchive/test/test_write_disk_failures.c \
+       libarchive/test/test_write_disk_fixup.c \
        libarchive/test/test_write_disk_hardlink.c \
        libarchive/test/test_write_disk_hfs_compression.c \
        libarchive/test/test_write_disk_lookup.c \
@@ -898,6 +902,7 @@ libarchive_test_EXTRA_DIST=\
        libarchive/test/test_read_format_warc.warc.uu \
        libarchive/test/test_read_format_zip.zip.uu \
        libarchive/test/test_read_format_zip_7075_utf8_paths.zip.uu \
+       libarchive/test/test_read_format_zip_7z_deflate.zip.uu \
        libarchive/test/test_read_format_zip_7z_lzma.zip.uu \
        libarchive/test/test_read_format_zip_bz2_hang.zip.uu \
        libarchive/test/test_read_format_zip_bzip2.zipx.uu \
index 1511b22..ba651eb 100644 (file)
@@ -304,7 +304,9 @@ am__libarchive_la_SOURCES_DIST = libarchive/archive_acl.c \
        libarchive/archive_write_set_format_ar.c \
        libarchive/archive_write_set_format_by_name.c \
        libarchive/archive_write_set_format_cpio.c \
+       libarchive/archive_write_set_format_cpio_binary.c \
        libarchive/archive_write_set_format_cpio_newc.c \
+       libarchive/archive_write_set_format_cpio_odc.c \
        libarchive/archive_write_set_format_filter_by_ext.c \
        libarchive/archive_write_set_format_iso9660.c \
        libarchive/archive_write_set_format_mtree.c \
@@ -441,7 +443,9 @@ am_libarchive_la_OBJECTS = libarchive/archive_acl.lo \
        libarchive/archive_write_set_format_ar.lo \
        libarchive/archive_write_set_format_by_name.lo \
        libarchive/archive_write_set_format_cpio.lo \
+       libarchive/archive_write_set_format_cpio_binary.lo \
        libarchive/archive_write_set_format_cpio_newc.lo \
+       libarchive/archive_write_set_format_cpio_odc.lo \
        libarchive/archive_write_set_format_filter_by_ext.lo \
        libarchive/archive_write_set_format_iso9660.lo \
        libarchive/archive_write_set_format_mtree.lo \
@@ -766,7 +770,9 @@ am__libarchive_test_SOURCES_DIST = libarchive/archive_acl.c \
        libarchive/archive_write_set_format_ar.c \
        libarchive/archive_write_set_format_by_name.c \
        libarchive/archive_write_set_format_cpio.c \
+       libarchive/archive_write_set_format_cpio_binary.c \
        libarchive/archive_write_set_format_cpio_newc.c \
+       libarchive/archive_write_set_format_cpio_odc.c \
        libarchive/archive_write_set_format_filter_by_ext.c \
        libarchive/archive_write_set_format_iso9660.c \
        libarchive/archive_write_set_format_mtree.c \
@@ -988,6 +994,7 @@ am__libarchive_test_SOURCES_DIST = libarchive/archive_acl.c \
        libarchive/test/test_read_too_many_filters.c \
        libarchive/test/test_read_truncated.c \
        libarchive/test/test_read_truncated_filter.c \
+       libarchive/test/test_short_writes.c \
        libarchive/test/test_sparse_basic.c \
        libarchive/test/test_tar_filenames.c \
        libarchive/test/test_tar_large.c \
@@ -997,6 +1004,7 @@ am__libarchive_test_SOURCES_DIST = libarchive/archive_acl.c \
        libarchive/test/test_write_disk.c \
        libarchive/test/test_write_disk_appledouble.c \
        libarchive/test/test_write_disk_failures.c \
+       libarchive/test/test_write_disk_fixup.c \
        libarchive/test/test_write_disk_hardlink.c \
        libarchive/test/test_write_disk_hfs_compression.c \
        libarchive/test/test_write_disk_lookup.c \
@@ -1183,7 +1191,9 @@ am__objects_19 = libarchive/test-archive_acl.$(OBJEXT) \
        libarchive/test-archive_write_set_format_ar.$(OBJEXT) \
        libarchive/test-archive_write_set_format_by_name.$(OBJEXT) \
        libarchive/test-archive_write_set_format_cpio.$(OBJEXT) \
+       libarchive/test-archive_write_set_format_cpio_binary.$(OBJEXT) \
        libarchive/test-archive_write_set_format_cpio_newc.$(OBJEXT) \
+       libarchive/test-archive_write_set_format_cpio_odc.$(OBJEXT) \
        libarchive/test-archive_write_set_format_filter_by_ext.$(OBJEXT) \
        libarchive/test-archive_write_set_format_iso9660.$(OBJEXT) \
        libarchive/test-archive_write_set_format_mtree.$(OBJEXT) \
@@ -1396,6 +1406,7 @@ am_libarchive_test_OBJECTS = $(am__objects_19) $(am__objects_20) \
        libarchive/test/test-test_read_too_many_filters.$(OBJEXT) \
        libarchive/test/test-test_read_truncated.$(OBJEXT) \
        libarchive/test/test-test_read_truncated_filter.$(OBJEXT) \
+       libarchive/test/test-test_short_writes.$(OBJEXT) \
        libarchive/test/test-test_sparse_basic.$(OBJEXT) \
        libarchive/test/test-test_tar_filenames.$(OBJEXT) \
        libarchive/test/test-test_tar_large.$(OBJEXT) \
@@ -1405,6 +1416,7 @@ am_libarchive_test_OBJECTS = $(am__objects_19) $(am__objects_20) \
        libarchive/test/test-test_write_disk.$(OBJEXT) \
        libarchive/test/test-test_write_disk_appledouble.$(OBJEXT) \
        libarchive/test/test-test_write_disk_failures.$(OBJEXT) \
+       libarchive/test/test-test_write_disk_fixup.$(OBJEXT) \
        libarchive/test/test-test_write_disk_hardlink.$(OBJEXT) \
        libarchive/test/test-test_write_disk_hfs_compression.$(OBJEXT) \
        libarchive/test/test-test_write_disk_lookup.$(OBJEXT) \
@@ -1679,7 +1691,9 @@ am__depfiles_remade = cat/$(DEPDIR)/bsdcat-bsdcat.Po \
        libarchive/$(DEPDIR)/archive_write_set_format_ar.Plo \
        libarchive/$(DEPDIR)/archive_write_set_format_by_name.Plo \
        libarchive/$(DEPDIR)/archive_write_set_format_cpio.Plo \
+       libarchive/$(DEPDIR)/archive_write_set_format_cpio_binary.Plo \
        libarchive/$(DEPDIR)/archive_write_set_format_cpio_newc.Plo \
+       libarchive/$(DEPDIR)/archive_write_set_format_cpio_odc.Plo \
        libarchive/$(DEPDIR)/archive_write_set_format_filter_by_ext.Plo \
        libarchive/$(DEPDIR)/archive_write_set_format_gnutar.Plo \
        libarchive/$(DEPDIR)/archive_write_set_format_iso9660.Plo \
@@ -1807,7 +1821,9 @@ am__depfiles_remade = cat/$(DEPDIR)/bsdcat-bsdcat.Po \
        libarchive/$(DEPDIR)/test-archive_write_set_format_ar.Po \
        libarchive/$(DEPDIR)/test-archive_write_set_format_by_name.Po \
        libarchive/$(DEPDIR)/test-archive_write_set_format_cpio.Po \
+       libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_binary.Po \
        libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_newc.Po \
+       libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_odc.Po \
        libarchive/$(DEPDIR)/test-archive_write_set_format_filter_by_ext.Po \
        libarchive/$(DEPDIR)/test-archive_write_set_format_gnutar.Po \
        libarchive/$(DEPDIR)/test-archive_write_set_format_iso9660.Po \
@@ -2017,6 +2033,7 @@ am__depfiles_remade = cat/$(DEPDIR)/bsdcat-bsdcat.Po \
        libarchive/test/$(DEPDIR)/test-test_read_too_many_filters.Po \
        libarchive/test/$(DEPDIR)/test-test_read_truncated.Po \
        libarchive/test/$(DEPDIR)/test-test_read_truncated_filter.Po \
+       libarchive/test/$(DEPDIR)/test-test_short_writes.Po \
        libarchive/test/$(DEPDIR)/test-test_sparse_basic.Po \
        libarchive/test/$(DEPDIR)/test-test_tar_filenames.Po \
        libarchive/test/$(DEPDIR)/test-test_tar_large.Po \
@@ -2026,6 +2043,7 @@ am__depfiles_remade = cat/$(DEPDIR)/bsdcat-bsdcat.Po \
        libarchive/test/$(DEPDIR)/test-test_write_disk.Po \
        libarchive/test/$(DEPDIR)/test-test_write_disk_appledouble.Po \
        libarchive/test/$(DEPDIR)/test-test_write_disk_failures.Po \
+       libarchive/test/$(DEPDIR)/test-test_write_disk_fixup.Po \
        libarchive/test/$(DEPDIR)/test-test_write_disk_hardlink.Po \
        libarchive/test/$(DEPDIR)/test-test_write_disk_hfs_compression.Po \
        libarchive/test/$(DEPDIR)/test-test_write_disk_lookup.Po \
@@ -2758,7 +2776,9 @@ libarchive_la_SOURCES = libarchive/archive_acl.c \
        libarchive/archive_write_set_format_ar.c \
        libarchive/archive_write_set_format_by_name.c \
        libarchive/archive_write_set_format_cpio.c \
+       libarchive/archive_write_set_format_cpio_binary.c \
        libarchive/archive_write_set_format_cpio_newc.c \
+       libarchive/archive_write_set_format_cpio_odc.c \
        libarchive/archive_write_set_format_filter_by_ext.c \
        libarchive/archive_write_set_format_iso9660.c \
        libarchive/archive_write_set_format_mtree.c \
@@ -3051,6 +3071,7 @@ libarchive_test_SOURCES = \
        libarchive/test/test_read_too_many_filters.c \
        libarchive/test/test_read_truncated.c \
        libarchive/test/test_read_truncated_filter.c \
+       libarchive/test/test_short_writes.c \
        libarchive/test/test_sparse_basic.c \
        libarchive/test/test_tar_filenames.c \
        libarchive/test/test_tar_large.c \
@@ -3060,6 +3081,7 @@ libarchive_test_SOURCES = \
        libarchive/test/test_write_disk.c \
        libarchive/test/test_write_disk_appledouble.c \
        libarchive/test/test_write_disk_failures.c \
+       libarchive/test/test_write_disk_fixup.c \
        libarchive/test/test_write_disk_hardlink.c \
        libarchive/test/test_write_disk_hfs_compression.c \
        libarchive/test/test_write_disk_lookup.c \
@@ -3392,6 +3414,7 @@ libarchive_test_EXTRA_DIST = \
        libarchive/test/test_read_format_warc.warc.uu \
        libarchive/test/test_read_format_zip.zip.uu \
        libarchive/test/test_read_format_zip_7075_utf8_paths.zip.uu \
+       libarchive/test/test_read_format_zip_7z_deflate.zip.uu \
        libarchive/test/test_read_format_zip_7z_lzma.zip.uu \
        libarchive/test/test_read_format_zip_bz2_hang.zip.uu \
        libarchive/test/test_read_format_zip_bzip2.zipx.uu \
@@ -4233,9 +4256,15 @@ libarchive/archive_write_set_format_by_name.lo:  \
 libarchive/archive_write_set_format_cpio.lo:  \
        libarchive/$(am__dirstamp) \
        libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_set_format_cpio_binary.lo:  \
+       libarchive/$(am__dirstamp) \
+       libarchive/$(DEPDIR)/$(am__dirstamp)
 libarchive/archive_write_set_format_cpio_newc.lo:  \
        libarchive/$(am__dirstamp) \
        libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_set_format_cpio_odc.lo:  \
+       libarchive/$(am__dirstamp) \
+       libarchive/$(DEPDIR)/$(am__dirstamp)
 libarchive/archive_write_set_format_filter_by_ext.lo:  \
        libarchive/$(am__dirstamp) \
        libarchive/$(DEPDIR)/$(am__dirstamp)
@@ -4980,9 +5009,15 @@ libarchive/test-archive_write_set_format_by_name.$(OBJEXT):  \
 libarchive/test-archive_write_set_format_cpio.$(OBJEXT):  \
        libarchive/$(am__dirstamp) \
        libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/test-archive_write_set_format_cpio_binary.$(OBJEXT):  \
+       libarchive/$(am__dirstamp) \
+       libarchive/$(DEPDIR)/$(am__dirstamp)
 libarchive/test-archive_write_set_format_cpio_newc.$(OBJEXT):  \
        libarchive/$(am__dirstamp) \
        libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/test-archive_write_set_format_cpio_odc.$(OBJEXT):  \
+       libarchive/$(am__dirstamp) \
+       libarchive/$(DEPDIR)/$(am__dirstamp)
 libarchive/test-archive_write_set_format_filter_by_ext.$(OBJEXT):  \
        libarchive/$(am__dirstamp) \
        libarchive/$(DEPDIR)/$(am__dirstamp)
@@ -5647,6 +5682,9 @@ libarchive/test/test-test_read_truncated.$(OBJEXT):  \
 libarchive/test/test-test_read_truncated_filter.$(OBJEXT):  \
        libarchive/test/$(am__dirstamp) \
        libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/test-test_short_writes.$(OBJEXT):  \
+       libarchive/test/$(am__dirstamp) \
+       libarchive/test/$(DEPDIR)/$(am__dirstamp)
 libarchive/test/test-test_sparse_basic.$(OBJEXT):  \
        libarchive/test/$(am__dirstamp) \
        libarchive/test/$(DEPDIR)/$(am__dirstamp)
@@ -5674,6 +5712,9 @@ libarchive/test/test-test_write_disk_appledouble.$(OBJEXT):  \
 libarchive/test/test-test_write_disk_failures.$(OBJEXT):  \
        libarchive/test/$(am__dirstamp) \
        libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/test-test_write_disk_fixup.$(OBJEXT):  \
+       libarchive/test/$(am__dirstamp) \
+       libarchive/test/$(DEPDIR)/$(am__dirstamp)
 libarchive/test/test-test_write_disk_hardlink.$(OBJEXT):  \
        libarchive/test/$(am__dirstamp) \
        libarchive/test/$(DEPDIR)/$(am__dirstamp)
@@ -6102,7 +6143,9 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_format_ar.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_format_by_name.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_format_cpio.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_format_cpio_binary.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_format_cpio_newc.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_format_cpio_odc.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_format_filter_by_ext.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_format_gnutar.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_format_iso9660.Plo@am__quote@ # am--include-marker
@@ -6230,7 +6273,9 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/test-archive_write_set_format_ar.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/test-archive_write_set_format_by_name.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/test-archive_write_set_format_cpio.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_binary.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_newc.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_odc.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/test-archive_write_set_format_filter_by_ext.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/test-archive_write_set_format_gnutar.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/test-archive_write_set_format_iso9660.Po@am__quote@ # am--include-marker
@@ -6440,6 +6485,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_too_many_filters.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_truncated.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_truncated_filter.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_short_writes.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_sparse_basic.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_tar_filenames.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_tar_large.Po@am__quote@ # am--include-marker
@@ -6449,6 +6495,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_write_disk.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_write_disk_appledouble.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_write_disk_failures.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_write_disk_fixup.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_write_disk_hardlink.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_write_disk_hfs_compression.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_write_disk_lookup.Po@am__quote@ # am--include-marker
@@ -10187,6 +10234,20 @@ libarchive/test-archive_write_set_format_cpio.obj: libarchive/archive_write_set_
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test-archive_write_set_format_cpio.obj `if test -f 'libarchive/archive_write_set_format_cpio.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_cpio.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_cpio.c'; fi`
 
+libarchive/test-archive_write_set_format_cpio_binary.o: libarchive/archive_write_set_format_cpio_binary.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test-archive_write_set_format_cpio_binary.o -MD -MP -MF libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_binary.Tpo -c -o libarchive/test-archive_write_set_format_cpio_binary.o `test -f 'libarchive/archive_write_set_format_cpio_binary.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_cpio_binary.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_binary.Tpo libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_binary.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libarchive/archive_write_set_format_cpio_binary.c' object='libarchive/test-archive_write_set_format_cpio_binary.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test-archive_write_set_format_cpio_binary.o `test -f 'libarchive/archive_write_set_format_cpio_binary.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_cpio_binary.c
+
+libarchive/test-archive_write_set_format_cpio_binary.obj: libarchive/archive_write_set_format_cpio_binary.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test-archive_write_set_format_cpio_binary.obj -MD -MP -MF libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_binary.Tpo -c -o libarchive/test-archive_write_set_format_cpio_binary.obj `if test -f 'libarchive/archive_write_set_format_cpio_binary.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_cpio_binary.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_cpio_binary.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_binary.Tpo libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_binary.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libarchive/archive_write_set_format_cpio_binary.c' object='libarchive/test-archive_write_set_format_cpio_binary.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test-archive_write_set_format_cpio_binary.obj `if test -f 'libarchive/archive_write_set_format_cpio_binary.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_cpio_binary.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_cpio_binary.c'; fi`
+
 libarchive/test-archive_write_set_format_cpio_newc.o: libarchive/archive_write_set_format_cpio_newc.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test-archive_write_set_format_cpio_newc.o -MD -MP -MF libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_newc.Tpo -c -o libarchive/test-archive_write_set_format_cpio_newc.o `test -f 'libarchive/archive_write_set_format_cpio_newc.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_cpio_newc.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_newc.Tpo libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_newc.Po
@@ -10201,6 +10262,20 @@ libarchive/test-archive_write_set_format_cpio_newc.obj: libarchive/archive_write
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test-archive_write_set_format_cpio_newc.obj `if test -f 'libarchive/archive_write_set_format_cpio_newc.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_cpio_newc.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_cpio_newc.c'; fi`
 
+libarchive/test-archive_write_set_format_cpio_odc.o: libarchive/archive_write_set_format_cpio_odc.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test-archive_write_set_format_cpio_odc.o -MD -MP -MF libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_odc.Tpo -c -o libarchive/test-archive_write_set_format_cpio_odc.o `test -f 'libarchive/archive_write_set_format_cpio_odc.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_cpio_odc.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_odc.Tpo libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_odc.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libarchive/archive_write_set_format_cpio_odc.c' object='libarchive/test-archive_write_set_format_cpio_odc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test-archive_write_set_format_cpio_odc.o `test -f 'libarchive/archive_write_set_format_cpio_odc.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_cpio_odc.c
+
+libarchive/test-archive_write_set_format_cpio_odc.obj: libarchive/archive_write_set_format_cpio_odc.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test-archive_write_set_format_cpio_odc.obj -MD -MP -MF libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_odc.Tpo -c -o libarchive/test-archive_write_set_format_cpio_odc.obj `if test -f 'libarchive/archive_write_set_format_cpio_odc.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_cpio_odc.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_cpio_odc.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_odc.Tpo libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_odc.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libarchive/archive_write_set_format_cpio_odc.c' object='libarchive/test-archive_write_set_format_cpio_odc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test-archive_write_set_format_cpio_odc.obj `if test -f 'libarchive/archive_write_set_format_cpio_odc.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_cpio_odc.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_cpio_odc.c'; fi`
+
 libarchive/test-archive_write_set_format_filter_by_ext.o: libarchive/archive_write_set_format_filter_by_ext.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test-archive_write_set_format_filter_by_ext.o -MD -MP -MF libarchive/$(DEPDIR)/test-archive_write_set_format_filter_by_ext.Tpo -c -o libarchive/test-archive_write_set_format_filter_by_ext.o `test -f 'libarchive/archive_write_set_format_filter_by_ext.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_filter_by_ext.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/$(DEPDIR)/test-archive_write_set_format_filter_by_ext.Tpo libarchive/$(DEPDIR)/test-archive_write_set_format_filter_by_ext.Po
@@ -13281,6 +13356,20 @@ libarchive/test/test-test_read_truncated_filter.obj: libarchive/test/test_read_t
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/test-test_read_truncated_filter.obj `if test -f 'libarchive/test/test_read_truncated_filter.c'; then $(CYGPATH_W) 'libarchive/test/test_read_truncated_filter.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_truncated_filter.c'; fi`
 
+libarchive/test/test-test_short_writes.o: libarchive/test/test_short_writes.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_short_writes.o -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_short_writes.Tpo -c -o libarchive/test/test-test_short_writes.o `test -f 'libarchive/test/test_short_writes.c' || echo '$(srcdir)/'`libarchive/test/test_short_writes.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_short_writes.Tpo libarchive/test/$(DEPDIR)/test-test_short_writes.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libarchive/test/test_short_writes.c' object='libarchive/test/test-test_short_writes.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/test-test_short_writes.o `test -f 'libarchive/test/test_short_writes.c' || echo '$(srcdir)/'`libarchive/test/test_short_writes.c
+
+libarchive/test/test-test_short_writes.obj: libarchive/test/test_short_writes.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_short_writes.obj -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_short_writes.Tpo -c -o libarchive/test/test-test_short_writes.obj `if test -f 'libarchive/test/test_short_writes.c'; then $(CYGPATH_W) 'libarchive/test/test_short_writes.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_short_writes.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_short_writes.Tpo libarchive/test/$(DEPDIR)/test-test_short_writes.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libarchive/test/test_short_writes.c' object='libarchive/test/test-test_short_writes.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/test-test_short_writes.obj `if test -f 'libarchive/test/test_short_writes.c'; then $(CYGPATH_W) 'libarchive/test/test_short_writes.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_short_writes.c'; fi`
+
 libarchive/test/test-test_sparse_basic.o: libarchive/test/test_sparse_basic.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_sparse_basic.o -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_sparse_basic.Tpo -c -o libarchive/test/test-test_sparse_basic.o `test -f 'libarchive/test/test_sparse_basic.c' || echo '$(srcdir)/'`libarchive/test/test_sparse_basic.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_sparse_basic.Tpo libarchive/test/$(DEPDIR)/test-test_sparse_basic.Po
@@ -13407,6 +13496,20 @@ libarchive/test/test-test_write_disk_failures.obj: libarchive/test/test_write_di
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/test-test_write_disk_failures.obj `if test -f 'libarchive/test/test_write_disk_failures.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_failures.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_failures.c'; fi`
 
+libarchive/test/test-test_write_disk_fixup.o: libarchive/test/test_write_disk_fixup.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_write_disk_fixup.o -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_write_disk_fixup.Tpo -c -o libarchive/test/test-test_write_disk_fixup.o `test -f 'libarchive/test/test_write_disk_fixup.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_fixup.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_write_disk_fixup.Tpo libarchive/test/$(DEPDIR)/test-test_write_disk_fixup.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libarchive/test/test_write_disk_fixup.c' object='libarchive/test/test-test_write_disk_fixup.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/test-test_write_disk_fixup.o `test -f 'libarchive/test/test_write_disk_fixup.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_fixup.c
+
+libarchive/test/test-test_write_disk_fixup.obj: libarchive/test/test_write_disk_fixup.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_write_disk_fixup.obj -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_write_disk_fixup.Tpo -c -o libarchive/test/test-test_write_disk_fixup.obj `if test -f 'libarchive/test/test_write_disk_fixup.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_fixup.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_fixup.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_write_disk_fixup.Tpo libarchive/test/$(DEPDIR)/test-test_write_disk_fixup.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libarchive/test/test_write_disk_fixup.c' object='libarchive/test/test-test_write_disk_fixup.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/test-test_write_disk_fixup.obj `if test -f 'libarchive/test/test_write_disk_fixup.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_fixup.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_fixup.c'; fi`
+
 libarchive/test/test-test_write_disk_hardlink.o: libarchive/test/test_write_disk_hardlink.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_write_disk_hardlink.o -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_write_disk_hardlink.Tpo -c -o libarchive/test/test-test_write_disk_hardlink.o `test -f 'libarchive/test/test_write_disk_hardlink.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_hardlink.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_write_disk_hardlink.Tpo libarchive/test/$(DEPDIR)/test-test_write_disk_hardlink.Po
@@ -15295,7 +15398,9 @@ distclean: distclean-am
        -rm -f libarchive/$(DEPDIR)/archive_write_set_format_ar.Plo
        -rm -f libarchive/$(DEPDIR)/archive_write_set_format_by_name.Plo
        -rm -f libarchive/$(DEPDIR)/archive_write_set_format_cpio.Plo
+       -rm -f libarchive/$(DEPDIR)/archive_write_set_format_cpio_binary.Plo
        -rm -f libarchive/$(DEPDIR)/archive_write_set_format_cpio_newc.Plo
+       -rm -f libarchive/$(DEPDIR)/archive_write_set_format_cpio_odc.Plo
        -rm -f libarchive/$(DEPDIR)/archive_write_set_format_filter_by_ext.Plo
        -rm -f libarchive/$(DEPDIR)/archive_write_set_format_gnutar.Plo
        -rm -f libarchive/$(DEPDIR)/archive_write_set_format_iso9660.Plo
@@ -15423,7 +15528,9 @@ distclean: distclean-am
        -rm -f libarchive/$(DEPDIR)/test-archive_write_set_format_ar.Po
        -rm -f libarchive/$(DEPDIR)/test-archive_write_set_format_by_name.Po
        -rm -f libarchive/$(DEPDIR)/test-archive_write_set_format_cpio.Po
+       -rm -f libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_binary.Po
        -rm -f libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_newc.Po
+       -rm -f libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_odc.Po
        -rm -f libarchive/$(DEPDIR)/test-archive_write_set_format_filter_by_ext.Po
        -rm -f libarchive/$(DEPDIR)/test-archive_write_set_format_gnutar.Po
        -rm -f libarchive/$(DEPDIR)/test-archive_write_set_format_iso9660.Po
@@ -15633,6 +15740,7 @@ distclean: distclean-am
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_too_many_filters.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_truncated.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_truncated_filter.Po
+       -rm -f libarchive/test/$(DEPDIR)/test-test_short_writes.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_sparse_basic.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_tar_filenames.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_tar_large.Po
@@ -15642,6 +15750,7 @@ distclean: distclean-am
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_disk.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_disk_appledouble.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_disk_failures.Po
+       -rm -f libarchive/test/$(DEPDIR)/test-test_write_disk_fixup.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_disk_hardlink.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_disk_hfs_compression.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_disk_lookup.Po
@@ -16031,7 +16140,9 @@ maintainer-clean: maintainer-clean-am
        -rm -f libarchive/$(DEPDIR)/archive_write_set_format_ar.Plo
        -rm -f libarchive/$(DEPDIR)/archive_write_set_format_by_name.Plo
        -rm -f libarchive/$(DEPDIR)/archive_write_set_format_cpio.Plo
+       -rm -f libarchive/$(DEPDIR)/archive_write_set_format_cpio_binary.Plo
        -rm -f libarchive/$(DEPDIR)/archive_write_set_format_cpio_newc.Plo
+       -rm -f libarchive/$(DEPDIR)/archive_write_set_format_cpio_odc.Plo
        -rm -f libarchive/$(DEPDIR)/archive_write_set_format_filter_by_ext.Plo
        -rm -f libarchive/$(DEPDIR)/archive_write_set_format_gnutar.Plo
        -rm -f libarchive/$(DEPDIR)/archive_write_set_format_iso9660.Plo
@@ -16159,7 +16270,9 @@ maintainer-clean: maintainer-clean-am
        -rm -f libarchive/$(DEPDIR)/test-archive_write_set_format_ar.Po
        -rm -f libarchive/$(DEPDIR)/test-archive_write_set_format_by_name.Po
        -rm -f libarchive/$(DEPDIR)/test-archive_write_set_format_cpio.Po
+       -rm -f libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_binary.Po
        -rm -f libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_newc.Po
+       -rm -f libarchive/$(DEPDIR)/test-archive_write_set_format_cpio_odc.Po
        -rm -f libarchive/$(DEPDIR)/test-archive_write_set_format_filter_by_ext.Po
        -rm -f libarchive/$(DEPDIR)/test-archive_write_set_format_gnutar.Po
        -rm -f libarchive/$(DEPDIR)/test-archive_write_set_format_iso9660.Po
@@ -16369,6 +16482,7 @@ maintainer-clean: maintainer-clean-am
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_too_many_filters.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_truncated.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_truncated_filter.Po
+       -rm -f libarchive/test/$(DEPDIR)/test-test_short_writes.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_sparse_basic.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_tar_filenames.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_tar_large.Po
@@ -16378,6 +16492,7 @@ maintainer-clean: maintainer-clean-am
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_disk.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_disk_appledouble.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_disk_failures.Po
+       -rm -f libarchive/test/$(DEPDIR)/test-test_write_disk_fixup.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_disk_hardlink.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_disk_hfs_compression.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_disk_lookup.Po
diff --git a/NEWS b/NEWS
index 47cebdd..0964106 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+Aug 22, 2021: libarchive 3.5.2 released
+
 Dec 26, 2020: libarchive 3.5.1 released
 
 Dec 01, 2020: libarchive 3.5.0 released
index 56cd723..d5ef70c 100644 (file)
--- a/README.md
+++ b/README.md
@@ -79,6 +79,7 @@ Currently, the library automatically detects and reads the following formats:
   * POSIX octet-oriented cpio
   * SVR4 ASCII cpio
   * Binary cpio (big-endian or little-endian)
+  * PWB binary cpio
   * ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions)
   * ZIP archives (with uncompressed or "deflate" compressed entries, including support for encrypted Zip archives)
   * ZIPX archives (with support for bzip2, ppmd8, lzma and xz compressed entries)
@@ -110,6 +111,8 @@ The library can create archives in any of the following formats:
   * Old V7 tar format
   * POSIX octet-oriented cpio
   * SVR4 "newc" cpio
+  * Binary cpio (little-endian)
+  * PWB binary cpio
   * shar archives
   * ZIP archives (with uncompressed or "deflate" compressed entries)
   * GNU and BSD 'ar' archives
index ff629f9..5ddd2f3 100644 (file)
@@ -744,6 +744,9 @@ typedef uint64_t uintmax_t;
 /* Define to 1 if you have the `link' function. */
 #cmakedefine HAVE_LINK 1
 
+/* Define to 1 if you have the `linkat' function. */
+#cmakedefine HAVE_LINKAT 1
+
 /* Define to 1 if you have the <linux/fiemap.h> header file. */
 #cmakedefine HAVE_LINUX_FIEMAP_H 1
 
index 205791c..5fce0ed 100644 (file)
@@ -1 +1 @@
-3005001
+3005002
index 57f2f2a..5246122 100644 (file)
@@ -5,13 +5,13 @@ DEFINE_TEST(test_empty_xz)
 DEFINE_TEST(test_empty_zstd)
 DEFINE_TEST(test_error)
 DEFINE_TEST(test_error_mixed)
-DEFINE_TEST(test_expand_Z)
 DEFINE_TEST(test_expand_bz2)
 DEFINE_TEST(test_expand_gz)
 DEFINE_TEST(test_expand_lz4)
 DEFINE_TEST(test_expand_mixed)
 DEFINE_TEST(test_expand_plain)
 DEFINE_TEST(test_expand_xz)
+DEFINE_TEST(test_expand_Z)
 DEFINE_TEST(test_expand_zstd)
 DEFINE_TEST(test_help)
 DEFINE_TEST(test_stdin)
index 30caaa1..8abfedc 100644 (file)
 /* Define to 1 if you have the `link' function. */
 #undef HAVE_LINK
 
+/* Define to 1 if you have the `linkat' function. */
+#undef HAVE_LINKAT
+
 /* Define to 1 if you have the <linux/fiemap.h> header file. */
 #undef HAVE_LINUX_FIEMAP_H
 
 /* Define to 1 if the system has the type `struct richacl'. */
 #undef HAVE_STRUCT_RICHACL
 
+/* Define to 1 if the system has the type `struct statfs'. */
+#undef HAVE_STRUCT_STATFS
+
+/* Define to 1 if `f_iosize' is a member of `struct statfs'. */
+#undef HAVE_STRUCT_STATFS_F_IOSIZE
+
 /* Define to 1 if `f_namemax' is a member of `struct statfs'. */
 #undef HAVE_STRUCT_STATFS_F_NAMEMAX
 
index 93a024a..e3190e2 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libarchive 3.5.1.
+# Generated by GNU Autoconf 2.69 for libarchive 3.5.2.
 #
 # Report bugs to <libarchive-discuss@googlegroups.com>.
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='libarchive'
 PACKAGE_TARNAME='libarchive'
-PACKAGE_VERSION='3.5.1'
-PACKAGE_STRING='libarchive 3.5.1'
+PACKAGE_VERSION='3.5.2'
+PACKAGE_STRING='libarchive 3.5.2'
 PACKAGE_BUGREPORT='libarchive-discuss@googlegroups.com'
 PACKAGE_URL=''
 
@@ -1397,7 +1397,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 3.5.1 to adapt to many kinds of systems.
+\`configure' configures libarchive 3.5.2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1468,7 +1468,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libarchive 3.5.1:";;
+     short | recursive ) echo "Configuration of libarchive 3.5.2:";;
    esac
   cat <<\_ACEOF
 
@@ -1635,7 +1635,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-libarchive configure 3.5.1
+libarchive configure 3.5.2
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2474,7 +2474,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 3.5.1, which was
+It was created by libarchive $as_me 3.5.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3343,7 +3343,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='libarchive'
- VERSION='3.5.1'
+ VERSION='3.5.2'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -3503,7 +3503,7 @@ AM_BACKSLASH='\'
 
 # Libtool interface version bumps on any API change, so increments
 # whenever libarchive minor version does.
-ARCHIVE_MINOR=$(( (3005001 / 1000) % 1000 ))
+ARCHIVE_MINOR=$(( (3005002 / 1000) % 1000 ))
 # Libarchive 2.7 == libtool interface 9 = 2 + 7
 # Libarchive 2.8 == libtool interface 10 = 2 + 8
 # Libarchive 2.9 == libtool interface 11 = 2 + 8
@@ -3511,7 +3511,7 @@ ARCHIVE_MINOR=$(( (3005001 / 1000) % 1000 ))
 # Libarchive 3.1 == libtool interface 13
 ARCHIVE_INTERFACE=`echo $((13 + ${ARCHIVE_MINOR}))`
 # Libarchive revision is bumped on any source change === libtool revision
-ARCHIVE_REVISION=$(( 3005001 % 1000 ))
+ARCHIVE_REVISION=$(( 3005002 % 1000 ))
 # Libarchive minor is bumped on any interface addition === libtool age
 ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_INTERFACE:$ARCHIVE_REVISION:$ARCHIVE_MINOR
 
@@ -3520,31 +3520,31 @@ ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_INTERFACE:$ARCHIVE_REVISION:$ARCHIVE_MINOR
 $as_echo "#define __LIBARCHIVE_CONFIG_H_INCLUDED 1" >>confdefs.h
 
 
-$as_echo "#define LIBARCHIVE_VERSION_STRING \"3.5.1\"" >>confdefs.h
+$as_echo "#define LIBARCHIVE_VERSION_STRING \"3.5.2\"" >>confdefs.h
 
 
 cat >>confdefs.h <<_ACEOF
-#define LIBARCHIVE_VERSION_NUMBER "3005001"
+#define LIBARCHIVE_VERSION_NUMBER "3005002"
 _ACEOF
 
 
-$as_echo "#define BSDCPIO_VERSION_STRING \"3.5.1\"" >>confdefs.h
+$as_echo "#define BSDCPIO_VERSION_STRING \"3.5.2\"" >>confdefs.h
 
 
-$as_echo "#define BSDTAR_VERSION_STRING \"3.5.1\"" >>confdefs.h
+$as_echo "#define BSDTAR_VERSION_STRING \"3.5.2\"" >>confdefs.h
 
 
-$as_echo "#define BSDCAT_VERSION_STRING \"3.5.1\"" >>confdefs.h
+$as_echo "#define BSDCAT_VERSION_STRING \"3.5.2\"" >>confdefs.h
 
 
 # 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=3.5.1
-BSDTAR_VERSION_STRING=3.5.1
-BSDCAT_VERSION_STRING=3.5.1
-LIBARCHIVE_VERSION_STRING=3.5.1
-LIBARCHIVE_VERSION_NUMBER=3005001
+BSDCPIO_VERSION_STRING=3.5.2
+BSDTAR_VERSION_STRING=3.5.2
+BSDCAT_VERSION_STRING=3.5.2
+LIBARCHIVE_VERSION_STRING=3.5.2
+LIBARCHIVE_VERSION_NUMBER=3005002
 
 # Substitute the above version numbers into the various files below.
 # Yes, I believe this is the fourth time we define what are essentially
@@ -4883,7 +4883,6 @@ fi
 
 
 
-
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -5022,6 +5021,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
 $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
 if ${ac_cv_path_GREP+:} false; then :
@@ -16768,6 +16768,22 @@ _ACEOF
 fi
 
 
+# Check for f_iosize in struct statfs
+ac_fn_c_check_member "$LINENO" "struct statfs" "f_iosize" "ac_cv_member_struct_statfs_f_iosize" "
+#include <sys/param.h>
+#include <sys/mount.h>
+
+"
+if test "x$ac_cv_member_struct_statfs_f_iosize" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STATFS_F_IOSIZE 1
+_ACEOF
+
+
+fi
+
+
 # Check for f_iosize in struct statvfs
 ac_fn_c_check_member "$LINENO" "struct statvfs" "f_iosize" "ac_cv_member_struct_statvfs_f_iosize" "
 #include <sys/statvfs.h>
@@ -18021,7 +18037,7 @@ _ACEOF
 fi
 done
 
-for ac_func in lchflags lchmod lchown link localtime_r lstat lutimes
+for ac_func in lchflags lchmod lchown link linkat localtime_r lstat lutimes
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -18198,6 +18214,22 @@ _ACEOF
 fi
 
 
+ac_fn_c_check_type "$LINENO" "struct statfs" "ac_cv_type_struct_statfs" "#if HAVE_SYS_TYPES_H
+       #include <sys/types.h>
+       #endif
+       #include <sys/mount.h>
+
+"
+if test "x$ac_cv_type_struct_statfs" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STATFS 1
+_ACEOF
+
+
+fi
+
+
 # There are several variants of readdir_r around; we only
 # accept the POSIX-compliant version.
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -22488,7 +22520,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=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 3.5.1, which was
+This file was extended by libarchive $as_me 3.5.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -22554,7 +22586,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-libarchive config.status 3.5.1
+libarchive config.status 3.5.2
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
index 84eb9a9..f59ada9 100644 (file)
@@ -4,8 +4,8 @@ dnl First, define all of the version numbers up front.
 dnl In particular, this allows the version macro to be used in AC_INIT
 
 dnl These first two version numbers are updated automatically on each release.
-m4_define([LIBARCHIVE_VERSION_S],[3.5.1])
-m4_define([LIBARCHIVE_VERSION_N],[3005001])
+m4_define([LIBARCHIVE_VERSION_S],[3.5.2])
+m4_define([LIBARCHIVE_VERSION_N],[3005002])
 
 dnl bsdtar and bsdcpio versioning tracks libarchive
 m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S())
@@ -107,6 +107,7 @@ AC_SUBST(PLATFORMCPPFLAGS)
 AC_PROG_CC
 AC_PROG_CC_C99
 AM_PROG_CC_C_O
+AC_PROG_CPP
 AC_USE_SYSTEM_EXTENSIONS
 AC_LIBTOOL_WIN32_DLL
 AC_PROG_LIBTOOL
@@ -380,7 +381,7 @@ if test "x$with_iconv" != "xno"; then
     AC_CHECK_FUNCS([locale_charset])
     LIBS="${am_save_LIBS}"
     if test "x$ac_cv_func_locale_charset" != "xyes"; then
-      # If locale_charset() is not in libiconv, we have to find libcharset. 
+      # If locale_charset() is not in libiconv, we have to find libcharset.
       AC_CHECK_LIB(charset,locale_charset)
     fi
   fi
@@ -565,6 +566,13 @@ AC_CHECK_MEMBERS([struct statfs.f_namemax],,,
 #include <sys/mount.h>
 ])
 
+# Check for f_iosize in struct statfs
+AC_CHECK_MEMBERS([struct statfs.f_iosize],,,
+[
+#include <sys/param.h>
+#include <sys/mount.h>
+])
+
 # Check for f_iosize in struct statvfs
 AC_CHECK_MEMBERS([struct statvfs.f_iosize],,,
 [
@@ -648,7 +656,7 @@ AC_CHECK_FUNCS([fstat fstatat fstatfs fstatvfs ftruncate])
 AC_CHECK_FUNCS([futimens futimes futimesat])
 AC_CHECK_FUNCS([geteuid getpid getgrgid_r getgrnam_r])
 AC_CHECK_FUNCS([getpwnam_r getpwuid_r getvfsbyname gmtime_r])
-AC_CHECK_FUNCS([lchflags lchmod lchown link localtime_r lstat lutimes])
+AC_CHECK_FUNCS([lchflags lchmod lchown link linkat localtime_r lstat lutimes])
 AC_CHECK_FUNCS([mbrtowc memmove memset])
 AC_CHECK_FUNCS([mkdir mkfifo mknod mkstemp])
 AC_CHECK_FUNCS([nl_langinfo openat pipe poll posix_spawnp readlink readlinkat])
@@ -677,6 +685,13 @@ AC_CHECK_TYPES(struct xvfsconf,,,
        #include <sys/mount.h>
        ])
 
+AC_CHECK_TYPES(struct statfs,,,
+       [#if HAVE_SYS_TYPES_H
+       #include <sys/types.h>
+       #endif
+       #include <sys/mount.h>
+       ])
+
 # There are several variants of readdir_r around; we only
 # accept the POSIX-compliant version.
 AC_COMPILE_IFELSE(
index 6ef8957..371ae64 100644 (file)
@@ -99,7 +99,7 @@ replace ()
             print \".Dt ${binary^^} 1\";
             next;
         }
-        # replace the first occurence of \"$pattern\" by \"$binary\"
+        # replace the first occurrence of \"$pattern\" by \"$binary\"
         !stop && /^.Nm $pattern/ {
             print \".Nm $binary\" ;
             stop = 1 ;
index 6d5c206..63161fc 100644 (file)
@@ -170,7 +170,7 @@ out:
 }
 
 /*
- * Write singe path to the archive. The path can be a regular file, directory
+ * Write single path to the archive. The path can be a regular file, directory
  * or device. Symbolic links are followed.
  */
 static int
index 514c1a2..01b508e 100644 (file)
@@ -82,6 +82,13 @@ all operating modes.
 .It Fl 0 , Fl Fl null
 Read filenames separated by NUL characters instead of newlines.
 This is necessary if any of the filenames being read might contain newlines.
+.It Fl 6 , Fl Fl pwb
+When reading a binary format archive, assume it's the earlier one,
+from the PWB variant of 6th Edition UNIX.
+When writing a cpio archive, use the PWB format.
+.It Fl 7 , Fl Fl binary
+(o mode only)
+When writing a cpio archive, use the (newer, non-PWB) binary format.
 .It Fl A
 (o mode only)
 Append to the specified archive.
index c8fc30e..2683524 100644 (file)
@@ -51,7 +51,7 @@ __FBSDID("$FreeBSD: src/usr.bin/cpio/cmdline.c,v 1.5 2008/12/06 07:30:40 kientzl
 /*
  * Short options for cpio.  Please keep this sorted.
  */
-static const char *short_options = "0AaBC:cdE:F:f:H:hI:iJjLlmnO:opR:rtuVvW:yZz";
+static const char *short_options = "067AaBC:cdE:F:f:H:hI:iJjLlmnO:opR:rtuVvW:yZz";
 
 /*
  * Long options for cpio.  Please keep this sorted.
@@ -62,6 +62,7 @@ static const struct option {
        int equivalent; /* Equivalent short option. */
 } cpio_longopts[] = {
        { "b64encode",                  0, OPTION_B64ENCODE },
+       { "binary",                     0, '7' },
        { "create",                     0, 'o' },
        { "dereference",                0, 'L' },
        { "dot",                        0, 'V' },
@@ -86,6 +87,7 @@ static const struct option {
        { "pass-through",               0, 'p' },
        { "preserve-modification-time", 0, 'm' },
        { "preserve-owner",             0, OPTION_PRESERVE_OWNER },
+       { "pwb",                        0, '6' },
        { "quiet",                      0, OPTION_QUIET },
        { "unconditional",              0, 'u' },
        { "uuencode",                   0, OPTION_UUENCODE },
index c15ee52..68a6301 100644 (file)
@@ -192,6 +192,12 @@ main(int argc, char *argv[])
                case '0': /* GNU convention: --null, -0 */
                        cpio->option_null = 1;
                        break;
+               case '6': /* in/out: assume/create 6th edition (PWB) format */
+                       cpio->option_pwb = 1;
+                       break;
+               case '7': /* out: create archive using 7th Edition binary format */
+                       cpio->format = "bin";
+                       break;
                case 'A': /* NetBSD/OpenBSD */
                        cpio->option_append = 1;
                        break;
@@ -400,11 +406,12 @@ main(int argc, char *argv[])
 
        switch (cpio->mode) {
        case 'o':
-               /* TODO: Implement old binary format in libarchive,
-                  use that here. */
-               if (cpio->format == NULL)
-                       cpio->format = "odc"; /* Default format */
-
+               if (cpio->format == NULL) {
+                       if (cpio->option_pwb)
+                               cpio->format = "pwb";
+                       else
+                               cpio->format = "cpio";
+               }
                mode_out(cpio);
                break;
        case 'i':
@@ -462,7 +469,7 @@ static const char *long_help_msg =
        "  -v Verbose filenames     -V  one dot per file\n"
        "Create: %p -o [options]  < [list of files] > [archive]\n"
        "  -J,-y,-z,--lzma  Compress archive with xz/bzip2/gzip/lzma\n"
-       "  --format {odc|newc|ustar}  Select archive format\n"
+       "  --format {pwb|bin|odc|newc|ustar}  Select archive format\n"
        "List: %p -it < [archive]\n"
        "Extract: %p -i [options] < [archive]\n";
 
@@ -970,6 +977,8 @@ mode_in(struct cpio *cpio)
                lafe_errc(1, 0, "Couldn't allocate archive object");
        archive_read_support_filter_all(a);
        archive_read_support_format_all(a);
+       if (cpio->option_pwb)
+               archive_read_set_options(a, "pwb");
        if (cpio->passphrase != NULL)
                r = archive_read_add_passphrase(a, cpio->passphrase);
        else
@@ -1080,6 +1089,8 @@ mode_list(struct cpio *cpio)
                lafe_errc(1, 0, "Couldn't allocate archive object");
        archive_read_support_filter_all(a);
        archive_read_support_format_all(a);
+       if (cpio->option_pwb)
+               archive_read_set_options(a, "pwb");
        if (cpio->passphrase != NULL)
                r = archive_read_add_passphrase(a, cpio->passphrase);
        else
index 8e7cc5f..a71b664 100644 (file)
@@ -62,6 +62,7 @@ struct cpio {
        int               option_list; /* -t */
        char              option_null; /* --null */
        int               option_numeric_uid_gid; /* -n */
+       int               option_pwb; /* -6 */
        int               option_rename; /* -r */
        char             *destdir;
        size_t            destdir_len;
index d0927a8..2c3fbb0 100644 (file)
@@ -13,17 +13,17 @@ IF(ENABLE_CPIO AND ENABLE_TEST)
     test_0.c
     test_basic.c
     test_cmdline.c
-    test_extract_cpio_Z
-    test_extract_cpio_bz2
-    test_extract_cpio_grz
-    test_extract_cpio_gz
-    test_extract_cpio_lrz
-    test_extract_cpio_lz
-    test_extract_cpio_lz4
-    test_extract_cpio_lzma
-    test_extract_cpio_lzo
-    test_extract_cpio_xz
-    test_extract_cpio_zstd
+    test_extract_cpio_Z.c
+    test_extract_cpio_bz2.c
+    test_extract_cpio_grz.c
+    test_extract_cpio_gz.c
+    test_extract_cpio_lrz.c
+    test_extract_cpio_lz.c
+    test_extract_cpio_lz4.c
+    test_extract_cpio_lzma.c
+    test_extract_cpio_lzo.c
+    test_extract_cpio_xz.c
+    test_extract_cpio_zstd.c
     test_format_newc.c
     test_gcpio_compat.c
     test_missing_file.c
index 9c170a0..92f9ec8 100644 (file)
@@ -1,35 +1,34 @@
 DEFINE_TEST(test_0)
 DEFINE_TEST(test_basic)
 DEFINE_TEST(test_cmdline)
-DEFINE_TEST(test_extract_cpio_Z)
 DEFINE_TEST(test_extract_cpio_bz2)
 DEFINE_TEST(test_extract_cpio_grz)
 DEFINE_TEST(test_extract_cpio_gz)
 DEFINE_TEST(test_extract_cpio_lrz)
-DEFINE_TEST(test_extract_cpio_lz)
 DEFINE_TEST(test_extract_cpio_lz4)
+DEFINE_TEST(test_extract_cpio_lz)
 DEFINE_TEST(test_extract_cpio_lzma)
 DEFINE_TEST(test_extract_cpio_lzo)
 DEFINE_TEST(test_extract_cpio_xz)
+DEFINE_TEST(test_extract_cpio_Z)
 DEFINE_TEST(test_extract_cpio_zstd)
 DEFINE_TEST(test_format_newc)
 DEFINE_TEST(test_gcpio_compat)
 DEFINE_TEST(test_missing_file)
 DEFINE_TEST(test_option_0)
-DEFINE_TEST(test_option_B_upper)
-DEFINE_TEST(test_option_C_upper)
-DEFINE_TEST(test_option_J_upper)
-DEFINE_TEST(test_option_L_upper)
-DEFINE_TEST(test_option_Z_upper)
 DEFINE_TEST(test_option_a)
 DEFINE_TEST(test_option_b64encode)
+DEFINE_TEST(test_option_B_upper)
 DEFINE_TEST(test_option_c)
+DEFINE_TEST(test_option_C_upper)
 DEFINE_TEST(test_option_d)
 DEFINE_TEST(test_option_f)
 DEFINE_TEST(test_option_grzip)
 DEFINE_TEST(test_option_help)
+DEFINE_TEST(test_option_J_upper)
 DEFINE_TEST(test_option_l)
 DEFINE_TEST(test_option_lrzip)
+DEFINE_TEST(test_option_L_upper)
 DEFINE_TEST(test_option_lz4)
 DEFINE_TEST(test_option_lzma)
 DEFINE_TEST(test_option_lzop)
@@ -43,6 +42,7 @@ DEFINE_TEST(test_option_xz)
 DEFINE_TEST(test_option_y)
 DEFINE_TEST(test_option_z)
 DEFINE_TEST(test_option_zstd)
+DEFINE_TEST(test_option_Z_upper)
 DEFINE_TEST(test_owner_parse)
 DEFINE_TEST(test_passthrough_dotdot)
 DEFINE_TEST(test_passthrough_reverse)
index b716253..3d7d86a 100644 (file)
@@ -230,6 +230,8 @@ DEFINE_TEST(test_basic)
        basic_cpio("copy_odc", "--format=odc", "", msg, msg);
        basic_cpio("copy_newc", "-H newc", "", result, "2 blocks\n");
        basic_cpio("copy_cpio", "-H odc", "", msg, msg);
+       msg = "1 block\n";
+       basic_cpio("copy_bin", "-H bin", "", msg, msg);
        msg = canSymlink() ? "9 blocks\n" : "8 blocks\n";
        basic_cpio("copy_ustar", "-H ustar", "", msg, msg);
 
index d15a786..5fdc652 100644 (file)
@@ -107,15 +107,15 @@ archive_write_set_passphrase.3.html: ../../libarchive/archive_write_set_passphra
 cpio.5.html: ../../libarchive/cpio.5
        groff -mdoc -T html ../../libarchive/cpio.5 > cpio.5.html
 
-libarchive-formats.5.html: ../../libarchive/libarchive-formats.5
-       groff -mdoc -T html ../../libarchive/libarchive-formats.5 > libarchive-formats.5.html
-
 libarchive.3.html: ../../libarchive/libarchive.3
        groff -mdoc -T html ../../libarchive/libarchive.3 > libarchive.3.html
 
 libarchive_changes.3.html: ../../libarchive/libarchive_changes.3
        groff -mdoc -T html ../../libarchive/libarchive_changes.3 > libarchive_changes.3.html
 
+libarchive-formats.5.html: ../../libarchive/libarchive-formats.5
+       groff -mdoc -T html ../../libarchive/libarchive-formats.5 > libarchive-formats.5.html
+
 libarchive_internals.3.html: ../../libarchive/libarchive_internals.3
        groff -mdoc -T html ../../libarchive/libarchive_internals.3 > libarchive_internals.3.html
 
@@ -130,4 +130,4 @@ bsdtar.1.html: ../../tar/bsdtar.1
 
 bsdcpio.1.html: ../../cpio/bsdcpio.1
        groff -mdoc -T html ../../cpio/bsdcpio.1 > bsdcpio.1.html
-all: archive_entry.3.html archive_entry_acl.3.html archive_entry_linkify.3.html archive_entry_misc.3.html archive_entry_paths.3.html archive_entry_perms.3.html archive_entry_stat.3.html archive_entry_time.3.html archive_read.3.html archive_read_add_passphrase.3.html archive_read_data.3.html archive_read_disk.3.html archive_read_extract.3.html archive_read_filter.3.html archive_read_format.3.html archive_read_free.3.html archive_read_header.3.html archive_read_new.3.html archive_read_open.3.html archive_read_set_options.3.html archive_util.3.html archive_write.3.html archive_write_blocksize.3.html archive_write_data.3.html archive_write_disk.3.html archive_write_filter.3.html archive_write_finish_entry.3.html archive_write_format.3.html archive_write_free.3.html archive_write_header.3.html archive_write_new.3.html archive_write_open.3.html archive_write_set_options.3.html archive_write_set_passphrase.3.html cpio.5.html libarchive-formats.5.html libarchive.3.html libarchive_changes.3.html libarchive_internals.3.html mtree.5.html tar.5.html bsdtar.1.html bsdcpio.1.html
+all: archive_entry.3.html archive_entry_acl.3.html archive_entry_linkify.3.html archive_entry_misc.3.html archive_entry_paths.3.html archive_entry_perms.3.html archive_entry_stat.3.html archive_entry_time.3.html archive_read.3.html archive_read_add_passphrase.3.html archive_read_data.3.html archive_read_disk.3.html archive_read_extract.3.html archive_read_filter.3.html archive_read_format.3.html archive_read_free.3.html archive_read_header.3.html archive_read_new.3.html archive_read_open.3.html archive_read_set_options.3.html archive_util.3.html archive_write.3.html archive_write_blocksize.3.html archive_write_data.3.html archive_write_disk.3.html archive_write_filter.3.html archive_write_finish_entry.3.html archive_write_format.3.html archive_write_free.3.html archive_write_header.3.html archive_write_new.3.html archive_write_open.3.html archive_write_set_options.3.html archive_write_set_passphrase.3.html cpio.5.html libarchive.3.html libarchive_changes.3.html libarchive-formats.5.html libarchive_internals.3.html mtree.5.html tar.5.html bsdtar.1.html bsdcpio.1.html
index 312e909..f0d0023 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:21 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:24 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 320763b..fe89601 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:21 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:24 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index a15f612..c6f214c 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:21 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:24 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index cfe1dfd..a0365c1 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:21 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:24 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 00bb512..127c394 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:21 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:25 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 10f5ee6..7a912cd 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:21 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:25 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 52ef42a..5b0e476 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:21 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:25 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 76b37be..fd62535 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:21 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:25 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 904b5b8..13a14b1 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:22 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:25 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 3736a6d..d39b665 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:22 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:25 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 0daf201..a610e15 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:22 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:25 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index f8d8259..c1dc2d6 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:22 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:25 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 21881d0..c98352c 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:22 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:25 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 578d4cc..d38e9df 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:22 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:25 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 6681174..cbc8261 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:22 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:26 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index df4e4e5..2f54cca 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:22 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:26 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 8690759..e6711d6 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:22 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:26 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 4699b59..3cd3b64 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:22 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:26 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 8c7a500..0ed14df 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:22 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:26 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index ddba86f..ce14464 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:23 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:26 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
@@ -165,12 +165,26 @@ character set name that will be used when translating file
 names.</p>
 
 <p>Format cpio <b><br>
-hdrcharset</b></p>
+compat-2x</b></p>
+
+<p style="margin-left:27%;">Libarchive 2.x incorrectly
+encoded Unicode filenames on some platforms. This option
+mimics the libarchive 2.x filename handling so that such
+archives can be read correctly.</p>
+
+<p><b>hdrcharset</b></p>
 
 <p style="margin-left:27%;">The value is used as a
 character set name that will be used when translating file
 names.</p>
 
+<p><b>pwb</b></p>
+
+<p style="margin-left:27%; margin-top: 1em">When reading a
+binary CPIO archive, assume that it is in the original PWB
+cpio format, and handle file mode bits accordingly. The
+default is to assume v7 format.</p>
+
 <p>Format iso9660 <b><br>
 joliet</b></p>
 
index a03148e..acd2ee7 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:23 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:26 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 630520b..9657293 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:23 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:26 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 6379458..e87406f 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:23 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:26 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 9c1552b..3a6c693 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:23 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:26 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 88ee8e2..9d8aaad 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:23 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:26 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index da5d300..a1b24ef 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:23 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:26 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index c3b132b..843e0b0 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:23 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:26 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 53c8464..50f5bd1 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:23 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:26 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
@@ -33,7 +33,10 @@ ARCHIVE_WRITE_FORMAT(3)</p>
 <b>archive_write_set_format_ar_svr4</b>,
 <b>archive_write_set_format_by_name</b>,
 <b>archive_write_set_format_cpio</b>,
+<b>archive_write_set_format_cpio_bin</b>,
 <b>archive_write_set_format_cpio_newc</b>,
+<b>archive_write_set_format_cpio_odc</b>,
+<b>archive_write_set_format_cpio_pwb</b>,
 <b>archive_write_set_format_filter_by_ext</b>,
 <b>archive_write_set_format_filter_by_ext_def</b>,
 <b>archive_write_set_format_gnutar</b>,
@@ -103,11 +106,26 @@ creating archives</p>
 <p style="margin-left:6%; margin-top: 1em"><i>int</i></p>
 
 
+<p style="margin-left:12%;"><b>archive_write_set_format_cpio_bin</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
+
+<p style="margin-left:6%; margin-top: 1em"><i>int</i></p>
+
+
 <p style="margin-left:12%;"><b>archive_write_set_format_cpio_newc</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
 
 <p style="margin-left:6%; margin-top: 1em"><i>int</i></p>
 
 
+<p style="margin-left:12%;"><b>archive_write_set_format_cpio_odc</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
+
+<p style="margin-left:6%; margin-top: 1em"><i>int</i></p>
+
+
+<p style="margin-left:12%;"><b>archive_write_set_format_cpio_pwb</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
+
+<p style="margin-left:6%; margin-top: 1em"><i>int</i></p>
+
+
 <p style="margin-left:12%;"><b>archive_write_set_format_filter_by_ext</b>(<i>struct&nbsp;archive&nbsp;*</i>,
 <i>const&nbsp;char&nbsp;*filename</i>);</p>
 
@@ -207,7 +225,7 @@ archive with the same format as an existing archive.</p>
 based on the common name.</p>
 
 
-<p style="margin-top: 1em"><b>archive_write_set_format_filter_by_ext</b>(),
+<p style="margin-top: 1em"><b>archive_write_set_format_filter_by_ext</b>()
 <b>archive_write_set_format_filter_by_ext_def</b>()</p>
 
 <p style="margin-left:17%;">Sets both filters and format
@@ -217,10 +235,13 @@ based on the output filename. Supported extensions: .7z,
 
 
 <p style="margin-top: 1em"><b>archive_write_set_format_7zip</b>()
-<b>archive_write_set_format_ar_bsd</b>(),
-<b>archive_write_set_format_ar_svr4</b>(),
+<b>archive_write_set_format_ar_bsd</b>()
+<b>archive_write_set_format_ar_svr4</b>()
 <b>archive_write_set_format_cpio</b>()
+<b>archive_write_set_format_cpio_bin</b>()
 <b>archive_write_set_format_cpio_newc</b>()
+<b>archive_write_set_format_cpio_odc</b>()
+<b>archive_write_set_format_cpio_pwb</b>()
 <b>archive_write_set_format_gnutar</b>()
 <b>archive_write_set_format_iso9660</b>()
 <b>archive_write_set_format_mtree</b>()
index c2a761c..e3c2621 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:23 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:26 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 5758485..9195154 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:23 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:27 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index bec82b9..c02916f 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:24 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:27 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 59e09c7..01f3603 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:24 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:27 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index fcc57df..1c23d5e 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:24 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:27 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
@@ -285,7 +285,7 @@ between 0 and 9 are supported. The interpretation of the
 compression level depends on the chosen compression
 method.</p>
 
-<p>Format cpio <b><br>
+<p>Format bin <b><br>
 hdrcharset</b></p>
 
 <p style="margin-left:27%;">The value is used as a
@@ -620,6 +620,20 @@ hdrcharset</b></p>
 character set name that will be used when translating file
 names.</p>
 
+<p>Format odc <b><br>
+hdrcharset</b></p>
+
+<p style="margin-left:27%;">The value is used as a
+character set name that will be used when translating file
+names.</p>
+
+<p>Format pwb <b><br>
+hdrcharset</b></p>
+
+<p style="margin-left:27%;">The value is used as a
+character set name that will be used when translating file
+names.</p>
+
 <p>Format pax <b><br>
 hdrcharset</b></p>
 
index 0a1616e..30734c9 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:24 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:27 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index ac681fb..d68897c 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:25 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:28 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
@@ -81,6 +81,18 @@ modes.</p>
 characters instead of newlines. This is necessary if any of
 the filenames being read might contain newlines.</p>
 
+<p style="margin-top: 1em"><b>-6</b>, <b>--pwb</b></p>
+
+<p style="margin-left:17%;">When reading a binary format
+archive, assume it&rsquo;s the earlier one, from the PWB
+variant of 6th Edition UNIX. When writing a cpio archive,
+use the PWB format.</p>
+
+<p style="margin-top: 1em"><b>-7</b>, <b>--binary</b></p>
+
+<p style="margin-left:17%;">(o mode only) When writing a
+cpio archive, use the (newer, non-PWB) binary format.</p>
+
 <p style="margin-top: 1em"><b>-A</b></p>
 
 <p style="margin-left:17%; margin-top: 1em">(o mode only)
index 259cb54..7ae3e72 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:25 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:28 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
@@ -32,9 +32,9 @@ tape archives</p>
 <p style="margin-left:12%;"><b>tar</b>
 [<i>bundled-flags&nbsp;</i>&lang;</p>
 
-<p>args &rang;] [&lang; <i><br>
-file</i> &rang;&nbsp;|&nbsp;&lang; <i><br>
-pattern</i> &rang;&nbsp;...]</p>
+<p>args &rang; ] [&lang; <i><br>
+file</i> &rang; &nbsp;|&nbsp;&lang; <i><br>
+pattern</i> &rang; &nbsp;...]</p>
 
 <p style="margin-left:12%;"><b>tar</b> {<b>-c</b>}
 [<i>options</i>]
index 003d13b..672be05 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:24 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:27 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
@@ -50,65 +50,43 @@ pathname &ldquo;TRAILER!!!&rdquo;.</p>
 
 <p style="margin-left:6%; margin-top: 1em"><b>PWB
 format</b> <br>
-XXX Any documentation of the original PWB/UNIX 1.0 format?
-XXX</p>
-
-<p style="margin-left:6%; margin-top: 1em"><b>Old Binary
-Format</b> <br>
-The old binary <b>cpio</b> format stores numbers as 2-byte
-and 4-byte binary values. Each entry begins with a header in
-the following format:</p>
+The PWB binary <b>cpio</b> format is the original format,
+when cpio was introduced as part of the Programmer&rsquo;s
+Work Bench system, a variant of 6th Edition UNIX. It stores
+numbers as 2-byte and 4-byte binary values. Each entry
+begins with a header in the following format:</p>
 
 <p style="margin-left:14%; margin-top: 1em">struct
-header_old_cpio { <br>
-unsigned short c_magic; <br>
-unsigned short c_dev; <br>
-unsigned short c_ino; <br>
-unsigned short c_mode; <br>
-unsigned short c_uid; <br>
-unsigned short c_gid; <br>
-unsigned short c_nlink; <br>
-unsigned short c_rdev;</p>
-
-<table width="100%" border="0" rules="none" frame="void"
-       cellspacing="0" cellpadding="0">
-<tr valign="top" align="left">
-<td width="24%"></td>
-<td width="11%">
-
-
-<p>unsigned short c_mtime[2];</p></td>
-<td width="65%">
-</td></tr>
-</table>
-
-<p style="margin-left:14%;">unsigned short c_namesize;</p>
-
-<table width="100%" border="0" rules="none" frame="void"
-       cellspacing="0" cellpadding="0">
-<tr valign="top" align="left">
-<td width="24%"></td>
-<td width="76%">
-
-
-<p>unsigned short c_filesize[2];</p></td></tr>
-</table>
+header_pwb_cpio { <br>
+short h_magic; <br>
+short h_dev; <br>
+short h_ino; <br>
+short h_mode; <br>
+short h_uid; <br>
+short h_gid; <br>
+short h_nlink; <br>
+short h_majmin; <br>
+long h_mtime; <br>
+short h_namesize; <br>
+long h_filesize; <br>
+};</p>
 
-<p style="margin-left:14%;">};</p>
+<p style="margin-left:6%; margin-top: 1em">The <i>short</i>
+fields here are 16-bit integer values, while the <i>long</i>
+fields are 32 bit integers. Since PWB UNIX, like the 6th
+Edition UNIX it was based on, only ran on PDP-11 computers,
+they are in PDP-endian format, which has little-endian
+shorts, and big-endian longs. That is, the long integer
+whose hexadecimal representation is 0x12345678 would be
+stored in four successive bytes as 0x34, 0x12, 0x78, 0x56.
+The fields are as follows:</p>
 
-<p style="margin-left:6%; margin-top: 1em">The <i>unsigned
-short</i> fields here are 16-bit integer values; the
-<i>unsigned int</i> fields are 32-bit integer values. The
-fields are as follows</p>
+<p style="margin-top: 1em"><i>h_magic</i></p>
 
-<p style="margin-top: 1em"><i>magic</i></p>
+<p style="margin-left:17%;">The integer value octal
+070707.</p>
 
-<p style="margin-left:17%; margin-top: 1em">The integer
-value octal 070707. This value can be used to determine
-whether this archive is written with little-endian or
-big-endian integers.</p>
-
-<p style="margin-top: 1em"><i>dev</i>, <i>ino</i></p>
+<p style="margin-top: 1em"><i>h_dev</i>, <i>h_ino</i></p>
 
 <p style="margin-left:17%;">The device and inode numbers
 from the disk. These are used by programs that read
@@ -117,37 +95,27 @@ the same file. Programs that synthesize <b>cpio</b> archives
 should be careful to set these to distinct values for each
 entry.</p>
 
-<p style="margin-top: 1em"><i>mode</i></p>
+<p style="margin-top: 1em"><i>h_mode</i></p>
 
 <p style="margin-left:17%; margin-top: 1em">The mode
-specifies both the regular permissions and the file type. It
-consists of several bit fields as follows:</p>
-
-<p>0170000</p>
+specifies both the regular permissions and the file type,
+and it also holds a couple of bits that are irrelevant to
+the cpio format, because the field is actually a raw copy of
+the mode field in the inode representing the file. These are
+the IALLOC flag, which shows that the inode entry is in use,
+and the ILARG flag, which shows that the file it represents
+is large enough to have indirect blocks pointers in the
+inode. The mode is decoded as follows:</p>
 
-<p style="margin-left:28%; margin-top: 1em">This masks the
-file type bits.</p>
+<p style="margin-top: 1em">0100000</p>
 
-<p>0140000</p>
-
-<p style="margin-left:28%; margin-top: 1em">File type value
-for sockets.</p>
-
-<p>0120000</p>
-
-<p style="margin-left:28%; margin-top: 1em">File type value
-for symbolic links. For symbolic links, the link body is
-stored as file data.</p>
-
-<p>0100000</p>
-
-<p style="margin-left:28%; margin-top: 1em">File type value
-for regular files.</p>
+<p style="margin-left:28%; margin-top: 1em">IALLOC flag -
+irrelevant to cpio.</p>
 
 <p>0060000</p>
 
-<p style="margin-left:28%; margin-top: 1em">File type value
-for block special devices.</p>
+<p style="margin-left:28%; margin-top: 1em">This masks the
+file type bits.</p>
 
 <p>0040000</p>
 
@@ -159,10 +127,15 @@ for directories.</p>
 <p style="margin-left:28%; margin-top: 1em">File type value
 for character special devices.</p>
 
-<p>0010000</p>
+<p>0060000</p>
 
 <p style="margin-left:28%; margin-top: 1em">File type value
-for named pipes or FIFOs.</p>
+for block special devices.</p>
+
+<p>0010000</p>
+
+<p style="margin-left:28%; margin-top: 1em">ILARG flag -
+irrelevant to cpio.</p>
 
 <p>0004000</p>
 
@@ -174,9 +147,7 @@ for named pipes or FIFOs.</p>
 
 <p>0001000</p>
 
-<p style="margin-left:28%; margin-top: 1em">Sticky bit. On
-some systems, this modifies the behavior of executables
-and/or directories.</p>
+<p style="margin-left:28%; margin-top: 1em">Sticky bit.</p>
 
 <p>0000777</p>
 
@@ -184,58 +155,157 @@ and/or directories.</p>
 bits specify read/write/execute permissions for world,
 group, and user following standard POSIX conventions.</p>
 
-<p style="margin-top: 1em"><i>uid</i>, <i>gid</i></p>
+<p style="margin-top: 1em"><i>h_uid</i>, <i>h_gid</i></p>
 
 <p style="margin-left:17%;">The numeric user id and group
 id of the owner.</p>
 
-<p style="margin-top: 1em"><i>nlink</i></p>
+<p style="margin-top: 1em"><i>h_nlink</i></p>
 
-<p style="margin-left:17%; margin-top: 1em">The number of
-links to this file. Directories always have a value of at
-least two here. Note that hardlinked files include file data
-with every copy in the archive.</p>
+<p style="margin-left:17%;">The number of links to this
+file. Directories always have a value of at least two here.
+Note that hardlinked files include file data with every copy
+in the archive.</p>
 
-<p style="margin-top: 1em"><i>rdev</i></p>
+<p style="margin-top: 1em"><i>h_majmin</i></p>
 
-<p style="margin-left:17%; margin-top: 1em">For block
-special and character special entries, this field contains
-the associated device number. For all other entry types, it
+<p style="margin-left:17%;">For block special and character
+special entries, this field contains the associated device
+number, with the major number in the high byte, and the
+minor number in the low byte. For all other entry types, it
 should be set to zero by writers and ignored by readers.</p>
 
-<p style="margin-top: 1em"><i>mtime</i></p>
+<p style="margin-top: 1em"><i>h_mtime</i></p>
 
-<p style="margin-left:17%; margin-top: 1em">Modification
-time of the file, indicated as the number of seconds since
-the start of the epoch, 00:00:00 UTC January 1, 1970. The
-four-byte integer is stored with the most-significant 16
-bits first followed by the least-significant 16 bits. Each
-of the two 16 bit values are stored in machine-native byte
-order.</p>
+<p style="margin-left:17%;">Modification time of the file,
+indicated as the number of seconds since the start of the
+epoch, 00:00:00 UTC January 1, 1970.</p>
 
-<p style="margin-top: 1em"><i>namesize</i></p>
+<p style="margin-top: 1em"><i>h_namesize</i></p>
 
 <p style="margin-left:17%;">The number of bytes in the
 pathname that follows the header. This count includes the
 trailing NUL byte.</p>
 
-<p style="margin-top: 1em"><i>filesize</i></p>
+<p style="margin-top: 1em"><i>h_filesize</i></p>
 
 <p style="margin-left:17%;">The size of the file. Note that
-this archive format is limited to four gigabyte file sizes.
-See <i>mtime</i> above for a description of the storage of
-four-byte integers.</p>
+this archive format is limited to 16 megabyte file sizes,
+because PWB UNIX, like 6th Edition, only used an unsigned 24
+bit integer for the file size internally.</p>
 
 <p style="margin-left:6%; margin-top: 1em">The pathname
-immediately follows the fixed header. If the <b>namesize</b>
+immediately follows the fixed header. If <b>h_namesize</b>
 is odd, an additional NUL byte is added after the pathname.
-The file data is then appended, padded with NUL bytes to an
-even length.</p>
+The file data is then appended, again with an additional NUL
+appended if needed to get the next header at an even
+offset.</p>
 
 <p style="margin-left:6%; margin-top: 1em">Hardlinked files
 are not given special treatment; the full file contents are
 included with each copy of the file.</p>
 
+<p style="margin-left:6%; margin-top: 1em"><b>New Binary
+Format</b> <br>
+The new binary <b>cpio</b> format showed up when cpio was
+adopted into late 7th Edition UNIX. It is exactly like the
+PWB binary format, described above, except for three
+changes:</p>
+
+<p style="margin-left:6%; margin-top: 1em">First, UNIX now
+ran on more than one hardware type, so the endianness of 16
+bit integers must be determined by observing the magic
+number at the start of the header. The 32 bit integers are
+still always stored with the most significant word first,
+though, so each of those two, in the struct shown above, was
+stored as an array of two 16 bit integers, in the
+traditional order. Those 16 bit integers, like all the
+others in the struct, were accessed using a macro that byte
+swapped them if necessary.</p>
+
+<p style="margin-left:6%; margin-top: 1em">Next, 7th
+Edition had more file types to store, and the IALLOC and
+ILARG flag bits were re-purposed to accommodate these. The
+revised use of the various bits is as follows:</p>
+
+<p style="margin-top: 1em">0170000</p>
+
+<p style="margin-left:18%; margin-top: 1em">This masks the
+file type bits.</p>
+
+<p>0140000</p>
+
+<p style="margin-left:18%; margin-top: 1em">File type value
+for sockets.</p>
+
+<p>0120000</p>
+
+<p style="margin-left:18%; margin-top: 1em">File type value
+for symbolic links. For symbolic links, the link body is
+stored as file data.</p>
+
+<p>0100000</p>
+
+<p style="margin-left:18%; margin-top: 1em">File type value
+for regular files.</p>
+
+<p>0060000</p>
+
+<p style="margin-left:18%; margin-top: 1em">File type value
+for block special devices.</p>
+
+<p>0040000</p>
+
+<p style="margin-left:18%; margin-top: 1em">File type value
+for directories.</p>
+
+<p>0020000</p>
+
+<p style="margin-left:18%; margin-top: 1em">File type value
+for character special devices.</p>
+
+<p>0010000</p>
+
+<p style="margin-left:18%; margin-top: 1em">File type value
+for named pipes or FIFOs.</p>
+
+<p>0004000</p>
+
+<p style="margin-left:18%; margin-top: 1em">SUID bit.</p>
+
+<p>0002000</p>
+
+<p style="margin-left:18%; margin-top: 1em">SGID bit.</p>
+
+<p>0001000</p>
+
+<p style="margin-left:18%; margin-top: 1em">Sticky bit.</p>
+
+<p>0000777</p>
+
+<p style="margin-left:18%; margin-top: 1em">The lower 9
+bits specify read/write/execute permissions for world,
+group, and user following standard POSIX conventions.</p>
+
+<p style="margin-left:6%; margin-top: 1em">Finally, the
+file size field now represents a signed 32 bit integer in
+the underlying file system, so the maximum file size has
+increased to 2 gigabytes.</p>
+
+<p style="margin-left:6%; margin-top: 1em">Note that there
+is no obvious way to tell which of the two binary formats an
+archive uses, other than to see which one makes more sense.
+The typical error scenario is that a PWB format archive
+unpacked as if it were in the new format will create named
+sockets instead of directories, and then fail to unpack
+files that should go in those directories. Running
+<i>bsdcpio -itv</i> on an unknown archive will make it
+obvious which it is: if it&rsquo;s PWB format, directories
+will be listed with an &rsquo;s&rsquo; instead of a
+&rsquo;d&rsquo; as the first character of the mode string,
+and the larger files will have a &rsquo;?&rsquo; in that
+position.</p>
+
 <p style="margin-left:6%; margin-top: 1em"><b>Portable
 ASCII Format</b> <br>
 Version&nbsp;2 of the Single UNIX Specification
@@ -262,10 +332,10 @@ char c_filesize[11]; <br>
 };</p>
 
 <p style="margin-left:6%; margin-top: 1em">The fields are
-identical to those in the old binary format. The name and
-file body follow the fixed header. Unlike the old binary
-format, there is no additional padding after the pathname or
-file contents. If the files being archived are themselves
+identical to those in the new binary format. The name and
+file body follow the fixed header. Unlike the binary
+formats, there is no additional padding after the pathname
+or file contents. If the files being archived are themselves
 entirely ASCII, then the resulting archive will be entirely
 ASCII, except for the NUL byte that terminates the name
 field.</p>
@@ -296,7 +366,7 @@ char c_check[8]; <br>
 
 <p style="margin-left:6%; margin-top: 1em">Except as
 specified below, the fields here match those specified for
-the old binary format above.</p>
+the new binary format above.</p>
 
 <p style="margin-top: 1em"><i>magic</i></p>
 
@@ -364,8 +434,8 @@ part of the specification for the pax(1) utility.</p>
 written by Dick Haight while working in AT&amp;T&rsquo;s
 Unix Support Group. It appeared in 1977 as part of PWB/UNIX
 1.0, the &ldquo;Programmer&rsquo;s Work Bench&rdquo; derived
-from Version&nbsp;6 AT&amp;T UNIX that was used internally
-at AT&amp;T. Both the old binary and old character formats
+from AT&amp;T UNIX 6th Edition UNIX that was used internally
+at AT&amp;T. Both the new binary and old character formats
 were in use by 1980, according to the System III source
 released by SCO under their &ldquo;Ancient Unix&rdquo;
 license. The character format was adopted as part of IEEE
@@ -380,10 +450,11 @@ extended attributes? XXX</p>
 mis-named, as it uses a simple checksum and not a cyclic
 redundancy check.</p>
 
-<p style="margin-left:6%; margin-top: 1em">The old binary
-format is limited to 16 bits for user id, group id, device,
-and inode numbers. It is limited to 4 gigabyte file
-sizes.</p>
+<p style="margin-left:6%; margin-top: 1em">The binary
+formats are limited to 16 bits for user id, group id,
+device, and inode numbers. They are limited to 16 megabyte
+and 2 gigabyte file sizes for the older and newer variants,
+respectively.</p>
 
 <p style="margin-left:6%; margin-top: 1em">The old ASCII
 format is limited to 18 bits for the user id, group id,
index f861d09..037207b 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:24 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:27 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
@@ -245,38 +245,42 @@ create the &ldquo;pax interchange&rdquo; format.</p>
 
 <p style="margin-left:6%; margin-top: 1em"><b>Cpio
 Formats</b> <br>
-The libarchive library can read a number of common cpio
-variants and can write &ldquo;odc&rdquo; and
-&ldquo;newc&rdquo; format archives. A cpio archive stores
-each entry as a fixed-size header followed by a
-variable-length filename and variable-length data. Unlike
-the tar format, the cpio format does only minimal padding of
-the header or file data. There are several cpio variants,
-which differ primarily in how they store the initial header:
-some store the values as octal or hexadecimal numbers in
-ASCII, others as binary values of varying byte order and
-length.</p>
+The libarchive library can read and write a number of common
+cpio variants. A cpio archive stores each entry as a
+fixed-size header followed by a variable-length filename and
+variable-length data. Unlike the tar format, the cpio format
+does only minimal padding of the header or file data. There
+are several cpio variants, which differ primarily in how
+they store the initial header: some store the values as
+octal or hexadecimal numbers in ASCII, others as binary
+values of varying byte order and length.</p>
 
 <p style="margin-top: 1em"><b>binary</b></p>
 
 <p style="margin-left:17%; margin-top: 1em">The libarchive
 library transparently reads both big-endian and
-little-endian variants of the original binary cpio format.
-This format used 32-bit binary values for file size and
-mtime, and 16-bit binary values for the other fields.</p>
+little-endian variants of the the two binary cpio formats;
+the original one from PWB/UNIX, and the later, more widely
+used, variant. This format used 32-bit binary values for
+file size and mtime, and 16-bit binary values for the other
+fields. The formats support only the file types present in
+UNIX at the time of their creation. File sizes are limited
+to 24 bits in the PWB format, because of the limits of the
+file system, and to 31 bits in the newer binary format,
+where signed 32 bit longs were used.</p>
 
 <p style="margin-top: 1em"><b>odc</b></p>
 
-<p style="margin-left:17%; margin-top: 1em">The libarchive
-library can both read and write this POSIX-standard format,
-which is officially known as the &ldquo;cpio interchange
-format&rdquo; or the &ldquo;octet-oriented cpio archive
-format&rdquo; and sometimes unofficially referred to as the
-&ldquo;old character format&rdquo;. This format stores the
-header contents as octal values in ASCII. It is standard,
-portable, and immune from byte-order confusion. File sizes
-and mtime are limited to 33 bits (8GB file size), other
-fields are limited to 18 bits.</p>
+<p style="margin-left:17%; margin-top: 1em">This is the
+POSIX standardized format, which is officially known as the
+&ldquo;cpio interchange format&rdquo; or the
+&ldquo;octet-oriented cpio archive format&rdquo; and
+sometimes unofficially referred to as the &ldquo;old
+character format&rdquo;. This format stores the header
+contents as octal values in ASCII. It is standard, portable,
+and immune from byte-order confusion. File sizes and mtime
+are limited to 33 bits (8GB file size), other fields are
+limited to 18 bits.</p>
 
 <p style="margin-top: 1em"><b>SVR4/newc</b></p>
 
index 6860308..647e86a 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:24 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:27 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
@@ -126,8 +126,7 @@ format&rdquo; archives,</p>
 
 <p><b>&bull;</b></p>
 
-<p style="margin-left:12%;">POSIX octet-oriented cpio
-archives,</p>
+<p style="margin-left:12%;">cpio archives,</p>
 
 <p><b>&bull;</b></p>
 
index f6a057c..0ac6352 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:24 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:27 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 8241e43..2220bca 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:24 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:27 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 670c9b7..812aba3 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:25 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:27 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 08eb4cd..d009950 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Sat Dec 26 01:33:25 2020 -->
+<!-- CreationDate: Sun Aug 22 23:03:28 2021 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
index 1d56a6d..82bac3b 100644 (file)
@@ -107,15 +107,15 @@ archive_write_set_passphrase.3: ../mdoc2man.awk ../../libarchive/archive_write_s
 cpio.5: ../mdoc2man.awk ../../libarchive/cpio.5
        awk -f ../mdoc2man.awk < ../../libarchive/cpio.5 > cpio.5
 
-libarchive-formats.5: ../mdoc2man.awk ../../libarchive/libarchive-formats.5
-       awk -f ../mdoc2man.awk < ../../libarchive/libarchive-formats.5 > libarchive-formats.5
-
 libarchive.3: ../mdoc2man.awk ../../libarchive/libarchive.3
        awk -f ../mdoc2man.awk < ../../libarchive/libarchive.3 > libarchive.3
 
 libarchive_changes.3: ../mdoc2man.awk ../../libarchive/libarchive_changes.3
        awk -f ../mdoc2man.awk < ../../libarchive/libarchive_changes.3 > libarchive_changes.3
 
+libarchive-formats.5: ../mdoc2man.awk ../../libarchive/libarchive-formats.5
+       awk -f ../mdoc2man.awk < ../../libarchive/libarchive-formats.5 > libarchive-formats.5
+
 libarchive_internals.3: ../mdoc2man.awk ../../libarchive/libarchive_internals.3
        awk -f ../mdoc2man.awk < ../../libarchive/libarchive_internals.3 > libarchive_internals.3
 
@@ -130,4 +130,4 @@ bsdtar.1: ../mdoc2man.awk ../../tar/bsdtar.1
 
 bsdcpio.1: ../mdoc2man.awk ../../cpio/bsdcpio.1
        awk -f ../mdoc2man.awk < ../../cpio/bsdcpio.1 > bsdcpio.1
-all: archive_entry.3 archive_entry_acl.3 archive_entry_linkify.3 archive_entry_misc.3 archive_entry_paths.3 archive_entry_perms.3 archive_entry_stat.3 archive_entry_time.3 archive_read.3 archive_read_add_passphrase.3 archive_read_data.3 archive_read_disk.3 archive_read_extract.3 archive_read_filter.3 archive_read_format.3 archive_read_free.3 archive_read_header.3 archive_read_new.3 archive_read_open.3 archive_read_set_options.3 archive_util.3 archive_write.3 archive_write_blocksize.3 archive_write_data.3 archive_write_disk.3 archive_write_filter.3 archive_write_finish_entry.3 archive_write_format.3 archive_write_free.3 archive_write_header.3 archive_write_new.3 archive_write_open.3 archive_write_set_options.3 archive_write_set_passphrase.3 cpio.5 libarchive-formats.5 libarchive.3 libarchive_changes.3 libarchive_internals.3 mtree.5 tar.5 bsdtar.1 bsdcpio.1
+all: archive_entry.3 archive_entry_acl.3 archive_entry_linkify.3 archive_entry_misc.3 archive_entry_paths.3 archive_entry_perms.3 archive_entry_stat.3 archive_entry_time.3 archive_read.3 archive_read_add_passphrase.3 archive_read_data.3 archive_read_disk.3 archive_read_extract.3 archive_read_filter.3 archive_read_format.3 archive_read_free.3 archive_read_header.3 archive_read_new.3 archive_read_open.3 archive_read_set_options.3 archive_util.3 archive_write.3 archive_write_blocksize.3 archive_write_data.3 archive_write_disk.3 archive_write_filter.3 archive_write_finish_entry.3 archive_write_format.3 archive_write_free.3 archive_write_header.3 archive_write_new.3 archive_write_open.3 archive_write_set_options.3 archive_write_set_passphrase.3 cpio.5 libarchive.3 libarchive_changes.3 libarchive-formats.5 libarchive_internals.3 mtree.5 tar.5 bsdtar.1 bsdcpio.1
index a1c321f..01a87c9 100644 (file)
@@ -156,9 +156,20 @@ used when translating file names.
 Format cpio
 .RS 5
 .TP
+\fBcompat-2x\fP
+Libarchive 2.x incorrectly encoded Unicode filenames on
+some platforms.
+This option mimics the libarchive 2.x filename handling
+so that such archives can be read correctly.
+.TP
 \fBhdrcharset\fP
 The value is used as a character set name that will be
 used when translating file names.
+.TP
+\fBpwb\fP
+When reading a binary CPIO archive, assume that it is
+in the original PWB cpio format, and handle file mode
+bits accordingly.  The default is to assume v7 format.
 .RE
 .TP
 Format iso9660
index 80ed63d..9f8c0b3 100644 (file)
@@ -8,7 +8,10 @@
 \fB\%archive_write_set_format_ar_svr4\fP,
 \fB\%archive_write_set_format_by_name\fP,
 \fB\%archive_write_set_format_cpio\fP,
+\fB\%archive_write_set_format_cpio_bin\fP,
 \fB\%archive_write_set_format_cpio_newc\fP,
+\fB\%archive_write_set_format_cpio_odc\fP,
+\fB\%archive_write_set_format_cpio_pwb\fP,
 \fB\%archive_write_set_format_filter_by_ext\fP,
 \fB\%archive_write_set_format_filter_by_ext_def\fP,
 \fB\%archive_write_set_format_gnutar\fP,
@@ -64,10 +67,22 @@ Streaming Archive Library (libarchive, -larchive)
 .br
 \fIint\fP
 .br
+\fB\%archive_write_set_format_cpio_bin\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
 \fB\%archive_write_set_format_cpio_newc\fP(\fI\%struct\ archive\ *\fP);
 .br
 \fIint\fP
 .br
+\fB\%archive_write_set_format_cpio_odc\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_set_format_cpio_pwb\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
 \fB\%archive_write_set_format_filter_by_ext\fP(\fI\%struct\ archive\ *\fP, \fI\%const\ char\ *filename\fP);
 .br
 \fIint\fP
@@ -143,16 +158,19 @@ to create a new archive with the same format as an existing archive.
 \fB\%archive_write_set_format_by_name\fP()
 Sets the corresponding format based on the common name.
 .TP
-\fB\%archive_write_set_format_filter_by_ext\fP(),
+\fB\%archive_write_set_format_filter_by_ext\fP()
 \fB\%archive_write_set_format_filter_by_ext_def\fP()
 Sets both filters and format based on the output filename.
 Supported extensions: .7z, .zip, .jar, .cpio, .iso, .a, .ar, .tar, .tgz, .tar.gz, .tar.bz2, .tar.xz
 .TP
 \fB\%archive_write_set_format_7zip\fP()
-\fB\%archive_write_set_format_ar_bsd\fP(),
-\fB\%archive_write_set_format_ar_svr4\fP(),
+\fB\%archive_write_set_format_ar_bsd\fP()
+\fB\%archive_write_set_format_ar_svr4\fP()
 \fB\%archive_write_set_format_cpio\fP()
+\fB\%archive_write_set_format_cpio_bin\fP()
 \fB\%archive_write_set_format_cpio_newc\fP()
+\fB\%archive_write_set_format_cpio_odc\fP()
+\fB\%archive_write_set_format_cpio_pwb\fP()
 \fB\%archive_write_set_format_gnutar\fP()
 \fB\%archive_write_set_format_iso9660\fP()
 \fB\%archive_write_set_format_mtree\fP()
index f81c076..b5b8009 100644 (file)
@@ -279,7 +279,7 @@ The interpretation of the compression level depends on the chosen
 compression method.
 .RE
 .TP
-Format cpio
+Format bin
 .RS 5
 .TP
 \fBhdrcharset\fP
@@ -569,6 +569,22 @@ The value is used as a character set name that will be
 used when translating file names.
 .RE
 .TP
+Format odc
+.RS 5
+.TP
+\fBhdrcharset\fP
+The value is used as a character set name that will be
+used when translating file names.
+.RE
+.TP
+Format pwb
+.RS 5
+.TP
+\fBhdrcharset\fP
+The value is used as a character set name that will be
+used when translating file names.
+.RE
+.TP
 Format pax
 .RS 5
 .TP
index 8f31df6..81135e1 100644 (file)
@@ -66,6 +66,15 @@ all operating modes.
 Read filenames separated by NUL characters instead of newlines.
 This is necessary if any of the filenames being read might contain newlines.
 .TP
+\fB\-6\fP, \fB\-Fl\fP pwb
+When reading a binary format archive, assume it's the earlier one,
+from the PWB variant of 6th Edition UNIX.
+When writing a cpio archive, use the PWB format.
+.TP
+\fB\-7\fP, \fB\-Fl\fP binary
+(o mode only)
+When writing a cpio archive, use the (newer, non-PWB) binary format.
+.TP
 \fB\-A\fP
 (o mode only)
 Append to the specified archive.
index 23d4ab2..4dd0bc8 100644 (file)
@@ -30,43 +30,47 @@ The end of the archive is indicated by a special record with
 the pathname
 ``TRAILER!!!''.
 .SS PWB format
-XXX Any documentation of the original PWB/UNIX 1.0 format? XXX
-.SS Old Binary Format
-The old binary
+The PWB binary
 \fB\%cpio\fP
-format stores numbers as 2-byte and 4-byte binary values.
+format is the original format, when cpio was introduced as part of the
+Programmer's Work Bench system, a variant of 6th Edition UNIX.  It
+stores numbers as 2-byte and 4-byte binary values.
 Each entry begins with a header in the following format:
+.PP
 .RS 4
 .nf
-struct header_old_cpio {
-        unsigned short   c_magic;
-        unsigned short   c_dev;
-        unsigned short   c_ino;
-        unsigned short   c_mode;
-        unsigned short   c_uid;
-        unsigned short   c_gid;
-        unsigned short   c_nlink;
-        unsigned short   c_rdev;
-       unsigned short   c_mtime[2];
-        unsigned short   c_namesize;
-       unsigned short   c_filesize[2];
+struct header_pwb_cpio {
+        short   h_magic;
+        short   h_dev;
+        short   h_ino;
+        short   h_mode;
+        short   h_uid;
+        short   h_gid;
+        short   h_nlink;
+        short   h_majmin;
+        long    h_mtime;
+        short   h_namesize;
+        long    h_filesize;
 };
 .RE
 .PP
 The
-\fIunsigned\fP short
-fields here are 16-bit integer values; the
-\fIunsigned\fP int
-fields are 32-bit integer values.
-The fields are as follows
+\fIshort\fP
+fields here are 16-bit integer values, while the
+\fIlong\fP
+fields are 32 bit integers.  Since PWB UNIX, like the 6th Edition UNIX
+it was based on, only ran on PDP-11 computers, they
+are in PDP-endian format, which has little-endian shorts, and
+big-endian longs.  That is, the long integer whose hexadecimal
+representation is 0x12345678 would be stored in four successive bytes
+as 0x34, 0x12, 0x78, 0x56.
+The fields are as follows:
 .RS 5
 .TP
-\fImagic\fP
+\fIh_magic\fP
 The integer value octal 070707.
-This value can be used to determine whether this archive is
-written with little-endian or big-endian integers.
 .TP
-\fIdev\fP, \fIino\fP
+\fIh_dev\fP, \fIh_ino\fP
 The device and inode numbers from the disk.
 These are used by programs that read
 \fB\%cpio\fP
@@ -75,26 +79,23 @@ Programs that synthesize
 \fB\%cpio\fP
 archives should be careful to set these to distinct values for each entry.
 .TP
-\fImode\fP
-The mode specifies both the regular permissions and the file type.
-It consists of several bit fields as follows:
+\fIh_mode\fP
+The mode specifies both the regular permissions and the file type, and
+it also holds a couple of bits that are irrelevant to the cpio format,
+because the field is actually a raw copy of the mode field in the inode
+representing the file.  These are the IALLOC flag, which shows that
+the inode entry is in use, and the ILARG flag, which shows that the
+file it represents is large enough to have indirect blocks pointers in
+the inode.
+The mode is decoded as follows:
+.PP
 .RS 5
 .TP
-0170000
-This masks the file type bits.
-.TP
-0140000
-File type value for sockets.
-.TP
-0120000
-File type value for symbolic links.
-For symbolic links, the link body is stored as file data.
-.TP
 0100000
-File type value for regular files.
+IALLOC flag - irrelevant to cpio.
 .TP
 0060000
-File type value for block special devices.
+This masks the file type bits.
 .TP
 0040000
 File type value for directories.
@@ -102,8 +103,11 @@ File type value for directories.
 0020000
 File type value for character special devices.
 .TP
+0060000
+File type value for block special devices.
+.TP
 0010000
-File type value for named pipes or FIFOs.
+ILARG flag - irrelevant to cpio.
 .TP
 0004000
 SUID bit.
@@ -113,58 +117,128 @@ SGID bit.
 .TP
 0001000
 Sticky bit.
-On some systems, this modifies the behavior of executables and/or directories.
 .TP
 0000777
 The lower 9 bits specify read/write/execute permissions
 for world, group, and user following standard POSIX conventions.
 .RE
 .TP
-\fIuid\fP, \fIgid\fP
+\fIh_uid\fP, \fIh_gid\fP
 The numeric user id and group id of the owner.
 .TP
-\fInlink\fP
+\fIh_nlink\fP
 The number of links to this file.
 Directories always have a value of at least two here.
 Note that hardlinked files include file data with every copy in the archive.
 .TP
-\fIrdev\fP
+\fIh_majmin\fP
 For block special and character special entries,
-this field contains the associated device number.
+this field contains the associated device number, with the major
+number in the high byte, and the minor number in the low byte.
 For all other entry types, it should be set to zero by writers
 and ignored by readers.
 .TP
-\fImtime\fP
+\fIh_mtime\fP
 Modification time of the file, indicated as the number
 of seconds since the start of the epoch,
 00:00:00 UTC January 1, 1970.
-The four-byte integer is stored with the most-significant 16 bits first
-followed by the least-significant 16 bits.
-Each of the two 16 bit values are stored in machine-native byte order.
 .TP
-\fInamesize\fP
+\fIh_namesize\fP
 The number of bytes in the pathname that follows the header.
 This count includes the trailing NUL byte.
 .TP
-\fIfilesize\fP
-The size of the file.
-Note that this archive format is limited to
-four gigabyte file sizes.
-See
-\fImtime\fP
-above for a description of the storage of four-byte integers.
+\fIh_filesize\fP
+The size of the file.  Note that this archive format is limited to 16
+megabyte file sizes, because PWB UNIX, like 6th Edition, only used
+an unsigned 24 bit integer for the file size internally.
 .RE
 .PP
 The pathname immediately follows the fixed header.
-If the
-\fBnamesize\fP
+If
+\fBh_namesize\fP
 is odd, an additional NUL byte is added after the pathname.
-The file data is then appended, padded with NUL
-bytes to an even length.
+The file data is then appended, again with an additional NUL
+appended if needed to get the next header at an even offset.
 .PP
 Hardlinked files are not given special treatment;
 the full file contents are included with each copy of the
 file.
+.SS New Binary Format
+The new binary
+\fB\%cpio\fP
+format showed up when cpio was adopted into late 7th Edition UNIX.
+It is exactly like the PWB binary format, described above, except for
+three changes:
+.PP
+First, UNIX now ran on more than one hardware type, so the endianness
+of 16 bit integers must be determined by observing the magic number at
+the start of the header.  The 32 bit integers are still always stored
+with the most significant word first, though, so each of those two, in
+the struct shown above, was stored as an array of two 16 bit integers,
+in the traditional order.  Those 16 bit integers, like all the others
+in the struct, were accessed using a macro that byte swapped them if
+necessary.
+.PP
+Next, 7th Edition had more file types to store, and the IALLOC and ILARG
+flag bits were re-purposed to accommodate these.  The revised use of the
+various bits is as follows:
+.PP
+.RS 5
+.TP
+0170000
+This masks the file type bits.
+.TP
+0140000
+File type value for sockets.
+.TP
+0120000
+File type value for symbolic links.
+For symbolic links, the link body is stored as file data.
+.TP
+0100000
+File type value for regular files.
+.TP
+0060000
+File type value for block special devices.
+.TP
+0040000
+File type value for directories.
+.TP
+0020000
+File type value for character special devices.
+.TP
+0010000
+File type value for named pipes or FIFOs.
+.TP
+0004000
+SUID bit.
+.TP
+0002000
+SGID bit.
+.TP
+0001000
+Sticky bit.
+.TP
+0000777
+The lower 9 bits specify read/write/execute permissions
+for world, group, and user following standard POSIX conventions.
+.RE
+.PP
+Finally, the file size field now represents a signed 32 bit integer in
+the underlying file system, so the maximum file size has increased to
+2 gigabytes.
+.PP
+Note that there is no obvious way to tell which of the two binary
+formats an archive uses, other than to see which one makes more
+sense.  The typical error scenario is that a PWB format archive
+unpacked as if it were in the new format will create named sockets
+instead of directories, and then fail to unpack files that should
+go in those directories.  Running
+\fIbsdcpio\fP -itv
+on an unknown archive will make it obvious which it is: if it's
+PWB format, directories will be listed with an 's' instead of
+a 'd' as the first character of the mode string, and the larger
+files will have a '?' in that position.
 .SS Portable ASCII Format
 Version 2 of the Single UNIX Specification (``SUSv2'')
 standardized an ASCII variant that is portable across all
@@ -176,6 +250,7 @@ format or as the
 format.
 It stores the same numeric fields as the old binary format, but
 represents them as 6-character or 11-character octal values.
+.PP
 .RS 4
 .nf
 struct cpio_odc_header {
@@ -193,9 +268,9 @@ struct cpio_odc_header {
 };
 .RE
 .PP
-The fields are identical to those in the old binary format.
+The fields are identical to those in the new binary format.
 The name and file body follow the fixed header.
-Unlike the old binary format, there is no additional padding
+Unlike the binary formats, there is no additional padding
 after the pathname or file contents.
 If the files being archived are themselves entirely ASCII, then
 the resulting archive will be entirely ASCII, except for the
@@ -204,6 +279,7 @@ NUL byte that terminates the name field.
 The "new" ASCII format uses 8-byte hexadecimal fields for
 all numbers and separates device numbers into separate fields
 for major and minor numbers.
+.PP
 .RS 4
 .nf
 struct cpio_newc_header {
@@ -225,7 +301,7 @@ struct cpio_newc_header {
 .RE
 .PP
 Except as specified below, the fields here match those specified
-for the old binary format above.
+for the new binary format above.
 .RS 5
 .TP
 \fImagic\fP
@@ -291,9 +367,9 @@ while working in AT&T's Unix Support Group.
 It appeared in 1977 as part of PWB/UNIX 1.0, the
 ``Programmer's Work Bench''
 derived from
-At v6
+At 6th Edition UNIX
 that was used internally at AT&T.
-Both the old binary and old character formats were in use
+Both the new binary and old character formats were in use
 by 1980, according to the System III source released
 by SCO under their
 ``Ancient Unix''
@@ -308,9 +384,9 @@ The
 format is mis-named, as it uses a simple checksum and
 not a cyclic redundancy check.
 .PP
-The old binary format is limited to 16 bits for user id,
-group id, device, and inode numbers.
-It is limited to 4 gigabyte file sizes.
+The binary formats are limited to 16 bits for user id, group id,
+device, and inode numbers.  They are limited to 16 megabyte and 2
+gigabyte file sizes for the older and newer variants, respectively.
 .PP
 The old ASCII format is limited to 18 bits for
 the user id, group id, device, and inode numbers.
index 091cbfb..2d5d191 100644 (file)
@@ -182,30 +182,29 @@ POSIX.1-2001 extended the ustar format to create the
 ``pax interchange''
 format.
 .SS Cpio Formats
-The libarchive library can read a number of common cpio variants and can write
-``odc''
-and
-``newc''
-format archives.
-A cpio archive stores each entry as a fixed-size header followed
-by a variable-length filename and variable-length data.
-Unlike the tar format, the cpio format does only minimal padding
-of the header or file data.
-There are several cpio variants, which differ primarily in
-how they store the initial header: some store the values as
-octal or hexadecimal numbers in ASCII, others as binary values of
-varying byte order and length.
+The libarchive library can read and write a number of common cpio
+variants.  A cpio archive stores each entry as a fixed-size header
+followed by a variable-length filename and variable-length data.
+Unlike the tar format, the cpio format does only minimal padding of
+the header or file data.  There are several cpio variants, which
+differ primarily in how they store the initial header: some store the
+values as octal or hexadecimal numbers in ASCII, others as binary
+values of varying byte order and length.
 .RS 5
 .TP
 \fBbinary\fP
-The libarchive library transparently reads both big-endian and little-endian
-variants of the original binary cpio format.
-This format used 32-bit binary values for file size and mtime,
-and 16-bit binary values for the other fields.
+The libarchive library transparently reads both big-endian and
+little-endian variants of the the two binary cpio formats; the
+original one from PWB/UNIX, and the later, more widely used, variant.
+This format used 32-bit binary values for file size and mtime, and
+16-bit binary values for the other fields.  The formats support only
+the file types present in UNIX at the time of their creation.  File
+sizes are limited to 24 bits in the PWB format, because of the limits
+of the file system, and to 31 bits in the newer binary format, where
+signed 32 bit longs were used.
 .TP
 \fBodc\fP
-The libarchive library can both read and write this
-POSIX-standard format, which is officially known as the
+This is the POSIX standardized format, which is officially known as the
 ``cpio interchange format''
 or the
 ``octet-oriented cpio archive format''
index 245a826..310ad15 100644 (file)
@@ -79,7 +79,7 @@ POSIX
 ``pax interchange format''
 archives,
 .IP \(bu
-POSIX octet-oriented cpio archives,
+cpio archives,
 .IP \(bu
 Zip archive,
 .IP \(bu
index b5bf21e..48a5311 100644 (file)
@@ -107,15 +107,15 @@ archive_write_set_passphrase.3.pdf: ../../libarchive/archive_write_set_passphras
 cpio.5.pdf: ../../libarchive/cpio.5
        groff -mdoc -T ps ../../libarchive/cpio.5 | ps2pdf - - > cpio.5.pdf
 
-libarchive-formats.5.pdf: ../../libarchive/libarchive-formats.5
-       groff -mdoc -T ps ../../libarchive/libarchive-formats.5 | ps2pdf - - > libarchive-formats.5.pdf
-
 libarchive.3.pdf: ../../libarchive/libarchive.3
        groff -mdoc -T ps ../../libarchive/libarchive.3 | ps2pdf - - > libarchive.3.pdf
 
 libarchive_changes.3.pdf: ../../libarchive/libarchive_changes.3
        groff -mdoc -T ps ../../libarchive/libarchive_changes.3 | ps2pdf - - > libarchive_changes.3.pdf
 
+libarchive-formats.5.pdf: ../../libarchive/libarchive-formats.5
+       groff -mdoc -T ps ../../libarchive/libarchive-formats.5 | ps2pdf - - > libarchive-formats.5.pdf
+
 libarchive_internals.3.pdf: ../../libarchive/libarchive_internals.3
        groff -mdoc -T ps ../../libarchive/libarchive_internals.3 | ps2pdf - - > libarchive_internals.3.pdf
 
@@ -130,4 +130,4 @@ bsdtar.1.pdf: ../../tar/bsdtar.1
 
 bsdcpio.1.pdf: ../../cpio/bsdcpio.1
        groff -mdoc -T ps ../../cpio/bsdcpio.1 | ps2pdf - - > bsdcpio.1.pdf
-all: archive_entry.3.pdf archive_entry_acl.3.pdf archive_entry_linkify.3.pdf archive_entry_misc.3.pdf archive_entry_paths.3.pdf archive_entry_perms.3.pdf archive_entry_stat.3.pdf archive_entry_time.3.pdf archive_read.3.pdf archive_read_add_passphrase.3.pdf archive_read_data.3.pdf archive_read_disk.3.pdf archive_read_extract.3.pdf archive_read_filter.3.pdf archive_read_format.3.pdf archive_read_free.3.pdf archive_read_header.3.pdf archive_read_new.3.pdf archive_read_open.3.pdf archive_read_set_options.3.pdf archive_util.3.pdf archive_write.3.pdf archive_write_blocksize.3.pdf archive_write_data.3.pdf archive_write_disk.3.pdf archive_write_filter.3.pdf archive_write_finish_entry.3.pdf archive_write_format.3.pdf archive_write_free.3.pdf archive_write_header.3.pdf archive_write_new.3.pdf archive_write_open.3.pdf archive_write_set_options.3.pdf archive_write_set_passphrase.3.pdf cpio.5.pdf libarchive-formats.5.pdf libarchive.3.pdf libarchive_changes.3.pdf libarchive_internals.3.pdf mtree.5.pdf tar.5.pdf bsdtar.1.pdf bsdcpio.1.pdf
+all: archive_entry.3.pdf archive_entry_acl.3.pdf archive_entry_linkify.3.pdf archive_entry_misc.3.pdf archive_entry_paths.3.pdf archive_entry_perms.3.pdf archive_entry_stat.3.pdf archive_entry_time.3.pdf archive_read.3.pdf archive_read_add_passphrase.3.pdf archive_read_data.3.pdf archive_read_disk.3.pdf archive_read_extract.3.pdf archive_read_filter.3.pdf archive_read_format.3.pdf archive_read_free.3.pdf archive_read_header.3.pdf archive_read_new.3.pdf archive_read_open.3.pdf archive_read_set_options.3.pdf archive_util.3.pdf archive_write.3.pdf archive_write_blocksize.3.pdf archive_write_data.3.pdf archive_write_disk.3.pdf archive_write_filter.3.pdf archive_write_finish_entry.3.pdf archive_write_format.3.pdf archive_write_free.3.pdf archive_write_header.3.pdf archive_write_new.3.pdf archive_write_open.3.pdf archive_write_set_options.3.pdf archive_write_set_passphrase.3.pdf cpio.5.pdf libarchive.3.pdf libarchive_changes.3.pdf libarchive-formats.5.pdf libarchive_internals.3.pdf mtree.5.pdf tar.5.pdf bsdtar.1.pdf bsdcpio.1.pdf
index 2a4e81d..0a159f2 100644 (file)
Binary files a/doc/pdf/archive_entry.3.pdf and b/doc/pdf/archive_entry.3.pdf differ
index 05cfadc..a428f40 100644 (file)
Binary files a/doc/pdf/archive_entry_acl.3.pdf and b/doc/pdf/archive_entry_acl.3.pdf differ
index c8179c9..983eb0c 100644 (file)
Binary files a/doc/pdf/archive_entry_linkify.3.pdf and b/doc/pdf/archive_entry_linkify.3.pdf differ
index 7134c60..4a815f3 100644 (file)
Binary files a/doc/pdf/archive_entry_misc.3.pdf and b/doc/pdf/archive_entry_misc.3.pdf differ
index c79f206..3165b31 100644 (file)
Binary files a/doc/pdf/archive_entry_paths.3.pdf and b/doc/pdf/archive_entry_paths.3.pdf differ
index 47c5bb2..cd4a6dd 100644 (file)
Binary files a/doc/pdf/archive_entry_perms.3.pdf and b/doc/pdf/archive_entry_perms.3.pdf differ
index dd3008f..432760b 100644 (file)
Binary files a/doc/pdf/archive_entry_stat.3.pdf and b/doc/pdf/archive_entry_stat.3.pdf differ
index acc1fe7..29289ce 100644 (file)
Binary files a/doc/pdf/archive_entry_time.3.pdf and b/doc/pdf/archive_entry_time.3.pdf differ
index df02996..553e24f 100644 (file)
Binary files a/doc/pdf/archive_read.3.pdf and b/doc/pdf/archive_read.3.pdf differ
index 85ec895..4600a06 100644 (file)
Binary files a/doc/pdf/archive_read_add_passphrase.3.pdf and b/doc/pdf/archive_read_add_passphrase.3.pdf differ
index 059c77c..ed8628f 100644 (file)
Binary files a/doc/pdf/archive_read_data.3.pdf and b/doc/pdf/archive_read_data.3.pdf differ
index 26ebffc..ff4845e 100644 (file)
Binary files a/doc/pdf/archive_read_disk.3.pdf and b/doc/pdf/archive_read_disk.3.pdf differ
index e7ecc5a..3d0f002 100644 (file)
Binary files a/doc/pdf/archive_read_extract.3.pdf and b/doc/pdf/archive_read_extract.3.pdf differ
index cc3111a..830ff89 100644 (file)
Binary files a/doc/pdf/archive_read_filter.3.pdf and b/doc/pdf/archive_read_filter.3.pdf differ
index c4937fa..554df99 100644 (file)
Binary files a/doc/pdf/archive_read_format.3.pdf and b/doc/pdf/archive_read_format.3.pdf differ
index e3cd43b..5c5c370 100644 (file)
Binary files a/doc/pdf/archive_read_free.3.pdf and b/doc/pdf/archive_read_free.3.pdf differ
index b8999aa..aabfcba 100644 (file)
Binary files a/doc/pdf/archive_read_header.3.pdf and b/doc/pdf/archive_read_header.3.pdf differ
index 5f85e8f..69eab90 100644 (file)
Binary files a/doc/pdf/archive_read_new.3.pdf and b/doc/pdf/archive_read_new.3.pdf differ
index e01b9a4..3fad700 100644 (file)
Binary files a/doc/pdf/archive_read_open.3.pdf and b/doc/pdf/archive_read_open.3.pdf differ
index 700572a..084687f 100644 (file)
Binary files a/doc/pdf/archive_read_set_options.3.pdf and b/doc/pdf/archive_read_set_options.3.pdf differ
index 141d00e..3cee5fe 100644 (file)
Binary files a/doc/pdf/archive_util.3.pdf and b/doc/pdf/archive_util.3.pdf differ
index 922996e..5c318d5 100644 (file)
Binary files a/doc/pdf/archive_write.3.pdf and b/doc/pdf/archive_write.3.pdf differ
index 26aacb8..99473f7 100644 (file)
Binary files a/doc/pdf/archive_write_blocksize.3.pdf and b/doc/pdf/archive_write_blocksize.3.pdf differ
index ea15250..f40d118 100644 (file)
Binary files a/doc/pdf/archive_write_data.3.pdf and b/doc/pdf/archive_write_data.3.pdf differ
index d464dcd..03ec498 100644 (file)
Binary files a/doc/pdf/archive_write_disk.3.pdf and b/doc/pdf/archive_write_disk.3.pdf differ
index 1195157..5953814 100644 (file)
Binary files a/doc/pdf/archive_write_filter.3.pdf and b/doc/pdf/archive_write_filter.3.pdf differ
index 0ac2f35..c06343c 100644 (file)
Binary files a/doc/pdf/archive_write_finish_entry.3.pdf and b/doc/pdf/archive_write_finish_entry.3.pdf differ
index 4651252..777a497 100644 (file)
Binary files a/doc/pdf/archive_write_format.3.pdf and b/doc/pdf/archive_write_format.3.pdf differ
index a8e4a89..0ef0d7d 100644 (file)
Binary files a/doc/pdf/archive_write_free.3.pdf and b/doc/pdf/archive_write_free.3.pdf differ
index 34bcc5a..9cd7603 100644 (file)
Binary files a/doc/pdf/archive_write_header.3.pdf and b/doc/pdf/archive_write_header.3.pdf differ
index b9af959..3688e70 100644 (file)
Binary files a/doc/pdf/archive_write_new.3.pdf and b/doc/pdf/archive_write_new.3.pdf differ
index c0c010e..09bdadb 100644 (file)
Binary files a/doc/pdf/archive_write_open.3.pdf and b/doc/pdf/archive_write_open.3.pdf differ
index 94d8185..686be86 100644 (file)
Binary files a/doc/pdf/archive_write_set_options.3.pdf and b/doc/pdf/archive_write_set_options.3.pdf differ
index 279dd8c..3681f06 100644 (file)
Binary files a/doc/pdf/archive_write_set_passphrase.3.pdf and b/doc/pdf/archive_write_set_passphrase.3.pdf differ
index 8d63a01..ff11dc5 100644 (file)
Binary files a/doc/pdf/bsdcpio.1.pdf and b/doc/pdf/bsdcpio.1.pdf differ
index c522ee7..07804d0 100644 (file)
Binary files a/doc/pdf/bsdtar.1.pdf and b/doc/pdf/bsdtar.1.pdf differ
index 0d82951..29722b2 100644 (file)
Binary files a/doc/pdf/cpio.5.pdf and b/doc/pdf/cpio.5.pdf differ
index 981fe67..b4f1b57 100644 (file)
Binary files a/doc/pdf/libarchive-formats.5.pdf and b/doc/pdf/libarchive-formats.5.pdf differ
index bbdaaf0..6450684 100644 (file)
Binary files a/doc/pdf/libarchive.3.pdf and b/doc/pdf/libarchive.3.pdf differ
index ebaa55f..566bd8d 100644 (file)
Binary files a/doc/pdf/libarchive_changes.3.pdf and b/doc/pdf/libarchive_changes.3.pdf differ
index 61ac2a8..03fc168 100644 (file)
Binary files a/doc/pdf/libarchive_internals.3.pdf and b/doc/pdf/libarchive_internals.3.pdf differ
index b92c6d8..13b63f0 100644 (file)
Binary files a/doc/pdf/mtree.5.pdf and b/doc/pdf/mtree.5.pdf differ
index 5de1685..84e5eff 100644 (file)
Binary files a/doc/pdf/tar.5.pdf and b/doc/pdf/tar.5.pdf differ
index cace75d..d533e84 100644 (file)
@@ -107,15 +107,15 @@ archive_write_set_passphrase.3.txt: ../../libarchive/archive_write_set_passphras
 cpio.5.txt: ../../libarchive/cpio.5
        nroff -mdoc ../../libarchive/cpio.5 | col -b > cpio.5.txt
 
-libarchive-formats.5.txt: ../../libarchive/libarchive-formats.5
-       nroff -mdoc ../../libarchive/libarchive-formats.5 | col -b > libarchive-formats.5.txt
-
 libarchive.3.txt: ../../libarchive/libarchive.3
        nroff -mdoc ../../libarchive/libarchive.3 | col -b > libarchive.3.txt
 
 libarchive_changes.3.txt: ../../libarchive/libarchive_changes.3
        nroff -mdoc ../../libarchive/libarchive_changes.3 | col -b > libarchive_changes.3.txt
 
+libarchive-formats.5.txt: ../../libarchive/libarchive-formats.5
+       nroff -mdoc ../../libarchive/libarchive-formats.5 | col -b > libarchive-formats.5.txt
+
 libarchive_internals.3.txt: ../../libarchive/libarchive_internals.3
        nroff -mdoc ../../libarchive/libarchive_internals.3 | col -b > libarchive_internals.3.txt
 
@@ -130,4 +130,4 @@ bsdtar.1.txt: ../../tar/bsdtar.1
 
 bsdcpio.1.txt: ../../cpio/bsdcpio.1
        nroff -mdoc ../../cpio/bsdcpio.1 | col -b > bsdcpio.1.txt
-all: archive_entry.3.txt archive_entry_acl.3.txt archive_entry_linkify.3.txt archive_entry_misc.3.txt archive_entry_paths.3.txt archive_entry_perms.3.txt archive_entry_stat.3.txt archive_entry_time.3.txt archive_read.3.txt archive_read_add_passphrase.3.txt archive_read_data.3.txt archive_read_disk.3.txt archive_read_extract.3.txt archive_read_filter.3.txt archive_read_format.3.txt archive_read_free.3.txt archive_read_header.3.txt archive_read_new.3.txt archive_read_open.3.txt archive_read_set_options.3.txt archive_util.3.txt archive_write.3.txt archive_write_blocksize.3.txt archive_write_data.3.txt archive_write_disk.3.txt archive_write_filter.3.txt archive_write_finish_entry.3.txt archive_write_format.3.txt archive_write_free.3.txt archive_write_header.3.txt archive_write_new.3.txt archive_write_open.3.txt archive_write_set_options.3.txt archive_write_set_passphrase.3.txt cpio.5.txt libarchive-formats.5.txt libarchive.3.txt libarchive_changes.3.txt libarchive_internals.3.txt mtree.5.txt tar.5.txt bsdtar.1.txt bsdcpio.1.txt
+all: archive_entry.3.txt archive_entry_acl.3.txt archive_entry_linkify.3.txt archive_entry_misc.3.txt archive_entry_paths.3.txt archive_entry_perms.3.txt archive_entry_stat.3.txt archive_entry_time.3.txt archive_read.3.txt archive_read_add_passphrase.3.txt archive_read_data.3.txt archive_read_disk.3.txt archive_read_extract.3.txt archive_read_filter.3.txt archive_read_format.3.txt archive_read_free.3.txt archive_read_header.3.txt archive_read_new.3.txt archive_read_open.3.txt archive_read_set_options.3.txt archive_util.3.txt archive_write.3.txt archive_write_blocksize.3.txt archive_write_data.3.txt archive_write_disk.3.txt archive_write_filter.3.txt archive_write_finish_entry.3.txt archive_write_format.3.txt archive_write_free.3.txt archive_write_header.3.txt archive_write_new.3.txt archive_write_open.3.txt archive_write_set_options.3.txt archive_write_set_passphrase.3.txt cpio.5.txt libarchive.3.txt libarchive_changes.3.txt libarchive-formats.5.txt libarchive_internals.3.txt mtree.5.txt tar.5.txt bsdtar.1.txt bsdcpio.1.txt
index 15b49e2..f3d57db 100644 (file)
@@ -2,7 +2,7 @@ ARCHIVE_ENTRY(3)         BSD Library Functions Manual         ARCHIVE_ENTRY(3)
 
 NAME
      archive_entry_clear, archive_entry_clone, archive_entry_free,
-     archive_entry_new -- functions for managing archive entry descriptions
+     archive_entry_new  functions for managing archive entry descriptions
 
 LIBRARY
      Streaming Archive Library (libarchive, -larchive)
@@ -65,7 +65,7 @@ DESCRIPTION
             Stores the provided data in the object.  In particular, for
             strings, the pointer is stored, not the referenced string.
      archive_entry_copy_XXXX()
-            As above, except that the referenced data is copied into the ob-
+            As above, except that the referenced data is copied into the ob
             ject.
      archive_entry_XXXX()
             Returns the specified data.  In the case of strings, a const-
@@ -76,7 +76,7 @@ DESCRIPTION
      For example, if you store a narrow string and read the corresponding wide
      string, the object will transparently convert formats using the current
      locale.  Similarly, if you store a wide string and then store a narrow
-     string for the same data, the previously-set wide string will be dis-
+     string for the same data, the previously-set wide string will be dis
      carded in favor of the new data.
 
 SEE ALSO
index 22fd913..f0e118c 100644 (file)
@@ -6,8 +6,8 @@ NAME
      archive_entry_acl_from_text, archive_entry_acl_from_text_w,
      archive_entry_acl_next, archive_entry_acl_reset,
      archive_entry_acl_to_text, archive_entry_acl_to_text_w,
-     archive_entry_acl_types -- functions for manipulating Access Control
-     Lists in archive entry descriptions
+     archive_entry_acl_types — functions for manipulating Access Control Lists
+     in archive entry descriptions
 
 LIBRARY
      Streaming Archive Library (libarchive, -larchive)
@@ -57,7 +57,7 @@ SYNOPSIS
      archive_entry_acl_types(struct archive_entry *a);
 
 DESCRIPTION
-     The "Access Control Lists (ACLs)" extend the standard Unix permission
+     The “Access Control Lists (ACLs)” extend the standard Unix permission
      model.  The ACL interface of libarchive supports both POSIX.1e and NFSv4
      style ACLs.  Use of ACLs is restricted by various levels of ACL support
      in operating systems, file systems and archive formats.
@@ -86,9 +86,9 @@ DESCRIPTION
      and ARCHIVE_ENTRY_ACL_OTHER are equivalent to user, group and other in
      the classic Unix permission model and specify non-extended ACL entries.
 
-     All files have an access ACL (ARCHIVE_ENTRY_ACL_TYPE_ACCESS).  This spec-
-     ifies the permissions required for access to the file itself.  Directo-
-     ries have an additional ACL (ARCHIVE_ENTRY_ACL_TYPE_DEFAULT), which con-
+     All files have an access ACL (ARCHIVE_ENTRY_ACL_TYPE_ACCESS).  This spec
+     ifies the permissions required for access to the file itself.  Directo
+     ries have an additional ACL (ARCHIVE_ENTRY_ACL_TYPE_DEFAULT), which con
      trols the initial access ACL for newly-created directory entries.
 
    NFSv4 Access Control Lists
@@ -96,13 +96,13 @@ DESCRIPTION
      Entries (ACEs).
 
      There are four possible types of a NFSv4 ACE:
-          ARCHIVE_ENTRY_ACL_TYPE_ALLOW Allow principal to perform actions re-
+          ARCHIVE_ENTRY_ACL_TYPE_ALLOW Allow principal to perform actions re
                                        quiring given permissions.
-          ARCHIVE_ENTRY_ACL_TYPE_DENY  Prevent principal from performing ac-
+          ARCHIVE_ENTRY_ACL_TYPE_DENY  Prevent principal from performing ac
                                        tions requiring given permissions.
           ARCHIVE_ENTRY_ACL_TYPE_AUDIT Log access attempts by principal which
                                        require given permissions.
-          ARCHIVE_ENTRY_ACL_TYPE_ALARM Trigger a system alarm on access at-
+          ARCHIVE_ENTRY_ACL_TYPE_ALARM Trigger a system alarm on access at
                                        tempts by principal which require
                                        given permissions.
 
@@ -182,7 +182,7 @@ DESCRIPTION
      classic Unix permissions are updated.  An archive entry cannot contain
      both POSIX.1e and NFSv4 ACL entries.
 
-     archive_entry_acl_clear() removes all ACL entries and resets the enumera-
+     archive_entry_acl_clear() removes all ACL entries and resets the enumera
      tion pointer.
 
      archive_entry_acl_count() counts the ACL entries that have the given type
@@ -195,7 +195,7 @@ DESCRIPTION
           ARCHIVE_ENTRY_ACL_TYPE_AUDIT
           ARCHIVE_ENTRY_ACL_TYPE_ALARM
      for NFSv4 ACLs.  For POSIX.1e ACLs if ARCHIVE_ENTRY_ACL_TYPE_ACCESS is
-     included and at least one extended ACL entry is found, the three non-ex-
+     included and at least one extended ACL entry is found, the three non-ex
      tended ACLs are added.
 
      archive_entry_acl_from_text() and archive_entry_acl_from_text_w() add new
@@ -207,23 +207,23 @@ DESCRIPTION
      Supports all formats that can be created with archive_entry_acl_to_text()
      or respectively archive_entry_acl_to_text_w().  Existing ACL entries are
      preserved.  To get a clean new ACL from text archive_entry_acl_clear()
-     must be called first.  Entries prefixed with "default:" are treated as
+     must be called first.  Entries prefixed with “default:” are treated as
      ARCHIVE_ENTRY_ACL_TYPE_DEFAULT unless type is
      ARCHIVE_ENTRY_ACL_TYPE_NFS4.  Invalid entries, non-parseable ACL entries
-     and entries beginning with the '#' character (comments) are skipped.
+     and entries beginning with the ‘#’ character (comments) are skipped.
 
      archive_entry_acl_next() return the next entry of the ACL list.  This
-     functions may only be called after archive_entry_acl_reset() has indi-
+     functions may only be called after archive_entry_acl_reset() has indi
      cated the presence of extended ACL entries.
 
      archive_entry_acl_reset() prepare reading the list of ACL entries with
      archive_entry_acl_next(). The function returns 0 if no non-extended ACLs
      are found.  In this case, the access permissions should be obtained by
-     archive_entry_mode(3) or set using chmod(2).  Otherwise, the function re-
+     archive_entry_mode(3) or set using chmod(2).  Otherwise, the function re
      turns the same value as archive_entry_acl_count().
 
      archive_entry_acl_to_text() and archive_entry_acl_to_text_w() convert the
-     ACL entries for the given type into a (wide) string of ACL entries sepa-
+     ACL entries for the given type into a (wide) string of ACL entries sepa
      rated by newline. If the pointer len_p is not NULL, then the function
      shall return the length of the string (not including the NULL terminator)
      in the location pointed to by len_p.  The flag argument is a bitwise-or.
@@ -234,7 +234,7 @@ DESCRIPTION
           ARCHIVE_ENTRY_ACL_TYPE_DEFAULT
                   Output POSIX.1e default ACLs.
           ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT
-                  Prefix each default ACL entry with the word "default:".
+                  Prefix each default ACL entry with the word “default:”.
           ARCHIVE_ENTRY_ACL_STYLE_SOLARIS
                   The mask and other ACLs don not contain a double colon.
 
@@ -250,21 +250,21 @@ DESCRIPTION
           ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA
                   Separate ACL entries with comma instead of newline.
 
-     If the archive entry contains NFSv4 ACLs, all types of NFSv4 ACLs are re-
+     If the archive entry contains NFSv4 ACLs, all types of NFSv4 ACLs are re
      turned.  It the entry contains POSIX.1e ACLs and none of the flags
-     ARCHIVE_ENTRY_ACL_TYPE_ACCESS or ARCHIVE_ENTRY_ACL_TYPE_DEFAULT are spec-
+     ARCHIVE_ENTRY_ACL_TYPE_ACCESS or ARCHIVE_ENTRY_ACL_TYPE_DEFAULT are spec
      ified, both access and default entries are returned and default entries
-     are prefixed with "default:".
+     are prefixed with “default:”.
 
-     archive_entry_acl_types() get ACL entry types contained in an archive en-
-     try's ACL.  As POSIX.1e and NFSv4 ACL entries cannot be mixed, this func-
+     archive_entry_acl_types() get ACL entry types contained in an archive en
+     try's ACL.  As POSIX.1e and NFSv4 ACL entries cannot be mixed, this func
      tion is a very efficient way to detect if an ACL already contains
      POSIX.1e or NFSv4 ACL entries.
 
 RETURN VALUES
-     archive_entry_acl_count() and archive_entry_acl_reset() returns the num-
+     archive_entry_acl_count() and archive_entry_acl_reset() returns the num
      ber of ACL entries that match the given type mask.  For POSIX.1e ACLS if
-     the type mask includes ARCHIVE_ENTRY_ACL_TYPE_ACCESS and at least one ex-
+     the type mask includes ARCHIVE_ENTRY_ACL_TYPE_ACCESS and at least one ex
      tended ACL entry exists, the three classic Unix permissions are counted.
 
      archive_entry_acl_from_text() and archive_entry_acl_from_text_w() return
index 4a4fcb4..6c8a5dd 100644 (file)
@@ -3,7 +3,7 @@ ARCHIVE_ENTRY_LINKIFY(3) BSD Library Functions Manual ARCHIVE_ENTRY_LINKIFY(3)
 NAME
      archive_entry_linkresolver, archive_entry_linkresolver_new,
      archive_entry_linkresolver_set_strategy, archive_entry_linkresolver_free,
-     archive_entry_linkify -- hardlink resolver functions
+     archive_entry_linkify  hardlink resolver functions
 
 LIBRARY
      Streaming Archive Library (libarchive, -larchive)
@@ -27,7 +27,7 @@ SYNOPSIS
 
 DESCRIPTION
      Programs that want to create archives have to deal with hardlinks.
-     Hardlinks are handled in different ways by the archive formats.  The ba-
+     Hardlinks are handled in different ways by the archive formats.  The ba
      sic strategies are:
 
      1.   Ignore hardlinks and store the body for each reference (old cpio,
@@ -37,22 +37,22 @@ DESCRIPTION
 
      3.   Store the body the last time an inode is seen (new cpio).
 
-     The archive_entry_linkresolver functions help by providing a unified in-
+     The archive_entry_linkresolver functions help by providing a unified in
      terface and handling the complexity behind the scene.
 
-     The archive_entry_linkresolver functions assume that archive_entry in-
+     The archive_entry_linkresolver functions assume that archive_entry in
      stances have valid nlinks, inode and device values.  The inode and device
      value is used to match entries.  The nlinks value is used to determined
      if all references have been found and if the internal references can be
      recycled.
 
-     The archive_entry_linkresolver_new() function allocates a new link re-
+     The archive_entry_linkresolver_new() function allocates a new link re
      solver.  The instance can be freed using
      archive_entry_linkresolver_free().  All deferred entries are flushed and
      the internal storage is freed.
 
-     The archive_entry_linkresolver_set_strategy() function selects the opti-
-     mal hardlink strategy for the given format.  The format code can be ob-
+     The archive_entry_linkresolver_set_strategy() function selects the opti
+     mal hardlink strategy for the given format.  The format code can be ob
      tained from archive_format(3).  The function can be called more than
      once, but it is recommended to flush all deferred entries first.
 
@@ -66,7 +66,7 @@ DESCRIPTION
 
      2.   For tar like archive formats, *sparse is set to NULL.  If *entry is
          NULL, no action is taken.  If the hardlink count of *entry is larger
-         than 1 and the file type is a regular file or symbolic link, the in-
+         than 1 and the file type is a regular file or symbolic link, the in
          ternal list is searched for a matching inode.  If such an inode is
          found, the link count is decremented and the file size of *entry is
          set to 0 to notify that no body should be written.  If no such inode
@@ -74,8 +74,8 @@ DESCRIPTION
          link count reduced by one.
 
      3.   For new cpio like archive formats a value for *entry of NULL is used
-         to flush deferred entries.  In that case *entry is set to an arbi-
-         trary deferred entry and the entry itself is removed from the inter-
+         to flush deferred entries.  In that case *entry is set to an arbi
+         trary deferred entry and the entry itself is removed from the inter
          nal list.  If the internal list is empty, *entry is set to NULL.  In
          either case, *sparse is set to NULL and the function returns.  If
          the hardlink count of *entry is one or the file type is a directory
@@ -83,7 +83,7 @@ DESCRIPTION
          Otherwise, the internal list is searched for a matching inode.  If
          such an inode is not found, the entry is added to the internal list,
          both *entry and *sparse are set to NULL and the function returns.
-         If such an inode is found, the link count is decremented.  If it re-
+         If such an inode is found, the link count is decremented.  If it re
          mains larger than one, the existing entry on the internal list is
          swapped with *entry after retaining the link count.  The existing
          entry is returned in *entry.  If the link count reached one, the new
@@ -101,7 +101,7 @@ DESCRIPTION
      4.   If *sparse is not NULL, archive it.
 
      5.   After all entries have been written to disk, call
-         archive_entry_linkify() with *entry set to NULL and archive the re-
+         archive_entry_linkify() with *entry set to NULL and archive the re
          turned entry as long as it is not NULL.
 
 RETURN VALUES
index 0d0fcad..77fd7fa 100644 (file)
@@ -1,7 +1,7 @@
 ARCHIVE_ENTRY_MISC(3)   BSD Library Functions Manual    ARCHIVE_ENTRY_MISC(3)
 
 NAME
-     archive_entry_symlink_type, archive_entry_set_symlink_type -- miscella-
+     archive_entry_symlink_type, archive_entry_set_symlink_type — miscella‐
      neous functions for manipulating properties of archive_entry
 
 LIBRARY
@@ -19,12 +19,12 @@ SYNOPSIS
 DESCRIPTION
      The function archive_entry_symlink_type() returns and the function
      archive_entry_set_symlink_type() sets the type of the symbolic link
-     stored in an archive entry.  These functions have special meaning on op-
+     stored in an archive entry.  These functions have special meaning on op
      erating systems that support multiple symbolic link types (e.g. Microsoft
      Windows).
 
      Supported values are:
-     AE_SYMLINK_TYPE_UNDEFINED Symbolic link target type is not defined (de-
+     AE_SYMLINK_TYPE_UNDEFINED Symbolic link target type is not defined (de
                                fault on unix systems)
      AE_SYMLINK_TYPE_FILE      Symbolic link points to a file
      AE_SYMLINK_TYPE_DIRECTORY Symbolic link points to a directory
index 9e639f8..b883257 100644 (file)
@@ -12,7 +12,7 @@ NAME
      archive_entry_sourcepath, archive_entry_copy_sourcepath,
      archive_entry_symlink, archive_entry_symlink_w,
      archive_entry_set_symlink, archive_entry_copy_symlink,
-     archive_entry_copy_symlink_w, archive_entry_update_symlink_utf8 -- func-
+     archive_entry_copy_symlink_w, archive_entry_update_symlink_utf8 — func‐
      tions for manipulating path names in archive entry descriptions
 
 LIBRARY
@@ -103,7 +103,7 @@ SYNOPSIS
 DESCRIPTION
      Path names supported by archive_entry(3):
      hardlink   Destination of the hardlink.
-     link       Update only.  For a symlink, update the destination.  Other-
+     link       Update only.  For a symlink, update the destination.  Other
                 wise, make the entry a hardlink and alter the destination for
                 that.
      pathname   Path in the archive
@@ -117,11 +117,11 @@ DESCRIPTION
      wchar_t * Wide character strings in the current locale.  The accessor
                functions are named XXX_w().
 
-     UTF-8     Unicode strings encoded as UTF-8.  These are convenience func-
+     UTF-8     Unicode strings encoded as UTF-8.  These are convenience func
                tions to update both the multibyte and wide character strings
                at the same time.
 
-     The sourcepath is a pure filesystem concept and never stored in an ar-
+     The sourcepath is a pure filesystem concept and never stored in an ar
      chive directly.
 
      For that reason, it is only available as multibyte string.  The link path
index a1ef748..ace02cc 100644 (file)
@@ -10,8 +10,8 @@ NAME
      archive_entry_copy_gname, archive_entry_copy_gname_w,
      archive_entry_update_gname_utf8, archive_entry_fflags,
      archive_entry_fflags_text, archive_entry_set_fflags,
-     archive_entry_copy_fflags_text, archive_entry_copy_fflags_text_w -- func-
-     tions for manipulating ownership and permissions in archive entry de-
+     archive_entry_copy_fflags_text, archive_entry_copy_fflags_text_w — func‐
+     tions for manipulating ownership and permissions in archive entry de
      scriptions
 
 LIBRARY
@@ -119,7 +119,7 @@ DESCRIPTION
      wchar_t * Wide character strings in the current locale.  The accessor
                functions are named XXX_w().
 
-     UTF-8     Unicode strings encoded as UTF-8.  These are convenience func-
+     UTF-8     Unicode strings encoded as UTF-8.  These are convenience func
                tions to update both the multibyte and wide character strings
                at the same time.
 
@@ -133,7 +133,7 @@ DESCRIPTION
      text, even if it is ill-formed.  If you need to canonicalize a textual
      flags string, you should first set the text form, then request the bitmap
      form, then use that to set the bitmap form.  Setting the bitmap format
-     will clear the internal text representation and force it to be recon-
+     will clear the internal text representation and force it to be recon
      structed when you next request the text form.
 
      The bitmap format consists of two integers, one containing bits that
@@ -152,8 +152,8 @@ DESCRIPTION
      This is a platform-specific operation; names that are not meaningful on
      the current platform will be ignored.  The function returns a pointer to
      the start of the first name that was not recognized, or NULL if every
-     name was recognized.  Note that every name -- including names that follow
-     an unrecognized name -- will be evaluated, and the bitmaps will be set to
+     name was recognized.  Note that every name  including names that follow
+     an unrecognized name  will be evaluated, and the bitmaps will be set to
      reflect every name that is recognized.  (In particular, this differs from
      strtofflags(3), which stops parsing at the first unrecognized name.)
 
@@ -163,7 +163,7 @@ SEE ALSO
 
 BUGS
      The platform types uid_t and gid_t are often 16 or 32 bit wide.  In this
-     case it is possible that the ids can not be correctly restored from ar-
+     case it is possible that the ids can not be correctly restored from ar
      chives and get truncated.
 
 BSD                           February 2, 2012                            BSD
index d352f7a..9969685 100644 (file)
@@ -11,8 +11,8 @@ NAME
      archive_entry_ino_is_set, archive_entry_ino64, archive_entry_set_ino64,
      archive_entry_nlink, archive_entry_rdev, archive_entry_set_rdev,
      archive_entry_rdevmajor, archive_entry_set_rdevmajor,
-     archive_entry_rdevminor, archive_entry_set_rdevminor -- accessor func-
-     tions for manipulating archive entry descriptions
+     archive_entry_rdevminor, archive_entry_set_rdevminor — accessor functions
+     for manipulating archive entry descriptions
 
 LIBRARY
      Streaming Archive Library (libarchive, -larchive)
@@ -113,7 +113,7 @@ SYNOPSIS
 DESCRIPTION
    Copying to and from struct stat
      The function archive_entry_stat() converts the various fields stored in
-     the archive entry to the format used by stat(2).  The return value re-
+     the archive entry to the format used by stat(2).  The return value re
      mains valid until either archive_entry_clear() or archive_entry_free() is
      called.  It is not affected by calls to the set accessor functions.  It
      currently sets the following values in struct stat: st_atime, st_ctime,
@@ -136,7 +136,7 @@ DESCRIPTION
           AE_IFDIR   Directory
           AE_IFIFO   Named pipe (fifo)
      Not all file types are supported by all platforms.  The constants used by
-     stat(2) may have different numeric values from the corresponding con-
+     stat(2) may have different numeric values from the corresponding con
      stants above.
 
      The functions archive_entry_mode() and archive_entry_set_mode() get/set a
@@ -166,11 +166,11 @@ DESCRIPTION
 
      The inode number can be obtained using archive_entry_ino().  This is a
      legacy interface that uses the platform ino_t, which may be very small.
-     To set the inode number, archive_entry_set_ino64() is the preferred in-
+     To set the inode number, archive_entry_set_ino64() is the preferred in
      terface.
 
    Accessor functions for block and character devices
-     Block and character devices are characterised either using a device num-
+     Block and character devices are characterised either using a device num
      ber or a pair of major and minor number.  The combined device number can
      be obtained with archive_device_rdev() and set with
      archive_device_set_rdev().  The major and minor numbers are accessed by
index d2d5328..49052c3 100644 (file)
@@ -10,7 +10,7 @@ NAME
      archive_entry_ctime_is_set, archive_entry_set_ctime,
      archive_entry_unset_ctime, archive_entry_mtime, archive_entry_mtime_nsec,
      archive_entry_mtime_is_set, archive_entry_set_mtime,
-     archive_entry_unset_mtime -- functions for manipulating times in archive
+     archive_entry_unset_mtime  functions for manipulating times in archive
      entry descriptions
 
 LIBRARY
@@ -95,7 +95,7 @@ DESCRIPTION
 
      All timestamp fields are optional.  The XXX_unset() functions can be used
      to mark the corresponding field as missing.  The current state can be
-     queried using XXX_is_set().  Unset time fields have a second and nanosec-
+     queried using XXX_is_set().  Unset time fields have a second and nanosec
      ond field of 0.
 
 SEE ALSO
index 2cba822..a9c3ad1 100644 (file)
@@ -1,7 +1,7 @@
 ARCHIVE_READ(3)         BSD Library Functions Manual          ARCHIVE_READ(3)
 
 NAME
-     archive_read -- functions for reading streaming archives
+     archive_read  functions for reading streaming archives
 
 LIBRARY
      Streaming Archive Library (libarchive, -larchive)
@@ -11,8 +11,8 @@ SYNOPSIS
 
 DESCRIPTION
      These functions provide a complete API for reading streaming archives.
-     The general process is to first create the struct archive object, set op-
-     tions, initialize the reader, iterate over the archive headers and asso-
+     The general process is to first create the struct archive object, set op
+     tions, initialize the reader, iterate over the archive headers and asso
      ciated data, then close the archive and release all resources.
 
    Create archive object
@@ -24,10 +24,10 @@ DESCRIPTION
    Enable filters and formats
      See archive_read_filter(3) and archive_read_format(3).
 
-     You can then modify this object for the desired operations with the vari-
+     You can then modify this object for the desired operations with the vari
      ous archive_read_set_XXX() and archive_read_support_XXX() functions.  In
      particular, you will need to invoke appropriate
-     archive_read_support_XXX() functions to enable the corresponding compres-
+     archive_read_support_XXX() functions to enable the corresponding compres
      sion and format support.  Note that these latter functions perform two
      distinct operations: they cause the corresponding support code to be
      linked into your program, and they enable the corresponding auto-detect
@@ -43,7 +43,7 @@ DESCRIPTION
      See archive_read_open(3).
 
      Once you have prepared the struct archive object, you call
-     archive_read_open() to actually open the archive and prepare it for read-
+     archive_read_open() to actually open the archive and prepare it for read
      ing.  There are several variants of this function; the most basic expects
      you to provide pointers to several functions that can provide blocks of
      bytes from the archive.  There are convenience forms that allow you to
@@ -58,11 +58,11 @@ DESCRIPTION
 
      Each archive entry consists of a header followed by a certain amount of
      data.  You can obtain the next header with archive_read_next_header(),
-     which returns a pointer to an struct archive_entry structure with infor-
+     which returns a pointer to an struct archive_entry structure with infor
      mation about the current archive element. If the entry is a regular
      file, then the header will be followed by the file data.  You can use
      archive_read_data() (which works much like the read(2) system call) to
-     read this data from the archive, or archive_read_data_block() which pro-
+     read this data from the archive, or archive_read_data_block() which pro
      vides a slightly more efficient interface.  You may prefer to use the
      higher-level archive_read_data_skip(), which reads and discards the data
      for this entry, archive_read_data_into_fd(), which copies the data to the
@@ -147,10 +147,10 @@ AUTHORS
      The libarchive library was written by Tim Kientzle <kientzle@acm.org>.
 
 BUGS
-     Many traditional archiver programs treat empty files as valid empty ar-
+     Many traditional archiver programs treat empty files as valid empty ar
      chives.  For example, many implementations of tar(1) allow you to append
      entries to an empty file. Of course, it is impossible to determine the
      format of an empty file by inspecting the contents, so this library
-     treats empty files as having a special "empty" format.
+     treats empty files as having a special “empty” format.
 
 BSD                           February 2, 2012                            BSD
index 67d572e..f3075b7 100644 (file)
@@ -1,8 +1,8 @@
 ARCHIVE_READ_ADD_PASS... BSD Library Functions Manual ARCHIVE_READ_ADD_PASS...
 
 NAME
-     archive_read_add_passphrase, archive_read_set_passphrase_callback --
-     functions for reading encrypted archives
+     archive_read_add_passphrase, archive_read_set_passphrase_callback — func‐
+     tions for reading encrypted archives
 
 LIBRARY
      Streaming Archive Library (libarchive, -larchive)
@@ -26,7 +26,7 @@ DESCRIPTION
 
      archive_read_set_passphrase_callback()
             Register a callback function that will be invoked to get a
-            passphrase for decryption after trying all the passphrases regis-
+            passphrase for decryption after trying all the passphrases regis
             tered by the archive_read_add_passphrase() function failed.
 
 SEE ALSO
index bc8d760..b39ebe0 100644 (file)
@@ -2,7 +2,7 @@ ARCHIVE_READ_DATA(3)     BSD Library Functions Manual     ARCHIVE_READ_DATA(3)
 
 NAME
      archive_read_data, archive_read_data_block, archive_read_data_skip,
-     archive_read_data_into_fd -- functions for reading streaming archives
+     archive_read_data_into_fd  functions for reading streaming archives
 
 LIBRARY
      Streaming Archive Library (libarchive, -larchive)
@@ -27,34 +27,34 @@ DESCRIPTION
      archive_read_data()
             Read data associated with the header just read.  Internally, this
             is a convenience function that calls archive_read_data_block()
-            and fills any gaps with nulls so that callers see a single con-
+            and fills any gaps with nulls so that callers see a single con
             tinuous stream of data.
      archive_read_data_block()
             Return the next available block of data for this entry.  Unlike
             archive_read_data(), the archive_read_data_block() function
             avoids copying data and allows you to correctly handle sparse
-            files, as supported by some archive formats.  The library guaran-
+            files, as supported by some archive formats.  The library guaran
             tees that offsets will increase and that blocks will not overlap.
             Note that the blocks returned from this function can be much
             larger than the block size read from disk, due to compression and
             internal buffer optimizations.
      archive_read_data_skip()
             A convenience function that repeatedly calls
-            archive_read_data_block() to skip all of the data for this ar-
+            archive_read_data_block() to skip all of the data for this ar
             chive entry.  Note that this function is invoked automatically by
-            archive_read_next_header2() if the previous entry was not com-
+            archive_read_next_header2() if the previous entry was not com
             pletely consumed.
      archive_read_data_into_fd()
             A convenience function that repeatedly calls
-            archive_read_data_block() to copy the entire entry to the pro-
+            archive_read_data_block() to copy the entire entry to the pro
             vided file descriptor.
 
 RETURN VALUES
      Most functions return zero on success, non-zero on error. The possible
      return codes include: ARCHIVE_OK (the operation succeeded), ARCHIVE_WARN
      (the operation succeeded but a non-critical error was encountered),
-     ARCHIVE_EOF (end-of-archive was encountered), ARCHIVE_RETRY (the opera-
-     tion failed but can be retried), and ARCHIVE_FATAL (there was a fatal er-
+     ARCHIVE_EOF (end-of-archive was encountered), ARCHIVE_RETRY (the opera
+     tion failed but can be retried), and ARCHIVE_FATAL (there was a fatal er
      ror; the archive should be closed immediately).
 
      archive_read_data() returns a count of bytes actually read or zero at the
index cdd162e..b9f8d90 100644 (file)
@@ -7,7 +7,7 @@ NAME
      archive_read_disk_set_symlink_hybrid, archive_read_disk_entry_from_file,
      archive_read_disk_gname, archive_read_disk_uname,
      archive_read_disk_set_uname_lookup, archive_read_disk_set_gname_lookup,
-     archive_read_disk_set_standard_lookup -- functions for reading objects
+     archive_read_disk_set_standard_lookup  functions for reading objects
      from disk
 
 LIBRARY
@@ -70,7 +70,7 @@ DESCRIPTION
                     (file flag) set.  By default, the nodump file attribute
                     is ignored.
             ARCHIVE_READDISK_MAC_COPYFILE
-                    Mac OS X specific.  Read metadata (ACLs and extended at-
+                    Mac OS X specific.  Read metadata (ACLs and extended at
                     tributes) with copyfile(3).  By default, metadata is read
                     using copyfile(3).
             ARCHIVE_READDISK_NO_ACL
@@ -79,31 +79,31 @@ DESCRIPTION
             ARCHIVE_READDISK_NO_FFLAGS
                     Do not read file attributes (file flags).  By default,
                     file attributes are read from disk.  See chattr(1)
-                    (Linux) or chflags(1) (FreeBSD, Mac OS X) for more infor-
+                    (Linux) or chflags(1) (FreeBSD, Mac OS X) for more infor
                     mation on file attributes.
             ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS
                     Do not traverse mount points.  By default, mount points
                     are traversed.
             ARCHIVE_READDISK_NO_XATTR
-                    Do not read extended file attributes (xattrs).  By de-
+                    Do not read extended file attributes (xattrs).  By de
                     fault, extended file attributes are read from disk.  See
                     xattr(7) (Linux), xattr(2) (Mac OS X), or getextattr(8)
-                    (FreeBSD) for more information on extended file at-
+                    (FreeBSD) for more information on extended file at
                     tributes.
             ARCHIVE_READDISK_RESTORE_ATIME
-                    Restore access time of traversed files.  By default, ac-
+                    Restore access time of traversed files.  By default, ac
                     cess time of traversed files is not restored.
 
      archive_read_disk_set_symlink_logical(),
             archive_read_disk_set_symlink_physical(),
             archive_read_disk_set_symlink_hybrid()
             This sets the mode used for handling symbolic links.  The
-            "logical" mode follows all symbolic links.  The "physical" mode
-            does not follow any symbolic links.  The "hybrid" mode currently
-            behaves identically to the "logical" mode.
+            “logical” mode follows all symbolic links.  The “physical” mode
+            does not follow any symbolic links.  The “hybrid” mode currently
+            behaves identically to the “logical” mode.
 
      archive_read_disk_gname(), archive_read_disk_uname()
-            Returns a user or group name given a gid or uid value.  By de-
+            Returns a user or group name given a gid or uid value.  By de
             fault, these always return a NULL string.
 
      archive_read_disk_set_gname_lookup(),
@@ -111,14 +111,14 @@ DESCRIPTION
             These allow you to override the functions used for user and group
             name lookups.  You may also provide a void * pointer to a private
             data structure and a cleanup function for that data.  The cleanup
-            function will be invoked when the struct archive object is de-
+            function will be invoked when the struct archive object is de
             stroyed or when new lookup functions are registered.
 
      archive_read_disk_set_standard_lookup()
             This convenience function installs a standard set of user and
             group name lookup functions.  These functions use getpwuid(3) and
             getgrgid(3) to convert ids to names, defaulting to NULL if the
-            names cannot be looked up.  These functions also implement a sim-
+            names cannot be looked up.  These functions also implement a sim
             ple memory cache to reduce the number of calls to getpwuid(3) and
             getgrgid(3).
 
@@ -130,15 +130,15 @@ DESCRIPTION
             source path will be used.)
 
             Information is read from disk using the path name from the struct
-            archive_entry object.  If a file descriptor is provided, some in-
-            formation will be obtained using that file descriptor, on plat-
+            archive_entry object.  If a file descriptor is provided, some in
+            formation will be obtained using that file descriptor, on plat
             forms that support the appropriate system calls.
 
             If a pointer to a struct stat is provided, information from that
-            structure will be used instead of reading from the disk where ap-
+            structure will be used instead of reading from the disk where ap
             propriate.  This can provide performance benefits in scenarios
             where struct stat information has already been read from the disk
-            as a side effect of some other operation.  (For example, direc-
+            as a side effect of some other operation.  (For example, direc
             tory traversal libraries often provide this information.)
 
             Where necessary, user and group ids are converted to user and
@@ -182,14 +182,14 @@ RETURN VALUES
      negative error codes for errors.  Specific error codes include:
      ARCHIVE_RETRY for operations that might succeed if retried, ARCHIVE_WARN
      for unusual conditions that do not prevent further operations, and
-     ARCHIVE_FATAL for serious errors that make remaining operations impossi-
+     ARCHIVE_FATAL for serious errors that make remaining operations impossi
      ble.
 
      archive_read_disk_new() returns a pointer to a newly-allocated struct
      archive object or NULL if the allocation failed for any reason.
 
      archive_read_disk_gname() and archive_read_disk_uname() return const char
-     * pointers to the textual name or NULL if the lookup failed for any rea-
+     * pointers to the textual name or NULL if the lookup failed for any rea
      son.  The returned pointer points to internal storage that may be reused
      on the next call to either of these functions; callers should copy the
      string if they need to continue accessing it.
@@ -204,7 +204,7 @@ SEE ALSO
 
 HISTORY
      The libarchive library first appeared in FreeBSD 5.3.  The
-     archive_read_disk interface was added to libarchive 2.6 and first ap-
+     archive_read_disk interface was added to libarchive 2.6 and first ap
      peared in FreeBSD 8.0.
 
 AUTHORS
@@ -212,22 +212,22 @@ AUTHORS
      <kientzle@FreeBSD.org>.
 
 BUGS
-     The "standard" user name and group name lookup functions are not the de-
+     The “standard” user name and group name lookup functions are not the de‐
      faults because getgrgid(3) and getpwuid(3) are sometimes too large for
-     particular applications.  The current design allows the application au-
+     particular applications.  The current design allows the application au
      thor to use a more compact implementation when appropriate.
 
      The full list of metadata read from disk by
      archive_read_disk_entry_from_file() is necessarily system-dependent.
 
-     The archive_read_disk_entry_from_file() function reads as much informa-
+     The archive_read_disk_entry_from_file() function reads as much informa
      tion as it can from disk. Some method should be provided to limit this
      so that clients who do not need ACLs, for instance, can avoid the extra
      work needed to look up such information.
 
      This API should provide a set of methods for walking a directory tree.
      That would make it a direct parallel of the archive_read(3) API.  When
-     such methods are implemented, the "hybrid" symbolic link mode will make
+     such methods are implemented, the “hybrid” symbolic link mode will make
      sense.
 
 BSD                             April 3, 2017                             BSD
index dfcf3b4..aaf1237 100644 (file)
@@ -2,7 +2,7 @@ ARCHIVE_READ_EXTRACT(3)  BSD Library Functions Manual  ARCHIVE_READ_EXTRACT(3)
 
 NAME
      archive_read_extract, archive_read_extract2,
-     archive_read_extract_set_progress_callback -- functions for reading
+     archive_read_extract_set_progress_callback  functions for reading
      streaming archives
 
 LIBRARY
@@ -29,9 +29,9 @@ DESCRIPTION
             archive_write_disk(3) interfaces.  The first call to
             archive_read_extract() creates a restore object using
             archive_write_disk_new(3) and
-            archive_write_disk_set_standard_lookup(3), then transparently in-
+            archive_write_disk_set_standard_lookup(3), then transparently in
             vokes archive_write_disk_set_options(3), archive_write_header(3),
-            archive_write_data(3), and archive_write_finish_entry(3) to cre-
+            archive_write_data(3), and archive_write_finish_entry(3) to cre
             ate the entry on disk and copy data into it.  The flags argument
             is passed unmodified to archive_write_disk_set_options(3).
      archive_read_extract2()
@@ -45,11 +45,11 @@ DESCRIPTION
             options yourself.
      archive_read_extract_set_progress_callback()
             Sets a pointer to a user-defined callback that can be used for
-            updating progress displays during extraction.  The progress func-
+            updating progress displays during extraction.  The progress func
             tion will be invoked during the extraction of large regular
             files.  The progress function will be invoked with the pointer
-            provided to this call.  Generally, the data pointed to should in-
-            clude a reference to the archive object and the archive_entry ob-
+            provided to this call.  Generally, the data pointed to should in
+            clude a reference to the archive object and the archive_entry ob
             ject so that various statistics can be retrieved for the progress
             display.
 
@@ -57,8 +57,8 @@ RETURN VALUES
      Most functions return zero on success, non-zero on error. The possible
      return codes include: ARCHIVE_OK (the operation succeeded), ARCHIVE_WARN
      (the operation succeeded but a non-critical error was encountered),
-     ARCHIVE_EOF (end-of-archive was encountered), ARCHIVE_RETRY (the opera-
-     tion failed but can be retried), and ARCHIVE_FATAL (there was a fatal er-
+     ARCHIVE_EOF (end-of-archive was encountered), ARCHIVE_RETRY (the opera
+     tion failed but can be retried), and ARCHIVE_FATAL (there was a fatal er
      ror; the archive should be closed immediately).
 
 ERRORS
index f7a617f..01b6c97 100644 (file)
@@ -7,7 +7,7 @@ NAME
      archive_read_support_filter_none, archive_read_support_filter_rpm,
      archive_read_support_filter_uu, archive_read_support_filter_xz,
      archive_read_support_filter_zstd, archive_read_support_filter_program,
-     archive_read_support_filter_program_signature -- functions for reading
+     archive_read_support_filter_program_signature  functions for reading
      streaming archives
 
 LIBRARY
@@ -86,20 +86,20 @@ DESCRIPTION
             specified compression.  These functions may fall back on external
             programs if an appropriate library was not available at build
             time.  Decompression using an external program is usually slower
-            than decompression through built-in libraries.  Note that "none"
+            than decompression through built-in libraries.  Note that “none”
             is always enabled by default.
      archive_read_support_filter_all()
             Enables all available decompression filters.
      archive_read_support_filter_by_code()
-            Enables a single filter specified by the filter code.  This func-
-            tion does not work with ARCHIVE_FILTER_PROGRAM.  Note: In stati-
+            Enables a single filter specified by the filter code.  This func
+            tion does not work with ARCHIVE_FILTER_PROGRAM.  Note: In stati
             cally-linked executables, this will cause your program to include
             support for every filter.  If executable size is a concern, you
             may wish to avoid using this function.
      archive_read_support_filter_program()
             Data is fed through the specified external program before being
             dearchived.  Note that this disables automatic detection of the
-            compression format, so it makes no sense to specify this in con-
+            compression format, so it makes no sense to specify this in con
             junction with any other decompression option.
      archive_read_support_filter_program_signature()
             This feeds data through the specified external program but only
index 320ffe7..cd80251 100644 (file)
@@ -8,7 +8,7 @@ NAME
      archive_read_support_format_lha, archive_read_support_format_mtree,
      archive_read_support_format_rar, archive_read_support_format_raw,
      archive_read_support_format_tar, archive_read_support_format_xar,
-     archive_read_support_format_zip -- functions for reading streaming ar-
+     archive_read_support_format_zip — functions for reading streaming ar‐
      chives
 
 LIBRARY
@@ -74,33 +74,33 @@ DESCRIPTION
             archive_read_support_format_tar(),
             archive_read_support_format_xar(),
             archive_read_support_format_zip()
-            Enables support---including auto-detection code---for the speci-
+            Enables support---including auto-detection code---for the speci
             fied archive format.  For example,
             archive_read_support_format_tar() enables support for a variety
             of standard tar formats, old-style tar, ustar, pax interchange
             format, and many common variants.
      archive_read_support_format_all()
-            Enables support for all available formats except the "raw" format
+            Enables support for all available formats except the “raw” format
             (see below).
      archive_read_support_format_by_code()
             Enables a single format specified by the format code.  This can
             be useful when reading a single archive twice; use
-            archive_format() after reading the first time and pass the re-
-            sulting code to this function to selectively enable only the nec-
+            archive_format() after reading the first time and pass the re
+            sulting code to this function to selectively enable only the nec
             essary format support.  Note:  In statically-linked executables,
             this will cause your program to include support for every format.
             If executable size is a concern, you may wish to avoid using this
             function.
      archive_read_support_format_empty()
-            Enables support for treating empty files as empty archives.  Be-
+            Enables support for treating empty files as empty archives.  Be
             cause empty files are valid for several different formats, it is
             not possible to accurately determine a format for an empty file
             based purely on contents.  So empty files are treated by
             libarchive as a distinct format.
      archive_read_support_format_raw()
-            The "raw" format handler allows libarchive to be used to read ar-
+            The “raw” format handler allows libarchive to be used to read ar‐
             bitrary data.  It treats any data stream as an archive with a
-            single entry.  The pathname of this entry is "data"; all other
+            single entry.  The pathname of this entry is “data”; all other
             entry fields are unset.  This is not enabled by
             archive_read_support_format_all() in order to avoid erroneous
             handling of damaged archives.
@@ -117,13 +117,13 @@ SEE ALSO
      archive_read_set_options(3), archive_util(3), libarchive(3), tar(5)
 
 BUGS
-     Many traditional archiver programs treat empty files as valid empty ar-
+     Many traditional archiver programs treat empty files as valid empty ar
      chives.  For example, many implementations of tar(1) allow you to append
      entries to an empty file. Of course, it is impossible to determine the
      format of an empty file by inspecting the contents, so this library
-     treats empty files as having a special "empty" format.
+     treats empty files as having a special “empty” format.
 
-     Using the "raw" handler together with any other handler will often work
+     Using the “raw” handler together with any other handler will often work
      but can produce surprising results.
 
 BSD                           February 2, 2012                            BSD
index ae2ea19..508b267 100644 (file)
@@ -1,7 +1,7 @@
 ARCHIVE_READ_FREE(3)    BSD Library Functions Manual     ARCHIVE_READ_FREE(3)
 
 NAME
-     archive_read_close, archive_read_finish, archive_read_free -- functions
+     archive_read_close, archive_read_finish, archive_read_free  functions
      for reading streaming archives
 
 LIBRARY
@@ -25,7 +25,7 @@ DESCRIPTION
      archive_read_finish()
             This is a deprecated synonym for archive_read_free().  The new
             name was introduced with libarchive 3.0.  Applications that need
-            to compile with either libarchive 2 or libarchive 3 should con-
+            to compile with either libarchive 2 or libarchive 3 should con
             tinue to use the archive_read_finish() name.  Both names will be
             supported until libarchive 4.0 is released, which is not expected
             to occur earlier than 2013.
index 68d556b..855711a 100644 (file)
@@ -1,8 +1,8 @@
 ARCHIVE_READ_HEADER(3)  BSD Library Functions Manual   ARCHIVE_READ_HEADER(3)
 
 NAME
-     archive_read_next_header, archive_read_next_header2 -- functions for
-     reading streaming archives
+     archive_read_next_header, archive_read_next_header2 — functions for read‐
+     ing streaming archives
 
 LIBRARY
      Streaming Archive Library (libarchive, -larchive)
@@ -29,8 +29,8 @@ DESCRIPTION
 RETURN VALUES
      These functions return ARCHIVE_OK (the operation succeeded), ARCHIVE_WARN
      (the operation succeeded but a non-critical error was encountered),
-     ARCHIVE_EOF (end-of-archive was encountered), ARCHIVE_RETRY (the opera-
-     tion failed but can be retried), and ARCHIVE_FATAL (there was a fatal er-
+     ARCHIVE_EOF (end-of-archive was encountered), ARCHIVE_RETRY (the opera
+     tion failed but can be retried), and ARCHIVE_FATAL (there was a fatal er
      ror; the archive should be closed immediately).
 
 ERRORS
index 302bedd..706285c 100644 (file)
@@ -1,7 +1,7 @@
 ARCHIVE_READ_NEW(3)     BSD Library Functions Manual      ARCHIVE_READ_NEW(3)
 
 NAME
-     archive_read_new -- functions for reading streaming archives
+     archive_read_new  functions for reading streaming archives
 
 LIBRARY
      Streaming Archive Library (libarchive, -larchive)
index 0d3bbf8..7ef2937 100644 (file)
@@ -3,7 +3,7 @@ ARCHIVE_READ_OPEN(3)     BSD Library Functions Manual     ARCHIVE_READ_OPEN(3)
 NAME
      archive_read_open, archive_read_open2, archive_read_open_fd,
      archive_read_open_FILE, archive_read_open_filename,
-     archive_read_open_memory -- functions for reading streaming archives
+     archive_read_open_memory  functions for reading streaming archives
 
 LIBRARY
      Streaming Archive Library (libarchive, -larchive)
@@ -52,7 +52,7 @@ DESCRIPTION
             pointer.  This function should not be used with tape drives or
             other devices that require strict I/O blocking.
      archive_read_open_fd()
-            Like archive_read_open(), except that it accepts a file descrip-
+            Like archive_read_open(), except that it accepts a file descrip
             tor and block size rather than a set of function pointers.  Note
             that the file descriptor will not be automatically closed at end-
             of-archive.  This function is safe for use with tape drives or
@@ -60,15 +60,15 @@ DESCRIPTION
      archive_read_open_file()
             This is a deprecated synonym for archive_read_open_filename().
      archive_read_open_filename()
-            Like archive_read_open(), except that it accepts a simple file-
-            name and a block size.  A NULL filename represents standard in-
+            Like archive_read_open(), except that it accepts a simple file
+            name and a block size.  A NULL filename represents standard in
             put.  This function is safe for use with tape drives or other
             blocked devices.
      archive_read_open_memory()
             Like archive_read_open(), except that it accepts a pointer and
             size of a block of memory containing the archive data.
 
-     A complete description of the struct archive and struct archive_entry ob-
+     A complete description of the struct archive and struct archive_entry ob
      jects can be found in the overview manual page for libarchive(3).
 
 CLIENT CALLBACKS
@@ -88,7 +88,7 @@ CLIENT CALLBACKS
 
      The open callback is invoked by archive_open().  It should return
      ARCHIVE_OK if the underlying file or data source is successfully opened.
-     If the open fails, it should call archive_set_error() to register an er-
+     If the open fails, it should call archive_set_error() to register an er
      ror code and message and return ARCHIVE_FATAL.
 
      The read callback is invoked whenever the library requires raw bytes from
@@ -98,7 +98,7 @@ CLIENT CALLBACKS
      callback again only after it has consumed this data.  The library imposes
      no constraints on the size of the data blocks returned.  On end-of-file,
      the read callback should return zero.  On error, the read callback should
-     invoke archive_set_error() to register an error code and message and re-
+     invoke archive_set_error() to register an error code and message and re
      turn -1.
 
      The skip callback is invoked when the library wants to ignore a block of
@@ -110,7 +110,7 @@ CLIENT CALLBACKS
      gains when reading uncompressed archives from slow disk drives or other
      media that can skip quickly.
 
-     The close callback is invoked by archive_close when the archive process-
+     The close callback is invoked by archive_close when the archive process
      ing is complete.  The callback should return ARCHIVE_OK on success.  On
      failure, the callback should invoke archive_set_error() to register an
      error code and message and return ARCHIVE_FATAL.
index ef0cb5e..fa516fd 100644 (file)
@@ -2,8 +2,8 @@ ARCHIVE_READ_OPTIONS(3)  BSD Library Functions Manual  ARCHIVE_READ_OPTIONS(3)
 
 NAME
      archive_read_set_filter_option, archive_read_set_format_option,
-     archive_read_set_option, archive_read_set_options -- functions control-
-     ling options for reading archives
+     archive_read_set_option, archive_read_set_options — functions controlling
+     options for reading archives
 
 LIBRARY
      Streaming Archive Library (libarchive, -larchive)
@@ -25,14 +25,14 @@ SYNOPSIS
      archive_read_set_options(struct archive *, const char *options);
 
 DESCRIPTION
-     These functions provide a way for libarchive clients to configure spe-
+     These functions provide a way for libarchive clients to configure spe
      cific read modules.
 
      archive_read_set_filter_option(), archive_read_set_format_option()
             Specifies an option that will be passed to currently-registered
             filters (including decompression filters) or format readers.
 
-            If option and value are both NULL, these functions will do noth-
+            If option and value are both NULL, these functions will do noth
             ing and ARCHIVE_OK will be returned.  If option is NULL but value
             is not, these functions will do nothing and ARCHIVE_FAILED will
             be returned.
@@ -51,7 +51,7 @@ DESCRIPTION
      archive_read_set_option()
             Calls archive_read_set_format_option(), then
             archive_read_set_filter_option().  If either function returns
-            ARCHIVE_FATAL, ARCHIVE_FATAL will be returned immediately.  Oth-
+            ARCHIVE_FATAL, ARCHIVE_FATAL will be returned immediately.  Oth
             erwise, greater of the two values will be returned.
 
      archive_read_set_options()
@@ -68,7 +68,7 @@ DESCRIPTION
                     Modules that do not accept an option with this name will
                     ignore it.
             option  The option will be provided to every module with a value
-                    of "1".
+                    of “1”.
             !option
                     The option will be provided to every module with a NULL
                     value.
@@ -82,9 +82,17 @@ OPTIONS
                     The value is used as a character set name that will be
                     used when translating file names.
      Format cpio
+            compat-2x
+                    Libarchive 2.x incorrectly encoded Unicode filenames on
+                    some platforms.  This option mimics the libarchive 2.x
+                    filename handling so that such archives can be read cor‐
+                    rectly.
             hdrcharset
                     The value is used as a character set name that will be
                     used when translating file names.
+            pwb     When reading a binary CPIO archive, assume that it is in
+                    the original PWB cpio format, and handle file mode bits
+                    accordingly.  The default is to assume v7 format.
      Format iso9660
             joliet  Support Joliet extensions.  Defaults to enabled, use
                     !joliet to disable.
@@ -107,7 +115,7 @@ OPTIONS
             compat-2x
                     Libarchive 2.x incorrectly encoded Unicode filenames on
                     some platforms.  This option mimics the libarchive 2.x
-                    filename handling so that such archives can be read cor-
+                    filename handling so that such archives can be read cor
                     rectly.
             hdrcharset
                     The value is used as a character set name that will be
@@ -115,12 +123,12 @@ OPTIONS
             mac-ext
                     Support Mac OS metadata extension that records data in
                     special files beginning with a period and underscore.
-                    Defaults to enabled on Mac OS, disabled on other plat-
+                    Defaults to enabled on Mac OS, disabled on other plat
                     forms.  Use !mac-ext to disable.
             read_concatenated_archives
                     Ignore zeroed blocks in the archive, which occurs when
                     multiple tar archives have been concatenated together.
-                    Without this option, only the contents of the first con-
+                    Without this option, only the contents of the first con
                     catenated archive would be read.
 
 ERRORS
index a2b129b..4827c0a 100644 (file)
@@ -5,7 +5,7 @@ NAME
      archive_copy_error, archive_errno, archive_error_string,
      archive_file_count, archive_filter_code, archive_filter_count,
      archive_filter_name, archive_format, archive_format_name,
-     archive_position, archive_set_error -- libarchive utility functions
+     archive_position, archive_set_error  libarchive utility functions
 
 LIBRARY
      Streaming Archive Library (libarchive, -larchive)
@@ -70,7 +70,7 @@ DESCRIPTION
             Copies error information from one archive to another.
      archive_errno()
             Returns a numeric error code (see errno(2)) indicating the reason
-            for the most recent error return.  Note that this can not be re-
+            for the most recent error return.  Note that this can not be re
             liably used to detect whether an error has occurred.  It should
             be used only after another libarchive function has returned an
             error status.
@@ -87,13 +87,13 @@ DESCRIPTION
             archive_filter_count() for details of the numbering.
      archive_filter_count()
             Returns the number of filters in the current pipeline.  For read
-            archive handles, these filters are added automatically by the au-
-            tomatic format detection.  For write archive handles, these fil-
+            archive handles, these filters are added automatically by the au
+            tomatic format detection.  For write archive handles, these fil
             ters are added by calls to the various
-            archive_write_add_filter_XXX() functions.  Filters in the result-
+            archive_write_add_filter_XXX() functions.  Filters in the result
             ing pipeline are numbered so that filter 0 is the filter closest
             to the format handler.  As a convenience, functions that expect a
-            filter number will accept -1 as a synonym for the highest-num-
+            filter number will accept -1 as a synonym for the highest-num
             bered filter.
 
             For example, when reading a uuencoded gzipped tar archive, there
@@ -104,13 +104,13 @@ DESCRIPTION
             archive_position(a, 2) which would return the number of bytes
             currently read from the archive, while archive_position(a, 1)
             would return the number of bytes after uudecoding, and
-            archive_position(a, 0) would return the number of bytes after de-
+            archive_position(a, 0) would return the number of bytes after de
             compression.
      archive_filter_name()
             Returns a textual name identifying the indicated filter.  See
             archive_filter_count() for details of the numbering.
      archive_format()
-            Returns a numeric code indicating the format of the current ar-
+            Returns a numeric code indicating the format of the current ar
             chive entry.  This value is set by a successful call to
             archive_read_next_header().  Note that it is common for this
             value to change from entry to entry.  For example, a tar archive
@@ -123,18 +123,18 @@ DESCRIPTION
             Returns the number of bytes read from or written to the indicated
             filter.  In particular, archive_position(a, 0) returns the number
             of bytes read or written by the format handler, while
-            archive_position(a, -1) returns the number of bytes read or writ-
+            archive_position(a, -1) returns the number of bytes read or writ
             ten to the archive.  See archive_filter_count() for details of
             the numbering here.
      archive_set_error()
             Sets the numeric error code and error description that will be
             returned by archive_errno() and archive_error_string().  This
-            function should be used within I/O callbacks to set system-spe-
+            function should be used within I/O callbacks to set system-spe
             cific error codes and error descriptions.  This function accepts
             a printf-like format string and arguments.  However, you should
             be careful to use only the following printf format specifiers:
-            "%c", "%d", "%jd", "%jo", "%ju", "%jx", "%ld", "%lo", "%lu",
-            "%lx", "%o", "%u", "%s", "%x", "%%".  Field-width specifiers and
+            “%c”, “%d”, “%jd”, “%jo”, “%ju”, “%jx”, “%ld”, “%lo”, “%lu”,
+            “%lx”, “%o”, “%u”, “%s”, “%x”, “%%”.  Field-width specifiers and
             other printf features are not uniformly supported and should not
             be used.
 
index d75f452..f8d08b3 100644 (file)
@@ -1,7 +1,7 @@
 ARCHIVE_WRITE(3)        BSD Library Functions Manual         ARCHIVE_WRITE(3)
 
 NAME
-     archive_write -- functions for creating archives
+     archive_write  functions for creating archives
 
 LIBRARY
      Streaming Archive Library (libarchive, -larchive)
@@ -25,7 +25,7 @@ DESCRIPTION
      See archive_write_filter(3), archive_write_format(3) and
      archive_write_blocksize(3).
 
-     You can then modify this object for the desired operations with the vari-
+     You can then modify this object for the desired operations with the vari
      ous archive_write_set_XXX() functions.  In particular, you will need to
      invoke appropriate archive_write_add_XXX() and archive_write_set_XXX()
      functions to enable the corresponding compression and format support.
@@ -38,7 +38,7 @@ DESCRIPTION
 
      Once you have prepared the struct archive object, you call
      archive_write_open() to actually open the archive and prepare it for
-     writing.  There are several variants of this function; the most basic ex-
+     writing.  There are several variants of this function; the most basic ex
      pects you to provide pointers to several functions that can provide
      blocks of bytes from the archive. There are convenience forms that allow
      you to specify a filename, file descriptor, FILE * object, or a block of
@@ -57,11 +57,11 @@ DESCRIPTION
    Release resources
      See archive_write_free(3).
 
-     After all entries have been written, use the archive_write_free() func-
+     After all entries have been written, use the archive_write_free() func
      tion to release all resources.
 
 EXAMPLES
-     The following sketch illustrates basic usage of the library.  In this ex-
+     The following sketch illustrates basic usage of the library.  In this ex
      ample, the callback functions are simply wrappers around the standard
      open(2), write(2), and close(2) system calls.
 
@@ -173,18 +173,18 @@ AUTHORS
 BUGS
      There are many peculiar bugs in historic tar implementations that may
      cause certain programs to reject archives written by this library.  For
-     example, several historic implementations calculated header checksums in-
+     example, several historic implementations calculated header checksums in
      correctly and will thus reject valid archives; GNU tar does not fully
      support pax interchange format; some old tar implementations required
      specific field terminations.
 
      The default pax interchange format eliminates most of the historic tar
-     limitations and provides a generic key/value attribute facility for ven-
+     limitations and provides a generic key/value attribute facility for ven
      dor-defined extensions.  One oversight in POSIX is the failure to provide
      a standard attribute for large device numbers.  This library uses
-     "SCHILY.devminor" and "SCHILY.devmajor" for device numbers that exceed
+     “SCHILY.devminor” and “SCHILY.devmajor” for device numbers that exceed
      the range supported by the backwards-compatible ustar header.  These keys
-     are compatible with Joerg Schilling's star archiver.  Other implementa-
+     are compatible with Joerg Schilling's star archiver.  Other implementa
      tions may not recognize these keys and will thus be unable to correctly
      restore device nodes with large device numbers from archives created by
      this library.
index b698aae..8f92638 100644 (file)
@@ -3,7 +3,7 @@ ARCHIVE_WRITE_BLOCKSI... BSD Library Functions Manual ARCHIVE_WRITE_BLOCKSI...
 NAME
      archive_write_get_bytes_per_block, archive_write_set_bytes_per_block,
      archive_write_get_bytes_in_last_block,
-     archive_write_set_bytes_in_last_block -- functions for creating archives
+     archive_write_set_bytes_in_last_block  functions for creating archives
 
 LIBRARY
      Streaming Archive Library (libarchive, -larchive)
@@ -43,11 +43,11 @@ DESCRIPTION
             the other blocks.  Otherwise, the final block will be padded to a
             multiple of this size.  In particular, setting it to 1 will cause
             the final block to not be padded.  For compressed output, any
-            padding generated by this option is applied only after the com-
+            padding generated by this option is applied only after the com
             pression.  The uncompressed data is always unpadded.  The default
             is to pad the last block to the full block size (note that
             archive_write_open_filename() will set this based on the file
-            type).  Unlike the other "set" functions, this function can be
+            type).  Unlike the other “set” functions, this function can be
             called after the archive is opened.
 
      archive_write_get_bytes_in_last_block()
index 75eaad1..96f8d1c 100644 (file)
@@ -1,8 +1,8 @@
 ARCHIVE_WRITE_DATA(3)   BSD Library Functions Manual    ARCHIVE_WRITE_DATA(3)
 
 NAME
-     archive_write_data, archive_write_data_block -- functions for creating
-     archives
+     archive_write_data, archive_write_data_block — functions for creating ar‐
+     chives
 
 LIBRARY
      Streaming Archive Library (libarchive, -larchive)
@@ -26,7 +26,7 @@ DESCRIPTION
             like archive_write_data() except that it performs a seek on the
             file being written to the specified offset before writing the
             data.  This is useful when restoring sparse files from archive
-            formats that support sparse files.  Returns number of bytes writ-
+            formats that support sparse files.  Returns number of bytes writ
             ten or -1 on error.  (Note: This is currently not supported for
             archive_write handles, only for archive_write_disk handles.
 
@@ -39,8 +39,8 @@ ERRORS
      archive_errno() and archive_error_string() functions.
 
 BUGS
-     In libarchive 3.x, this function sometimes returns zero on success in-
-     stead of returning the number of bytes written.  Specifically, this oc-
+     In libarchive 3.x, this function sometimes returns zero on success in
+     stead of returning the number of bytes written.  Specifically, this oc
      curs when writing to an archive_write_disk handle.  Clients should treat
      any value less than zero as an error and consider any non-negative value
      as success.
index 57921c6..1536edc 100644 (file)
@@ -4,7 +4,7 @@ NAME
      archive_write_disk_new, archive_write_disk_set_options,
      archive_write_disk_set_skip_file, archive_write_disk_set_group_lookup,
      archive_write_disk_set_standard_lookup,
-     archive_write_disk_set_user_lookup -- functions for creating objects on
+     archive_write_disk_set_user_lookup  functions for creating objects on
      disk
 
 LIBRARY
@@ -37,7 +37,7 @@ SYNOPSIS
 
 DESCRIPTION
      These functions provide a complete API for creating objects on disk from
-     struct archive_entry descriptions.  They are most naturally used when ex-
+     struct archive_entry descriptions.  They are most naturally used when ex
      tracting objects from an archive using the archive_read() interface.  The
      general process is to read struct archive_entry objects from an archive,
      then write those objects to a struct archive object created using the
@@ -52,7 +52,7 @@ DESCRIPTION
      archive_write_disk_set_skip_file()
             Records the device and inode numbers of a file that should not be
             overwritten.  This is typically used to ensure that an extraction
-            process does not overwrite the archive from which objects are be-
+            process does not overwrite the archive from which objects are be
             ing read.  This capability is technically unnecessary but can be
             a significant performance optimization in practice.
 
@@ -60,75 +60,75 @@ DESCRIPTION
             The options field consists of a bitwise OR of one or more of the
             following values:
             ARCHIVE_EXTRACT_ACL
-                    Attempt to restore Access Control Lists.  By default, ex-
+                    Attempt to restore Access Control Lists.  By default, ex
                     tended ACLs are ignored.
             ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS
                     Before removing a file system object prior to replacing
-                    it, clear platform-specific file flags which might pre-
+                    it, clear platform-specific file flags which might pre
                     vent its removal.
             ARCHIVE_EXTRACT_FFLAGS
-                    Attempt to restore file attributes (file flags).  By de-
+                    Attempt to restore file attributes (file flags).  By de
                     fault, file attributes are ignored.  See chattr(1)
-                    (Linux) or chflags(1) (FreeBSD, Mac OS X) for more infor-
+                    (Linux) or chflags(1) (FreeBSD, Mac OS X) for more infor
                     mation on file attributes.
             ARCHIVE_EXTRACT_MAC_METADATA
                     Mac OS X specific.  Restore metadata using copyfile(3).
                     By default, copyfile(3) metadata is ignored.
             ARCHIVE_EXTRACT_NO_OVERWRITE
-                    Existing files on disk will not be overwritten.  By de-
-                    fault, existing regular files are truncated and overwrit-
-                    ten; existing directories will have their permissions up-
-                    dated; other pre-existing objects are unlinked and recre-
+                    Existing files on disk will not be overwritten.  By de
+                    fault, existing regular files are truncated and overwrit
+                    ten; existing directories will have their permissions up
+                    dated; other pre-existing objects are unlinked and recre
                     ated from scratch.
             ARCHIVE_EXTRACT_OWNER
                     The user and group IDs should be set on the restored
-                    file.  By default, the user and group IDs are not re-
+                    file.  By default, the user and group IDs are not re
                     stored.
             ARCHIVE_EXTRACT_PERM
                     Full permissions (including SGID, SUID, and sticky bits)
                     should be restored exactly as specified, without obeying
                     the current umask.  Note that SUID and SGID bits can only
                     be restored if the user and group ID of the object on
-                    disk are correct.  If ARCHIVE_EXTRACT_OWNER is not speci-
+                    disk are correct.  If ARCHIVE_EXTRACT_OWNER is not speci
                     fied, then SUID and SGID bits will only be restored if
                     the default user and group IDs of newly-created objects
                     on disk happen to match those specified in the archive
                     entry.  By default, only basic permissions are restored,
                     and umask is obeyed.
             ARCHIVE_EXTRACT_SAFE_WRITES
-                    Extract files atomically, by first creating a unique tem-
-                    porary file and then renaming it to its required destina-
+                    Extract files atomically, by first creating a unique tem
+                    porary file and then renaming it to its required destina
                     tion name.  This avoids a race where an application might
                     see a partial file (or no file) during extraction.
             ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS
                     Refuse to extract an absolute path.  The default is to
                     not refuse such paths.
             ARCHIVE_EXTRACT_SECURE_NODOTDOT
-                    Refuse to extract a path that contains a .. element any-
+                    Refuse to extract a path that contains a .. element any
                     where within it.  The default is to not refuse such
-                    paths.  Note that paths ending in .. always cause an er-
+                    paths.  Note that paths ending in .. always cause an er
                     ror, regardless of this flag.
             ARCHIVE_EXTRACT_SECURE_SYMLINKS
                     Refuse to extract any object whose final location would
                     be altered by a symlink on disk.  This is intended to
-                    help guard against a variety of mischief caused by ar-
+                    help guard against a variety of mischief caused by ar
                     chives that (deliberately or otherwise) extract files
                     outside of the current directory.  The default is not to
                     perform this check.  If
             ARCHIVE_EXTRACT_SPARSE
                     Scan data for blocks of NUL bytes and try to recreate
-                    them with holes.  This results in sparse files, indepen-
+                    them with holes.  This results in sparse files, indepen
                     dent of whether the archive format supports or uses them.
                     ARCHIVE_EXTRACT_UNLINK is specified together with this
                     option, the library will remove any intermediate symlinks
                     it finds and return an error only if such symlink could
                     not be removed.
             ARCHIVE_EXTRACT_TIME
-                    The timestamps (mtime, ctime, and atime) should be re-
-                    stored.  By default, they are ignored.  Note that restor-
+                    The timestamps (mtime, ctime, and atime) should be re
+                    stored.  By default, they are ignored.  Note that restor
                     ing of atime is not currently supported.
             ARCHIVE_EXTRACT_UNLINK
-                    Existing files on disk will be unlinked before any at-
+                    Existing files on disk will be unlinked before any at
                     tempt to create them.  In some cases, this can prove to
                     be a significant performance improvement.  By default,
                     existing files are truncated and rewritten, but the file
@@ -147,7 +147,7 @@ DESCRIPTION
             describe the ownership of the file itself and also appear in ACL
             lists.  By default, the library uses the ids and ignores the
             names, but this can be overridden by registering user and group
-            lookup functions.  To register, you must provide a lookup func-
+            lookup functions.  To register, you must provide a lookup func
             tion which accepts both a name and id and returns a suitable id.
             You may also provide a void * pointer to a private data structure
             and a cleanup function for that data.  The cleanup function will
@@ -157,7 +157,7 @@ DESCRIPTION
             This convenience function installs a standard set of user and
             group lookup functions.  These functions use getpwnam(3) and
             getgrnam(3) to convert names to ids, defaulting to the ids if the
-            names cannot be looked up.  These functions also implement a sim-
+            names cannot be looked up.  These functions also implement a sim
             ple memory cache to reduce the number of calls to getpwnam(3) and
             getgrnam(3).
      More information about the struct archive object and the overall design
@@ -169,7 +169,7 @@ RETURN VALUES
      non-zero error codes for errors.  Specific error codes include:
      ARCHIVE_RETRY for operations that might succeed if retried, ARCHIVE_WARN
      for unusual conditions that do not prevent further operations, and
-     ARCHIVE_FATAL for serious errors that make remaining operations impossi-
+     ARCHIVE_FATAL for serious errors that make remaining operations impossi
      ble.
 
      archive_write_disk_new() returns a pointer to a newly-allocated struct
@@ -187,7 +187,7 @@ SEE ALSO
 
 HISTORY
      The libarchive library first appeared in FreeBSD 5.3.  The
-     archive_write_disk interface was added to libarchive 2.0 and first ap-
+     archive_write_disk interface was added to libarchive 2.0 and first ap
      peared in FreeBSD 6.3.
 
 AUTHORS
@@ -196,13 +196,13 @@ AUTHORS
 BUGS
      Directories are actually extracted in two distinct phases.  Directories
      are created during archive_write_header(), but final permissions are not
-     set until archive_write_close().  This separation is necessary to cor-
-     rectly handle borderline cases such as a non-writable directory contain-
+     set until archive_write_close().  This separation is necessary to cor
+     rectly handle borderline cases such as a non-writable directory contain
      ing files, but can cause unexpected results.  In particular, directory
      permissions are not fully restored until the archive is closed.  If you
      use chdir(2) to change the current directory between calls to
      archive_read_extract() or before calling archive_read_close(), you may
-     confuse the permission-setting logic with the result that directory per-
+     confuse the permission-setting logic with the result that directory per
      missions are restored incorrectly.
 
      The library attempts to create objects with filenames longer than
@@ -217,7 +217,7 @@ BUGS
      with a single request.  Of course, this does not work if the
      ARCHIVE_EXTRACT_NODOTDOT option is specified.
 
-     Implicit directories are always created obeying the current umask.  Ex-
+     Implicit directories are always created obeying the current umask.  Ex
      plicit objects are created obeying the current umask unless
      ARCHIVE_EXTRACT_PERM is specified, in which case they current umask is
      ignored.
@@ -228,8 +228,8 @@ BUGS
      only if the user and group of the final object happen to match those
      specified in the entry.
 
-     The "standard" user-id and group-id lookup functions are not the defaults
-     because getgrnam(3) and getpwnam(3) are sometimes too large for particu-
+     The “standard” user-id and group-id lookup functions are not the defaults
+     because getgrnam(3) and getpwnam(3) are sometimes too large for particu
      lar applications. The current design allows the application author to
      use a more compact implementation when appropriate.
 
index 341c8bf..99523f3 100644 (file)
@@ -8,7 +8,7 @@ NAME
      archive_write_add_filter_lzip, archive_write_add_filter_lzma,
      archive_write_add_filter_lzop, archive_write_add_filter_none,
      archive_write_add_filter_program, archive_write_add_filter_uuencode,
-     archive_write_add_filter_xz, archive_write_add_filter_zstd -- functions
+     archive_write_add_filter_xz, archive_write_add_filter_zstd  functions
      enabling output filters
 
 LIBRARY
@@ -79,7 +79,7 @@ DESCRIPTION
             always properly blocked.
 
      archive_write_add_filter_none()
-            This is never necessary.  It is provided only for backwards com-
+            This is never necessary.  It is provided only for backwards com
             patibility.
 
      archive_write_add_filter_program()
index 0cbe08a..399e2e4 100644 (file)
@@ -1,7 +1,7 @@
 ARCHIVE_WRITE_FINISH_... BSD Library Functions Manual ARCHIVE_WRITE_FINISH_...
 
 NAME
-     archive_write_finish_entry -- functions for creating archives
+     archive_write_finish_entry  functions for creating archives
 
 LIBRARY
      Streaming Archive Library (libarchive, -larchive)
@@ -13,7 +13,7 @@ SYNOPSIS
      archive_write_finish_entry(struct archive *);
 
 DESCRIPTION
-     Close out the entry just written. In particular, this writes out the fi-
+     Close out the entry just written. In particular, this writes out the fi
      nal padding required by some formats.  Ordinarily, clients never need to
      call this, as it is called automatically by archive_write_header() and
      archive_write_close() as needed.  For archive_write_disk handles, this
@@ -22,8 +22,8 @@ DESCRIPTION
 RETURN VALUES
      This function returns ARCHIVE_OK on success, or one of several non-zero
      error codes for errors.  Specific error codes include: ARCHIVE_RETRY for
-     operations that might succeed if retried, ARCHIVE_WARN for unusual condi-
-     tions that do not prevent further operations, and ARCHIVE_FATAL for seri-
+     operations that might succeed if retried, ARCHIVE_WARN for unusual condi
+     tions that do not prevent further operations, and ARCHIVE_FATAL for seri
      ous errors that make remaining operations impossible.
 
 ERRORS
index e45c1e5..1acbe7b 100644 (file)
@@ -4,7 +4,9 @@ NAME
      archive_write_set_format, archive_write_set_format_7zip,
      archive_write_set_format_ar, archive_write_set_format_ar_bsd,
      archive_write_set_format_ar_svr4, archive_write_set_format_by_name,
-     archive_write_set_format_cpio, archive_write_set_format_cpio_newc,
+     archive_write_set_format_cpio, archive_write_set_format_cpio_bin,
+     archive_write_set_format_cpio_newc, archive_write_set_format_cpio_odc,
+     archive_write_set_format_cpio_pwb,
      archive_write_set_format_filter_by_ext,
      archive_write_set_format_filter_by_ext_def,
      archive_write_set_format_gnutar, archive_write_set_format_iso9660,
@@ -14,7 +16,7 @@ NAME
      archive_write_set_format_shar, archive_write_set_format_shar_dump,
      archive_write_set_format_ustar, archive_write_set_format_v7tar,
      archive_write_set_format_warc, archive_write_set_format_xar,
-     archive_write_set_format_zip -- functions for creating archives
+     archive_write_set_format_zip  functions for creating archives
 
 LIBRARY
      Streaming Archive Library (libarchive, -larchive)
@@ -44,9 +46,18 @@ SYNOPSIS
      archive_write_set_format_cpio(struct archive *);
 
      int
+     archive_write_set_format_cpio_bin(struct archive *);
+
+     int
      archive_write_set_format_cpio_newc(struct archive *);
 
      int
+     archive_write_set_format_cpio_odc(struct archive *);
+
+     int
+     archive_write_set_format_cpio_pwb(struct archive *);
+
+     int
      archive_write_set_format_filter_by_ext(struct archive *,
         const char *filename);
 
@@ -107,16 +118,19 @@ DESCRIPTION
      archive_write_set_format_by_name()
             Sets the corresponding format based on the common name.
 
-     archive_write_set_format_filter_by_ext(),
+     archive_write_set_format_filter_by_ext()
             archive_write_set_format_filter_by_ext_def()
-            Sets both filters and format based on the output filename.  Sup-
+            Sets both filters and format based on the output filename.  Sup
             ported extensions: .7z, .zip, .jar, .cpio, .iso, .a, .ar, .tar,
             .tgz, .tar.gz, .tar.bz2, .tar.xz
 
-     archive_write_set_format_7zip() archive_write_set_format_ar_bsd(),
-            archive_write_set_format_ar_svr4(),
+     archive_write_set_format_7zip() archive_write_set_format_ar_bsd()
+            archive_write_set_format_ar_svr4()
             archive_write_set_format_cpio()
+            archive_write_set_format_cpio_bin()
             archive_write_set_format_cpio_newc()
+            archive_write_set_format_cpio_odc()
+            archive_write_set_format_cpio_pwb()
             archive_write_set_format_gnutar()
             archive_write_set_format_iso9660()
             archive_write_set_format_mtree()
@@ -128,7 +142,7 @@ DESCRIPTION
             archive_write_set_format_ustar() archive_write_set_format_v7tar()
             archive_write_set_format_warc() archive_write_set_format_xar()
             archive_write_set_format_zip()
-            Set the format as specified.  More details on the formats sup-
+            Set the format as specified.  More details on the formats sup
             ported by libarchive can be found in the libarchive-formats(5)
             manual page.
 
index 410adb8..34a047f 100644 (file)
@@ -2,7 +2,7 @@ ARCHIVE_WRITE_FREE(3)    BSD Library Functions Manual    ARCHIVE_WRITE_FREE(3)
 
 NAME
      archive_write_fail, archive_write_close, archive_write_finish,
-     archive_write_free -- functions for creating archives
+     archive_write_free  functions for creating archives
 
 LIBRARY
      Streaming Archive Library (libarchive, -larchive)
@@ -28,7 +28,7 @@ DESCRIPTION
             being unusable; after calling this function, the only call that
             can succeed is archive_write_free() to release the resources.
             This can be used to speed recovery when the archive creation must
-            be aborted.  Note that the created archive is likely to be mal-
+            be aborted.  Note that the created archive is likely to be mal
             formed in this case;
 
      archive_write_close()
@@ -38,7 +38,7 @@ DESCRIPTION
             This is a deprecated synonym for archive_write_free().
 
      archive_write_free()
-            Invokes archive_write_close() if necessary, then releases all re-
+            Invokes archive_write_close() if necessary, then releases all re
             sources.  If you need detailed information about
             archive_write_close() failures, you should be careful to call it
             separately, as you cannot obtain error information after
index 9989271..430c018 100644 (file)
@@ -1,7 +1,7 @@
 ARCHIVE_WRITE_HEADER(3)  BSD Library Functions Manual  ARCHIVE_WRITE_HEADER(3)
 
 NAME
-     archive_write_header -- functions for creating archives
+     archive_write_header  functions for creating archives
 
 LIBRARY
      Streaming Archive Library (libarchive, -larchive)
@@ -14,14 +14,14 @@ SYNOPSIS
 
 DESCRIPTION
      Build and write a header using the data in the provided struct
-     archive_entry structure.  See archive_entry(3) for information on creat-
+     archive_entry structure.  See archive_entry(3) for information on creat
      ing and populating struct archive_entry objects.
 
 RETURN VALUES
      This function returns ARCHIVE_OK on success, or one of the following on
      error: ARCHIVE_RETRY for operations that might succeed if retried,
-     ARCHIVE_WARN for unusual conditions that do not prevent further opera-
-     tions, and ARCHIVE_FATAL for serious errors that make remaining opera-
+     ARCHIVE_WARN for unusual conditions that do not prevent further opera
+     tions, and ARCHIVE_FATAL for serious errors that make remaining opera
      tions impossible.
 
 ERRORS
index 5b8ac3c..38608c8 100644 (file)
@@ -1,7 +1,7 @@
 ARCHIVE_WRITE_NEW(3)    BSD Library Functions Manual     ARCHIVE_WRITE_NEW(3)
 
 NAME
-     archive_write_new -- functions for creating archives
+     archive_write_new  functions for creating archives
 
 LIBRARY
      Streaming Archive Library (libarchive, -larchive)
index e0de3b2..c8dbec0 100644 (file)
@@ -3,7 +3,7 @@ ARCHIVE_WRITE_OPEN(3)    BSD Library Functions Manual    ARCHIVE_WRITE_OPEN(3)
 NAME
      archive_write_open, archive_write_open2, archive_write_open_fd,
      archive_write_open_FILE, archive_write_open_filename,
-     archive_write_open_memory -- functions for creating archives
+     archive_write_open_memory  functions for creating archives
 
 LIBRARY
      Streaming Archive Library (libarchive, -larchive)
@@ -38,12 +38,12 @@ DESCRIPTION
      archive_write_open()
             Freeze the settings, open the archive, and prepare for writing
             entries.  This is the most generic form of this function, which
-            accepts pointers to three callback functions which will be in-
+            accepts pointers to three callback functions which will be in
             voked by the compression layer to write the constructed archive.
             This does not alter the default archive padding.
 
      archive_write_open2()
-            Same as archive_write_open() with an additional fourth free call-
+            Same as archive_write_open() with an additional fourth free call
             back. This function should be preferred to archive_write_open().
 
      archive_write_open_fd()
@@ -61,18 +61,18 @@ DESCRIPTION
             A deprecated synonym for archive_write_open_filename().
 
      archive_write_open_filename()
-            A convenience form of archive_write_open() that accepts a file-
-            name.  A NULL argument indicates that the output should be writ-
-            ten to standard output; an argument of "-" will open a file with
+            A convenience form of archive_write_open() that accepts a file
+            name.  A NULL argument indicates that the output should be writ
+            ten to standard output; an argument of “-” will open a file with
             that name.  If you have not invoked
             archive_write_set_bytes_in_last_block(), then
             archive_write_open_filename() will adjust the last-block padding
             depending on the file: it will enable padding when writing to
             standard output or to a character or block device node, it will
-            disable padding otherwise.  You can override this by manually in-
+            disable padding otherwise.  You can override this by manually in
             voking archive_write_set_bytes_in_last_block() before calling
-            archive_write_open2().  The archive_write_open_filename() func-
-            tion is safe for use with tape drives or other block-oriented de-
+            archive_write_open2().  The archive_write_open_filename() func
+            tion is safe for use with tape drives or other block-oriented de
             vices.
 
      archive_write_open_memory()
@@ -80,7 +80,7 @@ DESCRIPTION
             pointer to a block of memory that will receive the archive.  The
             final size_t * argument points to a variable that will be updated
             after each write to reflect how much of the buffer is currently
-            in use.  You should be careful to ensure that this variable re-
+            in use.  You should be careful to ensure that this variable re
             mains allocated until after the archive is closed.  This function
             will disable padding unless you have specifically set the block
             size.
@@ -92,7 +92,7 @@ DESCRIPTION
      for writes or the end-of-file padding behavior.
 
 CLIENT CALLBACKS
-     To use this library, you will need to define and register callback func-
+     To use this library, you will need to define and register callback func
      tions that will be invoked to write data to the resulting archive.  These
      functions are registered by calling archive_write_open2():
 
@@ -101,7 +101,7 @@ CLIENT CALLBACKS
 
      The open callback is invoked by archive_write_open().  It should return
      ARCHIVE_OK if the underlying file or data source is successfully opened.
-     If the open fails, it should call archive_set_error() to register an er-
+     If the open fails, it should call archive_set_error() to register an er
      ror code and message and return ARCHIVE_FATAL.  Please note that if open
      fails, close is not called and resources must be freed inside the open
      callback or with the free callback.
@@ -110,7 +110,7 @@ CLIENT CALLBACKS
           void *client_data, const 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-
+     bytes to the archive.  For correct blocking, each call to the write call
      back function should translate into a single write(2) system call.  This
      is especially critical when writing archives to tape drives.  On success,
      the write callback should return the number of bytes actually written.
@@ -120,7 +120,7 @@ CLIENT CALLBACKS
           typedef int archive_close_callback(struct archive *, void
           *client_data)
 
-     The close callback is invoked by archive_close when the archive process-
+     The close callback is invoked by archive_close when the archive process
      ing is complete. If the open callback fails, the close callback is not
      invoked.  The callback should return ARCHIVE_OK on success.  On failure,
      the callback should invoke archive_set_error() to register an error code
index 1911dab..094fa40 100644 (file)
@@ -2,7 +2,7 @@ ARCHIVE_WRITE_OPTIONS(3) BSD Library Functions Manual ARCHIVE_WRITE_OPTIONS(3)
 
 NAME
      archive_write_set_filter_option, archive_write_set_format_option,
-     archive_write_set_option, archive_write_set_options -- functions control-
+     archive_write_set_option, archive_write_set_options — functions control‐
      ling options for writing archives
 
 LIBRARY
@@ -25,15 +25,15 @@ SYNOPSIS
      archive_write_set_options(struct archive *, const char *options);
 
 DESCRIPTION
-     These functions provide a way for libarchive clients to configure spe-
+     These functions provide a way for libarchive clients to configure spe
      cific write modules.
 
      archive_write_set_filter_option(), archive_write_set_format_option()
-            Specifies an option that will be passed to the currently-regis-
-            tered filters (including decompression filters) or format read-
+            Specifies an option that will be passed to the currently-regis
+            tered filters (including decompression filters) or format read
             ers.
 
-            If option and value are both NULL, these functions will do noth-
+            If option and value are both NULL, these functions will do noth
             ing and ARCHIVE_OK will be returned.  If option is NULL but value
             is not, these functions will do nothing and ARCHIVE_FAILED will
             be returned.
@@ -54,7 +54,7 @@ DESCRIPTION
      archive_write_set_option()
             Calls archive_write_set_format_option(), then
             archive_write_set_filter_option().  If either function returns
-            ARCHIVE_FATAL, ARCHIVE_FATAL will be returned immediately.  Oth-
+            ARCHIVE_FATAL, ARCHIVE_FATAL will be returned immediately.  Oth
             erwise, the greater of the two values will be returned.
 
      archive_write_set_options()
@@ -67,7 +67,7 @@ DESCRIPTION
                     Modules that do not accept an option with this name will
                     ignore it.
             option  The option will be provided to every module with a value
-                    of "1".
+                    of “1”.
             !option
                     The option will be provided to every module with a NULL
                     value.
@@ -95,7 +95,7 @@ OPTIONS
      Filter lrzip
             compression=type
                     Use type as compression method.  Supported values are
-                    "bzip2", "gzipi", "lzo" (ultra fast), and "zpaq" (best,
+                    “bzip2”, “gzipi”, “lzo” (ultra fast), and “zpaq” (best,
                     extremely slow).
             compression-level
                     The value is interpreted as a decimal integer specifying
@@ -133,27 +133,27 @@ OPTIONS
                     the compression level. Supported values are from 0 to 9.
             threads
                     The value is interpreted as a decimal integer specifying
-                    the number of threads for multi-threaded lzma compres-
+                    the number of threads for multi-threaded lzma compres
                     sion.  If supported, the default value is read from
                     lzma_cputhreads().
      Filter zstd
             compression-level
                     The value is interpreted as a decimal integer specifying
-                    the compression level. Supported values depend on the li-
+                    the compression level. Supported values depend on the li
                     brary version, common values are from 1 to 22.
      Format 7zip
             compression
-                    The value is one of "store", "deflate", "bzip2", "lzma1",
-                    "lzma2" or "ppmd" to indicate how the following entries
+                    The value is one of “store”, “deflate”, “bzip2”, “lzma1”,
+                    “lzma2” or “ppmd” to indicate how the following entries
                     should be compressed.  Note that this setting is ignored
-                    for directories, symbolic links, and other special en-
+                    for directories, symbolic links, and other special en
                     tries.
             compression-level
                     The value is interpreted as a decimal integer specifying
-                    the compression level.  Values between 0 and 9 are sup-
-                    ported.  The interpretation of the compression level de-
+                    the compression level.  Values between 0 and 9 are sup
+                    ported.  The interpretation of the compression level de
                     pends on the chosen compression method.
-     Format cpio
+     Format bin
             hdrcharset
                     The value is used as a character set name that will be
                     used when translating file names.
@@ -169,7 +169,7 @@ OPTIONS
                     volume.  Default: none.
             application-id=filename
                     The file with the specified name will be identified in
-                    the ISO9660 metadata as holding the application identi-
+                    the ISO9660 metadata as holding the application identi
                     fier for this volume.  Default: none.
             biblio-file=filename
                     The file with the specified name will be identified in
@@ -184,17 +184,17 @@ OPTIONS
                     the ISO9660 metadata as holding the publisher information
                     for this volume.  Default: none.
             volume-id=string
-                    The specified string will be used as the Volume Identi-
+                    The specified string will be used as the Volume Identi
                     fier in the ISO9660 metadata.  It is limited to 32 bytes.
                     Default: none.
      Format iso9660 - boot support
-            These options are used to make an ISO9660 image that can be di-
+            These options are used to make an ISO9660 image that can be di
             rectly booted on various systems.
             boot=filename
                     The file matching this name will be used as the El Torito
                     boot image file.
             boot-catalog=name
-                    The name that will be used for the El Torito boot cata-
+                    The name that will be used for the El Torito boot cata
                     log.  Default: boot.catalog
             boot-info-table
                     The boot image file provided by the boot=filename option
@@ -215,38 +215,38 @@ OPTIONS
                     Specifies the boot semantics used by the El Torito boot
                     image: If the value is fd, then the boot image is assumed
                     to be a bootable floppy image.  If the value is hd, then
-                    the boot image is assumed to be a bootable hard disk im-
+                    the boot image is assumed to be a bootable hard disk im
                     age.  If the value is no-emulation, the boot image is
                     used without floppy or hard disk emulation.  If the boot
-                    image is exactly 1.2MB, 1.44MB, or 2.88MB, then the de-
+                    image is exactly 1.2MB, 1.44MB, or 2.88MB, then the de
                     fault is fd, otherwise the default is no-emulation.
      Format iso9660 - filename and size extensions
             Various extensions to the base ISO9660 format.
             allow-ldots
-                    If enabled, allows filenames to begin with a leading pe-
+                    If enabled, allows filenames to begin with a leading pe
                     riod.  If disabled, filenames that begin with a leading
                     period will have that period replaced by an underscore
                     character in the standard ISO9660 namespace.  This does
-                    not impact names stored in the Rockridge or Joliet exten-
+                    not impact names stored in the Rockridge or Joliet exten
                     sion area.  Default: disabled.
             allow-lowercase
-                    If enabled, allows filenames to contain lowercase charac-
-                    ters.  If disabled, filenames will be forced to upper-
+                    If enabled, allows filenames to contain lowercase charac
+                    ters.  If disabled, filenames will be forced to upper
                     case.  This does not impact names stored in the Rockridge
                     or Joliet extension area.  Default: disabled.
             allow-multidot
                     If enabled, allows filenames to contain multiple period
                     characters, in violation of the ISO9660 specification.
-                    If disabled, additional periods will be converted to un-
+                    If disabled, additional periods will be converted to un
                     derscore characters.  This does not impact names stored
-                    in the Rockridge or Joliet extension area.  Default: dis-
+                    in the Rockridge or Joliet extension area.  Default: dis
                     abled.
             allow-period
                     If enabled, allows filenames to contain trailing period
                     characters, in violation of the ISO9660 specification.
-                    If disabled, trailing periods will be converted to under-
+                    If disabled, trailing periods will be converted to under
                     score characters.  This does not impact names stored in
-                    the Rockridge or Joliet extension area.  Default: dis-
+                    the Rockridge or Joliet extension area.  Default: dis
                     abled.
             allow-pvd-lowercase
                     If enabled, the Primary Volume Descriptor may contain
@@ -256,22 +256,22 @@ OPTIONS
             allow-sharp-tilde
                     If enabled, sharp and tilde characters will be permitted
                     in filenames, in violation if the ISO9660 specification.
-                    If disabled, such characters will be converted to under-
+                    If disabled, such characters will be converted to under
                     score characters.  Default: disabled.
             allow-vernum
                     If enabled, version numbers will be included with files.
-                    If disabled, version numbers will be suppressed, in vio-
+                    If disabled, version numbers will be suppressed, in vio
                     lation of the ISO9660 standard.  This does not impact
                     names stored in the Rockridge or Joliet extension area.
                     Default: enabled.
             iso-level
-                    This enables support for file size and file name exten-
+                    This enables support for file size and file name exten
                     sions in the core ISO9660 area.  The name extensions
                     specified here do not affect the names stored in the
                     Rockridge or Joliet extension areas.
                     iso-level=1
-                            The most compliant form of ISO9660 image.  File-
-                            names are limited to 8.3 uppercase format, direc-
+                            The most compliant form of ISO9660 image.  File
+                            names are limited to 8.3 uppercase format, direc
                             tory names are limited to 8 uppercase characters,
                             files are limited to 4 GiB, the complete ISO9660
                             image cannot exceed 4 GiB.
@@ -288,7 +288,7 @@ OPTIONS
                             up to 193 characters and may include arbitrary
                             8-bit characters.
             joliet  Microsoft's Joliet extensions store a completely separate
-                    set of directory information about each file.  In partic-
+                    set of directory information about each file.  In partic
                     ular, this information includes Unicode filenames of up
                     to 255 characters.  Default: enabled.
             limit-depth
@@ -307,24 +307,24 @@ OPTIONS
                     filenames (except lowercase characters unless
                     allow-lowercase is also specified).  This violates
                     ISO9660 standards.  This does not impact names stored in
-                    the Rockridge or Joliet extension area.  Default: dis-
+                    the Rockridge or Joliet extension area.  Default: dis
                     abled.
             rockridge
                     The Rockridge extensions store an additional set of
                     POSIX-style file information with each file, including
                     mtime, atime, ctime, permissions, and long filenames with
-                    arbitrary 8-bit characters.  These extensions also sup-
+                    arbitrary 8-bit characters.  These extensions also sup
                     port symbolic links and other POSIX file types.  Default:
                     enabled.
      Format iso9660 - zisofs support
-            The zisofs extensions permit each file to be independently com-
+            The zisofs extensions permit each file to be independently com
             pressed using a gzip-compatible compression.  This can provide
             significant size savings, but requires the reading system to have
             support for these extensions.  These extensions are disabled by
             default.
             compression-level=number
                     The compression level used by the deflate compressor.
-                    Ranges from 0 (least effort) to 9 (most effort).  De-
+                    Ranges from 0 (least effort) to 9 (most effort).  De
                     fault: 6
             zisofs  Synonym for zisofs=direct.
             zisofs=direct
@@ -332,18 +332,18 @@ OPTIONS
                     zisofs=indirect, this is handled entirely within
                     libarchive and does not require a separate utility.  For
                     best results, libarchive tests each file and will store
-                    the file uncompressed if the compression does not actu-
+                    the file uncompressed if the compression does not actu
                     ally save any space.  In particular, files under 2k will
                     never be compressed.  Note that boot image files are
                     never compressed.
             zisofs=indirect
                     Recognizes files that have already been compressed with
-                    the mkzftree utility and sets up the necessary file meta-
+                    the mkzftree utility and sets up the necessary file meta
                     data so that readers will correctly identify these as
                     zisofs-compressed files.
             zisofs-exclude=filename
                     Specifies a filename that should not be compressed when
-                    using zisofs=direct.  This option can be provided multi-
+                    using zisofs=direct.  This option can be provided multi
                     ple times to suppress compression on many files.
      Format mtree
             cksum, device, flags, gid, gname, indent, link, md5, mode, nlink,
@@ -351,9 +351,9 @@ OPTIONS
                     uname
                     Enable a particular keyword in the mtree output.  Prefix
                     with an exclamation mark to disable the corresponding
-                    keyword.  The default is equivalent to "device, flags,
+                    keyword.  The default is equivalent to device, flags,
                     gid, gname, link, mode, nlink, size, time, type, uid,
-                    uname".
+                    uname.
             all     Enables all of the above keywords.
             use-set
                     Enables generation of /set lines that specify default
@@ -363,18 +363,26 @@ OPTIONS
             hdrcharset
                     The value is used as a character set name that will be
                     used when translating file names.
+     Format odc
+            hdrcharset
+                    The value is used as a character set name that will be
+                    used when translating file names.
+     Format pwb
+            hdrcharset
+                    The value is used as a character set name that will be
+                    used when translating file names.
      Format pax
             hdrcharset
                     The value is used as a character set name that will be
                     used when translating file, group and user names.  The
-                    value is one of "BINARY" or "UTF-8".  With "BINARY" there
-                    is no character conversion, with "UTF-8" names are con-
+                    value is one of “BINARY” or “UTF-8”.  With “BINARY” there
+                    is no character conversion, with “UTF-8” names are con‐
                     verted to UTF-8.
             xattrheader
                     When storing extended attributes, this option configures
                     which headers should be written. The value is one of
-                    "all", "LIBARCHIVE", or "SCHILY".  By default, both
-                    "LIBARCHIVE.xattr" and "SCHILY.xattr" headers are writ-
+                    “all”, “LIBARCHIVE”, or “SCHILY”.      By default, both
+                    “LIBARCHIVE.xattr” and “SCHILY.xattr” headers are writ‐
                     ten.
      Format ustar
             hdrcharset
@@ -386,42 +394,42 @@ OPTIONS
                     used when translating file, group and user names.
      Format warc
             omit-warcinfo
-                    Set to "true" to disable output of the warcinfo record.
+                    Set to “true” to disable output of the warcinfo record.
      Format xar
             checksum=type
                     Use type as file checksum method.  Supported values are
-                    "none", "md5", and "sha1" (default).
+                    “none”, “md5”, and “sha1” (default).
             compression=type
                     Use type as compression method.  Supported values are
-                    "none", "bzip2", "gzip" (default), "lzma" and "xz".
+                    “none”, “bzip2”, “gzip” (default), “lzma” and “xz”.
             compression_level
                     The value is a decimal integer from 1 to 9 specifying the
                     compression level.
             toc-checksum=type
                     Use type as table of contents checksum method.  Supported
-                    values are "none", "md5" and "sha1" (default).
+                    values are “none”, “md5” and “sha1” (default).
      Format zip
             compression
-                    The value is either "store" or "deflate" to indicate how
+                    The value is either “store” or “deflate” to indicate how
                     the following entries should be compressed.  Note that
                     this setting is ignored for directories, symbolic links,
                     and other special entries.
             compression-level
                     The value is interpreted as a decimal integer specifying
-                    the compression level.  Values between 0 and 9 are sup-
-                    ported.  A compression level of 0 switches the compres-
-                    sion method to "store", other values will enable
-                    "deflate" compression with the given level.
+                    the compression level.  Values between 0 and 9 are sup
+                    ported.  A compression level of 0 switches the compres
+                    sion method to “store”, other values will enable
+                    “deflate” compression with the given level.
             encryption
                     Enable encryption using traditional zip encryption.
             encryption=type
                     Use type as encryption type.  Supported values are
-                    "zipcrypt" (traditional zip encryption), "aes128" (WinZip
-                    AES-128 encryption) and "aes256" (WinZip AES-256
+                    “zipcrypt” (traditional zip encryption), “aes128” (WinZip
+                    AES-128 encryption) and “aes256” (WinZip AES-256
                     encryption).
             experimental
                     This boolean option enables or disables experimental Zip
-                    features that may not be compatible with other Zip imple-
+                    features that may not be compatible with other Zip imple
                     mentations.
             fakecrc32
                     This boolean option disables CRC calculations.  All CRC
@@ -431,22 +439,22 @@ OPTIONS
                     The value is used as a character set name that will be
                     used when translating file names.
             zip64   Zip64 extensions provide additional file size information
-                    for entries larger than 4 GiB.  They also provide ex-
-                    tended file offset and archive size information when ar-
-                    chives exceed 4 GiB.  By default, the Zip writer selec-
-                    tively enables these extensions only as needed.  In par-
+                    for entries larger than 4 GiB.  They also provide ex
+                    tended file offset and archive size information when ar
+                    chives exceed 4 GiB.  By default, the Zip writer selec
+                    tively enables these extensions only as needed.  In par
                     ticular, if the file size is unknown, the Zip writer will
                     include Zip64 extensions to guard against the possibility
                     that the file might be larger than 4 GiB.
 
                     Setting this boolean option will force the writer to use
-                    Zip64 extensions even for small files that would not oth-
-                    erwise require them.  This is primarily useful for test-
+                    Zip64 extensions even for small files that would not oth
+                    erwise require them.  This is primarily useful for test
                     ing.
 
                     Disabling this option with !zip64 will force the Zip
                     writer to avoid Zip64 extensions: It will reject files
-                    with size greater than 4 GiB, it will reject any new en-
+                    with size greater than 4 GiB, it will reject any new en
                     tries once the total archive size reaches 4 GiB, and it
                     will not use Zip64 extensions for files with unknown
                     size.  In particular, this can improve compatibility when
@@ -456,7 +464,7 @@ OPTIONS
 EXAMPLES
      The following example creates an archive write handle to create a gzip-
      compressed ISO9660 format image.  The two options here specify that the
-     ISO9660 archive will use kernel.img as the boot image for El Torito boot-
+     ISO9660 archive will use kernel.img as the boot image for El Torito boot
      ing, and that the gzip compressor should use the maximum compression
      level.
 
index 9717d80..2acea6e 100644 (file)
@@ -1,7 +1,7 @@
 ARCHIVE_WRITE_SET_PAS... BSD Library Functions Manual ARCHIVE_WRITE_SET_PAS...
 
 NAME
-     archive_write_set_passphrase, archive_write_set_passphrase_callback --
+     archive_write_set_passphrase, archive_write_set_passphrase_callback 
      functions for writing encrypted archives
 
 LIBRARY
index dec0d85..6a0d3be 100644 (file)
@@ -1,7 +1,7 @@
 CPIO(1)                  BSD General Commands Manual                  CPIO(1)
 
 NAME
-     cpio -- copy files to and from archives
+     cpio  copy files to and from archives
 
 SYNOPSIS
      cpio -i [options] [pattern ...] [< archive]
@@ -15,7 +15,7 @@ DESCRIPTION
 
      The first option to cpio is a mode indicator from the following list:
      -i      Input.  Read an archive from standard input (unless overridden)
-            and extract the contents to disk or (if the -t option is speci-
+            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.
@@ -26,15 +26,24 @@ DESCRIPTION
             copy the files to the specified directory.
 
 OPTIONS
-     Unless specifically stated otherwise, options are applicable in all oper-
+     Unless specifically stated otherwise, options are applicable in all oper
      ating modes.
 
      -0, --null
             Read filenames separated by NUL characters instead of newlines.
-            This is necessary if any of the filenames being read might con-
+            This is necessary if any of the filenames being read might con
             tain newlines.
 
-     -A      (o mode only) Append to the specified archive.  (Not yet imple-
+     -6, --pwb
+            When reading a binary format archive, assume it's the earlier
+            one, from the PWB variant of 6th Edition UNIX.  When writing a
+            cpio archive, use the PWB format.
+
+     -7, --binary
+            (o mode only) When writing a cpio archive, use the (newer, non-
+            PWB) binary format.
+
+     -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.
@@ -67,7 +76,7 @@ OPTIONS
             cpio     Synonym for odc.
             newc     The SVR4 portable cpio format.
             odc      The old POSIX.1 portable octet-oriented cpio format.
-            pax      The POSIX.1 pax format, an extension of the ustar for-
+            pax      The POSIX.1 pax format, an extension of the ustar for
                      mat.
             ustar    The POSIX.1 tar format.
 
@@ -87,7 +96,7 @@ OPTIONS
      --insecure
             (i and p mode only) Disable security checks during extraction or
             copying.  This allows extraction via symbolic links, absolute
-            paths, and path names containing '..' in the name.
+            paths, and path names containing ‘..’ in the name.
 
      -J, --xz
             (o mode only) Compress the file with xz-compatible compression
@@ -102,18 +111,18 @@ OPTIONS
             instead.
 
      -l, --link
-            (p mode only) Create links from the target directory to the orig-
+            (p mode only) Create links from the target directory to the orig
             inal files, instead of copying.
 
      --lrzip
             (o mode only) Compress the resulting archive with lrzip(1).  In
             input mode, this option is ignored.
 
-     --lz4   (o mode only) Compress the archive with lz4-compatible compres-
+     --lz4   (o mode only) Compress the archive with lz4-compatible compres
             sion before writing it.  In input mode, this option is ignored;
             lz4 compression is recognized automatically on input.
 
-     --zstd  (o mode only) Compress the archive with zstd-compatible compres-
+     --zstd  (o mode only) Compress the archive with zstd-compatible compres
             sion before writing it.  In input mode, this option is ignored;
             zstd compression is recognized automatically on input.
 
@@ -183,11 +192,11 @@ OPTIONS
             restore the contents to disk.
 
      -u, --unconditional
-            (i and p modes) Unconditionally overwrite existing files.  Ordi-
+            (i and p modes) Unconditionally overwrite existing files.  Ordi
             narily, an older file will not overwrite a newer file on disk.
 
      -V, --dot
-            Print a dot to stderr for each file as it is processed.  Super-
+            Print a dot to stderr for each file as it is processed.  Super
             seded by -v.
 
      -v, --verbose
@@ -197,15 +206,15 @@ OPTIONS
      --version
             Print the program version information and exit.
 
-     -y      (o mode only) Compress the archive with bzip2-compatible compres-
+     -y      (o mode only) Compress the archive with bzip2-compatible compres
             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 ig-
+     -Z      (o mode only) Compress the archive with compress-compatible com
+            pression before writing it.  In input mode, this option is ig
             nored; compression is recognized automatically on input.
 
-     -z      (o mode only) Compress the archive with gzip-compatible compres-
+     -z      (o mode only) Compress the archive with gzip-compatible compres
             sion before writing it.  In input mode, this option is ignored;
             gzip compression is recognized automatically on input.
 
@@ -221,32 +230,32 @@ ENVIRONMENT
                more information.
 
 EXAMPLES
-     The cpio command is traditionally used to copy file hierarchies in con-
+     The cpio command is traditionally used to copy file hierarchies in con
      junction with the find(1) command.  The first example here simply copies
      all files from src to dest:
           find src | cpio -pmud dest
 
      By carefully selecting options to the find(1) command and combining it
-     with other standard utilities, it is possible to exercise very fine con-
+     with other standard utilities, it is possible to exercise very fine con
      trol over which files are copied. This next example copies files from
-     src to dest that are more than 2 days old and whose names match a partic-
+     src to dest that are more than 2 days old and whose names match a partic
      ular pattern:
           find src -mtime +2 | grep foo[bar] | cpio -pdmu dest
 
      This example copies files from src to dest that are more than 2 days old
-     and which contain the word "foobar":
+     and which contain the word “foobar”:
           find src -mtime +2 | xargs grep -l foobar | cpio -pdmu dest
 
 COMPATIBILITY
      The mode options i, o, and p and the options a, B, c, d, f, l, m, r, t,
      u, and v comply with SUSv2.
 
-     The old POSIX.1 standard specified that only -i, -o, and -p were inter-
+     The old POSIX.1 standard specified that only -i, -o, and -p were inter
      preted as command-line options.  Each took a single argument of a list of
      modifier characters.  For example, the standard syntax allows -imu but
      does not support -miu or -i -m -u, since m and u are only modifiers to
      -i, they are not command-line options in their own right. The syntax
-     supported by this implementation is backwards-compatible with the stan-
+     supported by this implementation is backwards-compatible with the stan
      dard.  For best compatibility, scripts should limit themselves to the
      standard syntax.
 
@@ -256,16 +265,16 @@ SEE ALSO
 
 STANDARDS
      There is no current POSIX standard for the cpio command; it appeared in
-     ISO/IEC 9945-1:1996 ("POSIX.1") but was dropped from IEEE Std 1003.1-2001
-     ("POSIX.1").
+     ISO/IEC 9945-1:1996 (“POSIX.1”) but was dropped from IEEE Std 1003.1-2001
+     (“POSIX.1”).
 
      The cpio, ustar, and pax interchange file formats are defined by IEEE Std
-     1003.1-2001 ("POSIX.1") for the pax command.
+     1003.1-2001 (“POSIX.1”) for the pax command.
 
 HISTORY
      The original cpio and find utilities were written by Dick Haight while
      working in AT&T's Unix Support Group.  They first appeared in 1977 in
-     PWB/UNIX 1.0, the "Programmer's Work Bench" system developed for use
+     PWB/UNIX 1.0, the “Programmer's Work Bench” system developed for use
      within AT&T.  They were first released outside of AT&T as part of System
      III Unix in 1981. As a result, cpio actually predates tar, even though
      it was not well-known outside of AT&T until some time later.
@@ -277,8 +286,8 @@ BUGS
      user and group names, only numbers.  As a result, it cannot be reliably
      used to transfer files between systems with dissimilar user and group
      numbering.  Older cpio formats limit the user and group numbers to 16 or
-     18 bits, which is insufficient for modern systems.  The cpio archive for-
-     mats cannot support files over 4 gigabytes, except for the "odc" variant,
+     18 bits, which is insufficient for modern systems.  The cpio archive for
+     mats cannot support files over 4 gigabytes, except for the “odc” variant,
      which can support files up to 8 gigabytes.
 
 BSD                          September 16, 2014                           BSD
index 698e1b0..75d6f0c 100644 (file)
@@ -1,10 +1,10 @@
 TAR(1)                   BSD General Commands Manual                   TAR(1)
 
 NAME
-     tar -- manipulate tape archives
+     tar  manipulate tape archives
 
 SYNOPSIS
-     tar [bundled-flags <args>] [<file> | <pattern> ...]
+     tar [bundled-flags ⟨args⟩] [⟨file⟩ | ⟨pattern⟩ ...]
      tar {-c} [options] [files | directories]
      tar {-r | -u} -f archive-file [options] [files | directories]
      tar {-t | -x} [options] [patterns]
@@ -15,8 +15,8 @@ DESCRIPTION
      9660 cdrom images and can create tar, pax, cpio, ar, zip, 7-zip, and shar
      archives.
 
-     The first synopsis form shows a "bundled" option word.  This usage is
-     provided for compatibility with historical implementations.  See COMPATI-
+     The first synopsis form shows a “bundled” option word.  This usage is
+     provided for compatibility with historical implementations.  See COMPATI
      BILITY below for details.
 
      The other synopsis forms show the preferred usage.  The first option to
@@ -27,31 +27,31 @@ DESCRIPTION
             this only works on uncompressed archives stored in regular files.
             The -f option is required.  The long option form is --append.
      -t      List archive contents to stdout.  The long option form is --list.
-     -u      Like -r, but new entries are added only if they have a modifica-
+     -u      Like -r, but new entries are added only if they have a modifica
             tion date newer than the corresponding entry in the archive.
-            Note that this only works on uncompressed archives stored in reg-
+            Note that this only works on uncompressed archives stored in reg
             ular files.  The -f option is required.  The long form is
             --update.
      -x      Extract to disk from the archive. If a file with the same name
-            appears more than once in the archive, each copy will be ex-
+            appears more than once in the archive, each copy will be ex
             tracted, with later copies overwriting (replacing) earlier
             copies.  The long option form is --extract.
 
      In -c, -r, or -u mode, each specified file or directory is added to the
-     archive in the order specified on the command line.  By default, the con-
+     archive in the order specified on the command line.  By default, the con
      tents of each directory are also archived.
 
-     In extract or list mode, the entire command line is read and parsed be-
+     In extract or list mode, the entire command line is read and parsed be
      fore the archive is opened.  The pathnames or patterns on the command
      line indicate which items in the archive should be processed.  Patterns
      are shell-style globbing patterns as documented in tcsh(1).
 
 OPTIONS
-     Unless specifically stated otherwise, options are applicable in all oper-
+     Unless specifically stated otherwise, options are applicable in all oper
      ating modes.
 
      @archive
-            (c and r modes only) The specified archive is opened and the en-
+            (c and r modes only) The specified archive is opened and the en
             tries in it will be appended to the current archive.  As a simple
             example,
                   tar -c -f - newfile @original.tar
@@ -60,24 +60,24 @@ OPTIONS
                   tar -c -f - newfile original.tar
             creates a new archive with only two entries.  Similarly,
                   tar -czf - --format pax @-
-            reads an archive from standard input (whose format will be deter-
+            reads an archive from standard input (whose format will be deter
             mined automatically) and converts it into a gzip-compressed pax-
-            format archive on stdout.  In this way, tar can be used to con-
+            format archive on stdout.  In this way, tar can be used to con
             vert archives from one format to another.
 
      -a, --auto-compress
-            (c mode only) Use the archive suffix to decide a set of the for-
+            (c mode only) Use the archive suffix to decide a set of the for
             mat and the compressions.  As a simple example,
                   tar -a -cf archive.tgz source.c source.h
-            creates a new archive with restricted pax format and gzip com-
+            creates a new archive with restricted pax format and gzip com
             pression,
                   tar -a -cf archive.tar.bz2.uu source.c source.h
-            creates a new archive with restricted pax format and bzip2 com-
+            creates a new archive with restricted pax format and bzip2 com
             pression and uuencode compression,
                   tar -a -cf archive.zip source.c source.h
             creates a new archive with zip format,
                   tar -a -jcf archive.tgz source.c source.h
-            ignores the "-j" option, and creates a new archive with re-
+            ignores the “-j” option, and creates a new archive with re‐
             stricted pax format and gzip compression,
                   tar -a -jcf archive.xxx source.c source.h
             if it is unknown suffix or no suffix, creates a new archive with
@@ -114,14 +114,14 @@ OPTIONS
             might prevent removal.
 
      --exclude pattern
-            Do not process files or directories that match the specified pat-
+            Do not process files or directories that match the specified pat
             tern.  Note that exclusions take precedence over patterns or
             filenames specified on the command line.
 
      --exclude-vcs
-            Do not process files or directories internally used by the ver-
-            sion control systems 'Arch', 'Bazaar', 'CVS', 'Darcs',
-            'Mercurial', 'RCS', 'SCCS', 'SVN' and 'git'.
+            Do not process files or directories internally used by the ver
+            sion control systems ‘Arch’, ‘Bazaar’, ‘CVS’, ‘Darcs’,
+            ‘Mercurial’, ‘RCS’, ‘SCCS’, ‘SVN’ and ‘git’.
 
      --fflags
             (c, r, u, x modes only) Archive or extract platform-specific file
@@ -130,12 +130,12 @@ OPTIONS
             mode as root.
 
      --format format
-            (c, r, u mode only) Use the specified format for the created ar-
-            chive.  Supported formats include "cpio", "pax", "shar", and
-            "ustar".  Other formats may also be supported; see
-            libarchive-formats(5) for more information about currently-sup-
-            ported formats.  In r and u modes, when extending an existing ar-
-            chive, the format specified here must be compatible with the for-
+            (c, r, u mode only) Use the specified format for the created ar
+            chive.  Supported formats include “cpio”, “pax”, “shar”, and
+            “ustar”.  Other formats may also be supported; see
+            libarchive-formats(5) for more information about currently-sup
+            ported formats.  In r and u modes, when extending an existing ar
+            chive, the format specified here must be compatible with the for
             mat of the existing archive on disk.
 
      -f file, --file file
@@ -170,28 +170,28 @@ OPTIONS
      --help  Show usage.
 
      --hfsCompression
-            (x mode only) Mac OS X specific (v10.6 or later). Compress ex-
+            (x mode only) Mac OS X specific (v10.6 or later). Compress ex
             tracted regular files with HFS+ compression.
 
      --ignore-zeros
-            An alias of --options read_concatenated_archives for compatibil-
+            An alias of --options read_concatenated_archives for compatibil
             ity with GNU tar.
 
      --include pattern
-            Process only files or directories that match the specified pat-
-            tern.  Note that exclusions specified with --exclude take prece-
-            dence over inclusions.  If no inclusions are explicitly speci-
+            Process only files or directories that match the specified pat
+            tern.  Note that exclusions specified with --exclude take prece
+            dence over inclusions.  If no inclusions are explicitly speci
             fied, all entries are processed by default.  The --include option
             is especially useful when filtering archives.  For example, the
             command
                   tar -c -f new.tar --include='*foo*' @old.tgz
             creates a new archive new.tar containing only the entries from
-            old.tgz containing the string 'foo'.
+            old.tgz containing the string ‘foo’.
 
      -J, --xz
-            (c mode only) Compress the resulting archive with xz(1).  In ex-
+            (c mode only) Compress the resulting archive with xz(1).  In ex
             tract or list modes, this option is ignored.  Note that this tar
-            implementation recognizes XZ compression automatically when read-
+            implementation recognizes XZ compression automatically when read
             ing archives.
 
      -j, --bzip, --bzip2, --bunzip2
@@ -210,7 +210,7 @@ OPTIONS
             the versions appearing in the archive being extracted.
 
      -L, --dereference
-            (c and r modes only) All symbolic links will be followed.  Nor-
+            (c and r modes only) All symbolic links will be followed.  Nor
             mally, symbolic links are archived as such.  With this option,
             the target of the link will be archived instead.
 
@@ -224,18 +224,18 @@ OPTIONS
             tar implementation recognizes lrzip compression automatically
             when reading archives.
 
-     --lz4   (c mode only) Compress the archive with lz4-compatible compres-
+     --lz4   (c mode only) Compress the archive with lz4-compatible compres
             sion before writing it.  In extract or list modes, this option is
-            ignored.  Note that this tar implementation recognizes lz4 com-
+            ignored.  Note that this tar implementation recognizes lz4 com
             pression automatically when reading archives.
 
-     --zstd  (c mode only) Compress the archive with zstd-compatible compres-
+     --zstd  (c mode only) Compress the archive with zstd-compatible compres
             sion before writing it.  In extract or list modes, this option is
-            ignored.  Note that this tar implementation recognizes zstd com-
+            ignored.  Note that this tar implementation recognizes zstd com
             pression automatically when reading archives.
 
      --lzma  (c mode only) Compress the resulting archive with the original
-            LZMA algorithm.  In extract or list modes, this option is ig-
+            LZMA algorithm.  In extract or list modes, this option is ig
             nored.  Use of this option is discouraged and new archives should
             be created with --xz instead.  Note that this tar implementation
             recognizes LZMA compression automatically when reading archives.
@@ -264,7 +264,7 @@ OPTIONS
             than the specified date.  This compares ctime entries.
 
      --newer-mtime date
-            (c, r, u modes only) Like --newer, except it compares mtime en-
+            (c, r, u modes only) Like --newer, except it compares mtime en
             tries instead of ctime entries.
 
      --newer-than file
@@ -281,17 +281,17 @@ OPTIONS
 
      --nopreserveHFSCompression
             (x mode only) Mac OS X specific (v10.6 or later). Do not compress
-            extracted regular files which were compressed with HFS+ compres-
+            extracted regular files which were compressed with HFS+ compres
             sion before archived.  By default, compress the regular files
             again with HFS+ compression.
 
      --null  (use with -I or -T) Filenames or patterns are separated by null
-            characters, not by newlines.  This is often used to read file-
+            characters, not by newlines.  This is often used to read file
             names output by the -print0 option to find(1).
 
      --no-acls
             (c, r, u, x modes only) Do not archive or extract POSIX.1e or
-            NFSv4 ACLs.  This is the reverse of --acls and the default behav-
+            NFSv4 ACLs.  This is the reverse of --acls and the default behav
             ior if tar is run as non-root in x mode (on Mac OS X as any user
             in c, r, u and x modes).
 
@@ -323,7 +323,7 @@ OPTIONS
 
      --no-xattrs
             (c, r, u, x modes only) Do not archive or extract extended file
-            attributes.  This is the reverse of --xattrs and the default be-
+            attributes.  This is the reverse of --xattrs and the default be
             havior if tar is run as non-root in x mode.
 
      --numeric-owner
@@ -352,7 +352,7 @@ OPTIONS
             than the specified date.  This compares ctime entries.
 
      --older-mtime date
-            (c, r, u modes only) Like --older, except it compares mtime en-
+            (c, r, u modes only) Like --older, except it compares mtime en
             tries instead of ctime entries.
 
      --older-than file
@@ -373,7 +373,7 @@ OPTIONS
             control how those formats will behave.  Each option has one of
             the following forms:
             key=value
-                    The key will be set to the specified value in every mod-
+                    The key will be set to the specified value in every mod
                     ule that supports it.  Modules that do not support this
                     key will ignore it.
             key     The key will be enabled in every module that supports it.
@@ -393,10 +393,10 @@ OPTIONS
                     Support Joliet extensions.  This is enabled by default,
                     use !joliet or iso9660:!joliet to disable.
             iso9660:rockridge
-                    Support Rock Ridge extensions.  This is enabled by de-
+                    Support Rock Ridge extensions.  This is enabled by de
                     fault, use !rockridge or iso9660:!rockridge to disable.
             gzip:compression-level
-                    A decimal integer from 1 to 9 specifying the gzip com-
+                    A decimal integer from 1 to 9 specifying the gzip com
                     pression level.
             gzip:timestamp
                     Store timestamp.  This is enabled by default, use
@@ -406,10 +406,10 @@ OPTIONS
                     bzip2, gzip, lzo (ultra fast), and zpaq (best, extremely
                     slow).
             lrzip:compression-level
-                    A decimal integer from 1 to 9 specifying the lrzip com-
+                    A decimal integer from 1 to 9 specifying the lrzip com
                     pression level.
             lz4:compression-level
-                    A decimal integer from 1 to 9 specifying the lzop com-
+                    A decimal integer from 1 to 9 specifying the lzop com
                     pression level.
             lz4:stream-checksum
                     Enable stream checksum.  This is by default, use
@@ -417,7 +417,7 @@ OPTIONS
             lz4:block-checksum
                     Enable block checksum (Disabled by default).
             lz4:block-size
-                    A decimal integer from 4 to 7 specifying the lz4 compres-
+                    A decimal integer from 4 to 7 specifying the lz4 compres
                     sion block size (7 is set by default).
             lz4:block-dependence
                     Use the previous block of the block being compressed for
@@ -427,19 +427,19 @@ OPTIONS
                     Supported values depend on the library version, common
                     values are from 1 to 22.
             lzop:compression-level
-                    A decimal integer from 1 to 9 specifying the lzop com-
+                    A decimal integer from 1 to 9 specifying the lzop com
                     pression level.
             xz:compression-level
-                    A decimal integer from 0 to 9 specifying the xz compres-
+                    A decimal integer from 0 to 9 specifying the xz compres
                     sion level.
             mtree:keyword
                     The mtree writer module allows you to specify which mtree
-                    keywords will be included in the output.  Supported key-
+                    keywords will be included in the output.  Supported key
                     words include: cksum, device, flags, gid, gname, indent,
                     link, md5, mode, nlink, rmd160, sha1, sha256, sha384,
-                    sha512, size, time, uid, uname.  The default is equiva-
-                    lent to: "device, flags, gid, gname, link, mode, nlink,
-                    size, time, type, uid, uname".
+                    sha512, size, time, uid, uname.  The default is equiva
+                    lent to: device, flags, gid, gname, link, mode, nlink,
+                    size, time, type, uid, uname.
             mtree:all
                     Enables all of the above keywords.  You can also use
                     mtree:!all to disable all keywords.
@@ -456,13 +456,13 @@ OPTIONS
             zip:encryption=type
                     Use type as encryption type.  Supported values are
                     zipcrypt (traditional zip encryption), aes128 (WinZip
-                    AES-128 encryption) and aes256 (WinZip AES-256 encryp-
+                    AES-128 encryption) and aes256 (WinZip AES-256 encryp
                     tion).
             read_concatenated_archives
                     Ignore zeroed blocks in the archive, which occurs when
                     multiple tar archives have been concatenated together.
-                    Without this option, only the contents of the first con-
-                    catenated archive would be read.  This option is compara-
+                    Without this option, only the contents of the first con
+                    catenated archive would be read.  This option is compara
                     ble to the -i, --ignore-zeros option of GNU tar.
             If a provided option is not supported by any module, that is a
             fatal error.
@@ -472,7 +472,7 @@ OPTIONS
             begin with a / character) have the leading slash removed both
             when creating archives and extracting from them.  Also, tar will
             refuse to extract archive entries whose pathnames contain .. or
-            whose target directory would be altered by a symlink.  This op-
+            whose target directory would be altered by a symlink.  This op
             tion suppresses these behaviors.
 
      -p, --insecure, --preserve-permissions
@@ -486,8 +486,8 @@ OPTIONS
 
      --passphrase passphrase
             The passphrase is used to extract or create an encrypted archive.
-            Currently, zip is the only supported format that supports encryp-
-            tion.  You shouldn't use this option unless you realize how inse-
+            Currently, zip is the only supported format that supports encryp
+            tion.  You shouldn't use this option unless you realize how inse
             cure use of this option is.
 
      --posix
@@ -498,7 +498,7 @@ OPTIONS
             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 en-
+            multiple entries with the same name and, by convention, later en
             tries overwrite earlier entries.  This option is provided as a
             performance optimization.
 
@@ -510,10 +510,10 @@ OPTIONS
             Modify file or archive member names according to pattern.  The
             pattern has the format /old/new/[ghHprRsS] where old is a basic
             regular expression, new is the replacement string of the matched
-            part, and the optional trailing letters modify how the replace-
+            part, and the optional trailing letters modify how the replace
             ment is handled.  If old is not matched, the pattern is skipped.
             Within new, ~ is substituted with the match, \1 to \9 with the
-            content of the corresponding captured group.  The optional trail-
+            content of the corresponding captured group.  The optional trail
             ing g specifies that matching should continue after the matched
             part and stop on the first unmatched pattern.  The optional
             trailing s specifies that the pattern applies to the value of
@@ -534,8 +534,8 @@ OPTIONS
             writes to it.  For a short period of time, applications trying to
             access the file might not find it, or see incomplete results.  If
             --safe-writes is enabled, tar first creates a unique temporary
-            file, then writes the new contents to the temporary file, and fi-
-            nally renames the temporary file to its final name atomically us-
+            file, then writes the new contents to the temporary file, and fi
+            nally renames the temporary file to its final name atomically us
             ing rename(2).  This guarantees that an application accessing the
             file, will either see the old contents or the new contents at all
             times.
@@ -554,11 +554,11 @@ OPTIONS
      -T filename, --files-from filename
             In x or t mode, tar will read the list of names to be extracted
             from filename.  In c mode, tar will read names to be archived
-            from filename.  The special name "-C" on a line by itself will
-            cause the current directory to be changed to the directory speci-
-            fied on the following line.  Names are terminated by newlines un-
+            from filename.  The special name “-C” on a line by itself will
+            cause the current directory to be changed to the directory speci
+            fied on the following line.  Names are terminated by newlines un
             less --null is specified.  Note that --null also disables the
-            special handling of lines containing "-C".  Note:  If you are
+            special handling of lines containing “-C”.  Note:      If you are
             generating lists of files using find(1), you probably want to use
             -n as well.
 
@@ -570,7 +570,7 @@ OPTIONS
             (x mode only) Unlink files before creating them.  This can be a
             minor performance optimization if most files already exist, but
             can make things slower if most files do not already exist.  This
-            flag also causes tar to remove intervening directory symlinks in-
+            flag also causes tar to remove intervening directory symlinks in
             stead of reporting an error.  See the SECURITY section below for
             more details.
 
@@ -595,7 +595,7 @@ OPTIONS
             Produce verbose output.  In create and extract modes, tar will
             list each file name as it is read from or written to the archive.
             In list mode, tar will produce output similar to that of ls(1).
-            An additional -v option will also provide ls-like details in cre-
+            An additional -v option will also provide ls-like details in cre
             ate and extract mode.
 
      --version
@@ -609,8 +609,8 @@ OPTIONS
             --exclude for more information about the handling of exclusions.
 
      --xattrs
-            (c, r, u, x modes only) Archive or extract extended file at-
-            tributes.  This is the reverse of --no-xattrs and the default be-
+            (c, r, u, x modes only) Archive or extract extended file at
+            tributes.  This is the reverse of --no-xattrs and the default be
             havior in c, r, and u modes or if tar is run in x mode as root.
 
      -y      (c mode only) Compress the resulting archive with bzip2(1).  In
@@ -634,11 +634,11 @@ ENVIRONMENT
      The following environment variables affect the execution of tar:
 
      TAR_READER_OPTIONS
-               The default options for format readers and compression read-
+               The default options for format readers and compression read
                ers.  The --options option overrides this.
 
      TAR_WRITER_OPTIONS
-               The default options for format writers and compression writ-
+               The default options for format writers and compression writ
                ers.  The --options option overrides this.
 
      LANG      The locale to use.  See environ(7) for more information.
@@ -677,7 +677,7 @@ EXAMPLES
           tar -c -f new.tar foo1 @old.tgz -C/tmp foo2
      will create a new archive new.tar.  tar will read the file foo1 from the
      current directory and add it to the output archive.  It will then read
-     each entry from old.tgz and add those entries to the output archive.  Fi-
+     each entry from old.tgz and add those entries to the output archive.  Fi
      nally, it will switch to the /tmp directory and add foo2 to the output
      archive.
 
@@ -692,8 +692,8 @@ EXAMPLES
           $ tar -cvf output.tar @input.mtree
 
      The --newer and --newer-mtime switches accept a variety of common date
-     and time specifications, including "12 Mar 2005 7:14:29pm", "2005-03-12
-     19:14", "5 minutes ago", and "19:14 PST May 1".
+     and time specifications, including “12 Mar 2005 7:14:29pm”, “2005-03-12
+     19:14”, “5 minutes ago”, and “19:14 PST May 1”.
 
      The --options argument can be used to control various details of archive
      generation or reading.  For example, you can generate mtree output which
@@ -707,12 +707,12 @@ EXAMPLES
 
 COMPATIBILITY
      The bundled-arguments format is supported for compatibility with historic
-     implementations.  It consists of an initial word (with no leading - char-
+     implementations.  It consists of an initial word (with no leading - char
      acter) in which each character indicates an option.  Arguments follow as
      separate words.  The order of the arguments must match the order of the
      corresponding characters in the bundled command word.  For example,
           tar tbf 32 file.tar
-     specifies three flags t, b, and f.  The b and f flags both require argu-
+     specifies three flags t, b, and f.  The b and f flags both require argu
      ments, so there must be two additional items on the command line. The 32
      is the argument to the b flag, and file.tar is the argument to the f
      flag.
@@ -729,24 +729,24 @@ COMPATIBILITY
 
 SECURITY
      Certain security issues are common to many archiving programs, including
-     tar.  In particular, carefully-crafted archives can request that tar ex-
-     tract files to locations outside of the target directory. This can po-
+     tar.  In particular, carefully-crafted archives can request that tar ex
+     tract files to locations outside of the target directory. This can po
      tentially be used to cause unwitting users to overwrite files they did
-     not intend to overwrite.  If the archive is being extracted by the supe-
+     not intend to overwrite.  If the archive is being extracted by the supe
      ruser, any file on the system can potentially be overwritten.  There are
      three ways this can happen.  Although tar has mechanisms to protect
      against each one, savvy users should be aware of the implications:
 
-     o      Archive entries can have absolute pathnames.  By default, tar re-
+     •            Archive entries can have absolute pathnames.  By default, tar re‐
             moves the leading / character from filenames before restoring
             them to guard against this problem.
 
-     o      Archive entries can have pathnames that include .. components.
+     •            Archive entries can have pathnames that include .. components.
             By default, tar will not extract files containing .. components
             in their pathname.
 
-     o      Archive entries can exploit symbolic links to restore files to
-            other directories.  An archive can restore a symbolic link to an-
+     •            Archive entries can exploit symbolic links to restore files to
+            other directories.  An archive can restore a symbolic link to an
             other directory, then use that link to restore a file into that
             directory.  To guard against this, tar checks each extracted path
             for symlinks.  If the final path element is a symlink, it will be
@@ -758,11 +758,11 @@ SECURITY
      untrusted sources.  You should examine the contents of an archive with
           tar -tf filename
      before extraction.  You should use the -k option to ensure that tar will
-     not overwrite any existing files or the -U option to remove any pre-ex-
+     not overwrite any existing files or the -U option to remove any pre-ex
      isting files.  You should generally not extract archives while running
      with super-user privileges.  Note that the -P option to tar disables the
-     security checks above and allows you to extract an archive while preserv-
-     ing any absolute pathnames, .. components, or symlinks to other directo-
+     security checks above and allows you to extract an archive while preserv
+     ing any absolute pathnames, .. components, or symlinks to other directo
      ries.
 
 SEE ALSO
@@ -771,18 +771,18 @@ SEE ALSO
 
 STANDARDS
      There is no current POSIX standard for the tar command; it appeared in
-     ISO/IEC 9945-1:1996 ("POSIX.1") but was dropped from IEEE Std 1003.1-2001
-     ("POSIX.1").  The options supported by this implementation were developed
+     ISO/IEC 9945-1:1996 (“POSIX.1”) but was dropped from IEEE Std 1003.1-2001
+     (“POSIX.1”).  The options supported by this implementation were developed
      by surveying a number of existing tar implementations as well as the old
      POSIX specification for tar and the current POSIX specification for pax.
 
      The ustar and pax interchange file formats are defined by IEEE Std
-     1003.1-2001 ("POSIX.1") for the pax command.
+     1003.1-2001 (“POSIX.1”) for the pax command.
 
 HISTORY
      A tar command appeared in Seventh Edition Unix, which was released in
      January, 1979.  There have been numerous other implementations, many of
-     which extended the file format.  John Gilmore's pdtar public-domain im-
+     which extended the file format.  John Gilmore's pdtar public-domain im
      plementation (circa November, 1987) was quite influential, and formed the
      basis of GNU tar. GNU tar was included as the standard system tar in
      FreeBSD beginning with FreeBSD 1.0.
@@ -791,19 +791,19 @@ HISTORY
      It was first released with FreeBSD 5.4 in May, 2005.
 
 BUGS
-     This program follows ISO/IEC 9945-1:1996 ("POSIX.1") for the definition
+     This program follows ISO/IEC 9945-1:1996 (“POSIX.1”) for the definition
      of the -l option. Note that GNU tar prior to version 1.15 treated -l as
      a synonym for the --one-file-system option.
 
      The -C dir option may differ from historic implementations.
 
-     All archive output is written in correctly-sized blocks, even if the out-
+     All archive output is written in correctly-sized blocks, even if the out
      put is being compressed.  Whether or not the last output block is padded
-     to a full block size varies depending on the format and the output de-
+     to a full block size varies depending on the format and the output de
      vice.  For tar and cpio formats, the last block of output is padded to a
      full block size if the output is being written to standard output or to a
      character or block device such as a tape drive.  If the output is being
-     written to a regular file, the last block will not be padded.  Many com-
+     written to a regular file, the last block will not be padded.  Many com
      pressors, including gzip(1) and bzip2(1), complain about the null padding
      when decompressing an archive created by tar, although they still extract
      it correctly.
@@ -832,7 +832,7 @@ BUGS
 
      There is not yet any support for multi-volume archives.
 
-     Converting between dissimilar archive formats (such as tar and cpio) us-
+     Converting between dissimilar archive formats (such as tar and cpio) us
      ing the @- convention can cause hard link information to be lost. (This
      is a consequence of the incompatible ways that different archive formats
      store hardlink information.)
index ebfee8f..d9c9cfd 100644 (file)
@@ -1,7 +1,7 @@
 CPIO(5)                    BSD File Formats Manual                    CPIO(5)
 
 NAME
-     cpio -- format of cpio archive files
+     cpio  format of cpio archive files
 
 DESCRIPTION
      The cpio archive format collects any number of files, directories, and
@@ -11,104 +11,160 @@ DESCRIPTION
    General Format
      Each file system object in a cpio archive comprises a header record with
      basic numeric metadata followed by the full pathname of the entry and the
-     file data.  The header record stores a series of integer values that gen-
+     file data.  The header record stores a series of integer values that gen
      erally follow the fields in struct stat.  (See stat(2) for details.)  The
-     variants differ primarily in how they store those integers (binary, oc-
-     tal, or hexadecimal).  The header is followed by the pathname of the en-
+     variants differ primarily in how they store those integers (binary, oc
+     tal, or hexadecimal).  The header is followed by the pathname of the en
      try (the length of the pathname is stored in the header) and any file
      data.  The end of the archive is indicated by a special record with the
-     pathname "TRAILER!!!".
+     pathname “TRAILER!!!”.
 
    PWB format
-     XXX Any documentation of the original PWB/UNIX 1.0 format? XXX
-
-   Old Binary Format
-     The old binary cpio format stores numbers as 2-byte and 4-byte binary
-     values.  Each entry begins with a header in the following format:
-
-          struct header_old_cpio {
-                  unsigned short   c_magic;
-                  unsigned short   c_dev;
-                  unsigned short   c_ino;
-                  unsigned short   c_mode;
-                  unsigned short   c_uid;
-                  unsigned short   c_gid;
-                  unsigned short   c_nlink;
-                  unsigned short   c_rdev;
-                  unsigned short   c_mtime[2];
-                  unsigned short   c_namesize;
-                  unsigned short   c_filesize[2];
+     The PWB binary cpio format is the original format, when cpio was intro‐
+     duced as part of the Programmer's Work Bench system, a variant of 6th
+     Edition UNIX.  It stores numbers as 2-byte and 4-byte binary values.
+     Each entry begins with a header in the following format:
+
+          struct header_pwb_cpio {
+                  short   h_magic;
+                  short   h_dev;
+                  short   h_ino;
+                  short   h_mode;
+                  short   h_uid;
+                  short   h_gid;
+                  short   h_nlink;
+                  short   h_majmin;
+                  long    h_mtime;
+                  short   h_namesize;
+                  long    h_filesize;
           };
 
-     The unsigned short fields here are 16-bit integer values; the unsigned
-     int fields are 32-bit integer values.  The fields are as follows
+     The short fields here are 16-bit integer values, while the long fields
+     are 32 bit integers.  Since PWB UNIX, like the 6th Edition UNIX it was
+     based on, only ran on PDP-11 computers, they are in PDP-endian format,
+     which has little-endian shorts, and big-endian longs.  That is, the long
+     integer whose hexadecimal representation is 0x12345678 would be stored in
+     four successive bytes as 0x34, 0x12, 0x78, 0x56.  The fields are as fol‐
+     lows:
 
-     magic   The integer value octal 070707.  This value can be used to deter-
-            mine whether this archive is written with little-endian or big-
-            endian integers.
+     h_magic
+            The integer value octal 070707.
 
-     dev, ino
+     h_dev, h_ino
             The device and inode numbers from the disk.  These are used by
             programs that read cpio archives to determine when two entries
             refer to the same file.  Programs that synthesize cpio archives
             should be careful to set these to distinct values for each entry.
 
-     mode    The mode specifies both the regular permissions and the file
-            type.  It consists of several bit fields as follows:
-            0170000  This masks the file type bits.
-            0140000  File type value for sockets.
-            0120000  File type value for symbolic links.  For symbolic links,
-                     the link body is stored as file data.
-            0100000  File type value for regular files.
-            0060000  File type value for block special devices.
+     h_mode  The mode specifies both the regular permissions and the file
+            type, and it also holds a couple of bits that are irrelevant to
+            the cpio format, because the field is actually a raw copy of the
+            mode field in the inode representing the file.  These are the
+            IALLOC flag, which shows that the inode entry is in use, and the
+            ILARG flag, which shows that the file it represents is large
+            enough to have indirect blocks pointers in the inode.  The mode
+            is decoded as follows:
+
+            0100000  IALLOC flag - irrelevant to cpio.
+            0060000  This masks the file type bits.
             0040000  File type value for directories.
             0020000  File type value for character special devices.
-            0010000  File type value for named pipes or FIFOs.
+            0060000  File type value for block special devices.
+            0010000  ILARG flag - irrelevant to cpio.
             0004000  SUID bit.
             0002000  SGID bit.
-            0001000  Sticky bit.  On some systems, this modifies the behavior
-                     of executables and/or directories.
+            0001000  Sticky bit.
             0000777  The lower 9 bits specify read/write/execute permissions
-                     for world, group, and user following standard POSIX con-
+                     for world, group, and user following standard POSIX con
                      ventions.
 
-     uid, gid
+     h_uid, h_gid
             The numeric user id and group id of the owner.
 
-     nlink   The number of links to this file. Directories always have a
+     h_nlink
+            The number of links to this file.  Directories always have a
             value of at least two here.  Note that hardlinked files include
             file data with every copy in the archive.
 
-     rdev    For block special and character special entries, this field con-
-            tains the associated device number.  For all other entry types,
-            it should be set to zero by writers and ignored by readers.
+     h_majmin
+            For block special and character special entries, this field con‐
+            tains the associated device number, with the major number in the
+            high byte, and the minor number in the low byte.  For all other
+            entry types, it should be set to zero by writers and ignored by
+            readers.
 
-     mtime   Modification time of the file, indicated as the number of seconds
-            since the start of the epoch, 00:00:00 UTC January 1, 1970.  The
-            four-byte integer is stored with the most-significant 16 bits
-            first followed by the least-significant 16 bits.  Each of the two
-            16 bit values are stored in machine-native byte order.
+     h_mtime
+            Modification time of the file, indicated as the number of seconds
+            since the start of the epoch, 00:00:00 UTC January 1, 1970.
 
-     namesize
+     h_namesize
             The number of bytes in the pathname that follows the header.
             This count includes the trailing NUL byte.
 
-     filesize
+     h_filesize
             The size of the file.  Note that this archive format is limited
-            to four gigabyte file sizes.  See mtime above for a description
-            of the storage of four-byte integers.
+            to 16 megabyte file sizes, because PWB UNIX, like 6th Edition,
+            only used an unsigned 24 bit integer for the file size inter‐
+            nally.
 
-     The pathname immediately follows the fixed header.  If the namesize is
-     odd, an additional NUL byte is added after the pathname.  The file data
-     is then appended, padded with NUL bytes to an even length.
+     The pathname immediately follows the fixed header.  If h_namesize is odd,
+     an additional NUL byte is added after the pathname.  The file data is
+     then appended, again with an additional NUL appended if needed to get the
+     next header at an even offset.
 
      Hardlinked files are not given special treatment; the full file contents
      are included with each copy of the file.
 
+   New Binary Format
+     The new binary cpio format showed up when cpio was adopted into late 7th
+     Edition UNIX.  It is exactly like the PWB binary format, described above,
+     except for three changes:
+
+     First, UNIX now ran on more than one hardware type, so the endianness of
+     16 bit integers must be determined by observing the magic number at the
+     start of the header.  The 32 bit integers are still always stored with
+     the most significant word first, though, so each of those two, in the
+     struct shown above, was stored as an array of two 16 bit integers, in the
+     traditional order.  Those 16 bit integers, like all the others in the
+     struct, were accessed using a macro that byte swapped them if necessary.
+
+     Next, 7th Edition had more file types to store, and the IALLOC and ILARG
+     flag bits were re-purposed to accommodate these.  The revised use of the
+     various bits is as follows:
+
+     0170000  This masks the file type bits.
+     0140000  File type value for sockets.
+     0120000  File type value for symbolic links.  For symbolic links, the
+             link body is stored as file data.
+     0100000  File type value for regular files.
+     0060000  File type value for block special devices.
+     0040000  File type value for directories.
+     0020000  File type value for character special devices.
+     0010000  File type value for named pipes or FIFOs.
+     0004000  SUID bit.
+     0002000  SGID bit.
+     0001000  Sticky bit.
+     0000777  The lower 9 bits specify read/write/execute permissions for
+             world, group, and user following standard POSIX conventions.
+
+     Finally, the file size field now represents a signed 32 bit integer in
+     the underlying file system, so the maximum file size has increased to 2
+     gigabytes.
+
+     Note that there is no obvious way to tell which of the two binary formats
+     an archive uses, other than to see which one makes more sense.  The typi‐
+     cal error scenario is that a PWB format archive unpacked as if it were in
+     the new format will create named sockets instead of directories, and then
+     fail to unpack files that should go in those directories. Running
+     bsdcpio -itv on an unknown archive will make it obvious which it is: if
+     it's PWB format, directories will be listed with an 's' instead of a 'd'
+     as the first character of the mode string, and the larger files will have
+     a '?' in that position.
+
    Portable ASCII Format
-     Version 2 of the Single UNIX Specification ("SUSv2") standardized an
+     Version 2 of the Single UNIX Specification (“SUSv2”) standardized an
      ASCII variant that is portable across all platforms.  It is commonly
-     known as the "old character" format or as the "odc" format.  It stores
+     known as the “old character” format or as the “odc” format.  It stores
      the same numeric fields as the old binary format, but represents them as
      6-character or 11-character octal values.
 
@@ -126,16 +182,16 @@ DESCRIPTION
                   char    c_filesize[11];
           };
 
-     The fields are identical to those in the old binary format.  The name and
-     file body follow the fixed header.  Unlike the old binary format, there
-     is no additional padding after the pathname or file contents.  If the
-     files being archived are themselves entirely ASCII, then the resulting
-     archive will be entirely ASCII, except for the NUL byte that terminates
-     the name field.
+     The fields are identical to those in the new binary format.  The name and
+     file body follow the fixed header.  Unlike the binary formats, there is
+     no additional padding after the pathname or file contents.  If the files
+     being archived are themselves entirely ASCII, then the resulting archive
+     will be entirely ASCII, except for the NUL byte that terminates the name
+     field.
 
    New ASCII Format
      The "new" ASCII format uses 8-byte hexadecimal fields for all numbers and
-     separates device numbers into separate fields for major and minor num-
+     separates device numbers into separate fields for major and minor num
      bers.
 
           struct cpio_newc_header {
@@ -156,27 +212,27 @@ DESCRIPTION
           };
 
      Except as specified below, the fields here match those specified for the
-     old binary format above.
+     new binary format above.
 
-     magic   The string "070701".
+     magic   The string “070701”.
 
-     check   This field is always set to zero by writers and ignored by read-
+     check   This field is always set to zero by writers and ignored by read
             ers.  See the next section for more details.
 
      The pathname is followed by NUL bytes so that the total size of the fixed
      header plus pathname is a multiple of four.  Likewise, the file data is
      padded to a multiple of four bytes.  Note that this format supports only
-     4 gigabyte files (unlike the older ASCII format, which supports 8 giga-
+     4 gigabyte files (unlike the older ASCII format, which supports 8 giga
      byte files).
 
      In this format, hardlinked files are handled by setting the filesize to
      zero for each entry except the first one that appears in the archive.
 
    New CRC Format
-     The CRC format is identical to the new ASCII format described in the pre-
-     vious section except that the magic field is set to "070702" and the
+     The CRC format is identical to the new ASCII format described in the pre
+     vious section except that the magic field is set to “070702” and the
      check field is set to the sum of all bytes in the file data.  This sum is
-     computed treating all bytes as unsigned values and using unsigned arith-
+     computed treating all bytes as unsigned values and using unsigned arith
      metic.  Only the least-significant 32 bits of the sum are stored.
 
    HP variants
@@ -184,8 +240,8 @@ DESCRIPTION
      numbers differently XXX.
 
    Other Extensions and Variants
-     Sun Solaris uses additional file types to store extended file data, in-
-     cluding ACLs and extended attributes, as special entries in cpio ar-
+     Sun Solaris uses additional file types to store extended file data, in
+     cluding ACLs and extended attributes, as special entries in cpio ar
      chives.
 
      XXX Others? XXX
@@ -194,37 +250,38 @@ SEE ALSO
      cpio(1), tar(5)
 
 STANDARDS
-     The cpio utility is no longer a part of POSIX or the Single Unix Stan-
+     The cpio utility is no longer a part of POSIX or the Single Unix Stan
      dard.  It last appeared in Version 2 of the Single UNIX Specification
-     ("SUSv2").  It has been supplanted in subsequent standards by pax(1).
+     (“SUSv2”).  It has been supplanted in subsequent standards by pax(1).
      The portable ASCII format is currently part of the specification for the
      pax(1) utility.
 
 HISTORY
      The original cpio utility was written by Dick Haight while working in
      AT&T's Unix Support Group.  It appeared in 1977 as part of PWB/UNIX 1.0,
-     the "Programmer's Work Bench" derived from Version 6 AT&T UNIX that was
-     used internally at AT&T.  Both the old binary and old character formats
-     were in use by 1980, according to the System III source released by SCO
-     under their "Ancient Unix" license.  The character format was adopted as
-     part of IEEE Std 1003.1-1988 ("POSIX.1"). XXX when did "newc" appear?
-     Who invented it?  When did HP come out with their variant?  When did Sun
-     introduce ACLs and extended attributes? XXX
+     the “Programmer's Work Bench” derived from AT&T UNIX 6th Edition UNIX
+     that was used internally at AT&T. Both the new binary and old character
+     formats were in use by 1980, according to the System III source released
+     by SCO under their “Ancient Unix” license.  The character format was
+     adopted as part of IEEE Std 1003.1-1988 (“POSIX.1”).  XXX when did "newc"
+     appear?  Who invented it? When did HP come out with their variant?  When
+     did Sun introduce ACLs and extended attributes? XXX
 
 BUGS
-     The "CRC" format is mis-named, as it uses a simple checksum and not a
+     The “CRC” format is mis-named, as it uses a simple checksum and not a
      cyclic redundancy check.
 
-     The old binary format is limited to 16 bits for user id, group id, de-
-     vice, and inode numbers.  It is limited to 4 gigabyte file sizes.
+     The binary formats are limited to 16 bits for user id, group id, device,
+     and inode numbers.  They are limited to 16 megabyte and 2 gigabyte file
+     sizes for the older and newer variants, respectively.
 
-     The old ASCII format is limited to 18 bits for the user id, group id, de-
+     The old ASCII format is limited to 18 bits for the user id, group id, de
      vice, and inode numbers.  It is limited to 8 gigabyte file sizes.
 
      The new ASCII format is limited to 4 gigabyte file sizes.
 
      None of the cpio formats store user or group names, which are essential
-     when moving files between systems with dissimilar user or group number-
+     when moving files between systems with dissimilar user or group number
      ing.
 
      Especially when writing older cpio variants, it may be necessary to map
index 0892faf..92fb8d5 100644 (file)
@@ -1,16 +1,16 @@
 LIBARCHIVE-FORMATS(5)      BSD File Formats Manual      LIBARCHIVE-FORMATS(5)
 
 NAME
-     libarchive-formats -- archive formats supported by the libarchive library
+     libarchive-formats  archive formats supported by the libarchive library
 
 DESCRIPTION
      The libarchive(3) library reads and writes a variety of streaming archive
      formats.  Generally speaking, all of these archive formats consist of a
-     series of "entries".  Each entry stores a single file system object, such
+     series of “entries”.  Each entry stores a single file system object, such
      as a file, directory, or symbolic link.
 
      The following provides a brief description of each format supported by
-     libarchive, with some information about recognized extensions or limita-
+     libarchive, with some information about recognized extensions or limita
      tions of the current library support.  Note that just because a format is
      supported by libarchive does not imply that a program that uses
      libarchive will support that format.  Applications that use libarchive
@@ -19,7 +19,7 @@ DESCRIPTION
 
    Tar Formats
      The libarchive(3) library can read most tar archives.  It can write
-     POSIX-standard "ustar" and "pax interchange" formats as well as v7 tar
+     POSIX-standard “ustar” and “pax interchange” formats as well as v7 tar
      format and a subset of the legacy GNU tar format.
 
      All tar formats store each entry in one or more 512-byte records. The
@@ -27,7 +27,7 @@ DESCRIPTION
      and mode information, and the file data is stored in subsequent records.
      Later variants have extended this by either appropriating undefined areas
      of the header record, extending the header to multiple records, or by
-     storing special entries that modify the interpretation of subsequent en-
+     storing special entries that modify the interpretation of subsequent en
      tries.
 
      gnutar  The libarchive(3) library can read most GNU-format tar archives.
@@ -45,14 +45,14 @@ DESCRIPTION
             interchange format archives.  Pax interchange format archives are
             an extension of the older ustar format that adds a separate entry
             with additional attributes stored as key/value pairs immediately
-            before each regular entry.  The presence of these additional en-
+            before each regular entry.  The presence of these additional en
             tries is the only difference between pax interchange format and
             the older ustar format.  The extended attributes are of unlimited
             length and are stored as UTF-8 Unicode strings.  Keywords defined
-            in the standard are in all lowercase; vendors are allowed to de-
+            in the standard are in all lowercase; vendors are allowed to de
             fine custom keys by preceding them with the vendor name in all
             uppercase.  When writing pax archives, libarchive uses many of
-            the SCHILY keys defined by Joerg Schilling's "star" archiver and
+            the SCHILY keys defined by Joerg Schilling's “star” archiver and
             a few LIBARCHIVE keys.  The libarchive library can read most of
             the SCHILY keys and most of the GNU keys introduced by GNU tar.
             It silently ignores any keywords that it does not understand.
@@ -60,54 +60,54 @@ DESCRIPTION
             The pax interchange format converts filenames to Unicode and
             stores them using the UTF-8 encoding.  Prior to libarchive 3.0,
             libarchive erroneously assumed that the system wide-character
-            routines natively supported Unicode.  This caused it to mis-han-
-            dle non-ASCII filenames on systems that did not satisfy this as-
+            routines natively supported Unicode.  This caused it to mis-han
+            dle non-ASCII filenames on systems that did not satisfy this as
             sumption.
 
      restricted pax
             The libarchive library can also write pax archives in which it
-            attempts to suppress the extended attributes entry whenever pos-
+            attempts to suppress the extended attributes entry whenever pos
             sible.  The result will be identical to a ustar archive unless
             the extended attributes entry is required to store a long file
             name, long linkname, extended ACL, file flags, or if any of the
             standard ustar data (user name, group name, UID, GID, etc) cannot
-            be fully represented in the ustar header.  In all cases, the re-
-            sult can be dearchived by any program that can read POSIX-compli-
+            be fully represented in the ustar header.  In all cases, the re
+            sult can be dearchived by any program that can read POSIX-compli
             ant pax interchange format archives.  Programs that correctly
-            read ustar format (see below) will also be able to read this for-
+            read ustar format (see below) will also be able to read this for
             mat; any extended attributes will be extracted as separate files
             stored in PaxHeader directories.
 
      ustar   The libarchive library can both read and write this format.  This
             format has the following limitations:
-            o   Device major and minor numbers are limited to 21 bits.  Nodes
+            •         Device major and minor numbers are limited to 21 bits.  Nodes
                 with larger numbers will not be added to the archive.
-            o   Path names in the archive are limited to 255 bytes.  (Shorter
+            •         Path names in the archive are limited to 255 bytes.  (Shorter
                 if there is no / character in exactly the right place.)
-            o   Symbolic links and hard links are stored in the archive with
+            •         Symbolic links and hard links are stored in the archive with
                 the name of the referenced file.  This name is limited to 100
                 bytes.
-            o   Extended attributes, file flags, and other extended security
+            •         Extended attributes, file flags, and other extended security
                 information cannot be stored.
-            o   Archive entries are limited to 8 gigabytes in size.
-            Note that the pax interchange format has none of these restric-
-            tions.  The ustar format is old and widely supported.  It is rec-
+            •         Archive entries are limited to 8 gigabytes in size.
+            Note that the pax interchange format has none of these restric
+            tions.  The ustar format is old and widely supported.  It is rec
             ommended when compatibility is the primary concern.
 
-     v7      The libarchive library can read and write the legacy v7 tar for-
+     v7      The libarchive library can read and write the legacy v7 tar for
             mat.  This format has the following limitations:
-            o   Only regular files, directories, and symbolic links can be
-                archived.  Block and character device nodes, FIFOs, and sock-
+            •         Only regular files, directories, and symbolic links can be
+                archived.  Block and character device nodes, FIFOs, and sock
                 ets cannot be archived.
-            o   Path names in the archive are limited to 100 bytes.
-            o   Symbolic links and hard links are stored in the archive with
+            •         Path names in the archive are limited to 100 bytes.
+            •         Symbolic links and hard links are stored in the archive with
                 the name of the referenced file.  This name is limited to 100
                 bytes.
-            o   User and group information are stored as numeric IDs; there
+            •         User and group information are stored as numeric IDs; there
                 is no provision for storing user or group names.
-            o   Extended attributes, file flags, and other extended security
+            •         Extended attributes, file flags, and other extended security
                 information cannot be stored.
-            o   Archive entries are limited to 8 gigabytes in size.
+            •         Archive entries are limited to 8 gigabytes in size.
             Generally, users should prefer the ustar format for portability
             as the v7 tar format is both less useful and less portable.
 
@@ -119,8 +119,8 @@ DESCRIPTION
             The POSIX standards require fixed-length numeric fields to be
             written with some character position reserved for terminators.
             Libarchive allows these fields to be written without terminator
-            characters.  This extends the allowable range; in particular, us-
-            tar archives with this extension can support entries up to 64 gi-
+            characters.  This extends the allowable range; in particular, us
+            tar archives with this extension can support entries up to 64 gi
             gabytes in size.  Libarchive also recognizes base-256 values in
             most numeric fields.  This essentially removes all limitations on
             file size, modification time, and device numbers.
@@ -130,33 +130,37 @@ DESCRIPTION
             by Solaris tar.
 
      The first tar program appeared in Seventh Edition Unix in 1979.  The
-     first official standard for the tar file format was the "ustar" (Unix
+     first official standard for the tar file format was the “ustar” (Unix
      Standard Tar) format defined by POSIX in 1988.  POSIX.1-2001 extended the
-     ustar format to create the "pax interchange" format.
+     ustar format to create the “pax interchange” format.
 
    Cpio Formats
-     The libarchive library can read a number of common cpio variants and can
-     write "odc" and "newc" format archives.  A cpio archive stores each entry
-     as a fixed-size header followed by a variable-length filename and vari-
-     able-length data. Unlike the tar format, the cpio format does only mini-
-     mal padding of the header or file data.  There are several cpio variants,
-     which differ primarily in how they store the initial header: some store
-     the values as octal or hexadecimal numbers in ASCII, others as binary
-     values of varying byte order and length.
+     The libarchive library can read and write a number of common cpio vari‐
+     ants.  A cpio archive stores each entry as a fixed-size header followed
+     by a variable-length filename and variable-length data.  Unlike the tar
+     format, the cpio format does only minimal padding of the header or file
+     data.  There are several cpio variants, which differ primarily in how
+     they store the initial header: some store the values as octal or hexadec‐
+     imal numbers in ASCII, others as binary values of varying byte order and
+     length.
 
      binary  The libarchive library transparently reads both big-endian and
-            little-endian variants of the original binary cpio format.  This
-            format used 32-bit binary values for file size and mtime, and
-            16-bit binary values for the other fields.
-
-     odc     The libarchive library can both read and write this POSIX-stan-
-            dard format, which is officially known as the "cpio interchange
-            format" or the "octet-oriented cpio archive format" and sometimes
-            unofficially referred to as the "old character format".  This
-            format stores the header contents as octal values in ASCII.  It
-            is standard, portable, and immune from byte-order confusion.
-            File sizes and mtime are limited to 33 bits (8GB file size),
-            other fields are limited to 18 bits.
+            little-endian variants of the the two binary cpio formats; the
+            original one from PWB/UNIX, and the later, more widely used,
+            variant.  This format used 32-bit binary values for file size and
+            mtime, and 16-bit binary values for the other fields.  The for‐
+            mats support only the file types present in UNIX at the time of
+            their creation.  File sizes are limited to 24 bits in the PWB
+            format, because of the limits of the file system, and to 31 bits
+            in the newer binary format, where signed 32 bit longs were used.
+
+     odc     This is the POSIX standardized format, which is officially known
+            as the “cpio interchange format” or the “octet-oriented cpio
+            archive format” and sometimes unofficially referred to as the
+            “old character format”.  This format stores the header contents
+            as octal values in ASCII.  It is standard, portable, and immune
+            from byte-order confusion.  File sizes and mtime are limited to
+            33 bits (8GB file size), other fields are limited to 18 bits.
 
      SVR4/newc
             The libarchive library can read both CRC and non-CRC variants of
@@ -172,32 +176,32 @@ DESCRIPTION
      included in Version 7 AT&T Unix.  As a result, the tar command became
      much better known in universities and research groups that used Version
      7.  The combination of the find and cpio utilities provided very precise
-     control over file selection.  Unfortunately, the format has many limita-
+     control over file selection.  Unfortunately, the format has many limita
      tions that make it unsuitable for widespread use. Only the POSIX format
      permits files over 4GB, and its 18-bit limit for most other fields makes
      it unsuitable for modern systems. In addition, cpio formats only store
      numeric UID/GID values (not usernames and group names), which can make it
-     very difficult to correctly transfer archives across systems with dissim-
+     very difficult to correctly transfer archives across systems with dissim
      ilar user numbering.
 
    Shar Formats
-     A "shell archive" is a shell script that, when executed on a POSIX-com-
+     A “shell archive” is a shell script that, when executed on a POSIX-com‐
      pliant system, will recreate a collection of file system objects. The
      libarchive library can write two different kinds of shar archives:
 
      shar    The traditional shar format uses a limited set of POSIX commands,
             including echo(1), mkdir(1), and sed(1).  It is suitable for
-            portably archiving small collections of plain text files.  How-
+            portably archiving small collections of plain text files.  How
             ever, it is not generally well-suited for large archives (many
             implementations of sh(1) have limits on the size of a script) nor
             should it be used with non-text files.
 
      shardump
             This format is similar to shar but encodes files using
-            uuencode(1) so that the result will be a plain text file regard-
+            uuencode(1) so that the result will be a plain text file regard
             less of the file contents.  It also includes additional shell
             commands that attempt to reproduce as many file attributes as
-            possible, including owner, mode, and flags.  The additional com-
+            possible, including owner, mode, and flags.  The additional com
             mands used to restore file attributes make shardump archives less
             portable than plain shar archives.
 
@@ -206,15 +210,15 @@ DESCRIPTION
      CDROM images.  In many cases, this can remove the need to burn a physical
      CDROM just in order to read the files contained in an ISO9660 image.  It
      also avoids security and complexity issues that come with virtual mounts
-     and loopback devices.  Libarchive supports the most common Rockridge ex-
-     tensions and has partial support for Joliet extensions.  If both exten-
+     and loopback devices.  Libarchive supports the most common Rockridge ex
+     tensions and has partial support for Joliet extensions.  If both exten
      sions are present, the Joliet extensions will be used and the Rockridge
      extensions will be ignored.  In particular, this can create problems with
      hardlinks and symlinks, which are supported by Rockridge but not by
      Joliet.
 
      Libarchive reads ISO9660 images using a streaming strategy.  This allows
-     it to read compressed images directly (decompressing on the fly) and al-
+     it to read compressed images directly (decompressing on the fly) and al
      lows it to read images directly from network sockets, pipes, and other
      non-seekable data sources.  This strategy works well for optimized
      ISO9660 images created by many popular programs.  Such programs collect
@@ -222,39 +226,39 @@ DESCRIPTION
      be read from a physical disk with a minimum of seeking.  However, not all
      ISO9660 images can be read in this fashion.
 
-     Libarchive can also write ISO9660 images. Such images are fully opti-
+     Libarchive can also write ISO9660 images. Such images are fully opti
      mized with the directory information preceding all file data.  This is
-     done by storing all file data to a temporary file while collecting direc-
+     done by storing all file data to a temporary file while collecting direc
      tory information in memory.  When the image is finished, libarchive
-     writes out the directory structure followed by the file data.  The loca-
+     writes out the directory structure followed by the file data.  The loca
      tion used for the temporary file can be changed by the usual environment
      variables.
 
    Zip format
      Libarchive can read and write zip format archives that have uncompressed
-     entries and entries compressed with the "deflate" algorithm.  Other zip
+     entries and entries compressed with the “deflate” algorithm.  Other zip
      compression algorithms are not supported. It can extract jar archives,
      archives that use Zip64 extensions and self-extracting zip archives.
-     Libarchive can use either of two different strategies for reading Zip ar-
+     Libarchive can use either of two different strategies for reading Zip ar
      chives: a streaming strategy which is fast and can handle extremely large
-     archives, and a seeking strategy which can correctly process self-ex-
+     archives, and a seeking strategy which can correctly process self-ex
      tracting Zip archives and archives with deleted members or other in-place
      modifications.
 
      The streaming reader processes Zip archives as they are read.  It can
-     read archives of arbitrary size from tape or network sockets, and can de-
-     code Zip archives that have been separately compressed or encoded.  How-
+     read archives of arbitrary size from tape or network sockets, and can de
+     code Zip archives that have been separately compressed or encoded.  How
      ever, self-extracting Zip archives and archives with certain types of
      modifications cannot be correctly handled.  Such archives require that
-     the reader first process the Central Directory, which is ordinarily lo-
-     cated at the end of a Zip archive and is thus inaccessible to the stream-
+     the reader first process the Central Directory, which is ordinarily lo
+     cated at the end of a Zip archive and is thus inaccessible to the stream
      ing reader.  If the program using libarchive has enabled seek support,
      then libarchive will use this to processes the central directory first.
 
      In particular, the seeking reader must be used to correctly handle self-
      extracting archives.  Such archives consist of a program followed by a
-     regular Zip archive.  The streaming reader cannot parse the initial pro-
-     gram portion, but the seeking reader starts by reading the Central Direc-
+     regular Zip archive.  The streaming reader cannot parse the initial pro
+     gram portion, but the seeking reader starts by reading the Central Direc
      tory from the end of the archive. Similarly, Zip archives that have been
      modified in-place can have deleted entries or other garbage data that can
      only be accurately detected by first reading the Central Directory.
@@ -262,7 +266,7 @@ DESCRIPTION
    Archive (library) file format
      The Unix archive format (commonly created by the ar(1) archiver) is a
      general-purpose format which is used almost exclusively for object files
-     to be read by the link editor ld(1).  The ar format has never been stan-
+     to be read by the link editor ld(1).  The ar format has never been stan
      dardised. There are two common variants: the GNU format derived from
      SVR4, and the BSD format, which first appeared in 4.4BSD. The two differ
      primarily in their handling of filenames longer than 15 characters: the
@@ -272,17 +276,17 @@ DESCRIPTION
      may include both types of long filenames. Programs using libarchive can
      write GNU/SVR4 format if they provide an entry called // containing a
      filename table to be written into the archive before any of the entries.
-     Any entries whose names are not in the filename table will be written us-
+     Any entries whose names are not in the filename table will be written us
      ing BSD-style long filenames.  This can cause problems for programs such
      as GNU ld that do not support the BSD-style long filenames.
 
    mtree
      Libarchive can read and write files in mtree(5) format.  This format is
-     not a true archive format, but rather a textual description of a file hi-
-     erarchy in which each line specifies the name of a file and provides spe-
+     not a true archive format, but rather a textual description of a file hi
+     erarchy in which each line specifies the name of a file and provides spe
      cific metadata about that file.  Libarchive can read all of the keywords
      supported by both the NetBSD and FreeBSD versions of mtree(8), although
-     many of the keywords cannot currently be stored in an archive_entry ob-
+     many of the keywords cannot currently be stored in an archive_entry ob
      ject.  When writing, libarchive supports use of the
      archive_write_set_options(3) interface to specify which keywords should
      be included in the output.  If libarchive was compiled with access to
@@ -291,33 +295,33 @@ DESCRIPTION
      to the mtree writer.
 
      When reading an mtree file, libarchive will locate the corresponding
-     files on disk using the contents keyword if present or the regular file-
+     files on disk using the contents keyword if present or the regular file
      name.  If it can locate and open the file on disk, it will use that to
      fill in any metadata that is missing from the mtree file and will read
      the file contents and return those to the program using libarchive.  If
-     it cannot locate and open the file on disk, libarchive will return an er-
+     it cannot locate and open the file on disk, libarchive will return an er
      ror for any attempt to read the entry body.
 
    7-Zip
-     Libarchive can read and write 7-Zip format archives.  TODO: Need more in-
+     Libarchive can read and write 7-Zip format archives.  TODO: Need more in
      formation
 
    CAB
-     Libarchive can read Microsoft Cabinet ( "CAB") format archives.  TODO:
+     Libarchive can read Microsoft Cabinet ( “CAB”) format archives.  TODO:
      Need more information.
 
    LHA
      TODO: Information about libarchive's LHA support
 
    RAR
-     Libarchive has limited support for reading RAR format archives.  Cur-
+     Libarchive has limited support for reading RAR format archives.  Cur
      rently, libarchive can read RARv3 format archives which have been either
      created uncompressed, or compressed using any of the compression methods
      supported by the RARv3 format.  Libarchive can also read self-extracting
      RAR archives.
 
    Warc
-     Libarchive can read and write "web archives".  TODO: Need more informa-
+     Libarchive can read and write “web archives”.  TODO: Need more informa‐
      tion
 
    XAR
index 86130c9..b570d04 100644 (file)
@@ -1,63 +1,63 @@
 LIBARCHIVE(3)           BSD Library Functions Manual            LIBARCHIVE(3)
 
 NAME
-     libarchive -- functions for reading and writing streaming archives
+     libarchive  functions for reading and writing streaming archives
 
 OVERVIEW
      The libarchive library provides a flexible interface for reading and
      writing archives in various formats such as tar and cpio. libarchive
-     also supports reading and writing archives compressed using various com-
+     also supports reading and writing archives compressed using various com
      pression filters such as gzip and bzip2.  The library is inherently
      stream-oriented; readers serially iterate through the archive, writers
      serially add things to the archive.  In particular, note that there is
-     currently no built-in support for random access nor for in-place modifi-
+     currently no built-in support for random access nor for in-place modifi
      cation.
 
      When reading an archive, the library automatically detects the format and
      the compression.  The library currently has read support for:
-     o  old-style tar archives,
-     o  most variants of the POSIX "ustar" format,
-     o  the POSIX "pax interchange" format,
-     o  GNU-format tar archives,
-     o  most common cpio archive formats,
-     o  ISO9660 CD images (including RockRidge and Joliet extensions),
-     o  Zip archives,
-     o  ar archives (including GNU/SysV and BSD extensions),
-     o  Microsoft CAB archives,
-     o  LHA archives,
-     o  mtree file tree descriptions,
-     o  RAR archives,
-     o  XAR archives.
+     •        old-style tar archives,
+     •        most variants of the POSIX “ustar” format,
+     •        the POSIX “pax interchange” format,
+     •        GNU-format tar archives,
+     •        most common cpio archive formats,
+     •        ISO9660 CD images (including RockRidge and Joliet extensions),
+     •        Zip archives,
+     •        ar archives (including GNU/SysV and BSD extensions),
+     •        Microsoft CAB archives,
+     •        LHA archives,
+     •        mtree file tree descriptions,
+     •        RAR archives,
+     •        XAR archives.
      The library automatically detects archives compressed with gzip(1),
-     bzip2(1), xz(1), lzip(1), or compress(1) and decompresses them transpar-
+     bzip2(1), xz(1), lzip(1), or compress(1) and decompresses them transpar
      ently.  It can similarly detect and decode archives processed with
      uuencode(1) or which have an rpm(1) header.
 
      When writing an archive, you can specify the compression to be used and
      the format to use.  The library can write
-     o  POSIX-standard "ustar" archives,
-     o  POSIX "pax interchange format" archives,
-     o  POSIX octet-oriented cpio archives,
-     o  Zip archive,
-     o  two different variants of shar archives,
-     o  ISO9660 CD images,
-     o  7-Zip archives,
-     o  ar archives,
-     o  mtree file tree descriptions,
-     o  XAR archives.
+     •        POSIX-standard “ustar” archives,
+     •        POSIX “pax interchange format” archives,
+     •        cpio archives,
+     •        Zip archive,
+     •        two different variants of shar archives,
+     •        ISO9660 CD images,
+     •        7-Zip archives,
+     •        ar archives,
+     •        mtree file tree descriptions,
+     •        XAR archives.
      Pax interchange format is an extension of the tar archive format that
      eliminates essentially all of the limitations of historic tar formats in
-     a standard fashion that is supported by POSIX-compliant pax(1) implemen-
+     a standard fashion that is supported by POSIX-compliant pax(1) implemen
      tations on many systems as well as several newer implementations of
-     tar(1).  Note that the default write format will suppress the pax ex-
+     tar(1).  Note that the default write format will suppress the pax ex
      tended attributes for most entries; explicitly requesting pax format will
      enable those attributes for all entries.
 
-     The read and write APIs are accessed through the archive_read_XXX() func-
+     The read and write APIs are accessed through the archive_read_XXX() func
      tions and the archive_write_XXX() functions, respectively, and either can
      be used independently of the other.
 
-     The rest of this manual page provides an overview of the library opera-
+     The rest of this manual page provides an overview of the library opera
      tion.  More detailed information can be found in the individual manual
      pages for each API or utility function.
 
@@ -68,16 +68,16 @@ WRITING AN ARCHIVE
      See archive_write(3).
 
 WRITING ENTRIES TO DISK
-     The archive_write_disk(3) API allows you to write archive_entry(3) ob-
+     The archive_write_disk(3) API allows you to write archive_entry(3) ob
      jects to disk using the same API used by archive_write(3).  The
      archive_write_disk(3) API is used internally by archive_read_extract();
-     using it directly can provide greater control over how entries get writ-
-     ten to disk.  This API also makes it possible to share code between ar-
+     using it directly can provide greater control over how entries get writ
+     ten to disk.  This API also makes it possible to share code between ar
      chive-to-archive copy and archive-to-disk extraction operations.
 
 READING ENTRIES FROM DISK
      The archive_read_disk(3) supports for populating archive_entry(3) objects
-     from information in the filesystem.  This includes the information acces-
+     from information in the filesystem.  This includes the information acces
      sible from the stat(2) system call as well as ACLs, extended attributes,
      and other metadata.  The archive_read_disk(3) API also supports iterating
      over directory trees, which allows directories of files to be read using
@@ -87,14 +87,14 @@ DESCRIPTION
      Detailed descriptions of each function are provided by the corresponding
      manual pages.
 
-     All of the functions utilize an opaque struct archive datatype that pro-
+     All of the functions utilize an opaque struct archive datatype that pro
      vides access to the archive contents.
 
      The struct archive_entry structure contains a complete description of a
-     single archive entry.  It uses an opaque interface that is fully docu-
+     single archive entry.  It uses an opaque interface that is fully docu
      mented in archive_entry(3).
 
-     Users familiar with historic formats should be aware that the newer vari-
+     Users familiar with historic formats should be aware that the newer vari
      ants have eliminated most restrictions on the length of textual fields.
      Clients should not assume that filenames, link names, user names, or
      group names are limited in length.  In particular, pax interchange format
@@ -106,12 +106,12 @@ RETURN VALUES
      The return value indicates the general severity of the error, ranging
      from ARCHIVE_WARN, which indicates a minor problem that should probably
      be reported to the user, to ARCHIVE_FATAL, which indicates a serious
-     problem that will prevent any further operations on this archive. On er-
+     problem that will prevent any further operations on this archive. On er
      ror, the archive_errno() function can be used to retrieve a numeric error
      code (see errno(2)).  The archive_error_string() returns a textual error
      message suitable for display.
 
-     archive_read_new() and archive_write_new() return pointers to an allo-
+     archive_read_new() and archive_write_new() return pointers to an allo
      cated and initialized struct archive object.
 
      archive_read_data() and archive_write_data() return a count of the number
@@ -137,14 +137,14 @@ AUTHORS
 
 BUGS
      Some archive formats support information that is not supported by struct
-     archive_entry.  Such information cannot be fully archived or restored us-
+     archive_entry.  Such information cannot be fully archived or restored us
      ing this library. This includes, for example, comments, character sets,
-     or the arbitrary key/value pairs that can appear in pax interchange for-
+     or the arbitrary key/value pairs that can appear in pax interchange for
      mat archives.
 
      Conversely, of course, not all of the information that can be stored in
      an struct archive_entry is supported by all formats.  For example, cpio
-     formats do not support nanosecond timestamps; old tar formats do not sup-
+     formats do not support nanosecond timestamps; old tar formats do not sup
      port large device numbers.
 
      The ISO9660 reader cannot yet read all ISO9660 images; it should learn
index 70e4cdd..fff1b3e 100644 (file)
@@ -1,7 +1,7 @@
 LIBARCHIVE_CHANGES(3)   BSD Library Functions Manual    LIBARCHIVE_CHANGES(3)
 
 NAME
-     libarchive_changes -- changes in libarchive interface
+     libarchive_changes  changes in libarchive interface
 
 CHANGES IN LIBARCHIVE 3
      This page describes user-visible changes in libarchive3, and lists public
@@ -9,7 +9,7 @@ CHANGES IN LIBARCHIVE 3
      libarchive3, along with their replacements if any.
 
    Multiple Filters
-     Libarchive2 permitted a single (input or output) filter active on an ar-
+     Libarchive2 permitted a single (input or output) filter active on an ar
      chive.  Libarchive3 extends this into a variable-length stack.  Where
      archive_write_set_compression_XXX() would replace any existing filter,
      archive_write_add_filter_XXX() extends the write pipeline with another
@@ -18,28 +18,28 @@ CHANGES IN LIBARCHIVE 3
    Character Set Handling
      Libarchive2 assumed that the local platform uses Unicode as the native
      wchar_t encoding, which is true on Windows, modern Linux, and a few other
-     systems, but is certainly not universal.  As a result, pax format ar-
-     chives were written incorrectly on some systems, since pax format re-
+     systems, but is certainly not universal.  As a result, pax format ar
+     chives were written incorrectly on some systems, since pax format re
      quires UTF-8 and libarchive 2 incorrectly assumed that wchar_t strings
      can be easily converted to UTF-8.
 
      Libarchive3 uses the standard iconv library to convert between character
-     sets and is introducing the notion of a "default character set for the
-     archive". To support this, archive_entry objects can now be bound to a
+     sets and is introducing the notion of a default character set for the
+     archive”.       To support this, archive_entry objects can now be bound to a
      particular archive when they are created. The automatic character set
      conversions performed by archive_entry objects when reading and writing
-     filenames, usernames, and other strings will now use an appropriate de-
+     filenames, usernames, and other strings will now use an appropriate de
      fault character set:
 
-     If the archive_entry object is bound to an archive, it will use the de-
+     If the archive_entry object is bound to an archive, it will use the de
      fault character set for that archive.
 
      The platform default character encoding (as returned by
      nl_langinfo(CHARSET)) will be used if nothing else is specified.
 
-     Libarchive3 also introduces charset options to many of the archive read-
-     ers and writers to control the character set that will be used for file-
-     names written in those archives.  When possible, this will be set auto-
+     Libarchive3 also introduces charset options to many of the archive read
+     ers and writers to control the character set that will be used for file
+     names written in those archives.  When possible, this will be set auto
      matically based on information in the archive itself.  Combining this
      with the notion of a default character set for the archive should allow
      you to configure libarchive to read archives from other platforms and
@@ -54,13 +54,13 @@ CHANGES IN LIBARCHIVE 3
 
      There are a few cases where these changes will affect your source code:
 
-     o   In some cases, libarchive's wider types will introduce the possibil-
+     •         In some cases, libarchive's wider types will introduce the possibil‐
          ity of truncation: for example, on a system with a 16-bit uid_t, you
          risk having uid 65536 be truncated to uid 0, which can cause serious
          security problems.
 
-     o   Typedef function pointer types will be incompatible.  For example,
-         if you define custom skip callbacks, you may have to use code simi-
+     •         Typedef function pointer types will be incompatible.  For example,
+         if you define custom skip callbacks, you may have to use code simi
          lar to the following if you want to support building against
          libarchive2 and libarchive3:
 
@@ -78,19 +78,19 @@ CHANGES IN LIBARCHIVE 3
 
      Affected functions:
 
-     o  archive_entry_gid(), archive_entry_set_gid()
-     o  archive_entry_uid(), archive_entry_set_uid()
-     o  archive_entry_ino(), archive_entry_set_ino()
-     o  archive_read_data_block(), archive_write_data_block()
-     o  archive_read_disk_gname(), archive_read_disk_uname()
-     o  archive_read_disk_set_gname_lookup(),
+     •        archive_entry_gid(), archive_entry_set_gid()
+     •        archive_entry_uid(), archive_entry_set_uid()
+     •        archive_entry_ino(), archive_entry_set_ino()
+     •        archive_read_data_block(), archive_write_data_block()
+     •        archive_read_disk_gname(), archive_read_disk_uname()
+     •        archive_read_disk_set_gname_lookup(),
         archive_read_disk_set_group_lookup(),
         archive_read_disk_set_uname_lookup(),
         archive_read_disk_set_user_lookup()
-     o  archive_skip_callback()
-     o  archive_read_extract_set_skip_file(),
+     •        archive_skip_callback()
+     •        archive_read_extract_set_skip_file(),
         archive_write_disk_set_skip_file(), archive_write_set_skip_file()
-     o  archive_write_disk_set_group_lookup(),
+     •        archive_write_disk_set_group_lookup(),
         archive_write_disk_set_user_lookup()
 
      Where these functions or their arguments took or returned gid_t, ino_t,
index 7ba6f0c..d649ab8 100644 (file)
@@ -1,12 +1,12 @@
 LIBARCHIVE_INTERNALS(3)  BSD Library Functions Manual  LIBARCHIVE_INTERNALS(3)
 
 NAME
-     libarchive_internals -- description of libarchive internal interfaces
+     libarchive_internals  description of libarchive internal interfaces
 
 OVERVIEW
      The libarchive library provides a flexible interface for reading and
      writing streaming archive files such as tar and cpio.  Internally, it
-     follows a modular layered design that should make it easy to add new ar-
+     follows a modular layered design that should make it easy to add new ar
      chive and compression formats.
 
 GENERAL ARCHITECTURE
@@ -17,7 +17,7 @@ GENERAL ARCHITECTURE
      files, and write them to disk.  (There are plans to add a facility to
      read archive_entry(3) objects from disk as well.)
 
-     The read and write APIs each have four layers: a public API layer, a for-
+     The read and write APIs each have four layers: a public API layer, a for
      mat layer that understands the archive file format, a compression layer,
      and an I/O layer. The I/O layer is completely exposed to clients who can
      replace it entirely with their own functions.
@@ -29,24 +29,24 @@ GENERAL ARCHITECTURE
 
 READ ARCHITECTURE
      From the outside, clients use the archive_read(3) API to manipulate an
-     archive object to read entries and bodies from an archive stream. Inter-
+     archive object to read entries and bodies from an archive stream. Inter
      nally, the archive object is cast to an archive_read object, which holds
      all read-specific data.  The API has four layers: The lowest layer is the
      I/O layer.  This layer can be overridden by clients, but most clients use
      the packaged I/O callbacks provided, for example, by
-     archive_read_open_memory(3), and archive_read_open_fd(3). The compres-
+     archive_read_open_memory(3), and archive_read_open_fd(3). The compres
      sion layer calls the I/O layer to read bytes and decompresses them for
      the format layer. The format layer unpacks a stream of uncompressed
      bytes and creates archive_entry objects from the incoming data.  The API
      layer tracks overall state (for example, it prevents clients from reading
      data before reading a header) and invokes the format and compression
      layer operations through registered function pointers.  In particular,
-     the API layer drives the format-detection process: When opening the ar-
+     the API layer drives the format-detection process: When opening the ar
      chive, it reads an initial block of data and offers it to each registered
      compression handler.  The one with the highest bid is initialized with
      the first block.  Similarly, the format handlers are polled to see which
-     handler is the best for each archive.  (Prior to 2.4.0, the format bid-
-     ders were invoked for each entry, but this design hindered error recov-
+     handler is the best for each archive.  (Prior to 2.4.0, the format bid
+     ders were invoked for each entry, but this design hindered error recov
      ery.)
 
    I/O Layer and Client Callbacks
@@ -61,7 +61,7 @@ READ ARCHITECTURE
      The client skip callback returns the number of bytes actually skipped,
      which may be much smaller than the skip requested.  The only requirement
      is that the skip not be larger.  In particular, clients are allowed to
-     return zero for any skip that they don't want to handle.  The skip call-
+     return zero for any skip that they don't want to handle.  The skip call
      back must never be invoked with a negative value.
 
      Keep in mind that not all clients are reading from disk: clients reading
@@ -73,10 +73,10 @@ READ ARCHITECTURE
 
    Decompresssion Layer
      The decompression layer not only handles decompression, it also buffers
-     data so that the format handlers see a much nicer I/O model.  The decom-
+     data so that the format handlers see a much nicer I/O model.  The decom
      pression API is a two stage peek/consume model.  A read_ahead request
      specifies a minimum read amount; the decompression layer must provide a
-     pointer to at least that much data.  If more data is immediately avail-
+     pointer to at least that much data.  If more data is immediately avail
      able, it should return more: the format layer handles bulk data reads by
      asking for a minimum of one byte and then copying as much data as is
      available.
@@ -92,27 +92,27 @@ READ ARCHITECTURE
 
      A decompression handler has a specific lifecycle:
      Registration/Configuration
-            When the client invokes the public support function, the decom-
+            When the client invokes the public support function, the decom
             pression handler invokes the internal
             __archive_read_register_compression() function to provide bid and
             initialization functions.  This function returns NULL on error or
-            else a pointer to a struct decompressor_t.  This structure con-
-            tains a void * config slot that can be used for storing any cus-
+            else a pointer to a struct decompressor_t.  This structure con
+            tains a void * config slot that can be used for storing any cus
             tomization information.
      Bid     The bid function is invoked with a pointer and size of a block of
             data.  The decompressor can access its config data through the
-            decompressor element of the archive_read object.  The bid func-
+            decompressor element of the archive_read object.  The bid func
             tion is otherwise stateless.  In particular, it must not perform
             any I/O operations.
 
             The value returned by the bid function indicates its suitability
             for handling this data stream.  A bid of zero will ensure that
             this decompressor is never invoked.  Return zero if magic number
-            checks fail.  Otherwise, your initial implementation should re-
+            checks fail.  Otherwise, your initial implementation should re
             turn the number of bits actually checked.  For example, if you
             verify two full bytes and three bits of another byte, bid 19.
             Note that the initial block may be very short; be careful to only
-            inspect the data you are given.  (The current decompressors re-
+            inspect the data you are given.  (The current decompressors re
             quire two bytes for correct bidding.)
      Initialize
             The winning bidder will have its init function called.  This
@@ -139,8 +139,8 @@ READ ARCHITECTURE
      Bid     Formats bid by invoking the read_ahead() decompression method but
             not calling the consume() method.  This allows each bidder to
             look ahead in the input stream.  Bidders should not look further
-            ahead than necessary, as long look aheads put pressure on the de-
-            compression layer to buffer lots of data.  Most formats only re-
+            ahead than necessary, as long look aheads put pressure on the de
+            compression layer to buffer lots of data.  Most formats only re
             quire a few hundred bytes of look ahead; look aheads of a few
             kilobytes are reasonable.  (The ISO9660 reader sometimes looks
             ahead by 48k, which should be considered an upper limit.)
@@ -158,7 +158,7 @@ READ ARCHITECTURE
             The read data interface supports sparse files; this requires that
             each call return a block of data specifying the file offset and
             size.  This may require you to carefully track the location so
-            that you can return accurate file offsets for each read.  Remem-
+            that you can return accurate file offsets for each read.  Remem
             ber that the decompressor will return as much data as it has.
             Generally, you will want to request one byte, examine the return
             value to see how much data is available, and possibly trim that
@@ -166,11 +166,11 @@ READ ARCHITECTURE
             block just before you return it.
      Skip All Data
             The skip data call should skip over all file data and trailing
-            padding.  This is called automatically by the API layer just be-
+            padding.  This is called automatically by the API layer just be
             fore each header read.  It is also called in response to the
             client calling the public data_skip() function.
      Cleanup
-            On cleanup, the format should release all of its allocated mem-
+            On cleanup, the format should release all of its allocated mem
             ory.
 
    API Layer
@@ -179,7 +179,7 @@ READ ARCHITECTURE
 WRITE ARCHITECTURE
      The write API has a similar set of four layers: an API layer, a format
      layer, a compression layer, and an I/O layer.  The registration here is
-     much simpler because only one format and one compression can be regis-
+     much simpler because only one format and one compression can be regis
      tered at a time.
 
    I/O Layer and Client Callbacks
@@ -200,12 +200,12 @@ WRITE_DISK ARCHITECTURE
      not layered internally.
 
 GENERAL SERVICES
-     The archive_read, archive_write, and archive_write_disk objects all con-
+     The archive_read, archive_write, and archive_write_disk objects all con
      tain an initial archive object which provides common support for a set of
      standard services.  (Recall that ANSI/ISO C90 guarantees that you can
      cast freely between a pointer to a structure and a pointer to the first
      element of that structure.)  The archive object has a magic value that
-     indicates which API this object is associated with, slots for storing er-
+     indicates which API this object is associated with, slots for storing er
      ror information, and function pointers for virtualized API functions.
 
 MISCELLANEOUS NOTES
@@ -217,12 +217,12 @@ MISCELLANEOUS NOTES
      very different approaches.
 
      For example, libarchive's ISO9660 support operates very differently from
-     most ISO9660 readers.  The libarchive support utilizes a work-queue de-
+     most ISO9660 readers.  The libarchive support utilizes a work-queue de
      sign that keeps a list of known entries sorted by their location in the
      input.  Whenever libarchive's ISO9660 implementation is asked for the
-     next header, checks this list to find the next item on the disk.  Direc-
+     next header, checks this list to find the next item on the disk.  Direc
      tories are parsed when they are encountered and new items are added to
-     the list. This design relies heavily on the ISO9660 image being opti-
+     the list. This design relies heavily on the ISO9660 image being opti
      mized so that directories always occur earlier on the disk than the files
      they describe.
 
index 901b1b5..f9e309f 100644 (file)
@@ -1,7 +1,7 @@
 MTREE(5)                   BSD File Formats Manual                   MTREE(5)
 
 NAME
-     mtree -- format of mtree dir hierarchy files
+     mtree  format of mtree dir hierarchy files
 
 DESCRIPTION
      The mtree format is a textual format that describes a collection of
@@ -13,9 +13,9 @@ DESCRIPTION
      about a single filesystem object. Leading whitespace is always ignored.
 
      When encoding file or pathnames, any backslash character or character
-     outside of the 95 printable ASCII characters must be encoded as a back-
-     slash followed by three octal digits.  When reading mtree files, any ap-
-     pearance of a backslash followed by three octal digits should be con-
+     outside of the 95 printable ASCII characters must be encoded as a back
+     slash followed by three octal digits.  When reading mtree files, any ap
+     pearance of a backslash followed by three octal digits should be con
      verted into the corresponding character.
 
      Each line is interpreted independently as one of the following types:
@@ -28,22 +28,22 @@ DESCRIPTION
                 the interpretation of later lines.
 
      Relative   If the first whitespace-delimited word has no / characters,
-                it is the name of a file in the current directory.  Any rela-
-                tive entry that describes a directory changes the current di-
+                it is the name of a file in the current directory.  Any rela
+                tive entry that describes a directory changes the current di
                 rectory.
 
      dot-dot    As a special case, a relative entry with the filename ..
-                changes the current directory to the parent directory.  Op-
+                changes the current directory to the parent directory.  Op
                 tions on dot-dot entries are always ignored.
 
-     Full       If the first whitespace-delimited word has a / character af-
-                ter the first character, it is the pathname of a file rela-
+     Full       If the first whitespace-delimited word has a / character af
+                ter the first character, it is the pathname of a file rela
                 tive to the starting directory.  There can be multiple full
                 entries describing the same file.
 
-     Some tools that process mtree files may require that multiple lines de-
+     Some tools that process mtree files may require that multiple lines de
      scribing the same file occur consecutively.  It is not permitted for the
-     same file to be mentioned using both a relative and a full file specifi-
+     same file to be mentioned using both a relative and a full file specifi
      cation.
 
    Special commands
@@ -52,23 +52,23 @@ DESCRIPTION
      /set       This command defines default values for one or more keywords.
                 It is followed on the same line by one or more whitespace-
                 separated keyword definitions.  These definitions apply to
-                all following files that do not specify a value for that key-
+                all following files that do not specify a value for that key
                 word.
 
      /unset     This command removes any default value set by a previous /set
-                command.  It is followed on the same line by one or more key-
+                command.  It is followed on the same line by one or more key
                 words separated by whitespace.
 
    Keywords
      After the filename, a full or relative entry consists of zero or more
      whitespace-separated keyword definitions. Each such 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-
+     a value.  Software programs reading mtree files should warn about unrec
      ognized keywords.
 
      Currently supported keywords are as follows:
 
-     cksum      The checksum of the file using the default algorithm speci-
+     cksum      The checksum of the file using the default algorithm speci
                 fied by the cksum(1) utility.
 
      device     The device number for block or char file types.  The value
@@ -91,9 +91,9 @@ DESCRIPTION
      contents   The full pathname of a file that holds the contents of this
                 file.
 
-     flags      The file flags as a symbolic name.  See chflags(1) for infor-
+     flags      The file flags as a symbolic name.  See chflags(1) for infor
                 mation on these names.  If no flags are to be set the string
-                "none" may be used to override the current default.
+                “none” may be used to override the current default.
 
      gid        The file group as a numeric value.
 
@@ -109,7 +109,7 @@ DESCRIPTION
 
      md5digest  A synonym for md5.
 
-     mode       The current file's permissions as a numeric (octal) or sym-
+     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.
@@ -120,7 +120,7 @@ DESCRIPTION
      optional   The file is optional; do not complain about the file if it is
                 not in the file hierarchy.
 
-     resdevice  The "resident" device number of the file, e.g. the ID of the
+     resdevice  The “resident” device number of the file, e.g. the ID of the
                 device that contains the file.  Its format is the same as the
                 one for device.
 
@@ -132,21 +132,21 @@ DESCRIPTION
      rmd160digest
                 A synonym for ripemd160digest.
 
-     sha1       The FIPS 160-1 ("SHA-1") message digest of the file.
+     sha1       The FIPS 160-1 (“SHA-1”) message digest of the file.
 
      sha1digest  A synonym for sha1.
 
-     sha256     The FIPS 180-2 ("SHA-256") message digest of the file.
+     sha256     The FIPS 180-2 (“SHA-256”) message digest of the file.
 
      sha256digest
                 A synonym for sha256.
 
-     sha384     The FIPS 180-2 ("SHA-384") message digest of the file.
+     sha384     The FIPS 180-2 (“SHA-384”) message digest of the file.
 
      sha384digest
                 A synonym for sha384.
 
-     sha512     The FIPS 180-2 ("SHA-512") message digest of the file.
+     sha512     The FIPS 180-2 (“SHA-512”) message digest of the file.
 
      sha512digest
                 A synonym for sha512.
@@ -178,7 +178,7 @@ HISTORY
      can spoof cksum(1).  The SHA-1 and RIPEMD160 digests were added in
      FreeBSD 4.0, as new attacks have demonstrated weaknesses in MD5.  The
      SHA-256 digest was added in FreeBSD 6.0.  Support for file flags was
-     added in FreeBSD 4.0, and mostly comes from NetBSD.  The "full" entry
+     added in FreeBSD 4.0, and mostly comes from NetBSD.  The “full” entry
      format was added by NetBSD.
 
 BSD                           September 4, 2013                           BSD
index afc3cdf..72aaee1 100644 (file)
@@ -1,7 +1,7 @@
 TAR(5)                     BSD File Formats Manual                     TAR(5)
 
 NAME
-     tar -- format of tape archive files
+     tar  format of tape archive files
 
 DESCRIPTION
      The tar archive format collects any number of files, directories, and
@@ -14,17 +14,17 @@ DESCRIPTION
      A tar archive consists of a series of 512-byte records.  Each file system
      object requires a header record which stores basic metadata (pathname,
      owner, permissions, etc.) and zero or more records containing any file
-     data.  The end of the archive is indicated by two records consisting en-
+     data.  The end of the archive is indicated by two records consisting en
      tirely of zero bytes.
 
      For compatibility with tape drives that use fixed block sizes, programs
      that read or write tar files always read or write a fixed number of
-     records with each I/O operation.  These "blocks" are always a multiple of
-     the record size.  The maximum block size supported by early implementa-
+     records with each I/O operation.  These “blocks” are always a multiple of
+     the record size.  The maximum block size supported by early implementa
      tions was 10240 bytes or 20 records.  This is still the default for most
      implementations although block sizes of 1MiB (2048 records) or larger are
      commonly used with modern high-speed tape drives. (Note: the terms
-     "block" and "record" here are not entirely standard; this document fol-
+     “block” and “record” here are not entirely standard; this document fol‐
      lows the convention established by John Gilmore in documenting pdtar.)
 
    Old-Style Archive Format
@@ -50,10 +50,10 @@ DESCRIPTION
           };
      All unused bytes in the header record are filled with nulls.
 
-     name    Pathname, stored as a null-terminated string.  Early tar imple-
+     name    Pathname, stored as a null-terminated string.  Early tar imple
             mentations only stored regular files (including hardlinks to
             those files).  One common early convention used a trailing "/"
-            character to indicate a directory name, allowing directory per-
+            character to indicate a directory name, allowing directory per
             missions and owner information to be archived and restored.
 
      mode    File mode, stored as an octal number in ASCII.
@@ -67,7 +67,7 @@ DESCRIPTION
             when extracting hardlinks.  Modern writers should always store a
             zero length for hardlink entries.
 
-     mtime   Modification time of file, as an octal number in ASCII.  This in-
+     mtime   Modification time of file, as an octal number in ASCII.  This in
             dicates the number of seconds since the start of the epoch,
             00:00:00 UTC January 1, 1970.  Note that negative values should
             be avoided here, as they are handled inconsistently.
@@ -78,7 +78,7 @@ DESCRIPTION
             bytes in the header using unsigned arithmetic.  This field should
             be stored as six octal digits followed by a null and a space
             character.  Note that many early implementations of tar used
-            signed arithmetic for the checksum field, which can cause inter-
+            signed arithmetic for the checksum field, which can cause inter
             operability problems when transferring archives between systems.
             Modern robust readers compute the checksum both ways and accept
             the header if either computation matches.
@@ -87,7 +87,7 @@ DESCRIPTION
             In order to preserve hardlinks and conserve tape, a file with
             multiple links is only written to the archive the first time it
             is encountered.  The next time it is encountered, the linkflag is
-            set to an ASCII '1' and the linkname field holds the first name
+            set to an ASCII ‘1’ and the linkname field holds the first name
             under which this file appears.  (Note that regular files have a
             null value in the linkflag field.)
 
@@ -96,30 +96,30 @@ DESCRIPTION
      (this is also documented in early BSD manpages): the pathname must be
      null-terminated; the mode, uid, and gid fields must end in a space and a
      null byte; the size and mtime fields must end in a space; the checksum is
-     terminated by a null and a space. Early implementations filled the nu-
-     meric fields with leading spaces. This seems to have been common prac-
-     tice until the IEEE Std 1003.1-1988 ("POSIX.1") standard was released.
+     terminated by a null and a space. Early implementations filled the nu
+     meric fields with leading spaces. This seems to have been common prac
+     tice until the IEEE Std 1003.1-1988 (“POSIX.1”) standard was released.
      For best portability, modern implementations should fill the numeric
      fields with leading zeros.
 
    Pre-POSIX Archives
-     An early draft of IEEE Std 1003.1-1988 ("POSIX.1") served as the basis
+     An early draft of IEEE Std 1003.1-1988 (“POSIX.1”) served as the basis
      for John Gilmore's pdtar program and many system implementations from the
      late 1980s and early 1990s.  These archives generally follow the POSIX
      ustar format described below with the following variations:
-     o      The magic value consists of the five characters "ustar" followed
-            by a space.  The version field contains a space character fol-
+     •            The magic value consists of the five characters “ustar” followed
+            by a space.  The version field contains a space character fol
             lowed by a null.
-     o      The numeric fields are generally filled with leading spaces (not
+     •            The numeric fields are generally filled with leading spaces (not
             leading zeros as recommended in the final standard).
-     o      The prefix field is often not used, limiting pathnames to the 100
+     •            The prefix field is often not used, limiting pathnames to the 100
             characters of old-style archives.
 
    POSIX ustar Archives
-     IEEE Std 1003.1-1988 ("POSIX.1") defined a standard tar file format to be
+     IEEE Std 1003.1-1988 (“POSIX.1”) defined a standard tar file format to be
      read and written by compliant implementations of tar(1).  This format is
-     often called the "ustar" format, after the magic value used in the
-     header.  (The name is an acronym for "Unix Standard TAR".)  It extends
+     often called the “ustar” format, after the magic value used in the
+     header.  (The name is an acronym for “Unix Standard TAR”.)  It extends
      the historic format with new fields:
 
           struct header_posix_ustar {
@@ -145,36 +145,36 @@ DESCRIPTION
      typeflag
             Type of entry.  POSIX extended the earlier linkflag field with
             several new type values:
-            "0"     Regular file.  NUL should be treated as a synonym, for
+            “0”     Regular file.  NUL should be treated as a synonym, for
                     compatibility purposes.
-            "1"     Hard link.
-            "2"     Symbolic link.
-            "3"     Character device node.
-            "4"     Block device node.
-            "5"     Directory.
-            "6"     FIFO node.
-            "7"     Reserved.
-            Other   A POSIX-compliant implementation must treat any unrecog-
+            “1”     Hard link.
+            “2”     Symbolic link.
+            “3”     Character device node.
+            “4”     Block device node.
+            “5”     Directory.
+            “6”     FIFO node.
+            “7”     Reserved.
+            Other   A POSIX-compliant implementation must treat any unrecog
                     nized typeflag value as a regular file.  In particular,
-                    writers should ensure that all entries have a valid file-
+                    writers should ensure that all entries have a valid file
                     name so that they can be restored by readers that do not
                     support the corresponding extension.  Uppercase letters
                     "A" through "Z" are reserved for custom extensions.  Note
                     that sockets and whiteout entries are not archivable.
-            It is worth noting that the size field, in particular, has dif-
+            It is worth noting that the size field, in particular, has dif
             ferent meanings depending on the type.  For regular files, of
             course, it indicates the amount of data following the header.
             For directories, it may be used to indicate the total size of all
-            files in the directory, for use by operating systems that pre-al-
+            files in the directory, for use by operating systems that pre-al
             locate directory space.  For all other types, it should be set to
             zero by writers and ignored by readers.
 
-     magic   Contains the magic value "ustar" followed by a NUL byte to indi-
-            cate that this is a POSIX standard archive.  Full compliance re-
+     magic   Contains the magic value “ustar” followed by a NUL byte to indi‐
+            cate that this is a POSIX standard archive.  Full compliance re
             quires the uname and gname fields be properly set.
 
      version
-            Version.  This should be "00" (two copies of the ASCII digit
+            Version.  This should be “00” (two copies of the ASCII digit
             zero) for POSIX standard archives.
 
      uname, gname
@@ -183,7 +183,7 @@ DESCRIPTION
             set and the corresponding names exist on the system.
 
      devmajor, devminor
-            Major and minor numbers for character device or block device en-
+            Major and minor numbers for character device or block device en
             try.
 
      name, prefix
@@ -193,12 +193,12 @@ DESCRIPTION
             is not empty, the reader will prepend the prefix value and a /
             character to the regular name field to obtain the full pathname.
             The standard does not require a trailing / character on directory
-            names, though most implementations still include this for compat-
+            names, though most implementations still include this for compat
             ibility reasons.
 
      Note that all unused bytes must be set to NUL.
 
-     Field termination is specified slightly differently by POSIX than by pre-
+     Field termination is specified slightly differently by POSIX than by pre
      vious implementations.  The magic, uname, and gname fields must have a
      trailing NUL.  The pathname, linkname, and prefix fields must have a
      trailing NUL unless they fill the entire field.  (In particular, it is
@@ -207,7 +207,7 @@ DESCRIPTION
      the front, and requires them to be terminated with either space or NUL
      characters.
 
-     Currently, most tar implementations comply with the ustar format, occa-
+     Currently, most tar implementations comply with the ustar format, occa
      sionally extending it by adding new fields to the blank area at the end
      of the header record.
 
@@ -221,37 +221,37 @@ DESCRIPTION
      the twelfth byte for a trailing NUL character.  Allowing 12 octal digits
      allows file sizes up to 64 GB.
 
-     Another extension, utilized by GNU tar, star, and other newer tar imple-
+     Another extension, utilized by GNU tar, star, and other newer tar imple
      mentations, permits binary numbers in the standard numeric fields.  This
      is flagged by setting the high bit of the first byte.  The remainder of
      the field is treated as a signed twos-complement value.  This permits
      95-bit values for the length and time fields and 63-bit values for the
      uid, gid, and device numbers.  In particular, this provides a consistent
      way to handle negative time values.  GNU tar supports this extension for
-     the length, mtime, ctime, and atime fields.  Joerg Schilling's star pro-
+     the length, mtime, ctime, and atime fields.  Joerg Schilling's star pro
      gram and the libarchive library support this extension for all numeric
      fields.  Note that this extension is largely obsoleted by the extended
      attribute record provided by the pax interchange format.
 
      Another early GNU extension allowed base-64 values rather than octal.
-     This extension was short-lived and is no longer supported by any imple-
+     This extension was short-lived and is no longer supported by any imple
      mentation.
 
    Pax Interchange Format
      There are many attributes that cannot be portably stored in a POSIX ustar
-     archive.  IEEE Std 1003.1-2001 ("POSIX.1") defined a "pax interchange
-     format" that uses two new types of entries to hold text-formatted meta-
-     data that applies to following entries.  Note that a pax interchange for-
+     archive.  IEEE Std 1003.1-2001 (“POSIX.1”) defined a “pax interchange
+     format” that uses two new types of entries to hold text-formatted meta‐
+     data that applies to following entries.  Note that a pax interchange for
      mat archive is a ustar archive in every respect.  The new data is stored
-     in ustar-compatible archive entries that use the "x" or "g" typeflag.  In
-     particular, older implementations that do not fully support these exten-
+     in ustar-compatible archive entries that use the “x” or “g” typeflag.  In
+     particular, older implementations that do not fully support these exten
      sions will extract the metadata into regular files, where the metadata
      can be examined as necessary.
 
-     An entry in a pax interchange format archive consists of one or two stan-
-     dard ustar entries, each with its own header and data.  The first op-
+     An entry in a pax interchange format archive consists of one or two stan
+     dard ustar entries, each with its own header and data.  The first op
      tional entry stores the extended attributes for the following entry.
-     This optional first entry has an "x" typeflag and a size field that indi-
+     This optional first entry has an "x" typeflag and a size field that indi
      cates the total size of the extended attributes.  The extended attributes
      themselves are stored as a series of text-format lines encoded in the
      portable UTF-8 encoding.  Each line consists of a decimal number, a
@@ -262,7 +262,7 @@ DESCRIPTION
           25 ctime=1084839148.1212\n
      Keys in all lowercase are standard keys.  Vendors can add their own keys
      by prefixing them with an all uppercase vendor name and a period. Note
-     that, unlike the historic header, numeric values are stored using deci-
+     that, unlike the historic header, numeric values are stored using deci
      mal, not octal.  A description of some common keys follows:
 
      atime, ctime, mtime
@@ -276,10 +276,10 @@ DESCRIPTION
             be in UTF-8, including pathnames, user names, and group names.
             In some cases, it is not possible to translate local conventions
             into UTF-8.  If this key is present and the value is the six-
-            character ASCII string "BINARY", then all textual values are as-
+            character ASCII string “BINARY”, then all textual values are as‐
             sumed to be in a platform-dependent multi-byte encoding.  Note
-            that there are only two valid values for this key: "BINARY" or
-            "ISO-IR 10646 2000 UTF-8".  No other values are permitted by the
+            that there are only two valid values for this key: “BINARY” or
+            “ISO-IR 10646 2000 UTF-8”.  No other values are permitted by the
             standard, and the latter value should generally not be used as it
             is the default when this key is not specified.  In particular,
             this flag should not be used as a general mechanism to allow
@@ -299,7 +299,7 @@ DESCRIPTION
             UTF8 and can thus include non-ASCII characters.
 
      realtime.*, security.*
-            These keys are reserved and may be used for future standardiza-
+            These keys are reserved and may be used for future standardiza
             tion.
 
      size    The size of the file.  Note that there is no length limit on this
@@ -307,7 +307,7 @@ DESCRIPTION
             than the historic 8GB limit.
 
      SCHILY.*
-            Vendor-specific attributes used by Joerg Schilling's star imple-
+            Vendor-specific attributes used by Joerg Schilling's star imple
             mentation.
 
      SCHILY.acl.access, SCHILY.acl.default, SCHILY.acl.ace
@@ -340,14 +340,14 @@ DESCRIPTION
 
      LIBARCHIVE.creationtime
             The time when the file was created.  (This should not be confused
-            with the POSIX "ctime" attribute, which refers to the time when
+            with the POSIX “ctime” attribute, which refers to the time when
             the file metadata was last changed.)
 
      LIBARCHIVE.xattr.namespace.key
             Libarchive stores POSIX.1e-style extended attributes using keys
-            of this form.  The key value is URL-encoded: All non-ASCII char-
-            acters and the two special characters "=" and "%" are encoded as
-            "%" followed by two uppercase hexadecimal digits.  The value of
+            of this form.  The key value is URL-encoded: All non-ASCII char
+            acters and the two special characters “=” and “%” are encoded as
+            “%” followed by two uppercase hexadecimal digits.      The value of
             this key is the extended attribute value encoded in base 64.  XXX
             Detail the base-64 format here XXX
 
@@ -355,9 +355,9 @@ DESCRIPTION
             XXX document other vendor-specific extensions XXX
 
      Any values stored in an extended attribute override the corresponding
-     values in the regular tar header. Note that compliant readers should ig-
+     values in the regular tar header. Note that compliant readers should ig
      nore the regular fields when they are overridden. This is important, as
-     existing archivers are known to store non-compliant values in the stan-
+     existing archivers are known to store non-compliant values in the stan
      dard header fields in this situation.  There are no limits on length for
      any of these fields.  In particular, numeric fields can be arbitrarily
      large.  All text fields are encoded in UTF8.  Compliant writers should
@@ -366,8 +366,8 @@ DESCRIPTION
      characters.
 
      In addition to the x entry described above, the pax interchange format
-     also supports a g entry.  The g entry is identical in format, but speci-
-     fies attributes that serve as defaults for all subsequent archive en-
+     also supports a g entry.  The g entry is identical in format, but speci
+     fies attributes that serve as defaults for all subsequent archive en
      tries.  The g entry is not widely used.
 
      Besides the new x and g entries, the pax interchange format has a few
@@ -379,15 +379,15 @@ DESCRIPTION
      ignore the size field for hardlink entries.
 
    GNU Tar Archives
-     The GNU tar program started with a pre-POSIX format similar to that de-
+     The GNU tar program started with a pre-POSIX format similar to that de
      scribed earlier and has extended it using several different mechanisms:
      It added new fields to the empty space in the header (some of which was
      later used by POSIX for conflicting purposes); it allowed the header to
-     be continued over multiple records; and it defined new entries that mod-
+     be continued over multiple records; and it defined new entries that mod
      ify following entries (similar in principle to the x entry described
      above, but each GNU special entry is single-purpose, unlike the general-
-     purpose x entry). As a result, GNU tar archives are not POSIX compati-
-     ble, although more lenient POSIX-compliant readers can successfully ex-
+     purpose x entry). As a result, GNU tar archives are not POSIX compati
+     ble, although more lenient POSIX-compliant readers can successfully ex
      tract most GNU tar archives.
 
           struct header_gnu_tar {
@@ -429,14 +429,14 @@ DESCRIPTION
                     to indicate the pre-allocation of a contiguous file on
                     disk.
 
-            D       This indicates a directory entry.  Unlike the POSIX-stan-
+            D       This indicates a directory entry.  Unlike the POSIX-stan
                     dard "5" typeflag, the header is followed by data records
                     listing the names of files in this directory.  Each name
                     is preceded by an ASCII "Y" if the file is stored in this
                     archive or "N" if the file is not stored in this archive.
                     Each name is terminated with a null, and an extra null
-                    marks the end of the name list.  The purpose of this en-
-                    try is to support incremental backups; a program restor-
+                    marks the end of the name list.  The purpose of this en
+                    try is to support incremental backups; a program restor
                     ing from such an archive may wish to delete files on disk
                     that did not exist in the directory when the archive was
                     made.
@@ -447,25 +447,25 @@ DESCRIPTION
                     file could interfere with subsequent creation of the
                     like-named directory.
 
-            K       The data for this entry is a long linkname for the fol-
+            K       The data for this entry is a long linkname for the fol
                     lowing regular entry.
 
-            L       The data for this entry is a long pathname for the fol-
+            L       The data for this entry is a long pathname for the fol
                     lowing regular entry.
 
             M       This is a continuation of the last file on the previous
                     volume.  GNU multi-volume archives guarantee that each
                     volume begins with a valid entry header.  To ensure this,
                     a file may be split, with part stored at the end of one
-                    volume, and part stored at the beginning of the next vol-
-                    ume.  The "M" typeflag indicates that this entry contin-
+                    volume, and part stored at the beginning of the next vol
+                    ume.  The "M" typeflag indicates that this entry contin
                     ues an existing file.  Such entries can only occur as the
                     first or second entry in an archive (the latter only if
-                    the first entry is a volume label).  The size field spec-
+                    the first entry is a volume label).  The size field spec
                     ifies the size of this entry.  The offset field at bytes
-                    369-380 specifies the offset where this file fragment be-
+                    369-380 specifies the offset where this file fragment be
                     gins.  The realsize field specifies the total size of the
-                    file (which must equal size plus offset).  When extract-
+                    file (which must equal size plus offset).  When extract
                     ing, GNU tar checks that the header file name is the one
                     it is expecting, that the header offset is in the correct
                     sequence, and that the sum of offset and size is equal to
@@ -474,31 +474,31 @@ DESCRIPTION
             N       Type "N" records are no longer generated by GNU tar.
                     They contained a list of files to be renamed or symlinked
                     after extraction; this was originally used to support
-                    long names.  The contents of this record are a text de-
+                    long names.  The contents of this record are a text de
                     scription of the operations to be done, in the form
-                    "Rename %s to %s\n" or "Symlink %s to %s\n"; in either
+                    “Rename %s to %s\n” or “Symlink %s to %s\n”; in either
                     case, both filenames are escaped using K&R C syntax.  Due
-                    to security concerns, "N" records are now generally ig-
+                    to security concerns, "N" records are now generally ig
                     nored when reading archives.
 
-            S       This is a "sparse" regular file.  Sparse files are stored
+            S       This is a “sparse” regular file.  Sparse files are stored
                     as a series of fragments.  The header contains a list of
-                    fragment offset/length pairs.  If more than four such en-
+                    fragment offset/length pairs.  If more than four such en
                     tries are required, the header is extended as necessary
-                    with "extra" header extensions (an older format that is
-                    no longer used), or "sparse" extensions.
+                    with “extra” header extensions (an older format that is
+                    no longer used), or “sparse” extensions.
 
             V       The name field should be interpreted as a tape/volume
                     header name.  This entry should generally be ignored on
                     extraction.
 
-     magic   The magic field holds the five characters "ustar" followed by a
+     magic   The magic field holds the five characters “ustar” followed by a
             space.  Note that POSIX ustar archives have a trailing null.
 
      version
             The version field holds a space character followed by a null.
             Note that POSIX ustar archives use two copies of the ASCII digit
-            "0".
+            “0”.
 
      atime, ctime
             The time the file was last accessed and the time of last change
@@ -510,14 +510,14 @@ DESCRIPTION
      Sparse offset / numbytes
             Each such structure specifies a single fragment of a sparse file.
             The two fields store values as octal numbers.  The fragments are
-            each padded to a multiple of 512 bytes in the archive.  On ex-
-            traction, the list of fragments is collected from the header (in-
+            each padded to a multiple of 512 bytes in the archive.  On ex
+            traction, the list of fragments is collected from the header (in
             cluding any extension headers), and the data is then read and
             written to the file at appropriate offsets.
 
      isextended
-            If this is set to non-zero, the header will be followed by addi-
-            tional "sparse header" records.  Each such record contains infor-
+            If this is set to non-zero, the header will be followed by addi
+            tional “sparse header” records.  Each such record contains infor‐
             mation about as many as 21 additional sparse blocks as shown
             here:
 
@@ -541,14 +541,14 @@ DESCRIPTION
    GNU tar pax archives
      GNU tar 1.14 (XXX check this XXX) and later will write pax interchange
      format archives when you specify the --posix flag.  This format follows
-     the pax interchange format closely, using some SCHILY tags and introduc-
+     the pax interchange format closely, using some SCHILY tags and introduc
      ing new keywords to store sparse file information.  There have been three
-     iterations of the sparse file support, referred to as "0.0", "0.1", and
-     "1.0".
+     iterations of the sparse file support, referred to as “0.0”, “0.1”, and
+     “1.0”.
 
      GNU.sparse.numblocks, GNU.sparse.offset, GNU.sparse.numbytes,
             GNU.sparse.size
-            The "0.0" format used an initial GNU.sparse.numblocks attribute
+            The “0.0” format used an initial GNU.sparse.numblocks attribute
             to indicate the number of blocks in the file, a pair of
             GNU.sparse.offset and GNU.sparse.numbytes to indicate the offset
             and size of each block, and a single GNU.sparse.size to indicate
@@ -560,7 +560,7 @@ DESCRIPTION
             the standards.
 
      GNU.sparse.map
-            The "0.1" format used a single attribute that stored a comma-sep-
+            The “0.1” format used a single attribute that stored a comma-sep‐
             arated list of decimal numbers.  Each pair of numbers indicated
             the offset and size, respectively, of a block of data.  This does
             not work well if the archive is extracted by an archiver that
@@ -568,27 +568,27 @@ DESCRIPTION
             simply discard unrecognized attributes.
 
      GNU.sparse.major, GNU.sparse.minor, GNU.sparse.name, GNU.sparse.realsize
-            The "1.0" format stores the sparse block map in one or more
+            The “1.0” format stores the sparse block map in one or more
             512-byte blocks prepended to the file data in the entry body.
             The pax attributes indicate the existence of this map (via the
             GNU.sparse.major and GNU.sparse.minor fields) and the full size
             of the file.  The GNU.sparse.name holds the true name of the
             file.  To avoid confusion, the name stored in the regular tar
-            header is a modified name so that extraction errors will be ap-
+            header is a modified name so that extraction errors will be ap
             parent to users.
 
    Solaris Tar
      XXX More Details Needed XXX
 
-     Solaris tar (beginning with SunOS XXX 5.7 ?? XXX) supports an "extended"
+     Solaris tar (beginning with SunOS XXX 5.7 ?? XXX) supports an “extended”
      format that is fundamentally similar to pax interchange format, with the
      following differences:
-     o      Extended attributes are stored in an entry whose type is X, not
+     •            Extended attributes are stored in an entry whose type is X, not
             x, as used by pax interchange format.  The detailed format of
-            this entry appears to be the same as detailed above for the x en-
+            this entry appears to be the same as detailed above for the x en
             try.
-     o      An additional A header is used to store an ACL for the following
-            regular entry.  The body of this entry contains a seven-digit oc-
+     •            An additional A header is used to store an ACL for the following
+            regular entry.  The body of this entry contains a seven-digit oc
             tal number followed by a zero byte, followed by the textual ACL
             description.  The octal value is the number of ACL entries plus a
             constant that indicates the ACL type: 01000000 for POSIX.1e ACLs
@@ -606,17 +606,17 @@ DESCRIPTION
    Mac OS X Tar
      The tar distributed with Apple's Mac OS X stores most regular files as
      two separate files in the tar archive.  The two files have the same name
-     except that the first one has "._" prepended to the last path element.
-     This special file stores an AppleDouble-encoded binary blob with addi-
-     tional metadata about the second file, including ACL, extended at-
+     except that the first one has “._” prepended to the last path element.
+     This special file stores an AppleDouble-encoded binary blob with addi
+     tional metadata about the second file, including ACL, extended at
      tributes, and resources.  To recreate the original file on disk, each
      separate file can be extracted and the Mac OS X copyfile() function can
      be used to unpack the separate metadata file and apply it to th regular
-     file.  Conversely, the same function provides a "pack" option to encode
+     file.  Conversely, the same function provides a “pack” option to encode
      the extended metadata from a file into a separate file whose contents can
      then be put into a tar archive.
 
-     Note that the Apple extended attributes interact badly with long file-
+     Note that the Apple extended attributes interact badly with long file
      names.  Since each file is stored with the full name, a separate set of
      extensions needs to be included in the archive for each one, doubling the
      overhead required for files with long names.
@@ -654,10 +654,10 @@ SEE ALSO
 
 STANDARDS
      The tar utility is no longer a part of POSIX or the Single Unix Standard.
-     It last appeared in Version 2 of the Single UNIX Specification ("SUSv2").
-     It has been supplanted in subsequent standards by pax(1). The ustar for-
+     It last appeared in Version 2 of the Single UNIX Specification (“SUSv2”).
+     It has been supplanted in subsequent standards by pax(1). The ustar for
      mat is currently part of the specification for the pax(1) utility.  The
-     pax interchange file format is new with IEEE Std 1003.1-2001 ("POSIX.1").
+     pax interchange file format is new with IEEE Std 1003.1-2001 (“POSIX.1”).
 
 HISTORY
      A tar command appeared in Seventh Edition Unix, which was released in
index 0b8cb5d..206afa1 100644 (file)
@@ -107,15 +107,15 @@ ManPageArchiveWriteSetPassphrase3.wiki: ../mdoc2wiki.awk ../../libarchive/archiv
 ManPageCpio5.wiki: ../mdoc2wiki.awk ../../libarchive/cpio.5
        awk -f ../mdoc2wiki.awk < ../../libarchive/cpio.5 > ManPageCpio5.wiki
 
-ManPageLibarchiveFormats5.wiki: ../mdoc2wiki.awk ../../libarchive/libarchive-formats.5
-       awk -f ../mdoc2wiki.awk < ../../libarchive/libarchive-formats.5 > ManPageLibarchiveFormats5.wiki
-
 ManPageLibarchive3.wiki: ../mdoc2wiki.awk ../../libarchive/libarchive.3
        awk -f ../mdoc2wiki.awk < ../../libarchive/libarchive.3 > ManPageLibarchive3.wiki
 
 ManPageLibarchiveChanges3.wiki: ../mdoc2wiki.awk ../../libarchive/libarchive_changes.3
        awk -f ../mdoc2wiki.awk < ../../libarchive/libarchive_changes.3 > ManPageLibarchiveChanges3.wiki
 
+ManPageLibarchiveFormats5.wiki: ../mdoc2wiki.awk ../../libarchive/libarchive-formats.5
+       awk -f ../mdoc2wiki.awk < ../../libarchive/libarchive-formats.5 > ManPageLibarchiveFormats5.wiki
+
 ManPageLibarchiveInternals3.wiki: ../mdoc2wiki.awk ../../libarchive/libarchive_internals.3
        awk -f ../mdoc2wiki.awk < ../../libarchive/libarchive_internals.3 > ManPageLibarchiveInternals3.wiki
 
@@ -130,4 +130,4 @@ ManPageBsdtar1.wiki: ../mdoc2wiki.awk ../../tar/bsdtar.1
 
 ManPageBsdcpio1.wiki: ../mdoc2wiki.awk ../../cpio/bsdcpio.1
        awk -f ../mdoc2wiki.awk < ../../cpio/bsdcpio.1 > ManPageBsdcpio1.wiki
-all: ManPageArchiveEntry3.wiki ManPageArchiveEntryAcl3.wiki ManPageArchiveEntryLinkify3.wiki ManPageArchiveEntryMisc3.wiki ManPageArchiveEntryPaths3.wiki ManPageArchiveEntryPerms3.wiki ManPageArchiveEntryStat3.wiki ManPageArchiveEntryTime3.wiki ManPageArchiveRead3.wiki ManPageArchiveReadAddPassphrase3.wiki ManPageArchiveReadData3.wiki ManPageArchiveReadDisk3.wiki ManPageArchiveReadExtract3.wiki ManPageArchiveReadFilter3.wiki ManPageArchiveReadFormat3.wiki ManPageArchiveReadFree3.wiki ManPageArchiveReadHeader3.wiki ManPageArchiveReadNew3.wiki ManPageArchiveReadOpen3.wiki ManPageArchiveReadSetOptions3.wiki ManPageArchiveUtil3.wiki ManPageArchiveWrite3.wiki ManPageArchiveWriteBlocksize3.wiki ManPageArchiveWriteData3.wiki ManPageArchiveWriteDisk3.wiki ManPageArchiveWriteFilter3.wiki ManPageArchiveWriteFinishEntry3.wiki ManPageArchiveWriteFormat3.wiki ManPageArchiveWriteFree3.wiki ManPageArchiveWriteHeader3.wiki ManPageArchiveWriteNew3.wiki ManPageArchiveWriteOpen3.wiki ManPageArchiveWriteSetOptions3.wiki ManPageArchiveWriteSetPassphrase3.wiki ManPageCpio5.wiki ManPageLibarchiveFormats5.wiki ManPageLibarchive3.wiki ManPageLibarchiveChanges3.wiki ManPageLibarchiveInternals3.wiki ManPageMtree5.wiki ManPageTar5.wiki ManPageBsdtar1.wiki ManPageBsdcpio1.wiki
+all: ManPageArchiveEntry3.wiki ManPageArchiveEntryAcl3.wiki ManPageArchiveEntryLinkify3.wiki ManPageArchiveEntryMisc3.wiki ManPageArchiveEntryPaths3.wiki ManPageArchiveEntryPerms3.wiki ManPageArchiveEntryStat3.wiki ManPageArchiveEntryTime3.wiki ManPageArchiveRead3.wiki ManPageArchiveReadAddPassphrase3.wiki ManPageArchiveReadData3.wiki ManPageArchiveReadDisk3.wiki ManPageArchiveReadExtract3.wiki ManPageArchiveReadFilter3.wiki ManPageArchiveReadFormat3.wiki ManPageArchiveReadFree3.wiki ManPageArchiveReadHeader3.wiki ManPageArchiveReadNew3.wiki ManPageArchiveReadOpen3.wiki ManPageArchiveReadSetOptions3.wiki ManPageArchiveUtil3.wiki ManPageArchiveWrite3.wiki ManPageArchiveWriteBlocksize3.wiki ManPageArchiveWriteData3.wiki ManPageArchiveWriteDisk3.wiki ManPageArchiveWriteFilter3.wiki ManPageArchiveWriteFinishEntry3.wiki ManPageArchiveWriteFormat3.wiki ManPageArchiveWriteFree3.wiki ManPageArchiveWriteHeader3.wiki ManPageArchiveWriteNew3.wiki ManPageArchiveWriteOpen3.wiki ManPageArchiveWriteSetOptions3.wiki ManPageArchiveWriteSetPassphrase3.wiki ManPageCpio5.wiki ManPageLibarchive3.wiki ManPageLibarchiveChanges3.wiki ManPageLibarchiveFormats5.wiki ManPageLibarchiveInternals3.wiki ManPageMtree5.wiki ManPageTar5.wiki ManPageBsdtar1.wiki ManPageBsdcpio1.wiki
index 9bf77c2..49be450 100644 (file)
@@ -146,9 +146,18 @@ used when translating file names.
 </dd></dl> 
 </dd><dt>Format cpio</dt><dd> 
 <dl> 
-<dt>'''hdrcharset'''</dt><dd> 
+<dt>'''compat-2x'''</dt><dd> 
+Libarchive 2.x incorrectly encoded Unicode filenames on 
+some platforms. 
+This option mimics the libarchive 2.x filename handling 
+so that such archives can be read correctly. 
+</dd><dt>'''hdrcharset'''</dt><dd> 
 The value is used as a character set name that will be 
 used when translating file names. 
+</dd><dt>'''pwb'''</dt><dd> 
+When reading a binary CPIO archive, assume that it is 
+in the original PWB cpio format, and handle file mode 
+bits accordingly.  The default is to assume v7 format. 
 </dd></dl> 
 </dd><dt>Format iso9660</dt><dd> 
 <dl> 
index 2c93394..b5423b1 100644 (file)
@@ -7,7 +7,10 @@ ARCHIVE_WRITE_FORMAT(3) manual page
 '''archive_write_set_format_ar_svr4''', 
 '''archive_write_set_format_by_name''', 
 '''archive_write_set_format_cpio''', 
+'''archive_write_set_format_cpio_bin''', 
 '''archive_write_set_format_cpio_newc''', 
+'''archive_write_set_format_cpio_odc''', 
+'''archive_write_set_format_cpio_pwb''', 
 '''archive_write_set_format_filter_by_ext''', 
 '''archive_write_set_format_filter_by_ext_def''', 
 '''archive_write_set_format_gnutar''', 
@@ -61,10 +64,22 @@ Streaming Archive Library (libarchive, -larchive)
 <br> 
 ''int'' 
 <br> 
+'''archive_write_set_format_cpio_bin'''(''struct archive *''); 
+<br> 
+''int'' 
+<br> 
 '''archive_write_set_format_cpio_newc'''(''struct archive *''); 
 <br> 
 ''int'' 
 <br> 
+'''archive_write_set_format_cpio_odc'''(''struct archive *''); 
+<br> 
+''int'' 
+<br> 
+'''archive_write_set_format_cpio_pwb'''(''struct archive *''); 
+<br> 
+''int'' 
+<br> 
 '''archive_write_set_format_filter_by_ext'''(''struct archive *'', ''const char *filename''); 
 <br> 
 ''int'' 
@@ -137,17 +152,20 @@ to create a new archive with the same format as an existing archive.
 </dd><dt>'''archive_write_set_format_by_name'''()</dt><dd> 
 Sets the corresponding format based on the common name. 
 </dd><dt> 
-'''archive_write_set_format_filter_by_ext'''(), 
+'''archive_write_set_format_filter_by_ext'''() 
 '''archive_write_set_format_filter_by_ext_def'''() 
 </dt> <dd> 
 Sets both filters and format based on the output filename. 
 Supported extensions: .7z, .zip, .jar, .cpio, .iso, .a, .ar, .tar, .tgz, .tar.gz, .tar.bz2, .tar.xz 
 </dd><dt> 
 '''archive_write_set_format_7zip'''() 
-'''archive_write_set_format_ar_bsd'''(), 
-'''archive_write_set_format_ar_svr4'''(), 
+'''archive_write_set_format_ar_bsd'''() 
+'''archive_write_set_format_ar_svr4'''() 
 '''archive_write_set_format_cpio'''() 
+'''archive_write_set_format_cpio_bin'''() 
 '''archive_write_set_format_cpio_newc'''() 
+'''archive_write_set_format_cpio_odc'''() 
+'''archive_write_set_format_cpio_pwb'''() 
 '''archive_write_set_format_gnutar'''() 
 '''archive_write_set_format_iso9660'''() 
 '''archive_write_set_format_mtree'''() 
index 35fbd88..177fe3d 100644 (file)
@@ -238,7 +238,7 @@ Values between 0 and 9 are supported.
 The interpretation of the compression level depends on the chosen 
 compression method. 
 </dd></dl> 
-</dd><dt>Format cpio</dt><dd> 
+</dd><dt>Format bin</dt><dd> 
 <dl> 
 <dt>'''hdrcharset'''</dt><dd> 
 The value is used as a character set name that will be 
@@ -478,6 +478,18 @@ XXX needs explanation XXX
 The value is used as a character set name that will be 
 used when translating file names. 
 </dd></dl> 
+</dd><dt>Format odc</dt><dd> 
+<dl> 
+<dt>'''hdrcharset'''</dt><dd> 
+The value is used as a character set name that will be 
+used when translating file names. 
+</dd></dl> 
+</dd><dt>Format pwb</dt><dd> 
+<dl> 
+<dt>'''hdrcharset'''</dt><dd> 
+The value is used as a character set name that will be 
+used when translating file names. 
+</dd></dl> 
 </dd><dt>Format pax</dt><dd> 
 <dl> 
 <dt>'''hdrcharset'''</dt><dd> 
index 2dc5093..fc7647e 100644 (file)
@@ -57,6 +57,13 @@ all operating modes.
 <dt>-0, --null</dt><dd> 
 Read filenames separated by NUL characters instead of newlines. 
 This is necessary if any of the filenames being read might contain newlines. 
+</dd><dt>-6, --pwb</dt><dd> 
+When reading a binary format archive, assume it's the earlier one, 
+from the PWB variant of 6th Edition UNIX. 
+When writing a cpio archive, use the PWB format. 
+</dd><dt>-7, --binary</dt><dd> 
+(o mode only) 
+When writing a cpio archive, use the (newer, non-PWB) binary format. 
 </dd><dt>-A</dt><dd> 
 (o mode only) 
 Append to the specified archive. 
index 7f74b44..4850863 100644 (file)
@@ -28,40 +28,44 @@ The end of the archive is indicated by a special record with
 the pathname 
 "TRAILER!!!". 
 === PWB format=== 
-XXX Any documentation of the original PWB/UNIX 1.0 format? XXX 
-=== Old Binary Format=== 
-The old binary 
+The PWB binary 
 '''cpio''' 
-format stores numbers as 2-byte and 4-byte binary values. 
+format is the original format, when cpio was introduced as part of the 
+Programmer's Work Bench system, a variant of 6th Edition UNIX.  It 
+stores numbers as 2-byte and 4-byte binary values. 
 Each entry begins with a header in the following format: 
+
 ```text
-struct header_old_cpio {
-        unsigned short   c_magic;
-        unsigned short   c_dev;
-        unsigned short   c_ino;
-        unsigned short   c_mode;
-        unsigned short   c_uid;
-        unsigned short   c_gid;
-        unsigned short   c_nlink;
-        unsigned short   c_rdev;
-       unsigned short   c_mtime[2];
-        unsigned short   c_namesize;
-       unsigned short   c_filesize[2];
+struct header_pwb_cpio {
+        short   h_magic;
+        short   h_dev;
+        short   h_ino;
+        short   h_mode;
+        short   h_uid;
+        short   h_gid;
+        short   h_nlink;
+        short   h_majmin;
+        long    h_mtime;
+        short   h_namesize;
+        long    h_filesize;
 };
 ```
 
 The 
-''unsigned'' short 
-fields here are 16-bit integer values; the 
-''unsigned'' int 
-fields are 32-bit integer values. 
-The fields are as follows 
+''short'' 
+fields here are 16-bit integer values, while the 
+''long'' 
+fields are 32 bit integers.  Since PWB UNIX, like the 6th Edition UNIX 
+it was based on, only ran on PDP-11 computers, they 
+are in PDP-endian format, which has little-endian shorts, and 
+big-endian longs.  That is, the long integer whose hexadecimal 
+representation is 0x12345678 would be stored in four successive bytes 
+as 0x34, 0x12, 0x78, 0x56. 
+The fields are as follows: 
 <dl> 
-<dt>''magic''</dt><dd> 
+<dt>''h_magic''</dt><dd> 
 The integer value octal 070707. 
-This value can be used to determine whether this archive is 
-written with little-endian or big-endian integers. 
-</dd><dt>''dev'', ''ino''</dt><dd> 
+</dd><dt>''h_dev'', ''h_ino''</dt><dd> 
 The device and inode numbers from the disk. 
 These are used by programs that read 
 '''cpio''' 
@@ -69,78 +73,138 @@ archives to determine when two entries refer to the same file.
 Programs that synthesize 
 '''cpio''' 
 archives should be careful to set these to distinct values for each entry. 
-</dd><dt>''mode''</dt><dd> 
-The mode specifies both the regular permissions and the file type. 
-It consists of several bit fields as follows: 
+</dd><dt>''h_mode''</dt><dd> 
+The mode specifies both the regular permissions and the file type, and 
+it also holds a couple of bits that are irrelevant to the cpio format, 
+because the field is actually a raw copy of the mode field in the inode 
+representing the file.  These are the IALLOC flag, which shows that 
+the inode entry is in use, and the ILARG flag, which shows that the 
+file it represents is large enough to have indirect blocks pointers in 
+the inode. 
+The mode is decoded as follows: 
+
 <dl> 
-<dt>0170000</dt><dd> 
-This masks the file type bits. 
-</dd><dt>0140000</dt><dd> 
-File type value for sockets. 
-</dd><dt>0120000</dt><dd> 
-File type value for symbolic links. 
-For symbolic links, the link body is stored as file data. 
-</dd><dt>0100000</dt><dd> 
-File type value for regular files. 
+<dt>0100000</dt><dd> 
+IALLOC flag - irrelevant to cpio. 
 </dd><dt>0060000</dt><dd> 
-File type value for block special devices. 
+This masks the file type bits. 
 </dd><dt>0040000</dt><dd> 
 File type value for directories. 
 </dd><dt>0020000</dt><dd> 
 File type value for character special devices. 
+</dd><dt>0060000</dt><dd> 
+File type value for block special devices. 
 </dd><dt>0010000</dt><dd> 
-File type value for named pipes or FIFOs
+ILARG flag - irrelevant to cpio
 </dd><dt>0004000</dt><dd> 
 SUID bit. 
 </dd><dt>0002000</dt><dd> 
 SGID bit. 
 </dd><dt>0001000</dt><dd> 
 Sticky bit. 
-On some systems, this modifies the behavior of executables and/or directories. 
 </dd><dt>0000777</dt><dd> 
 The lower 9 bits specify read/write/execute permissions 
 for world, group, and user following standard POSIX conventions. 
 </dd></dl> 
-</dd><dt>''uid'', ''gid''</dt><dd> 
+</dd><dt>''h_uid'', ''h_gid''</dt><dd> 
 The numeric user id and group id of the owner. 
-</dd><dt>''nlink''</dt><dd> 
+</dd><dt>''h_nlink''</dt><dd> 
 The number of links to this file. 
 Directories always have a value of at least two here. 
 Note that hardlinked files include file data with every copy in the archive. 
-</dd><dt>''rdev''</dt><dd> 
+</dd><dt>''h_majmin''</dt><dd> 
 For block special and character special entries, 
-this field contains the associated device number. 
+this field contains the associated device number, with the major 
+number in the high byte, and the minor number in the low byte. 
 For all other entry types, it should be set to zero by writers 
 and ignored by readers. 
-</dd><dt>''mtime''</dt><dd> 
+</dd><dt>''h_mtime''</dt><dd> 
 Modification time of the file, indicated as the number 
 of seconds since the start of the epoch, 
 00:00:00 UTC January 1, 1970. 
-The four-byte integer is stored with the most-significant 16 bits first 
-followed by the least-significant 16 bits. 
-Each of the two 16 bit values are stored in machine-native byte order. 
-</dd><dt>''namesize''</dt><dd> 
+</dd><dt>''h_namesize''</dt><dd> 
 The number of bytes in the pathname that follows the header. 
 This count includes the trailing NUL byte. 
-</dd><dt>''filesize''</dt><dd> 
-The size of the file. 
-Note that this archive format is limited to 
-four gigabyte file sizes. 
-See 
-''mtime'' 
-above for a description of the storage of four-byte integers. 
+</dd><dt>''h_filesize''</dt><dd> 
+The size of the file.  Note that this archive format is limited to 16 
+megabyte file sizes, because PWB UNIX, like 6th Edition, only used 
+an unsigned 24 bit integer for the file size internally. 
 </dd></dl> 
 
 The pathname immediately follows the fixed header. 
-If the 
-'''namesize''' 
+If 
+'''h_namesize''' 
 is odd, an additional NUL byte is added after the pathname. 
-The file data is then appended, padded with NUL 
-bytes to an even length
+The file data is then appended, again with an additional NUL 
+appended if needed to get the next header at an even offset
 
 Hardlinked files are not given special treatment; 
 the full file contents are included with each copy of the 
 file. 
+=== New Binary Format=== 
+The new binary 
+'''cpio''' 
+format showed up when cpio was adopted into late 7th Edition UNIX. 
+It is exactly like the PWB binary format, described above, except for 
+three changes: 
+
+First, UNIX now ran on more than one hardware type, so the endianness 
+of 16 bit integers must be determined by observing the magic number at 
+the start of the header.  The 32 bit integers are still always stored 
+with the most significant word first, though, so each of those two, in 
+the struct shown above, was stored as an array of two 16 bit integers, 
+in the traditional order.  Those 16 bit integers, like all the others 
+in the struct, were accessed using a macro that byte swapped them if 
+necessary. 
+
+Next, 7th Edition had more file types to store, and the IALLOC and ILARG 
+flag bits were re-purposed to accommodate these.  The revised use of the 
+various bits is as follows: 
+
+<dl> 
+<dt>0170000</dt><dd> 
+This masks the file type bits. 
+</dd><dt>0140000</dt><dd> 
+File type value for sockets. 
+</dd><dt>0120000</dt><dd> 
+File type value for symbolic links. 
+For symbolic links, the link body is stored as file data. 
+</dd><dt>0100000</dt><dd> 
+File type value for regular files. 
+</dd><dt>0060000</dt><dd> 
+File type value for block special devices. 
+</dd><dt>0040000</dt><dd> 
+File type value for directories. 
+</dd><dt>0020000</dt><dd> 
+File type value for character special devices. 
+</dd><dt>0010000</dt><dd> 
+File type value for named pipes or FIFOs. 
+</dd><dt>0004000</dt><dd> 
+SUID bit. 
+</dd><dt>0002000</dt><dd> 
+SGID bit. 
+</dd><dt>0001000</dt><dd> 
+Sticky bit. 
+</dd><dt>0000777</dt><dd> 
+The lower 9 bits specify read/write/execute permissions 
+for world, group, and user following standard POSIX conventions. 
+</dd></dl> 
+
+Finally, the file size field now represents a signed 32 bit integer in 
+the underlying file system, so the maximum file size has increased to 
+2 gigabytes. 
+
+Note that there is no obvious way to tell which of the two binary 
+formats an archive uses, other than to see which one makes more 
+sense.  The typical error scenario is that a PWB format archive 
+unpacked as if it were in the new format will create named sockets 
+instead of directories, and then fail to unpack files that should 
+go in those directories.  Running 
+''bsdcpio'' -itv 
+on an unknown archive will make it obvious which it is: if it's 
+PWB format, directories will be listed with an 's' instead of 
+a 'd' as the first character of the mode string, and the larger 
+files will have a '?' in that position. 
 === Portable ASCII Format=== 
 <nowiki>Version 2 of the Single UNIX Specification (``SUSv2'')</nowiki> 
 standardized an ASCII variant that is portable across all 
@@ -152,6 +216,7 @@ format or as the
 format. 
 It stores the same numeric fields as the old binary format, but 
 represents them as 6-character or 11-character octal values. 
+
 ```text
 struct cpio_odc_header {
         char    c_magic[6];
@@ -168,9 +233,9 @@ struct cpio_odc_header {
 };
 ```
 
-The fields are identical to those in the old binary format. 
+The fields are identical to those in the new binary format. 
 The name and file body follow the fixed header. 
-Unlike the old binary format, there is no additional padding 
+Unlike the binary formats, there is no additional padding 
 after the pathname or file contents. 
 If the files being archived are themselves entirely ASCII, then 
 the resulting archive will be entirely ASCII, except for the 
@@ -179,6 +244,7 @@ NUL byte that terminates the name field.
 The "new" ASCII format uses 8-byte hexadecimal fields for 
 all numbers and separates device numbers into separate fields 
 for major and minor numbers. 
+
 ```text
 struct cpio_newc_header {
         char    c_magic[6];
@@ -199,7 +265,7 @@ struct cpio_newc_header {
 ```
 
 Except as specified below, the fields here match those specified 
-for the old binary format above. 
+for the new binary format above. 
 <dl> 
 <dt>''magic''</dt><dd> 
 The string 
@@ -260,9 +326,9 @@ while working in AT&T's Unix Support Group.
 It appeared in 1977 as part of PWB/UNIX 1.0, the 
 "Programmer's Work Bench" 
 derived from 
-At v6 
+At 6th Edition UNIX 
 that was used internally at AT&T. 
-Both the old binary and old character formats were in use 
+Both the new binary and old character formats were in use 
 by 1980, according to the System III source released 
 by SCO under their 
 "Ancient Unix" 
@@ -276,9 +342,9 @@ The
 format is mis-named, as it uses a simple checksum and 
 not a cyclic redundancy check. 
 
-The old binary format is limited to 16 bits for user id, 
-group id, device, and inode numbers. 
-It is limited to 4 gigabyte file sizes
+The binary formats are limited to 16 bits for user id, group id, 
+device, and inode numbers.  They are limited to 16 megabyte and 2 
+gigabyte file sizes for the older and newer variants, respectively
 
 The old ASCII format is limited to 18 bits for 
 the user id, group id, device, and inode numbers. 
index 3cb828b..40f0340 100644 (file)
@@ -77,7 +77,7 @@ POSIX
 "pax interchange format" 
 archives, 
 </li><li> 
-POSIX octet-oriented cpio archives, 
+cpio archives, 
 </li><li> 
 Zip archive, 
 </li><li> 
index 54663b2..5414eba 100644 (file)
@@ -173,28 +173,27 @@ POSIX.1-2001 extended the ustar format to create the
 "pax interchange" 
 format. 
 === Cpio Formats=== 
-The libarchive library can read a number of common cpio variants and can write 
-"odc" 
-and 
-"newc" 
-format archives. 
-A cpio archive stores each entry as a fixed-size header followed 
-by a variable-length filename and variable-length data. 
-Unlike the tar format, the cpio format does only minimal padding 
-of the header or file data. 
-There are several cpio variants, which differ primarily in 
-how they store the initial header: some store the values as 
-octal or hexadecimal numbers in ASCII, others as binary values of 
-varying byte order and length. 
+The libarchive library can read and write a number of common cpio 
+variants.  A cpio archive stores each entry as a fixed-size header 
+followed by a variable-length filename and variable-length data. 
+Unlike the tar format, the cpio format does only minimal padding of 
+the header or file data.  There are several cpio variants, which 
+differ primarily in how they store the initial header: some store the 
+values as octal or hexadecimal numbers in ASCII, others as binary 
+values of varying byte order and length. 
 <dl> 
 <dt>'''binary'''</dt><dd> 
-The libarchive library transparently reads both big-endian and little-endian 
-variants of the original binary cpio format. 
-This format used 32-bit binary values for file size and mtime, 
-and 16-bit binary values for the other fields. 
+The libarchive library transparently reads both big-endian and 
+little-endian variants of the the two binary cpio formats; the 
+original one from PWB/UNIX, and the later, more widely used, variant. 
+This format used 32-bit binary values for file size and mtime, and 
+16-bit binary values for the other fields.  The formats support only 
+the file types present in UNIX at the time of their creation.  File 
+sizes are limited to 24 bits in the PWB format, because of the limits 
+of the file system, and to 31 bits in the newer binary format, where 
+signed 32 bit longs were used. 
 </dd><dt>'''odc'''</dt><dd> 
-The libarchive library can both read and write this 
-POSIX-standard format, which is officially known as the 
+This is the POSIX standardized format, which is officially known as the 
 "cpio interchange format" 
 or the 
 "octet-oriented cpio archive format" 
index 9389bbc..e1d76a5 100644 (file)
@@ -144,7 +144,9 @@ SET(libarchive_SOURCES
   archive_write_set_format_ar.c
   archive_write_set_format_by_name.c
   archive_write_set_format_cpio.c
+  archive_write_set_format_cpio_binary.c
   archive_write_set_format_cpio_newc.c
+  archive_write_set_format_cpio_odc.c
   archive_write_set_format_filter_by_ext.c
   archive_write_set_format_gnutar.c
   archive_write_set_format_iso9660.c
index 52f4d78..ca83cbd 100644 (file)
@@ -36,7 +36,7 @@
  * assert that ARCHIVE_VERSION_NUMBER >= 2012108.
  */
 /* Note: Compiler will complain if this does not match archive_entry.h! */
-#define        ARCHIVE_VERSION_NUMBER 3005001
+#define        ARCHIVE_VERSION_NUMBER 3005002
 
 #include <sys/stat.h>
 #include <stddef.h>  /* for wchar_t */
@@ -155,7 +155,7 @@ __LA_DECL int               archive_version_number(void);
 /*
  * Textual name/version of the library, useful for version displays.
  */
-#define        ARCHIVE_VERSION_ONLY_STRING "3.5.1"
+#define        ARCHIVE_VERSION_ONLY_STRING "3.5.2"
 #define        ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING
 __LA_DECL const char * archive_version_string(void);
 
@@ -319,6 +319,7 @@ typedef const char *archive_passphrase_callback(struct archive *,
 #define        ARCHIVE_FORMAT_CPIO_SVR4_NOCRC          (ARCHIVE_FORMAT_CPIO | 4)
 #define        ARCHIVE_FORMAT_CPIO_SVR4_CRC            (ARCHIVE_FORMAT_CPIO | 5)
 #define        ARCHIVE_FORMAT_CPIO_AFIO_LARGE          (ARCHIVE_FORMAT_CPIO | 6)
+#define        ARCHIVE_FORMAT_CPIO_PWB                 (ARCHIVE_FORMAT_CPIO | 7)
 #define        ARCHIVE_FORMAT_SHAR                     0x20000
 #define        ARCHIVE_FORMAT_SHAR_BASE                (ARCHIVE_FORMAT_SHAR | 1)
 #define        ARCHIVE_FORMAT_SHAR_DUMP                (ARCHIVE_FORMAT_SHAR | 2)
@@ -800,7 +801,10 @@ __LA_DECL int archive_write_set_format_7zip(struct archive *);
 __LA_DECL int archive_write_set_format_ar_bsd(struct archive *);
 __LA_DECL int archive_write_set_format_ar_svr4(struct archive *);
 __LA_DECL int archive_write_set_format_cpio(struct archive *);
+__LA_DECL int archive_write_set_format_cpio_bin(struct archive *);
 __LA_DECL int archive_write_set_format_cpio_newc(struct archive *);
+__LA_DECL int archive_write_set_format_cpio_odc(struct archive *);
+__LA_DECL int archive_write_set_format_cpio_pwb(struct archive *);
 __LA_DECL int archive_write_set_format_gnutar(struct archive *);
 __LA_DECL int archive_write_set_format_iso9660(struct archive *);
 __LA_DECL int archive_write_set_format_mtree(struct archive *);
index aba41e5..ed4e7a7 100644 (file)
@@ -319,7 +319,7 @@ translate_acl(struct archive_read_disk *a,
 
 static int
 set_acl(struct archive *a, int fd, const char *name,
-    struct archive_acl *abstract_acl,
+    struct archive_acl *abstract_acl, __LA_MODE_T mode,
     int ae_requested_type, const char *tname)
 {
        int              acl_type = 0;
@@ -364,6 +364,13 @@ set_acl(struct archive *a, int fd, const char *name,
                return (ARCHIVE_FAILED);
        }
 
+       if (acl_type == ACL_TYPE_DEFAULT && !S_ISDIR(mode)) {
+               errno = EINVAL;
+               archive_set_error(a, errno,
+                   "Cannot set default ACL on non-directory");
+               return (ARCHIVE_WARN);
+       }
+
        acl = acl_init(entries);
        if (acl == (acl_t)NULL) {
                archive_set_error(a, errno,
@@ -542,7 +549,10 @@ set_acl(struct archive *a, int fd, const char *name,
        else if (acl_set_link_np(name, acl_type, acl) != 0)
 #else
        /* FreeBSD older than 8.0 */
-       else if (acl_set_file(name, acl_type, acl) != 0)
+       else if (S_ISLNK(mode)) {
+           /* acl_set_file() follows symbolic links, skip */
+           ret = ARCHIVE_OK;
+       } else if (acl_set_file(name, acl_type, acl) != 0)
 #endif
        {
                if (errno == EOPNOTSUPP) {
@@ -677,14 +687,14 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
            & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) {
                if ((archive_acl_types(abstract_acl)
                    & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
-                       ret = set_acl(a, fd, name, abstract_acl,
+                       ret = set_acl(a, fd, name, abstract_acl, mode,
                            ARCHIVE_ENTRY_ACL_TYPE_ACCESS, "access");
                        if (ret != ARCHIVE_OK)
                                return (ret);
                }
                if ((archive_acl_types(abstract_acl)
                    & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0)
-                       ret = set_acl(a, fd, name, abstract_acl,
+                       ret = set_acl(a, fd, name, abstract_acl, mode,
                            ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default");
 
                /* Simultaneous POSIX.1e and NFSv4 is not supported */
@@ -693,7 +703,7 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
 #if ARCHIVE_ACL_FREEBSD_NFS4
        else if ((archive_acl_types(abstract_acl) &
            ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {
-               ret = set_acl(a, fd, name, abstract_acl,
+               ret = set_acl(a, fd, name, abstract_acl, mode,
                    ARCHIVE_ENTRY_ACL_TYPE_NFS4, "nfs4");
        }
 #endif
index 3928f3d..31d2705 100644 (file)
@@ -343,6 +343,11 @@ set_richacl(struct archive *a, int fd, const char *name,
                return (ARCHIVE_FAILED);
        }
 
+       if (S_ISLNK(mode)) {
+               /* Linux does not support RichACLs on symbolic links */
+               return (ARCHIVE_OK);
+       }
+
        richacl = richacl_alloc(entries);
        if (richacl == NULL) {
                archive_set_error(a, errno,
@@ -455,7 +460,7 @@ exit_free:
 #if ARCHIVE_ACL_LIBACL
 static int
 set_acl(struct archive *a, int fd, const char *name,
-    struct archive_acl *abstract_acl,
+    struct archive_acl *abstract_acl, __LA_MODE_T mode,
     int ae_requested_type, const char *tname)
 {
        int              acl_type = 0;
@@ -488,6 +493,18 @@ set_acl(struct archive *a, int fd, const char *name,
                return (ARCHIVE_FAILED);
        }
 
+       if (S_ISLNK(mode)) {
+               /* Linux does not support ACLs on symbolic links */
+               return (ARCHIVE_OK);
+       }
+
+       if (acl_type == ACL_TYPE_DEFAULT && !S_ISDIR(mode)) {
+               errno = EINVAL;
+               archive_set_error(a, errno,
+                   "Cannot set default ACL on non-directory");
+               return (ARCHIVE_WARN);
+       }
+
        acl = acl_init(entries);
        if (acl == (acl_t)NULL) {
                archive_set_error(a, errno,
@@ -727,14 +744,14 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
            & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) {
                if ((archive_acl_types(abstract_acl)
                    & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
-                       ret = set_acl(a, fd, name, abstract_acl,
+                       ret = set_acl(a, fd, name, abstract_acl, mode,
                            ARCHIVE_ENTRY_ACL_TYPE_ACCESS, "access");
                        if (ret != ARCHIVE_OK)
                                return (ret);
                }
                if ((archive_acl_types(abstract_acl)
                    & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0)
-                       ret = set_acl(a, fd, name, abstract_acl,
+                       ret = set_acl(a, fd, name, abstract_acl, mode,
                            ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default");
        }
 #endif /* ARCHIVE_ACL_LIBACL */
index b0f5dfa..0ef3ad5 100644 (file)
@@ -443,7 +443,7 @@ translate_acl(struct archive_read_disk *a,
 
 static int
 set_acl(struct archive *a, int fd, const char *name,
-    struct archive_acl *abstract_acl,
+    struct archive_acl *abstract_acl, __LA_MODE_T mode,
     int ae_requested_type, const char *tname)
 {
        aclent_t         *aclent;
@@ -467,7 +467,6 @@ set_acl(struct archive *a, int fd, const char *name,
        if (entries == 0)
                return (ARCHIVE_OK);
 
-
        switch (ae_requested_type) {
        case ARCHIVE_ENTRY_ACL_TYPE_POSIX1E:
                cmd = SETACL;
@@ -492,6 +491,12 @@ set_acl(struct archive *a, int fd, const char *name,
                return (ARCHIVE_FAILED);
        }
 
+        if (S_ISLNK(mode)) {
+                /* Skip ACLs on symbolic links */
+               ret = ARCHIVE_OK;
+               goto exit_free;
+        }
+
        e = 0;
 
        while (archive_acl_next(a, abstract_acl, ae_requested_type, &ae_type,
@@ -801,7 +806,7 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
        if ((archive_acl_types(abstract_acl)
            & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) {
                /* Solaris writes POSIX.1e access and default ACLs together */
-               ret = set_acl(a, fd, name, abstract_acl,
+               ret = set_acl(a, fd, name, abstract_acl, mode,
                    ARCHIVE_ENTRY_ACL_TYPE_POSIX1E, "posix1e");
 
                /* Simultaneous POSIX.1e and NFSv4 is not supported */
@@ -810,7 +815,7 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
 #if ARCHIVE_ACL_SUNOS_NFS4
        else if ((archive_acl_types(abstract_acl) &
            ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {
-               ret = set_acl(a, fd, name, abstract_acl,
+               ret = set_acl(a, fd, name, abstract_acl, mode,
                    ARCHIVE_ENTRY_ACL_TYPE_NFS4, "nfs4");
        }
 #endif
index c0e75bf..bfba54f 100644 (file)
@@ -30,7 +30,7 @@
 #define        ARCHIVE_ENTRY_H_INCLUDED
 
 /* Note: Compiler will complain if this does not match archive.h! */
-#define        ARCHIVE_VERSION_NUMBER 3005001
+#define        ARCHIVE_VERSION_NUMBER 3005002
 
 /*
  * Note: archive_entry.h is for use outside of libarchive; the
index 619e2b6..0867a26 100644 (file)
@@ -384,6 +384,8 @@ __archive_pathmatch(const char *p, const char *s, int flags)
        /* Empty pattern only matches the empty string. */
        if (p == NULL || *p == '\0')
                return (s == NULL || *s == '\0');
+       else if (s == NULL)
+               return (0);
 
        /* Leading '^' anchors the start of the pattern. */
        if (*p == '^') {
@@ -424,6 +426,8 @@ __archive_pathmatch_w(const wchar_t *p, const wchar_t *s, int flags)
        /* Empty pattern only matches the empty string. */
        if (p == NULL || *p == L'\0')
                return (s == NULL || *s == L'\0');
+       else if (s == NULL)
+               return (0);
 
        /* Leading '^' anchors the start of the pattern. */
        if (*p == L'^') {
index 937a87b..55a8da1 100644 (file)
 #define        __LA_DEAD
 #endif
 
+#if defined(__GNUC__) && (__GNUC__ > 2 || \
+                         (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
+#define        __LA_UNUSED     __attribute__((__unused__))
+#else
+#define        __LA_UNUSED
+#endif
+
 #define        ARCHIVE_WRITE_MAGIC     (0xb0c5c0deU)
 #define        ARCHIVE_READ_MAGIC      (0xdeb0c5U)
 #define        ARCHIVE_WRITE_DISK_MAGIC (0xc001b0c5U)
index 65ea691..9d1aa49 100644 (file)
@@ -173,7 +173,7 @@ arc4_init(void)
 }
 
 static inline void
-arc4_addrandom(u_char *dat, int datlen)
+arc4_addrandom(uint8_t *dat, int datlen)
 {
        int     n;
        uint8_t si;
@@ -196,7 +196,7 @@ arc4_stir(void)
        struct {
                struct timeval  tv;
                pid_t           pid;
-               u_char          rnd[KEYSIZE];
+               uint8_t         rnd[KEYSIZE];
        } rdat;
 
        if (!rs_initialized) {
@@ -216,7 +216,7 @@ arc4_stir(void)
                /* We'll just take whatever was on the stack too... */
        }
 
-       arc4_addrandom((u_char *)&rdat, KEYSIZE);
+       arc4_addrandom((uint8_t *)&rdat, KEYSIZE);
 
        /*
         * Discard early keystream, as per recommendations in:
@@ -258,7 +258,7 @@ arc4_getbyte(void)
 static void
 arc4random_buf(void *_buf, size_t n)
 {
-       u_char *buf = (u_char *)_buf;
+       uint8_t *buf = (uint8_t *)_buf;
        _ARC4_LOCK();
        arc4_stir_if_needed();
        while (n--) {
index 2898206..3ee6269 100644 (file)
@@ -1522,8 +1522,40 @@ get_xfer_size(struct tree *t, int fd, const char *path)
 }
 #endif
 
-#if defined(HAVE_STATFS) && defined(HAVE_FSTATFS) && defined(MNT_LOCAL) \
-       && !defined(ST_LOCAL)
+#if defined(HAVE_STATVFS)
+static inline __LA_UNUSED void
+set_statvfs_transfer_size(struct filesystem *fs, const struct statvfs *sfs)
+{
+       fs->xfer_align = sfs->f_frsize > 0 ? (long)sfs->f_frsize : -1;
+       fs->max_xfer_size = -1;
+#if defined(HAVE_STRUCT_STATVFS_F_IOSIZE)
+       fs->min_xfer_size = sfs->f_iosize > 0 ? (long)sfs->f_iosize : -1;
+       fs->incr_xfer_size = sfs->f_iosize > 0 ? (long)sfs->f_iosize : -1;
+#else
+       fs->min_xfer_size = sfs->f_bsize > 0 ? (long)sfs->f_bsize : -1;
+       fs->incr_xfer_size = sfs->f_bsize > 0 ? (long)sfs->f_bsize : -1;
+#endif
+}
+#endif
+
+#if defined(HAVE_STRUCT_STATFS)
+static inline __LA_UNUSED void
+set_statfs_transfer_size(struct filesystem *fs, const struct statfs *sfs)
+{
+       fs->xfer_align = sfs->f_bsize > 0 ? (long)sfs->f_bsize : -1;
+       fs->max_xfer_size = -1;
+#if defined(HAVE_STRUCT_STATFS_F_IOSIZE)
+       fs->min_xfer_size = sfs->f_iosize > 0 ? (long)sfs->f_iosize : -1;
+       fs->incr_xfer_size = sfs->f_iosize > 0 ? (long)sfs->f_iosize : -1;
+#else
+       fs->min_xfer_size = sfs->f_bsize > 0 ? (long)sfs->f_bsize : -1;
+       fs->incr_xfer_size = sfs->f_bsize > 0 ? (long)sfs->f_bsize : -1;
+#endif
+}
+#endif
+
+#if defined(HAVE_STRUCT_STATFS) && defined(HAVE_STATFS) && \
+    defined(HAVE_FSTATFS) && defined(MNT_LOCAL) && !defined(ST_LOCAL)
 
 /*
  * Gather current filesystem properties on FreeBSD, OpenBSD and Mac OS X.
@@ -1593,10 +1625,7 @@ setup_current_filesystem(struct archive_read_disk *a)
                return (ARCHIVE_FAILED);
        } else if (xr == 1) {
                /* pathconf(_PC_REX_*) operations are not supported. */
-               t->current_filesystem->xfer_align = sfs.f_bsize;
-               t->current_filesystem->max_xfer_size = -1;
-               t->current_filesystem->min_xfer_size = sfs.f_iosize;
-               t->current_filesystem->incr_xfer_size = sfs.f_iosize;
+               set_statfs_transfer_size(t->current_filesystem, &sfs);
        }
        if (sfs.f_flags & MNT_LOCAL)
                t->current_filesystem->remote = 0;
@@ -1688,15 +1717,7 @@ setup_current_filesystem(struct archive_read_disk *a)
        } else if (xr == 1) {
                /* Usually come here unless NetBSD supports _PC_REC_XFER_ALIGN
                 * for pathconf() function. */
-               t->current_filesystem->xfer_align = svfs.f_frsize;
-               t->current_filesystem->max_xfer_size = -1;
-#if defined(HAVE_STRUCT_STATVFS_F_IOSIZE)
-               t->current_filesystem->min_xfer_size = svfs.f_iosize;
-               t->current_filesystem->incr_xfer_size = svfs.f_iosize;
-#else
-               t->current_filesystem->min_xfer_size = svfs.f_bsize;
-               t->current_filesystem->incr_xfer_size = svfs.f_bsize;
-#endif
+               set_statvfs_transfer_size(t->current_filesystem, &svfs);
        }
        if (svfs.f_flag & ST_LOCAL)
                t->current_filesystem->remote = 0;
@@ -1803,15 +1824,9 @@ setup_current_filesystem(struct archive_read_disk *a)
        } else if (xr == 1) {
                /* pathconf(_PC_REX_*) operations are not supported. */
 #if defined(HAVE_STATVFS)
-               t->current_filesystem->xfer_align = svfs.f_frsize;
-               t->current_filesystem->max_xfer_size = -1;
-               t->current_filesystem->min_xfer_size = svfs.f_bsize;
-               t->current_filesystem->incr_xfer_size = svfs.f_bsize;
+               set_statvfs_transfer_size(t->current_filesystem, &svfs);
 #else
-               t->current_filesystem->xfer_align = sfs.f_frsize;
-               t->current_filesystem->max_xfer_size = -1;
-               t->current_filesystem->min_xfer_size = sfs.f_bsize;
-               t->current_filesystem->incr_xfer_size = sfs.f_bsize;
+               set_statfs_transfer_size(t->current_filesystem, &sfs);
 #endif
        }
        switch (sfs.f_type) {
@@ -1918,10 +1933,7 @@ setup_current_filesystem(struct archive_read_disk *a)
                return (ARCHIVE_FAILED);
        } else if (xr == 1) {
                /* pathconf(_PC_REX_*) operations are not supported. */
-               t->current_filesystem->xfer_align = svfs.f_frsize;
-               t->current_filesystem->max_xfer_size = -1;
-               t->current_filesystem->min_xfer_size = svfs.f_bsize;
-               t->current_filesystem->incr_xfer_size = svfs.f_bsize;
+               set_statvfs_transfer_size(t->current_filesystem, &svfs);
        }
 
 #if defined(ST_NOATIME)
index fdd376f..877bc44 100644 (file)
@@ -1844,7 +1844,7 @@ tree_next(struct tree *t)
                                        continue;
                                return (r);
                        } else {
-                               HANDLE h = FindFirstFileW(d, &t->_findData);
+                               HANDLE h = FindFirstFileW(t->stack->full_path.s, &t->_findData);
                                if (h == INVALID_HANDLE_VALUE) {
                                        la_dosmaperr(GetLastError());
                                        t->tree_errno = errno;
index 78d9999..b2db4cb 100644 (file)
@@ -188,9 +188,18 @@ used when translating file names.
 .El
 .It Format cpio
 .Bl -tag -compact -width indent
+.It Cm compat-2x
+Libarchive 2.x incorrectly encoded Unicode filenames on
+some platforms.
+This option mimics the libarchive 2.x filename handling
+so that such archives can be read correctly.
 .It Cm hdrcharset
 The value is used as a character set name that will be
 used when translating file names.
+.It Cm pwb
+When reading a binary CPIO archive, assume that it is
+in the original PWB cpio format, and handle file mode
+bits accordingly.  The default is to assume v7 format.
 .El
 .It Format iso9660
 .Bl -tag -compact -width indent
index e7e58e5..ddd6839 100644 (file)
@@ -216,7 +216,7 @@ rpm_filter_read(struct archive_read_filter *self, const void **buff)
                                                archive_set_error(
                                                    &self->archive->archive,
                                                    ARCHIVE_ERRNO_FILE_FORMAT,
-                                                   "Unrecoginized rpm header");
+                                                   "Unrecognized rpm header");
                                                return (ARCHIVE_FATAL);
                                        }
                                        rpm->state = ST_ARCHIVE;
index 67ddffb..689c18c 100644 (file)
@@ -248,7 +248,7 @@ bid_get_line(struct archive_read_filter *filter,
                *ravail = *avail;
                *b += diff;
                *avail -= diff;
-               tested = len;/* Skip some bytes we already determinated. */
+               tested = len;/* Skip some bytes we already determined. */
                len = get_line(*b + tested, *avail - tested, nl);
                if (len >= 0)
                        len += tested;
index 6ce9d1a..63cbb7d 100644 (file)
@@ -808,8 +808,12 @@ archive_read_format_7zip_read_data(struct archive_read *a,
        if (zip->end_of_entry)
                return (ARCHIVE_EOF);
 
-       bytes = read_stream(a, buff,
-               (size_t)zip->entry_bytes_remaining, 0);
+       const uint64_t max_read_size = 16 * 1024 * 1024;  // Don't try to read more than 16 MB at a time
+       size_t bytes_to_read = max_read_size;
+       if ((uint64_t)bytes_to_read > zip->entry_bytes_remaining) {
+               bytes_to_read = zip->entry_bytes_remaining;
+       }
+       bytes = read_stream(a, buff, bytes_to_read, 0);
        if (bytes < 0)
                return ((int)bytes);
        if (bytes == 0) {
@@ -1493,7 +1497,7 @@ decompress(struct archive_read *a, struct _7zip *zip,
                                zip->ppmd7_stat = -1;
                                archive_set_error(&a->archive,
                                    ARCHIVE_ERRNO_MISC,
-                                   "Failed to initialize PPMd range decorder");
+                                   "Failed to initialize PPMd range decoder");
                                return (ARCHIVE_FAILED);
                        }
                        if (zip->ppstream.overconsumed) {
@@ -3031,10 +3035,10 @@ extract_pack_stream(struct archive_read *a, size_t minimum)
                            "Truncated 7-Zip file body");
                        return (ARCHIVE_FATAL);
                }
-               if (bytes_avail > (ssize_t)zip->pack_stream_inbytes_remaining)
+               if ((uint64_t)bytes_avail > zip->pack_stream_inbytes_remaining)
                        bytes_avail = (ssize_t)zip->pack_stream_inbytes_remaining;
                zip->pack_stream_inbytes_remaining -= bytes_avail;
-               if (bytes_avail > (ssize_t)zip->folder_outbytes_remaining)
+               if ((uint64_t)bytes_avail > zip->folder_outbytes_remaining)
                        bytes_avail = (ssize_t)zip->folder_outbytes_remaining;
                zip->folder_outbytes_remaining -= bytes_avail;
                zip->uncompressed_buffer_bytes_remaining = bytes_avail;
index 43738b5..950f3d2 100644 (file)
@@ -2110,7 +2110,6 @@ lzx_decode_init(struct lzx_stream *strm, int w_bits)
                ds->pos_tbl = malloc(sizeof(ds->pos_tbl[0]) * w_slot);
                if (ds->pos_tbl == NULL)
                        return (ARCHIVE_FATAL);
-               lzx_huffman_free(&(ds->mt));
        }
 
        for (footer = 0; footer < 18; footer++)
index 1c96e6a..6b8ae33 100644 (file)
@@ -185,6 +185,8 @@ struct cpio {
        struct archive_string_conv *opt_sconv;
        struct archive_string_conv *sconv_default;
        int                       init_default_conversion;
+
+       int                       option_pwb;
 };
 
 static int64_t atol16(const char *, unsigned);
@@ -343,6 +345,10 @@ archive_read_format_cpio_options(struct archive_read *a,
                                ret = ARCHIVE_FATAL;
                }
                return (ret);
+       } else if (strcmp(key, "pwb")  == 0) {
+               if (val != NULL && val[0] != 0)
+                       cpio->option_pwb = 1;
+               return (ARCHIVE_OK);
        }
 
        /* Note: The "warn" return is just to inform the options
@@ -891,6 +897,12 @@ header_bin_le(struct archive_read *a, struct cpio *cpio,
        archive_entry_set_dev(entry, header[bin_dev_offset] + header[bin_dev_offset + 1] * 256);
        archive_entry_set_ino(entry, header[bin_ino_offset] + header[bin_ino_offset + 1] * 256);
        archive_entry_set_mode(entry, header[bin_mode_offset] + header[bin_mode_offset + 1] * 256);
+       if (cpio->option_pwb) {
+               /* turn off random bits left over from V6 inode */
+               archive_entry_set_mode(entry, archive_entry_mode(entry) & 067777);
+               if ((archive_entry_mode(entry) & AE_IFMT) == 0)
+                       archive_entry_set_mode(entry, archive_entry_mode(entry) | AE_IFREG);
+       }
        archive_entry_set_uid(entry, header[bin_uid_offset] + header[bin_uid_offset + 1] * 256);
        archive_entry_set_gid(entry, header[bin_gid_offset] + header[bin_gid_offset + 1] * 256);
        archive_entry_set_nlink(entry, header[bin_nlink_offset] + header[bin_nlink_offset + 1] * 256);
@@ -930,6 +942,12 @@ header_bin_be(struct archive_read *a, struct cpio *cpio,
        archive_entry_set_dev(entry, header[bin_dev_offset] * 256 + header[bin_dev_offset + 1]);
        archive_entry_set_ino(entry, header[bin_ino_offset] * 256 + header[bin_ino_offset + 1]);
        archive_entry_set_mode(entry, header[bin_mode_offset] * 256 + header[bin_mode_offset + 1]);
+       if (cpio->option_pwb) {
+               /* turn off random bits left over from V6 inode */
+               archive_entry_set_mode(entry, archive_entry_mode(entry) & 067777);
+               if ((archive_entry_mode(entry) & AE_IFMT) == 0)
+                       archive_entry_set_mode(entry, archive_entry_mode(entry) | AE_IFREG);
+       }
        archive_entry_set_uid(entry, header[bin_uid_offset] * 256 + header[bin_uid_offset + 1]);
        archive_entry_set_gid(entry, header[bin_gid_offset] * 256 + header[bin_gid_offset + 1]);
        archive_entry_set_nlink(entry, header[bin_nlink_offset] * 256 + header[bin_nlink_offset + 1]);
index 93ba295..c87a154 100644 (file)
@@ -408,7 +408,7 @@ next_line(struct archive_read *a,
                *ravail = *avail;
                *b += diff;
                *avail -= diff;
-               tested = len;/* Skip some bytes we already determinated. */
+               tested = len;/* Skip some bytes we already determined. */
                len = get_line_size(*b + len, *avail - len, nl);
                if (len >= 0)
                        len += tested;
@@ -1074,7 +1074,7 @@ read_mtree(struct archive_read *a, struct mtree *mtree)
                        continue;
                /* Non-printable characters are not allowed */
                for (s = p;s < p + len - 1; s++) {
-                       if (!isprint(*s)) {
+                       if (!isprint((unsigned char)*s)) {
                                r = ARCHIVE_FATAL;
                                break;
                        }
@@ -2035,13 +2035,13 @@ mtree_atol(char **p, int base)
 
        if (**p == '-') {
                limit = INT64_MIN / base;
-               last_digit_limit = INT64_MIN % base;
+               last_digit_limit = -(INT64_MIN % base);
                ++(*p);
 
                l = 0;
                digit = parsedigit(**p);
                while (digit >= 0 && digit < base) {
-                       if (l < limit || (l == limit && digit > last_digit_limit))
+                       if (l < limit || (l == limit && digit >= last_digit_limit))
                                return INT64_MIN;
                        l = (l * base) - digit;
                        digit = parsedigit(*++(*p));
index 283a960..c2666b2 100644 (file)
@@ -958,17 +958,17 @@ archive_read_format_rar_read_header(struct archive_read *a,
       crc32_val = 0;
       while (skip > 0) {
              size_t to_read = skip;
-             ssize_t did_read;
-             if (to_read > 32 * 1024) {
+             if (to_read > 32 * 1024)
                      to_read = 32 * 1024;
-             }
-             if ((h = __archive_read_ahead(a, to_read, &did_read)) == NULL) {
+             if ((h = __archive_read_ahead(a, to_read, NULL)) == NULL) {
+                     archive_set_error(&a->archive,  ARCHIVE_ERRNO_FILE_FORMAT,
+                         "Bad RAR file");
                      return (ARCHIVE_FATAL);
              }
              p = h;
-             crc32_val = crc32(crc32_val, (const unsigned char *)p, (unsigned)did_read);
-             __archive_read_consume(a, did_read);
-             skip -= did_read;
+             crc32_val = crc32(crc32_val, (const unsigned char *)p, to_read);
+             __archive_read_consume(a, to_read);
+             skip -= to_read;
       }
       if ((crc32_val & 0xffff) != crc32_expected) {
              archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
index 58a61d1..5d62d16 100644 (file)
@@ -4076,6 +4076,7 @@ int archive_read_support_format_rar5(struct archive *_a) {
        if(ARCHIVE_OK != rar5_init(rar)) {
                archive_set_error(&ar->archive, ENOMEM,
                    "Can't allocate rar5 filter buffer");
+               free(rar);
                return ARCHIVE_FATAL;
        }
 
index 96d8101..7e8feba 100644 (file)
@@ -1906,7 +1906,7 @@ pax_attribute(struct archive_read *a, struct tar *tar,
                }
                if (strcmp(key, "GNU.sparse.numbytes") == 0) {
                        tar->sparse_numbytes = tar_atol10(value, strlen(value));
-                       if (tar->sparse_numbytes != -1) {
+                       if (tar->sparse_offset != -1) {
                                if (gnu_add_sparse_entry(a, tar,
                                    tar->sparse_offset, tar->sparse_numbytes)
                                    != ARCHIVE_OK)
@@ -2643,14 +2643,14 @@ tar_atol_base_n(const char *p, size_t char_cnt, int base)
 
                maxval = INT64_MIN;
                limit = -(INT64_MIN / base);
-               last_digit_limit = INT64_MIN % base;
+               last_digit_limit = -(INT64_MIN % base);
        }
 
        l = 0;
        if (char_cnt != 0) {
                digit = *p - '0';
                while (digit >= 0 && digit < base  && char_cnt != 0) {
-                       if (l>limit || (l == limit && digit > last_digit_limit)) {
+                       if (l>limit || (l == limit && digit >= last_digit_limit)) {
                                return maxval; /* Truncate on overflow. */
                        }
                        l = (l * base) + digit;
index a64332c..21d41cc 100644 (file)
@@ -142,6 +142,7 @@ struct zip {
        /* Structural information about the archive. */
        struct archive_string   format_name;
        int64_t                 central_directory_offset;
+       int64_t                 central_directory_offset_adjusted;
        size_t                  central_directory_entries_total;
        size_t                  central_directory_entries_on_this_disk;
        int                     has_encrypted_entries;
@@ -246,6 +247,17 @@ struct zip {
 /* Many systems define min or MIN, but not all. */
 #define        zipmin(a,b) ((a) < (b) ? (a) : (b))
 
+#ifdef HAVE_ZLIB_H
+static int
+zip_read_data_deflate(struct archive_read *a, const void **buff,
+       size_t *size, int64_t *offset);
+#endif
+#if HAVE_LZMA_H && HAVE_LIBLZMA
+static int
+zip_read_data_zipx_lzma_alone(struct archive_read *a, const void **buff,
+       size_t *size, int64_t *offset);
+#endif
+
 /* This function is used by Ppmd8_DecodeSymbol during decompression of Ppmd8
  * streams inside ZIP files. It has 2 purposes: one is to fetch the next
  * compressed byte from the stream, second one is to increase the counter how
@@ -899,81 +911,6 @@ process_extra(struct archive_read *a, struct archive_entry *entry,
        return ARCHIVE_OK;
 }
 
-#if HAVE_LZMA_H && HAVE_LIBLZMA
-/*
- * Auxiliary function to uncompress data chunk from zipx archive
- * (zip with lzma compression).
- */
-static int
-zipx_lzma_uncompress_buffer(const char *compressed_buffer,
-       size_t compressed_buffer_size,
-       char *uncompressed_buffer,
-       size_t uncompressed_buffer_size)
-{
-       int status = ARCHIVE_FATAL;
-       // length of 'lzma properties data' in lzma compressed
-       // data segment (stream) inside zip archive
-       const size_t lzma_params_length = 5;
-       // offset of 'lzma properties data' from the beginning of lzma stream
-       const size_t lzma_params_offset = 4;
-       // end position of 'lzma properties data' in lzma stream
-       const size_t lzma_params_end = lzma_params_offset + lzma_params_length;
-       if (compressed_buffer == NULL ||
-                       compressed_buffer_size < lzma_params_end ||
-                       uncompressed_buffer == NULL)
-               return status;
-
-       // prepare header for lzma_alone_decoder to replace zipx header
-       // (see comments in 'zipx_lzma_alone_init' for justification)
-#pragma pack(push)
-#pragma pack(1)
-       struct _alone_header
-       {
-               uint8_t bytes[5]; // lzma_params_length
-               uint64_t uncompressed_size;
-       } alone_header;
-#pragma pack(pop)
-       // copy 'lzma properties data' blob
-       memcpy(&alone_header.bytes[0], compressed_buffer + lzma_params_offset,
-               lzma_params_length);
-       alone_header.uncompressed_size = UINT64_MAX;
-
-       // prepare new compressed buffer, see 'zipx_lzma_alone_init' for details
-       const size_t lzma_alone_buffer_size =
-               compressed_buffer_size - lzma_params_end + sizeof(alone_header);
-       unsigned char *lzma_alone_compressed_buffer =
-               (unsigned char*) malloc(lzma_alone_buffer_size);
-       if (lzma_alone_compressed_buffer == NULL)
-               return status;
-       // copy lzma_alone header into new buffer
-       memcpy(lzma_alone_compressed_buffer, (void*) &alone_header,
-               sizeof(alone_header));
-       // copy compressed data into new buffer
-       memcpy(lzma_alone_compressed_buffer + sizeof(alone_header),
-               compressed_buffer + lzma_params_end,
-               compressed_buffer_size - lzma_params_end);
-
-       // create and fill in lzma_alone_decoder stream
-       lzma_stream stream = LZMA_STREAM_INIT;
-       lzma_ret ret = lzma_alone_decoder(&stream, UINT64_MAX);
-       if (ret == LZMA_OK)
-       {
-               stream.next_in = lzma_alone_compressed_buffer;
-               stream.avail_in = lzma_alone_buffer_size;
-               stream.total_in = 0;
-               stream.next_out = (unsigned char*)uncompressed_buffer;
-               stream.avail_out = uncompressed_buffer_size;
-               stream.total_out = 0;
-               ret = lzma_code(&stream, LZMA_RUN);
-               if (ret == LZMA_OK || ret == LZMA_STREAM_END)
-                       status = ARCHIVE_OK;
-       }
-       lzma_end(&stream);
-       free(lzma_alone_compressed_buffer);
-       return status;
-}
-#endif
-
 /*
  * Assumes file pointer is at beginning of local file header.
  */
@@ -1242,36 +1179,30 @@ zip_read_local_file_header(struct archive_read *a, struct archive_entry *entry,
                linkname_length = (size_t)zip_entry->compressed_size;
 
                archive_entry_set_size(entry, 0);
-               p = __archive_read_ahead(a, linkname_length, NULL);
-               if (p == NULL) {
-                       archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
-                           "Truncated Zip file");
-                       return ARCHIVE_FATAL;
-               }
+
                // take into account link compression if any
                size_t linkname_full_length = linkname_length;
                if (zip->entry->compression != 0)
                {
                        // symlink target string appeared to be compressed
                        int status = ARCHIVE_FATAL;
-                       char *uncompressed_buffer =
-                               (char*) malloc(zip_entry->uncompressed_size);
-                       if (uncompressed_buffer == NULL)
-                       {
-                               archive_set_error(&a->archive, ENOMEM,
-                                       "No memory for lzma decompression");
-                               return status;
-                       }
+                       const void *uncompressed_buffer;
 
                        switch (zip->entry->compression)
                        {
+#if HAVE_ZLIB_H
+                               case 8: /* Deflate compression. */
+                                       zip->entry_bytes_remaining = zip_entry->compressed_size;
+                                       status = zip_read_data_deflate(a, &uncompressed_buffer,
+                                               &linkname_full_length, NULL);
+                                       break;
+#endif
 #if HAVE_LZMA_H && HAVE_LIBLZMA
                                case 14: /* ZIPx LZMA compression. */
                                        /*(see zip file format specification, section 4.4.5)*/
-                                       status = zipx_lzma_uncompress_buffer(p,
-                                               linkname_length,
-                                               uncompressed_buffer,
-                                               (size_t)zip_entry->uncompressed_size);
+                                       zip->entry_bytes_remaining = zip_entry->compressed_size;
+                                       status = zip_read_data_zipx_lzma_alone(a, &uncompressed_buffer,
+                                               &linkname_full_length, NULL);
                                        break;
 #endif
                                default: /* Unsupported compression. */
@@ -1280,8 +1211,6 @@ zip_read_local_file_header(struct archive_read *a, struct archive_entry *entry,
                        if (status == ARCHIVE_OK)
                        {
                                p = uncompressed_buffer;
-                               linkname_full_length =
-                                       (size_t)zip_entry->uncompressed_size;
                        }
                        else
                        {
@@ -1294,6 +1223,16 @@ zip_read_local_file_header(struct archive_read *a, struct archive_entry *entry,
                                return ARCHIVE_FAILED;
                        }
                }
+               else
+               {
+                       p = __archive_read_ahead(a, linkname_length, NULL);
+               }
+
+               if (p == NULL) {
+                       archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+                           "Truncated Zip file");
+                       return ARCHIVE_FATAL;
+               }
 
                sconv = zip->sconv;
                if (sconv == NULL && (zip->entry->zip_flags & ZIP_UTF8_NAME))
@@ -1663,7 +1602,8 @@ zipx_lzma_alone_init(struct archive_read *a, struct zip *zip)
        /* To unpack ZIPX's "LZMA" (id 14) stream we can use standard liblzma
         * that is a part of XZ Utils. The stream format stored inside ZIPX
         * file is a modified "lzma alone" file format, that was used by the
-        * `lzma` utility which was later deprecated in favour of `xz` utility.          * Since those formats are nearly the same, we can use a standard
+        * `lzma` utility which was later deprecated in favour of `xz` utility.
+        * Since those formats are nearly the same, we can use a standard
         * "lzma alone" decoder from XZ Utils. */
 
        memset(&zip->zipx_lzma_stream, 0, sizeof(zip->zipx_lzma_stream));
@@ -3415,24 +3355,31 @@ archive_read_support_format_zip_capabilities_seekable(struct archive_read * a)
 static int
 read_eocd(struct zip *zip, const char *p, int64_t current_offset)
 {
+       uint16_t disk_num;
+       uint32_t cd_size, cd_offset;
+       
+       disk_num = archive_le16dec(p + 4);
+       cd_size = archive_le32dec(p + 12);
+       cd_offset = archive_le32dec(p + 16);
+
        /* Sanity-check the EOCD we've found. */
 
        /* This must be the first volume. */
-       if (archive_le16dec(p + 4) != 0)
+       if (disk_num != 0)
                return 0;
        /* Central directory must be on this volume. */
-       if (archive_le16dec(p + 4) != archive_le16dec(p + 6))
+       if (disk_num != archive_le16dec(p + 6))
                return 0;
        /* All central directory entries must be on this volume. */
        if (archive_le16dec(p + 10) != archive_le16dec(p + 8))
                return 0;
        /* Central directory can't extend beyond start of EOCD record. */
-       if (archive_le32dec(p + 16) + archive_le32dec(p + 12)
-           > current_offset)
+       if (cd_offset + cd_size > current_offset)
                return 0;
 
        /* Save the central directory location for later use. */
-       zip->central_directory_offset = archive_le32dec(p + 16);
+       zip->central_directory_offset = cd_offset;
+       zip->central_directory_offset_adjusted = current_offset - cd_size;
 
        /* This is just a tiny bit higher than the maximum
           returned by the streaming Zip bidder.  This ensures
@@ -3484,6 +3431,8 @@ read_zip64_eocd(struct archive_read *a, struct zip *zip, const char *p)
 
        /* Save the central directory offset for later use. */
        zip->central_directory_offset = archive_le64dec(p + 48);
+       /* TODO: Needs scanning backwards to find the eocd64 instead of assuming */
+       zip->central_directory_offset_adjusted = zip->central_directory_offset;
 
        return 32;
 }
@@ -3655,7 +3604,8 @@ slurp_central_directory(struct archive_read *a, struct archive_entry* entry,
         * know the correction we need to apply to account for leading
         * padding.
         */
-       if (__archive_read_seek(a, zip->central_directory_offset, SEEK_SET) < 0)
+       if (__archive_read_seek(a, zip->central_directory_offset_adjusted, SEEK_SET)
+               < 0)
                return ARCHIVE_FATAL;
 
        found = 0;
index 8d70f51..38c14cb 100644 (file)
@@ -482,6 +482,8 @@ archive_write_client_close(struct archive_write_filter *f)
        ssize_t block_length;
        ssize_t target_block_length;
        ssize_t bytes_written;
+       size_t to_write;
+       char *p;
        int ret = ARCHIVE_OK;
 
        /* If there's pending data, pad and write the last block */
@@ -504,9 +506,24 @@ archive_write_client_close(struct archive_write_filter *f)
                            target_block_length - block_length);
                        block_length = target_block_length;
                }
-               bytes_written = (a->client_writer)(&a->archive,
-                   a->client_data, state->buffer, block_length);
-               ret = bytes_written <= 0 ? ARCHIVE_FATAL : ARCHIVE_OK;
+               p = state->buffer;
+               to_write = block_length;
+               while (to_write > 0) {
+                       bytes_written = (a->client_writer)(&a->archive,
+                           a->client_data, p, to_write);
+                       if (bytes_written <= 0) {
+                               ret = ARCHIVE_FATAL;
+                               break;
+                       }
+                       if ((size_t)bytes_written > to_write) {
+                               archive_set_error(&(a->archive),
+                                                 -1, "write overrun");
+                               ret = ARCHIVE_FATAL;
+                               break;
+                       }
+                       p += bytes_written;
+                       to_write -= bytes_written;
+               }
        }
        if (a->client_closer)
                (*a->client_closer)(&a->archive, a->client_data);
index 7e32fca..fcd733a 100644 (file)
@@ -360,7 +360,7 @@ static int  la_mktemp(struct archive_write_disk *);
 static void    fsobj_error(int *, struct archive_string *, int, const char *,
                    const char *);
 static int     check_symlinks_fsobj(char *, int *, struct archive_string *,
-                   int);
+                   int, int);
 static int     check_symlinks(struct archive_write_disk *);
 static int     create_filesystem_object(struct archive_write_disk *);
 static struct fixup_entry *current_fixup(struct archive_write_disk *,
@@ -2263,7 +2263,7 @@ create_filesystem_object(struct archive_write_disk *a)
                        return (EPERM);
                }
                r = check_symlinks_fsobj(linkname_copy, &error_number,
-                   &error_string, a->flags);
+                   &error_string, a->flags, 1);
                if (r != ARCHIVE_OK) {
                        archive_set_error(&a->archive, error_number, "%s",
                            error_string.s);
@@ -2284,7 +2284,12 @@ create_filesystem_object(struct archive_write_disk *a)
                 */
                if (a->flags & ARCHIVE_EXTRACT_SAFE_WRITES)
                        unlink(a->name);
+#ifdef HAVE_LINKAT
+               r = linkat(AT_FDCWD, linkname, AT_FDCWD, a->name,
+                   0) ? errno : 0;
+#else
                r = link(linkname, a->name) ? errno : 0;
+#endif
                /*
                 * New cpio and pax formats allow hardlink entries
                 * to carry data, so we may have to open the file
@@ -2456,6 +2461,7 @@ _archive_write_disk_close(struct archive *_a)
 {
        struct archive_write_disk *a = (struct archive_write_disk *)_a;
        struct fixup_entry *next, *p;
+       struct stat st;
        int fd, ret;
 
        archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
@@ -2473,6 +2479,20 @@ _archive_write_disk_close(struct archive *_a)
                    (TODO_TIMES | TODO_MODE_BASE | TODO_ACLS | TODO_FFLAGS)) {
                        fd = open(p->name,
                            O_WRONLY | O_BINARY | O_NOFOLLOW | O_CLOEXEC);
+                       if (fd == -1) {
+                               /* If we cannot lstat, skip entry */
+                               if (lstat(p->name, &st) != 0)
+                                       goto skip_fixup_entry;
+                               /*
+                                * If we deal with a symbolic link, mark
+                                * it in the fixup mode to ensure no
+                                * modifications are made to its target.
+                                */
+                               if (S_ISLNK(st.st_mode)) {
+                                       p->mode &= ~S_IFMT;
+                                       p->mode |= S_IFLNK;
+                               }
+                       }
                }
                if (p->fixup & TODO_TIMES) {
                        set_times(a, fd, p->mode, p->name,
@@ -2487,7 +2507,12 @@ _archive_write_disk_close(struct archive *_a)
                                fchmod(fd, p->mode);
                        else
 #endif
-                       chmod(p->name, p->mode);
+#ifdef HAVE_LCHMOD
+                       lchmod(p->name, p->mode);
+#else
+                       if (!S_ISLNK(p->mode))
+                               chmod(p->name, p->mode);
+#endif
                }
                if (p->fixup & TODO_ACLS)
                        archive_write_disk_set_acls(&a->archive, fd,
@@ -2498,6 +2523,7 @@ _archive_write_disk_close(struct archive *_a)
                if (p->fixup & TODO_MAC_METADATA)
                        set_mac_metadata(a, p->name, p->mac_metadata,
                                         p->mac_metadata_size);
+skip_fixup_entry:
                next = p->next;
                archive_acl_clear(&p->acl);
                free(p->mac_metadata);
@@ -2638,6 +2664,7 @@ new_fixup(struct archive_write_disk *a, const char *pathname)
        fe->next = a->fixup_list;
        a->fixup_list = fe;
        fe->fixup = 0;
+       fe->mode = 0;
        fe->name = strdup(pathname);
        return (fe);
 }
@@ -2675,7 +2702,7 @@ fsobj_error(int *a_eno, struct archive_string *a_estr,
  */
 static int
 check_symlinks_fsobj(char *path, int *a_eno, struct archive_string *a_estr,
-    int flags)
+    int flags, int checking_linkname)
 {
 #if !defined(HAVE_LSTAT) && \
     !(defined(HAVE_OPENAT) && defined(HAVE_FSTATAT) && defined(HAVE_UNLINKAT))
@@ -2684,6 +2711,7 @@ check_symlinks_fsobj(char *path, int *a_eno, struct archive_string *a_estr,
        (void)error_number; /* UNUSED */
        (void)error_string; /* UNUSED */
        (void)flags; /* UNUSED */
+       (void)checking_linkname; /* UNUSED */
        return (ARCHIVE_OK);
 #else
        int res = ARCHIVE_OK;
@@ -2805,6 +2833,28 @@ check_symlinks_fsobj(char *path, int *a_eno, struct archive_string *a_estr,
                                head = tail + 1;
                        }
                } else if (S_ISLNK(st.st_mode)) {
+                       if (last && checking_linkname) {
+#ifdef HAVE_LINKAT
+                               /*
+                                * Hardlinks to symlinks are safe to write
+                                * if linkat() is supported as it does not
+                                * follow symlinks.
+                                */
+                               res = ARCHIVE_OK;
+#else
+                               /*
+                                * We return ARCHIVE_FAILED here as we are
+                                * not able to safely write hardlinks
+                                * to symlinks.
+                                */
+                               tail[0] = c;
+                               fsobj_error(a_eno, a_estr, errno,
+                                   "Cannot write hardlink to symlink ",
+                                   path);
+                               res = ARCHIVE_FAILED;
+#endif
+                               break;
+                       } else
                        if (last) {
                                /*
                                 * Last element is symlink; remove it
@@ -2971,7 +3021,7 @@ check_symlinks(struct archive_write_disk *a)
        int rc;
        archive_string_init(&error_string);
        rc = check_symlinks_fsobj(a->name, &error_number, &error_string,
-           a->flags);
+           a->flags, 0);
        if (rc != ARCHIVE_OK) {
                archive_set_error(&a->archive, error_number, "%s",
                    error_string.s);
@@ -3899,7 +3949,8 @@ set_fflags_platform(struct archive_write_disk *a, int fd, const char *name,
 
        /* If we weren't given an fd, open it ourselves. */
        if (myfd < 0) {
-               myfd = open(name, O_RDONLY | O_NONBLOCK | O_BINARY | O_CLOEXEC);
+               myfd = open(name, O_RDONLY | O_NONBLOCK | O_BINARY |
+                   O_CLOEXEC | O_NOFOLLOW);
                __archive_ensure_cloexec_flag(myfd);
        }
        if (myfd < 0)
index 47a7403..653089f 100644 (file)
 .Nm archive_write_set_format_ar_svr4 ,
 .Nm archive_write_set_format_by_name ,
 .Nm archive_write_set_format_cpio ,
+.Nm archive_write_set_format_cpio_bin ,
 .Nm archive_write_set_format_cpio_newc ,
+.Nm archive_write_set_format_cpio_odc ,
+.Nm archive_write_set_format_cpio_pwb ,
 .Nm archive_write_set_format_filter_by_ext ,
 .Nm archive_write_set_format_filter_by_ext_def ,
 .Nm archive_write_set_format_gnutar ,
@@ -73,8 +76,14 @@ Streaming Archive Library (libarchive, -larchive)
 .Ft int
 .Fn archive_write_set_format_cpio "struct archive *"
 .Ft int
+.Fn archive_write_set_format_cpio_bin "struct archive *"
+.Ft int
 .Fn archive_write_set_format_cpio_newc "struct archive *"
 .Ft int
+.Fn archive_write_set_format_cpio_odc "struct archive *"
+.Ft int
+.Fn archive_write_set_format_cpio_pwb "struct archive *"
+.Ft int
 .Fn archive_write_set_format_filter_by_ext "struct archive *" "const char *filename"
 .Ft int
 .Fn archive_write_set_format_filter_by_ext_def "struct archive *" "const char *filename" "const char *def_ext"
@@ -119,17 +128,20 @@ to create a new archive with the same format as an existing archive.
 .It Fn archive_write_set_format_by_name
 Sets the corresponding format based on the common name.
 .It Xo
-.Fn archive_write_set_format_filter_by_ext ,
+.Fn archive_write_set_format_filter_by_ext
 .Fn archive_write_set_format_filter_by_ext_def
 .Xc
 Sets both filters and format based on the output filename.
 Supported extensions: .7z, .zip, .jar, .cpio, .iso, .a, .ar, .tar, .tgz, .tar.gz, .tar.bz2, .tar.xz
 .It Xo
 .Fn archive_write_set_format_7zip
-.Fn archive_write_set_format_ar_bsd ,
-.Fn archive_write_set_format_ar_svr4 ,
+.Fn archive_write_set_format_ar_bsd
+.Fn archive_write_set_format_ar_svr4
 .Fn archive_write_set_format_cpio
+.Fn archive_write_set_format_cpio_bin
 .Fn archive_write_set_format_cpio_newc
+.Fn archive_write_set_format_cpio_odc
+.Fn archive_write_set_format_cpio_pwb
 .Fn archive_write_set_format_gnutar
 .Fn archive_write_set_format_iso9660
 .Fn archive_write_set_format_mtree
index 7dbe7b9..1f65fa4 100644 (file)
@@ -44,7 +44,9 @@ struct { int code; int (*setter)(struct archive *); } codes[] =
 {
        { ARCHIVE_FORMAT_7ZIP,          archive_write_set_format_7zip },
        { ARCHIVE_FORMAT_CPIO,          archive_write_set_format_cpio },
-       { ARCHIVE_FORMAT_CPIO_POSIX,    archive_write_set_format_cpio },
+       { ARCHIVE_FORMAT_CPIO_BIN_LE,   archive_write_set_format_cpio_bin },
+       { ARCHIVE_FORMAT_CPIO_PWB,      archive_write_set_format_cpio_pwb },
+       { ARCHIVE_FORMAT_CPIO_POSIX,    archive_write_set_format_cpio_odc },
        { ARCHIVE_FORMAT_CPIO_SVR4_NOCRC,       archive_write_set_format_cpio_newc },
        { ARCHIVE_FORMAT_ISO9660,       archive_write_set_format_iso9660 },
        { ARCHIVE_FORMAT_MTREE,         archive_write_set_format_mtree },
index f3a7446..d5ca9a6 100644 (file)
@@ -755,6 +755,10 @@ _7z_close(struct archive_write *a)
                 */
 #if HAVE_LZMA_H
                header_compression = _7Z_LZMA1;
+               if(zip->opt_compression == _7Z_LZMA2 ||
+                  zip->opt_compression == _7Z_COPY)
+                       header_compression = zip->opt_compression;
+
                /* If the stored file is only one, do not encode the header.
                 * This is the same way 7z command does. */
                if (zip->total_number_entry == 1)
@@ -762,7 +766,8 @@ _7z_close(struct archive_write *a)
 #else
                header_compression = _7Z_COPY;
 #endif
-               r = _7z_compression_init_encoder(a, header_compression, 6);
+               r = _7z_compression_init_encoder(a, header_compression,
+                                                zip->opt_compression_level);
                if (r < 0)
                        return (r);
                zip->crc32flg = PRECODE_CRC32;
index 86e8621..bfb4b35 100644 (file)
@@ -49,6 +49,7 @@ struct { const char *name; int (*setter)(struct archive *); } names[] =
        { "arbsd",      archive_write_set_format_ar_bsd },
        { "argnu",      archive_write_set_format_ar_svr4 },
        { "arsvr4",     archive_write_set_format_ar_svr4 },
+       { "bin",        archive_write_set_format_cpio_bin },
        { "bsdtar",     archive_write_set_format_pax_restricted },
        { "cd9660",     archive_write_set_format_iso9660 },
        { "cpio",       archive_write_set_format_cpio },
@@ -58,11 +59,12 @@ struct { const char *name; int (*setter)(struct archive *); } names[] =
        { "mtree",      archive_write_set_format_mtree },
        { "mtree-classic",      archive_write_set_format_mtree_classic },
        { "newc",       archive_write_set_format_cpio_newc },
-       { "odc",        archive_write_set_format_cpio },
+       { "odc",        archive_write_set_format_cpio_odc },
        { "oldtar",     archive_write_set_format_v7tar },
        { "pax",        archive_write_set_format_pax },
        { "paxr",       archive_write_set_format_pax_restricted },
        { "posix",      archive_write_set_format_pax },
+       { "pwb",        archive_write_set_format_cpio_pwb },
        { "raw",        archive_write_set_format_raw },
        { "rpax",       archive_write_set_format_pax_restricted },
        { "shar",       archive_write_set_format_shar },
index e066733..29a7cad 100644 (file)
-/*-
- * Copyright (c) 2003-2007 Tim Kientzle
- * Copyright (c) 2011-2012 Michihiro NAKAJIMA
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "archive_platform.h"
-__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_cpio.c 201170 2009-12-29 06:34:23Z kientzle $");
-
-#ifdef HAVE_ERRNO_H
-#include <errno.h>
-#endif
-#include <stdio.h>
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
 #include "archive.h"
-#include "archive_entry.h"
-#include "archive_entry_locale.h"
-#include "archive_private.h"
-#include "archive_write_private.h"
-#include "archive_write_set_format_private.h"
-
-static ssize_t archive_write_cpio_data(struct archive_write *,
-                   const void *buff, size_t s);
-static int     archive_write_cpio_close(struct archive_write *);
-static int     archive_write_cpio_free(struct archive_write *);
-static int     archive_write_cpio_finish_entry(struct archive_write *);
-static int     archive_write_cpio_header(struct archive_write *,
-                   struct archive_entry *);
-static int     archive_write_cpio_options(struct archive_write *,
-                   const char *, const char *);
-static int     format_octal(int64_t, void *, int);
-static int64_t format_octal_recursive(int64_t, char *, int);
-static int     write_header(struct archive_write *, struct archive_entry *);
-
-struct cpio {
-       uint64_t          entry_bytes_remaining;
-
-       int64_t           ino_next;
-
-       struct           { int64_t old; int new;} *ino_list;
-       size_t            ino_list_size;
-       size_t            ino_list_next;
-
-       struct archive_string_conv *opt_sconv;
-       struct archive_string_conv *sconv_default;
-       int               init_default_conversion;
-};
-
-#define        c_magic_offset 0
-#define        c_magic_size 6
-#define        c_dev_offset 6
-#define        c_dev_size 6
-#define        c_ino_offset 12
-#define        c_ino_size 6
-#define        c_mode_offset 18
-#define        c_mode_size 6
-#define        c_uid_offset 24
-#define        c_uid_size 6
-#define        c_gid_offset 30
-#define        c_gid_size 6
-#define        c_nlink_offset 36
-#define        c_nlink_size 6
-#define        c_rdev_offset 42
-#define        c_rdev_size 6
-#define        c_mtime_offset 48
-#define        c_mtime_size 11
-#define        c_namesize_offset 59
-#define        c_namesize_size 6
-#define        c_filesize_offset 65
-#define        c_filesize_size 11
 
 /*
- * Set output format to 'cpio' format.
+ * Set output format to the default 'cpio' format.
  */
 int
 archive_write_set_format_cpio(struct archive *_a)
 {
-       struct archive_write *a = (struct archive_write *)_a;
-       struct cpio *cpio;
-
-       archive_check_magic(_a, ARCHIVE_WRITE_MAGIC,
-           ARCHIVE_STATE_NEW, "archive_write_set_format_cpio");
-
-       /* If someone else was already registered, unregister them. */
-       if (a->format_free != NULL)
-               (a->format_free)(a);
-
-       cpio = (struct cpio *)calloc(1, sizeof(*cpio));
-       if (cpio == NULL) {
-               archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data");
-               return (ARCHIVE_FATAL);
-       }
-       a->format_data = cpio;
-       a->format_name = "cpio";
-       a->format_options = archive_write_cpio_options;
-       a->format_write_header = archive_write_cpio_header;
-       a->format_write_data = archive_write_cpio_data;
-       a->format_finish_entry = archive_write_cpio_finish_entry;
-       a->format_close = archive_write_cpio_close;
-       a->format_free = archive_write_cpio_free;
-       a->archive.archive_format = ARCHIVE_FORMAT_CPIO_POSIX;
-       a->archive.archive_format_name = "POSIX cpio";
-       return (ARCHIVE_OK);
-}
-
-static int
-archive_write_cpio_options(struct archive_write *a, const char *key,
-    const char *val)
-{
-       struct cpio *cpio = (struct cpio *)a->format_data;
-       int ret = ARCHIVE_FAILED;
-
-       if (strcmp(key, "hdrcharset")  == 0) {
-               if (val == NULL || val[0] == 0)
-                       archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
-                           "%s: hdrcharset option needs a character-set name",
-                           a->format_name);
-               else {
-                       cpio->opt_sconv = archive_string_conversion_to_charset(
-                           &a->archive, val, 0);
-                       if (cpio->opt_sconv != NULL)
-                               ret = ARCHIVE_OK;
-                       else
-                               ret = ARCHIVE_FATAL;
-               }
-               return (ret);
-       }
-
-       /* Note: The "warn" return is just to inform the options
-        * supervisor that we didn't handle it.  It will generate
-        * a suitable error if no one used this option. */
-       return (ARCHIVE_WARN);
-}
-
-/*
- * Ino values are as long as 64 bits on some systems; cpio format
- * only allows 18 bits and relies on the ino values to identify hardlinked
- * files.  So, we can't merely "hash" the ino numbers since collisions
- * would corrupt the archive.  Instead, we generate synthetic ino values
- * to store in the archive and maintain a map of original ino values to
- * synthetic ones so we can preserve hardlink information.
- *
- * TODO: Make this more efficient.  It's not as bad as it looks (most
- * files don't have any hardlinks and we don't do any work here for those),
- * but it wouldn't be hard to do better.
- *
- * TODO: Work with dev/ino pairs here instead of just ino values.
- */
-static int
-synthesize_ino_value(struct cpio *cpio, struct archive_entry *entry)
-{
-       int64_t ino = archive_entry_ino64(entry);
-       int ino_new;
-       size_t i;
-
-       /*
-        * If no index number was given, don't assign one.  In
-        * particular, this handles the end-of-archive marker
-        * correctly by giving it a zero index value.  (This is also
-        * why we start our synthetic index numbers with one below.)
-        */
-       if (ino == 0)
-               return (0);
-
-       /* Don't store a mapping if we don't need to. */
-       if (archive_entry_nlink(entry) < 2) {
-               return (int)(++cpio->ino_next);
-       }
-
-       /* Look up old ino; if we have it, this is a hardlink
-        * and we reuse the same value. */
-       for (i = 0; i < cpio->ino_list_next; ++i) {
-               if (cpio->ino_list[i].old == ino)
-                       return (cpio->ino_list[i].new);
-       }
-
-       /* Assign a new index number. */
-       ino_new = (int)(++cpio->ino_next);
-
-       /* Ensure space for the new mapping. */
-       if (cpio->ino_list_size <= cpio->ino_list_next) {
-               size_t newsize = cpio->ino_list_size < 512
-                   ? 512 : cpio->ino_list_size * 2;
-               void *newlist = realloc(cpio->ino_list,
-                   sizeof(cpio->ino_list[0]) * newsize);
-               if (newlist == NULL)
-                       return (-1);
-
-               cpio->ino_list_size = newsize;
-               cpio->ino_list = newlist;
-       }
-
-       /* Record and return the new value. */
-       cpio->ino_list[cpio->ino_list_next].old = ino;
-       cpio->ino_list[cpio->ino_list_next].new = ino_new;
-       ++cpio->ino_list_next;
-       return (ino_new);
-}
-
-
-static struct archive_string_conv *
-get_sconv(struct archive_write *a)
-{
-       struct cpio *cpio;
-       struct archive_string_conv *sconv;
-
-       cpio = (struct cpio *)a->format_data;
-       sconv = cpio->opt_sconv;
-       if (sconv == NULL) {
-               if (!cpio->init_default_conversion) {
-                       cpio->sconv_default =
-                           archive_string_default_conversion_for_write(
-                             &(a->archive));
-                       cpio->init_default_conversion = 1;
-               }
-               sconv = cpio->sconv_default;
-       }
-       return (sconv);
-}
-
-static int
-archive_write_cpio_header(struct archive_write *a, struct archive_entry *entry)
-{
-       const char *path;
-       size_t len;
-
-       if (archive_entry_filetype(entry) == 0 && archive_entry_hardlink(entry) == NULL) {
-               archive_set_error(&a->archive, -1, "Filetype required");
-               return (ARCHIVE_FAILED);
-       }
-
-       if (archive_entry_pathname_l(entry, &path, &len, get_sconv(a)) != 0
-           && errno == ENOMEM) {
-               archive_set_error(&a->archive, ENOMEM,
-                   "Can't allocate memory for Pathname");
-               return (ARCHIVE_FATAL);
-       }
-       if (len == 0 || path == NULL || path[0] == '\0') {
-               archive_set_error(&a->archive, -1, "Pathname required");
-               return (ARCHIVE_FAILED);
-       }
-
-       if (!archive_entry_size_is_set(entry) || archive_entry_size(entry) < 0) {
-               archive_set_error(&a->archive, -1, "Size required");
-               return (ARCHIVE_FAILED);
-       }
-       return write_header(a, entry);
-}
-
-static int
-write_header(struct archive_write *a, struct archive_entry *entry)
-{
-       struct cpio *cpio;
-       const char *p, *path;
-       int pathlength, ret, ret_final;
-       int64_t ino;
-       char h[76];
-       struct archive_string_conv *sconv;
-       struct archive_entry *entry_main;
-       size_t len;
-
-       cpio = (struct cpio *)a->format_data;
-       ret_final = ARCHIVE_OK;
-       sconv = get_sconv(a);
-
-#if defined(_WIN32) && !defined(__CYGWIN__)
-       /* Make sure the path separators in pathname, hardlink and symlink
-        * are all slash '/', not the Windows path separator '\'. */
-       entry_main = __la_win_entry_in_posix_pathseparator(entry);
-       if (entry_main == NULL) {
-               archive_set_error(&a->archive, ENOMEM,
-                   "Can't allocate ustar data");
-               return(ARCHIVE_FATAL);
-       }
-       if (entry != entry_main)
-               entry = entry_main;
-       else
-               entry_main = NULL;
-#else
-       entry_main = NULL;
-#endif
-
-       ret = archive_entry_pathname_l(entry, &path, &len, sconv);
-       if (ret != 0) {
-               if (errno == ENOMEM) {
-                       archive_set_error(&a->archive, ENOMEM,
-                           "Can't allocate memory for Pathname");
-                       ret_final = ARCHIVE_FATAL;
-                       goto exit_write_header;
-               }
-               archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
-                   "Can't translate pathname '%s' to %s",
-                   archive_entry_pathname(entry),
-                   archive_string_conversion_charset_name(sconv));
-               ret_final = ARCHIVE_WARN;
-       }
-       /* Include trailing null. */
-       pathlength = (int)len + 1;
-
-       memset(h, 0, sizeof(h));
-       format_octal(070707, h + c_magic_offset, c_magic_size);
-       format_octal(archive_entry_dev(entry), h + c_dev_offset, c_dev_size);
-
-       ino = synthesize_ino_value(cpio, entry);
-       if (ino < 0) {
-               archive_set_error(&a->archive, ENOMEM,
-                   "No memory for ino translation table");
-               ret_final = ARCHIVE_FATAL;
-               goto exit_write_header;
-       } else if (ino > 0777777) {
-               archive_set_error(&a->archive, ERANGE,
-                   "Too many files for this cpio format");
-               ret_final = ARCHIVE_FATAL;
-               goto exit_write_header;
-       }
-       format_octal(ino & 0777777, h + c_ino_offset, c_ino_size);
-
-       /* TODO: Set ret_final to ARCHIVE_WARN if any of these overflow. */
-       format_octal(archive_entry_mode(entry), h + c_mode_offset, c_mode_size);
-       format_octal(archive_entry_uid(entry), h + c_uid_offset, c_uid_size);
-       format_octal(archive_entry_gid(entry), h + c_gid_offset, c_gid_size);
-       format_octal(archive_entry_nlink(entry), h + c_nlink_offset, c_nlink_size);
-       if (archive_entry_filetype(entry) == AE_IFBLK
-           || archive_entry_filetype(entry) == AE_IFCHR)
-           format_octal(archive_entry_rdev(entry), h + c_rdev_offset, c_rdev_size);
-       else
-           format_octal(0, h + c_rdev_offset, c_rdev_size);
-       format_octal(archive_entry_mtime(entry), h + c_mtime_offset, c_mtime_size);
-       format_octal(pathlength, h + c_namesize_offset, c_namesize_size);
-
-       /* Non-regular files don't store bodies. */
-       if (archive_entry_filetype(entry) != AE_IFREG)
-               archive_entry_set_size(entry, 0);
-
-       /* Symlinks get the link written as the body of the entry. */
-       ret = archive_entry_symlink_l(entry, &p, &len, sconv);
-       if (ret != 0) {
-               if (errno == ENOMEM) {
-                       archive_set_error(&a->archive, ENOMEM,
-                           "Can't allocate memory for Linkname");
-                       ret_final = ARCHIVE_FATAL;
-                       goto exit_write_header;
-               }
-               archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
-                   "Can't translate linkname '%s' to %s",
-                   archive_entry_symlink(entry),
-                   archive_string_conversion_charset_name(sconv));
-               ret_final = ARCHIVE_WARN;
-       }
-       if (len > 0 && p != NULL  &&  *p != '\0')
-               ret = format_octal(strlen(p), h + c_filesize_offset,
-                   c_filesize_size);
-       else
-               ret = format_octal(archive_entry_size(entry),
-                   h + c_filesize_offset, c_filesize_size);
-       if (ret) {
-               archive_set_error(&a->archive, ERANGE,
-                   "File is too large for cpio format.");
-               ret_final = ARCHIVE_FAILED;
-               goto exit_write_header;
-       }
-
-       ret = __archive_write_output(a, h, sizeof(h));
-       if (ret != ARCHIVE_OK) {
-               ret_final = ARCHIVE_FATAL;
-               goto exit_write_header;
-       }
-
-       ret = __archive_write_output(a, path, pathlength);
-       if (ret != ARCHIVE_OK) {
-               ret_final = ARCHIVE_FATAL;
-               goto exit_write_header;
-       }
-
-       cpio->entry_bytes_remaining = archive_entry_size(entry);
-
-       /* Write the symlink now. */
-       if (p != NULL  &&  *p != '\0') {
-               ret = __archive_write_output(a, p, strlen(p));
-               if (ret != ARCHIVE_OK) {
-                       ret_final = ARCHIVE_FATAL;
-                       goto exit_write_header;
-               }
-       }
-exit_write_header:
-       archive_entry_free(entry_main);
-       return (ret_final);
-}
-
-static ssize_t
-archive_write_cpio_data(struct archive_write *a, const void *buff, size_t s)
-{
-       struct cpio *cpio;
-       int ret;
-
-       cpio = (struct cpio *)a->format_data;
-       if (s > cpio->entry_bytes_remaining)
-               s = (size_t)cpio->entry_bytes_remaining;
-
-       ret = __archive_write_output(a, buff, s);
-       cpio->entry_bytes_remaining -= s;
-       if (ret >= 0)
-               return (s);
-       else
-               return (ret);
-}
-
-/*
- * Format a number into the specified field.
- */
-static int
-format_octal(int64_t v, void *p, int digits)
-{
-       int64_t max;
-       int     ret;
-
-       max = (((int64_t)1) << (digits * 3)) - 1;
-       if (v >= 0  &&  v <= max) {
-           format_octal_recursive(v, (char *)p, digits);
-           ret = 0;
-       } else {
-           format_octal_recursive(max, (char *)p, digits);
-           ret = -1;
-       }
-       return (ret);
-}
-
-static int64_t
-format_octal_recursive(int64_t v, char *p, int s)
-{
-       if (s == 0)
-               return (v);
-       v = format_octal_recursive(v, p+1, s-1);
-       *p = '0' + ((char)v & 7);
-       return (v >> 3);
-}
-
-static int
-archive_write_cpio_close(struct archive_write *a)
-{
-       int er;
-       struct archive_entry *trailer;
-
-       trailer = archive_entry_new2(NULL);
-       /* nlink = 1 here for GNU cpio compat. */
-       archive_entry_set_nlink(trailer, 1);
-       archive_entry_set_size(trailer, 0);
-       archive_entry_set_pathname(trailer, "TRAILER!!!");
-       er = write_header(a, trailer);
-       archive_entry_free(trailer);
-       return (er);
-}
-
-static int
-archive_write_cpio_free(struct archive_write *a)
-{
-       struct cpio *cpio;
-
-       cpio = (struct cpio *)a->format_data;
-       free(cpio->ino_list);
-       free(cpio);
-       a->format_data = NULL;
-       return (ARCHIVE_OK);
-}
-
-static int
-archive_write_cpio_finish_entry(struct archive_write *a)
-{
-       struct cpio *cpio;
-
-       cpio = (struct cpio *)a->format_data;
-       return (__archive_write_nulls(a,
-               (size_t)cpio->entry_bytes_remaining));
+       return archive_write_set_format_cpio_odc(_a);
 }
diff --git a/libarchive/archive_write_set_format_cpio_binary.c b/libarchive/archive_write_set_format_cpio_binary.c
new file mode 100644 (file)
index 0000000..c1e2f65
--- /dev/null
@@ -0,0 +1,610 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * Copyright (c) 2011-2012 Michihiro NAKAJIMA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_cpio.c 201170 2009-12-29 06:34:23Z kientzle $");
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "archive.h"
+#include "archive_entry.h"
+#include "archive_entry_locale.h"
+#include "archive_private.h"
+#include "archive_write_private.h"
+#include "archive_write_set_format_private.h"
+
+static ssize_t archive_write_binary_data(struct archive_write *,
+                   const void *buff, size_t s);
+static int     archive_write_binary_close(struct archive_write *);
+static int     archive_write_binary_free(struct archive_write *);
+static int     archive_write_binary_finish_entry(struct archive_write *);
+static int     archive_write_binary_header(struct archive_write *,
+                   struct archive_entry *);
+static int     archive_write_binary_options(struct archive_write *,
+                   const char *, const char *);
+static int     write_header(struct archive_write *, struct archive_entry *);
+
+struct cpio {
+       uint64_t          entry_bytes_remaining;
+
+       int64_t           ino_next;
+
+       struct           { int64_t old; int new;} *ino_list;
+       size_t            ino_list_size;
+       size_t            ino_list_next;
+
+       struct archive_string_conv *opt_sconv;
+       struct archive_string_conv *sconv_default;
+       int               init_default_conversion;
+};
+
+/* This struct needs to be packed to get the header right */
+
+#if defined(__GNUC__)
+#define PACKED(x) x __attribute__((packed))
+#elif defined(_MSC_VER)
+#define PACKED(x) __pragma(pack(push, 1)) x __pragma(pack(pop))
+#else
+#define PACKED(x) x
+#endif
+
+#define HSIZE 26
+
+PACKED(struct cpio_binary_header {
+       uint16_t        h_magic;
+       uint16_t        h_dev;
+       uint16_t        h_ino;
+       uint16_t        h_mode;
+       uint16_t        h_uid;
+       uint16_t        h_gid;
+       uint16_t        h_nlink;
+       uint16_t        h_majmin;
+       uint32_t        h_mtime;
+       uint16_t        h_namesize;
+       uint32_t        h_filesize;
+});
+
+/* Back in the day, the 7th Edition cpio.c had this, to
+ * adapt to, as the comment said, "VAX, Interdata, ...":
+ *
+ * union { long l; short s[2]; char c[4]; } U;
+ * #define MKSHORT(v,lv) {U.l=1L;if(U.c[0]) U.l=lv,v[0]=U.s[1],v[1]=U.s[0]; else U.l=lv,v[0]=U.s[0],v[1]=U.s[1];}
+ * long mklong(v)
+ * short v[];
+ * {
+ *         U.l = 1;
+ *         if(U.c[0])
+ *                 U.s[0] = v[1], U.s[1] = v[0];
+ *         else
+ *                 U.s[0] = v[0], U.s[1] = v[1];
+ *         return U.l;
+ * }
+ *
+ * Of course, that assumes that all machines have little-endian shorts,
+ * and just adapts the others to the special endianness of the PDP-11.
+ *
+ * Now, we could do this:
+ *
+ * union { uint32_t l; uint16_t s[2]; uint8_t c[4]; } U;
+ * #define PUTI16(v,sv) {U.s[0]=1;if(U.c[0]) v=sv; else U.s[0]=sv,U.c[2]=U.c[1],U.c[3]=U.c[0],v=U.s[1];}
+ * #define PUTI32(v,lv) {char_t Ut;U.l=1;if(U.c[0]) U.l=lv,v[0]=U.s[1],v[1]=U.s[0]; else U.l=lv,Ut=U.c[0],U.c[0]=U.c[1],U.c[1]=Ut,Ut=U.c[2],U.c[2]=U.c[3],U.c[3]=Ut,v[0]=U.s[0],v[1]=U.s[1];}
+ *
+ * ...but it feels a little better to do it like this:
+ */
+
+static uint16_t swap16(uint16_t in) {
+       union {
+               uint16_t s[2];
+               uint8_t c[4];
+       } U;
+       U.s[0] = 1;
+       if (U.c[0])
+               return in;
+       else {
+               U.s[0] = in;
+               U.c[2] = U.c[1];
+               U.c[3] = U.c[0];
+               return U.s[1];
+       }
+       /* NOTREACHED */
+}
+
+static uint32_t swap32(uint32_t in) {
+       union {
+               uint32_t l;
+               uint16_t s[2];
+               uint8_t c[4];
+       } U;
+       U.l = 1;
+       if (U.c[0]) {           /* Little-endian */
+               uint16_t t;
+               U.l = in;
+               t = U.s[0];
+               U.s[0] = U.s[1];
+               U.s[1] = t;
+       } else if (U.c[3]) {    /* Big-endian */
+               U.l = in;
+               U.s[0] = swap16(U.s[0]);
+               U.s[1] = swap16(U.s[1]);
+       } else {                /* PDP-endian */
+               U.l = in;
+       }
+       return U.l;
+}
+
+/*
+ * Set output format to the selected binary variant
+ */
+static int
+archive_write_set_format_cpio_binary(struct archive *_a, int format)
+{
+       struct archive_write *a = (struct archive_write *)_a;
+       struct cpio *cpio;
+
+       if (sizeof(struct cpio_binary_header) != HSIZE) {
+               archive_set_error(&a->archive, EINVAL,
+                                 "Binary cpio format not supported on this platform");
+               return (ARCHIVE_FATAL);
+       }
+
+       archive_check_magic(_a, ARCHIVE_WRITE_MAGIC,
+           ARCHIVE_STATE_NEW, "archive_write_set_format_cpio_binary");
+
+       /* If someone else was already registered, unregister them. */
+       if (a->format_free != NULL)
+               (a->format_free)(a);
+
+       cpio = (struct cpio *)calloc(1, sizeof(*cpio));
+       if (cpio == NULL) {
+               archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data");
+               return (ARCHIVE_FATAL);
+       }
+       a->format_data = cpio;
+       a->format_name = "cpio";
+       a->format_options = archive_write_binary_options;
+       a->format_write_header = archive_write_binary_header;
+       a->format_write_data = archive_write_binary_data;
+       a->format_finish_entry = archive_write_binary_finish_entry;
+       a->format_close = archive_write_binary_close;
+       a->format_free = archive_write_binary_free;
+       a->archive.archive_format = format;
+       switch (format) {
+       case ARCHIVE_FORMAT_CPIO_PWB:
+               a->archive.archive_format_name = "PWB cpio";
+               break;
+       case ARCHIVE_FORMAT_CPIO_BIN_LE:
+               a->archive.archive_format_name = "7th Edition cpio";
+               break;
+       default:
+               archive_set_error(&a->archive, EINVAL, "binary format must be 'pwb' or 'bin'");
+               return (ARCHIVE_FATAL);
+       }
+       return (ARCHIVE_OK);
+}
+
+/*
+ * Set output format to PWB (6th Edition) binary format
+ */
+int
+archive_write_set_format_cpio_pwb(struct archive *_a)
+{
+       return archive_write_set_format_cpio_binary(_a, ARCHIVE_FORMAT_CPIO_PWB);
+}
+
+/*
+ * Set output format to 7th Edition binary format
+ */
+int
+archive_write_set_format_cpio_bin(struct archive *_a)
+{
+       return archive_write_set_format_cpio_binary(_a, ARCHIVE_FORMAT_CPIO_BIN_LE);
+}
+
+static int
+archive_write_binary_options(struct archive_write *a, const char *key,
+    const char *val)
+{
+       struct cpio *cpio = (struct cpio *)a->format_data;
+       int ret = ARCHIVE_FAILED;
+
+       if (strcmp(key, "hdrcharset")  == 0) {
+               if (val == NULL || val[0] == 0)
+                       archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+                           "%s: hdrcharset option needs a character-set name",
+                           a->format_name);
+               else {
+                       cpio->opt_sconv = archive_string_conversion_to_charset(
+                           &a->archive, val, 0);
+                       if (cpio->opt_sconv != NULL)
+                               ret = ARCHIVE_OK;
+                       else
+                               ret = ARCHIVE_FATAL;
+               }
+               return (ret);
+       }
+
+       /* Note: The "warn" return is just to inform the options
+        * supervisor that we didn't handle it.  It will generate
+        * a suitable error if no one used this option. */
+       return (ARCHIVE_WARN);
+}
+
+/*
+ * Ino values are as long as 64 bits on some systems; cpio format
+ * only allows 16 bits and relies on the ino values to identify hardlinked
+ * files.  So, we can't merely "hash" the ino numbers since collisions
+ * would corrupt the archive.  Instead, we generate synthetic ino values
+ * to store in the archive and maintain a map of original ino values to
+ * synthetic ones so we can preserve hardlink information.
+ *
+ * TODO: Make this more efficient.  It's not as bad as it looks (most
+ * files don't have any hardlinks and we don't do any work here for those),
+ * but it wouldn't be hard to do better.
+ *
+ * TODO: Work with dev/ino pairs here instead of just ino values.
+ */
+static int
+synthesize_ino_value(struct cpio *cpio, struct archive_entry *entry)
+{
+       int64_t ino = archive_entry_ino64(entry);
+       int ino_new;
+       size_t i;
+
+       /*
+        * If no index number was given, don't assign one.  In
+        * particular, this handles the end-of-archive marker
+        * correctly by giving it a zero index value.  (This is also
+        * why we start our synthetic index numbers with one below.)
+        */
+       if (ino == 0)
+               return (0);
+
+       /* Don't store a mapping if we don't need to. */
+       if (archive_entry_nlink(entry) < 2) {
+               return (int)(++cpio->ino_next);
+       }
+
+       /* Look up old ino; if we have it, this is a hardlink
+        * and we reuse the same value. */
+       for (i = 0; i < cpio->ino_list_next; ++i) {
+               if (cpio->ino_list[i].old == ino)
+                       return (cpio->ino_list[i].new);
+       }
+
+       /* Assign a new index number. */
+       ino_new = (int)(++cpio->ino_next);
+
+       /* Ensure space for the new mapping. */
+       if (cpio->ino_list_size <= cpio->ino_list_next) {
+               size_t newsize = cpio->ino_list_size < 512
+                   ? 512 : cpio->ino_list_size * 2;
+               void *newlist = realloc(cpio->ino_list,
+                   sizeof(cpio->ino_list[0]) * newsize);
+               if (newlist == NULL)
+                       return (-1);
+
+               cpio->ino_list_size = newsize;
+               cpio->ino_list = newlist;
+       }
+
+       /* Record and return the new value. */
+       cpio->ino_list[cpio->ino_list_next].old = ino;
+       cpio->ino_list[cpio->ino_list_next].new = ino_new;
+       ++cpio->ino_list_next;
+       return (ino_new);
+}
+
+
+static struct archive_string_conv *
+get_sconv(struct archive_write *a)
+{
+       struct cpio *cpio;
+       struct archive_string_conv *sconv;
+
+       cpio = (struct cpio *)a->format_data;
+       sconv = cpio->opt_sconv;
+       if (sconv == NULL) {
+               if (!cpio->init_default_conversion) {
+                       cpio->sconv_default =
+                           archive_string_default_conversion_for_write(
+                             &(a->archive));
+                       cpio->init_default_conversion = 1;
+               }
+               sconv = cpio->sconv_default;
+       }
+       return (sconv);
+}
+
+static int
+archive_write_binary_header(struct archive_write *a, struct archive_entry *entry)
+{
+       const char *path;
+       size_t len;
+
+       if (archive_entry_filetype(entry) == 0 && archive_entry_hardlink(entry) == NULL) {
+               archive_set_error(&a->archive, -1, "Filetype required");
+               return (ARCHIVE_FAILED);
+       }
+
+       if (archive_entry_pathname_l(entry, &path, &len, get_sconv(a)) != 0
+           && errno == ENOMEM) {
+               archive_set_error(&a->archive, ENOMEM,
+                   "Can't allocate memory for Pathname");
+               return (ARCHIVE_FATAL);
+       }
+       if (len == 0 || path == NULL || path[0] == '\0') {
+               archive_set_error(&a->archive, -1, "Pathname required");
+               return (ARCHIVE_FAILED);
+       }
+
+       if (!archive_entry_size_is_set(entry) || archive_entry_size(entry) < 0) {
+               archive_set_error(&a->archive, -1, "Size required");
+               return (ARCHIVE_FAILED);
+       }
+       return write_header(a, entry);
+}
+
+static int
+write_header(struct archive_write *a, struct archive_entry *entry)
+{
+       struct cpio *cpio;
+       const char *p, *path;
+       int pathlength, ret, ret_final;
+       int64_t ino;
+       struct cpio_binary_header h;
+       struct archive_string_conv *sconv;
+       struct archive_entry *entry_main;
+       size_t len;
+
+       cpio = (struct cpio *)a->format_data;
+       ret_final = ARCHIVE_OK;
+       sconv = get_sconv(a);
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+       /* Make sure the path separators in pathname, hardlink and symlink
+        * are all slash '/', not the Windows path separator '\'. */
+       entry_main = __la_win_entry_in_posix_pathseparator(entry);
+       if (entry_main == NULL) {
+               archive_set_error(&a->archive, ENOMEM,
+                   "Can't allocate ustar data");
+               return(ARCHIVE_FATAL);
+       }
+       if (entry != entry_main)
+               entry = entry_main;
+       else
+               entry_main = NULL;
+#else
+       entry_main = NULL;
+#endif
+
+       ret = archive_entry_pathname_l(entry, &path, &len, sconv);
+       if (ret != 0) {
+               if (errno == ENOMEM) {
+                       archive_set_error(&a->archive, ENOMEM,
+                           "Can't allocate memory for Pathname");
+                       ret_final = ARCHIVE_FATAL;
+                       goto exit_write_header;
+               }
+               archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+                   "Can't translate pathname '%s' to %s",
+                   archive_entry_pathname(entry),
+                   archive_string_conversion_charset_name(sconv));
+               ret_final = ARCHIVE_WARN;
+       }
+       /* Include trailing null */
+       pathlength = (int)len + 1;
+
+       h.h_magic = swap16(070707);
+       h.h_dev = swap16(archive_entry_dev(entry));
+
+       ino = synthesize_ino_value(cpio, entry);
+       if (ino < 0) {
+               archive_set_error(&a->archive, ENOMEM,
+                   "No memory for ino translation table");
+               ret_final = ARCHIVE_FATAL;
+               goto exit_write_header;
+       } else if (ino > 077777) {
+               archive_set_error(&a->archive, ERANGE,
+                   "Too many files for this cpio format");
+               ret_final = ARCHIVE_FATAL;
+               goto exit_write_header;
+       }
+       h.h_ino = swap16(ino);
+
+       h.h_mode = archive_entry_mode(entry);
+       if (((h.h_mode & AE_IFMT) == AE_IFSOCK) || ((h.h_mode & AE_IFMT) == AE_IFIFO)) {
+               archive_set_error(&a->archive, EINVAL,
+                                 "sockets and fifos cannot be represented in the binary cpio formats");
+               ret_final = ARCHIVE_FATAL;
+               goto exit_write_header;
+       }
+       if (a->archive.archive_format == ARCHIVE_FORMAT_CPIO_PWB) {
+               if ((h.h_mode & AE_IFMT) == AE_IFLNK) {
+                       archive_set_error(&a->archive, EINVAL,
+                                         "symbolic links cannot be represented in the PWB cpio format");
+                       ret_final = ARCHIVE_FATAL;
+                       goto exit_write_header;
+               }
+               /* we could turn off AE_IFREG here, but it does no harm, */
+               /* and allows v7 cpio to read the entry without confusion */
+       }
+       h.h_mode = swap16(h.h_mode);
+
+       h.h_uid = swap16(archive_entry_uid(entry));
+       h.h_gid = swap16(archive_entry_gid(entry));
+       h.h_nlink = swap16(archive_entry_nlink(entry));
+
+       if (archive_entry_filetype(entry) == AE_IFBLK
+           || archive_entry_filetype(entry) == AE_IFCHR)
+               h.h_majmin = swap16(archive_entry_rdev(entry));
+       else
+               h.h_majmin = 0;
+
+       h.h_mtime = swap32(archive_entry_mtime(entry));
+       h.h_namesize = swap16(pathlength);
+
+       /* Non-regular files don't store bodies. */
+       if (archive_entry_filetype(entry) != AE_IFREG)
+               archive_entry_set_size(entry, 0);
+
+       /* Symlinks get the link written as the body of the entry. */
+       ret = archive_entry_symlink_l(entry, &p, &len, sconv);
+       if (ret != 0) {
+               if (errno == ENOMEM) {
+                       archive_set_error(&a->archive, ENOMEM,
+                           "Can't allocate memory for Linkname");
+                       ret_final = ARCHIVE_FATAL;
+                       goto exit_write_header;
+               }
+               archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+                   "Can't translate linkname '%s' to %s",
+                   archive_entry_symlink(entry),
+                   archive_string_conversion_charset_name(sconv));
+               ret_final = ARCHIVE_WARN;
+       }
+
+       if (len > 0 && p != NULL  &&  *p != '\0') {
+               if (a->archive.archive_format == ARCHIVE_FORMAT_CPIO_PWB) {
+                       archive_set_error(&a->archive, EINVAL,
+                                         "symlinks are not supported by UNIX V6 or by PWB cpio");
+                       ret_final = ARCHIVE_FATAL;
+                       goto exit_write_header;
+               }
+               h.h_filesize = swap32(strlen(p)); /* symlink */
+       } else {
+               if ((a->archive.archive_format == ARCHIVE_FORMAT_CPIO_PWB) &&
+                   (archive_entry_size(entry) > 256*256*256-1)) {
+                       archive_set_error(&a->archive, ERANGE,
+                                         "File is too large for PWB binary cpio format.");
+                       ret_final = ARCHIVE_FAILED;
+                       goto exit_write_header;
+               } else if (archive_entry_size(entry) > INT32_MAX) {
+                       archive_set_error(&a->archive, ERANGE,
+                                         "File is too large for binary cpio format.");
+                       ret_final = ARCHIVE_FAILED;
+                       goto exit_write_header;
+               }
+               h.h_filesize = swap32(archive_entry_size(entry)); /* file */
+       }
+
+       ret = __archive_write_output(a, &h, HSIZE);
+       if (ret != ARCHIVE_OK) {
+               ret_final = ARCHIVE_FATAL;
+               goto exit_write_header;
+       }
+
+       ret = __archive_write_output(a, path, pathlength);
+       if ((ret == ARCHIVE_OK) && ((pathlength % 2) != 0))
+               ret = __archive_write_nulls(a, 1);
+       if (ret != ARCHIVE_OK) {
+               ret_final = ARCHIVE_FATAL;
+               goto exit_write_header;
+       }
+
+       cpio->entry_bytes_remaining = archive_entry_size(entry);
+       if ((cpio->entry_bytes_remaining % 2) != 0)
+               cpio->entry_bytes_remaining++;
+
+       /* Write the symlink now. */
+       if (p != NULL  &&  *p != '\0') {
+               ret = __archive_write_output(a, p, strlen(p));
+               if ((ret == ARCHIVE_OK) && ((strlen(p) % 2) != 0))
+                       ret = __archive_write_nulls(a, 1);
+               if (ret != ARCHIVE_OK) {
+                       ret_final = ARCHIVE_FATAL;
+                       goto exit_write_header;
+               }
+       }
+
+exit_write_header:
+       archive_entry_free(entry_main);
+       return (ret_final);
+}
+
+static ssize_t
+archive_write_binary_data(struct archive_write *a, const void *buff, size_t s)
+{
+       struct cpio *cpio;
+       int ret;
+
+       cpio = (struct cpio *)a->format_data;
+       if (s > cpio->entry_bytes_remaining)
+               s = (size_t)cpio->entry_bytes_remaining;
+
+       ret = __archive_write_output(a, buff, s);
+       cpio->entry_bytes_remaining -= s;
+       if (ret >= 0)
+               return (s);
+       else
+               return (ret);
+}
+
+static int
+archive_write_binary_close(struct archive_write *a)
+{
+       int er;
+       struct archive_entry *trailer;
+
+       trailer = archive_entry_new2(NULL);
+       /* nlink = 1 here for GNU cpio compat. */
+       archive_entry_set_nlink(trailer, 1);
+       archive_entry_set_size(trailer, 0);
+       archive_entry_set_pathname(trailer, "TRAILER!!!");
+       er = write_header(a, trailer);
+       archive_entry_free(trailer);
+       return (er);
+}
+
+static int
+archive_write_binary_free(struct archive_write *a)
+{
+       struct cpio *cpio;
+
+       cpio = (struct cpio *)a->format_data;
+       free(cpio->ino_list);
+       free(cpio);
+       a->format_data = NULL;
+       return (ARCHIVE_OK);
+}
+
+static int
+archive_write_binary_finish_entry(struct archive_write *a)
+{
+       struct cpio *cpio;
+
+       cpio = (struct cpio *)a->format_data;
+       return (__archive_write_nulls(a,
+               (size_t)cpio->entry_bytes_remaining));
+}
diff --git a/libarchive/archive_write_set_format_cpio_odc.c b/libarchive/archive_write_set_format_cpio_odc.c
new file mode 100644 (file)
index 0000000..091925a
--- /dev/null
@@ -0,0 +1,500 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * Copyright (c) 2011-2012 Michihiro NAKAJIMA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_cpio.c 201170 2009-12-29 06:34:23Z kientzle $");
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "archive.h"
+#include "archive_entry.h"
+#include "archive_entry_locale.h"
+#include "archive_private.h"
+#include "archive_write_private.h"
+#include "archive_write_set_format_private.h"
+
+static ssize_t archive_write_odc_data(struct archive_write *,
+                   const void *buff, size_t s);
+static int     archive_write_odc_close(struct archive_write *);
+static int     archive_write_odc_free(struct archive_write *);
+static int     archive_write_odc_finish_entry(struct archive_write *);
+static int     archive_write_odc_header(struct archive_write *,
+                   struct archive_entry *);
+static int     archive_write_odc_options(struct archive_write *,
+                   const char *, const char *);
+static int     format_octal(int64_t, void *, int);
+static int64_t format_octal_recursive(int64_t, char *, int);
+static int     write_header(struct archive_write *, struct archive_entry *);
+
+struct cpio {
+       uint64_t          entry_bytes_remaining;
+
+       int64_t           ino_next;
+
+       struct           { int64_t old; int new;} *ino_list;
+       size_t            ino_list_size;
+       size_t            ino_list_next;
+
+       struct archive_string_conv *opt_sconv;
+       struct archive_string_conv *sconv_default;
+       int               init_default_conversion;
+};
+
+#define        c_magic_offset 0
+#define        c_magic_size 6
+#define        c_dev_offset 6
+#define        c_dev_size 6
+#define        c_ino_offset 12
+#define        c_ino_size 6
+#define        c_mode_offset 18
+#define        c_mode_size 6
+#define        c_uid_offset 24
+#define        c_uid_size 6
+#define        c_gid_offset 30
+#define        c_gid_size 6
+#define        c_nlink_offset 36
+#define        c_nlink_size 6
+#define        c_rdev_offset 42
+#define        c_rdev_size 6
+#define        c_mtime_offset 48
+#define        c_mtime_size 11
+#define        c_namesize_offset 59
+#define        c_namesize_size 6
+#define        c_filesize_offset 65
+#define        c_filesize_size 11
+
+/*
+ * Set output format to 'cpio' format.
+ */
+int
+archive_write_set_format_cpio_odc(struct archive *_a)
+{
+       struct archive_write *a = (struct archive_write *)_a;
+       struct cpio *cpio;
+
+       archive_check_magic(_a, ARCHIVE_WRITE_MAGIC,
+           ARCHIVE_STATE_NEW, "archive_write_set_format_cpio_odc");
+
+       /* If someone else was already registered, unregister them. */
+       if (a->format_free != NULL)
+               (a->format_free)(a);
+
+       cpio = (struct cpio *)calloc(1, sizeof(*cpio));
+       if (cpio == NULL) {
+               archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data");
+               return (ARCHIVE_FATAL);
+       }
+       a->format_data = cpio;
+       a->format_name = "cpio";
+       a->format_options = archive_write_odc_options;
+       a->format_write_header = archive_write_odc_header;
+       a->format_write_data = archive_write_odc_data;
+       a->format_finish_entry = archive_write_odc_finish_entry;
+       a->format_close = archive_write_odc_close;
+       a->format_free = archive_write_odc_free;
+       a->archive.archive_format = ARCHIVE_FORMAT_CPIO_POSIX;
+       a->archive.archive_format_name = "POSIX cpio";
+       return (ARCHIVE_OK);
+}
+
+static int
+archive_write_odc_options(struct archive_write *a, const char *key,
+    const char *val)
+{
+       struct cpio *cpio = (struct cpio *)a->format_data;
+       int ret = ARCHIVE_FAILED;
+
+       if (strcmp(key, "hdrcharset")  == 0) {
+               if (val == NULL || val[0] == 0)
+                       archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+                           "%s: hdrcharset option needs a character-set name",
+                           a->format_name);
+               else {
+                       cpio->opt_sconv = archive_string_conversion_to_charset(
+                           &a->archive, val, 0);
+                       if (cpio->opt_sconv != NULL)
+                               ret = ARCHIVE_OK;
+                       else
+                               ret = ARCHIVE_FATAL;
+               }
+               return (ret);
+       }
+
+       /* Note: The "warn" return is just to inform the options
+        * supervisor that we didn't handle it.  It will generate
+        * a suitable error if no one used this option. */
+       return (ARCHIVE_WARN);
+}
+
+/*
+ * Ino values are as long as 64 bits on some systems; cpio format
+ * only allows 18 bits and relies on the ino values to identify hardlinked
+ * files.  So, we can't merely "hash" the ino numbers since collisions
+ * would corrupt the archive.  Instead, we generate synthetic ino values
+ * to store in the archive and maintain a map of original ino values to
+ * synthetic ones so we can preserve hardlink information.
+ *
+ * TODO: Make this more efficient.  It's not as bad as it looks (most
+ * files don't have any hardlinks and we don't do any work here for those),
+ * but it wouldn't be hard to do better.
+ *
+ * TODO: Work with dev/ino pairs here instead of just ino values.
+ */
+static int
+synthesize_ino_value(struct cpio *cpio, struct archive_entry *entry)
+{
+       int64_t ino = archive_entry_ino64(entry);
+       int ino_new;
+       size_t i;
+
+       /*
+        * If no index number was given, don't assign one.  In
+        * particular, this handles the end-of-archive marker
+        * correctly by giving it a zero index value.  (This is also
+        * why we start our synthetic index numbers with one below.)
+        */
+       if (ino == 0)
+               return (0);
+
+       /* Don't store a mapping if we don't need to. */
+       if (archive_entry_nlink(entry) < 2) {
+               return (int)(++cpio->ino_next);
+       }
+
+       /* Look up old ino; if we have it, this is a hardlink
+        * and we reuse the same value. */
+       for (i = 0; i < cpio->ino_list_next; ++i) {
+               if (cpio->ino_list[i].old == ino)
+                       return (cpio->ino_list[i].new);
+       }
+
+       /* Assign a new index number. */
+       ino_new = (int)(++cpio->ino_next);
+
+       /* Ensure space for the new mapping. */
+       if (cpio->ino_list_size <= cpio->ino_list_next) {
+               size_t newsize = cpio->ino_list_size < 512
+                   ? 512 : cpio->ino_list_size * 2;
+               void *newlist = realloc(cpio->ino_list,
+                   sizeof(cpio->ino_list[0]) * newsize);
+               if (newlist == NULL)
+                       return (-1);
+
+               cpio->ino_list_size = newsize;
+               cpio->ino_list = newlist;
+       }
+
+       /* Record and return the new value. */
+       cpio->ino_list[cpio->ino_list_next].old = ino;
+       cpio->ino_list[cpio->ino_list_next].new = ino_new;
+       ++cpio->ino_list_next;
+       return (ino_new);
+}
+
+
+static struct archive_string_conv *
+get_sconv(struct archive_write *a)
+{
+       struct cpio *cpio;
+       struct archive_string_conv *sconv;
+
+       cpio = (struct cpio *)a->format_data;
+       sconv = cpio->opt_sconv;
+       if (sconv == NULL) {
+               if (!cpio->init_default_conversion) {
+                       cpio->sconv_default =
+                           archive_string_default_conversion_for_write(
+                             &(a->archive));
+                       cpio->init_default_conversion = 1;
+               }
+               sconv = cpio->sconv_default;
+       }
+       return (sconv);
+}
+
+static int
+archive_write_odc_header(struct archive_write *a, struct archive_entry *entry)
+{
+       const char *path;
+       size_t len;
+
+       if (archive_entry_filetype(entry) == 0 && archive_entry_hardlink(entry) == NULL) {
+               archive_set_error(&a->archive, -1, "Filetype required");
+               return (ARCHIVE_FAILED);
+       }
+
+       if (archive_entry_pathname_l(entry, &path, &len, get_sconv(a)) != 0
+           && errno == ENOMEM) {
+               archive_set_error(&a->archive, ENOMEM,
+                   "Can't allocate memory for Pathname");
+               return (ARCHIVE_FATAL);
+       }
+       if (len == 0 || path == NULL || path[0] == '\0') {
+               archive_set_error(&a->archive, -1, "Pathname required");
+               return (ARCHIVE_FAILED);
+       }
+
+       if (!archive_entry_size_is_set(entry) || archive_entry_size(entry) < 0) {
+               archive_set_error(&a->archive, -1, "Size required");
+               return (ARCHIVE_FAILED);
+       }
+       return write_header(a, entry);
+}
+
+static int
+write_header(struct archive_write *a, struct archive_entry *entry)
+{
+       struct cpio *cpio;
+       const char *p, *path;
+       int pathlength, ret, ret_final;
+       int64_t ino;
+       char h[76];
+       struct archive_string_conv *sconv;
+       struct archive_entry *entry_main;
+       size_t len;
+
+       cpio = (struct cpio *)a->format_data;
+       ret_final = ARCHIVE_OK;
+       sconv = get_sconv(a);
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+       /* Make sure the path separators in pathname, hardlink and symlink
+        * are all slash '/', not the Windows path separator '\'. */
+       entry_main = __la_win_entry_in_posix_pathseparator(entry);
+       if (entry_main == NULL) {
+               archive_set_error(&a->archive, ENOMEM,
+                   "Can't allocate ustar data");
+               return(ARCHIVE_FATAL);
+       }
+       if (entry != entry_main)
+               entry = entry_main;
+       else
+               entry_main = NULL;
+#else
+       entry_main = NULL;
+#endif
+
+       ret = archive_entry_pathname_l(entry, &path, &len, sconv);
+       if (ret != 0) {
+               if (errno == ENOMEM) {
+                       archive_set_error(&a->archive, ENOMEM,
+                           "Can't allocate memory for Pathname");
+                       ret_final = ARCHIVE_FATAL;
+                       goto exit_write_header;
+               }
+               archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+                   "Can't translate pathname '%s' to %s",
+                   archive_entry_pathname(entry),
+                   archive_string_conversion_charset_name(sconv));
+               ret_final = ARCHIVE_WARN;
+       }
+       /* Include trailing null. */
+       pathlength = (int)len + 1;
+
+       memset(h, 0, sizeof(h));
+       format_octal(070707, h + c_magic_offset, c_magic_size);
+       format_octal(archive_entry_dev(entry), h + c_dev_offset, c_dev_size);
+
+       ino = synthesize_ino_value(cpio, entry);
+       if (ino < 0) {
+               archive_set_error(&a->archive, ENOMEM,
+                   "No memory for ino translation table");
+               ret_final = ARCHIVE_FATAL;
+               goto exit_write_header;
+       } else if (ino > 0777777) {
+               archive_set_error(&a->archive, ERANGE,
+                   "Too many files for this cpio format");
+               ret_final = ARCHIVE_FATAL;
+               goto exit_write_header;
+       }
+       format_octal(ino & 0777777, h + c_ino_offset, c_ino_size);
+
+       /* TODO: Set ret_final to ARCHIVE_WARN if any of these overflow. */
+       format_octal(archive_entry_mode(entry), h + c_mode_offset, c_mode_size);
+       format_octal(archive_entry_uid(entry), h + c_uid_offset, c_uid_size);
+       format_octal(archive_entry_gid(entry), h + c_gid_offset, c_gid_size);
+       format_octal(archive_entry_nlink(entry), h + c_nlink_offset, c_nlink_size);
+       if (archive_entry_filetype(entry) == AE_IFBLK
+           || archive_entry_filetype(entry) == AE_IFCHR)
+           format_octal(archive_entry_rdev(entry), h + c_rdev_offset, c_rdev_size);
+       else
+           format_octal(0, h + c_rdev_offset, c_rdev_size);
+       format_octal(archive_entry_mtime(entry), h + c_mtime_offset, c_mtime_size);
+       format_octal(pathlength, h + c_namesize_offset, c_namesize_size);
+
+       /* Non-regular files don't store bodies. */
+       if (archive_entry_filetype(entry) != AE_IFREG)
+               archive_entry_set_size(entry, 0);
+
+       /* Symlinks get the link written as the body of the entry. */
+       ret = archive_entry_symlink_l(entry, &p, &len, sconv);
+       if (ret != 0) {
+               if (errno == ENOMEM) {
+                       archive_set_error(&a->archive, ENOMEM,
+                           "Can't allocate memory for Linkname");
+                       ret_final = ARCHIVE_FATAL;
+                       goto exit_write_header;
+               }
+               archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+                   "Can't translate linkname '%s' to %s",
+                   archive_entry_symlink(entry),
+                   archive_string_conversion_charset_name(sconv));
+               ret_final = ARCHIVE_WARN;
+       }
+       if (len > 0 && p != NULL  &&  *p != '\0')
+               ret = format_octal(strlen(p), h + c_filesize_offset,
+                   c_filesize_size);
+       else
+               ret = format_octal(archive_entry_size(entry),
+                   h + c_filesize_offset, c_filesize_size);
+       if (ret) {
+               archive_set_error(&a->archive, ERANGE,
+                   "File is too large for cpio format.");
+               ret_final = ARCHIVE_FAILED;
+               goto exit_write_header;
+       }
+
+       ret = __archive_write_output(a, h, sizeof(h));
+       if (ret != ARCHIVE_OK) {
+               ret_final = ARCHIVE_FATAL;
+               goto exit_write_header;
+       }
+
+       ret = __archive_write_output(a, path, pathlength);
+       if (ret != ARCHIVE_OK) {
+               ret_final = ARCHIVE_FATAL;
+               goto exit_write_header;
+       }
+
+       cpio->entry_bytes_remaining = archive_entry_size(entry);
+
+       /* Write the symlink now. */
+       if (p != NULL  &&  *p != '\0') {
+               ret = __archive_write_output(a, p, strlen(p));
+               if (ret != ARCHIVE_OK) {
+                       ret_final = ARCHIVE_FATAL;
+                       goto exit_write_header;
+               }
+       }
+exit_write_header:
+       archive_entry_free(entry_main);
+       return (ret_final);
+}
+
+static ssize_t
+archive_write_odc_data(struct archive_write *a, const void *buff, size_t s)
+{
+       struct cpio *cpio;
+       int ret;
+
+       cpio = (struct cpio *)a->format_data;
+       if (s > cpio->entry_bytes_remaining)
+               s = (size_t)cpio->entry_bytes_remaining;
+
+       ret = __archive_write_output(a, buff, s);
+       cpio->entry_bytes_remaining -= s;
+       if (ret >= 0)
+               return (s);
+       else
+               return (ret);
+}
+
+/*
+ * Format a number into the specified field.
+ */
+static int
+format_octal(int64_t v, void *p, int digits)
+{
+       int64_t max;
+       int     ret;
+
+       max = (((int64_t)1) << (digits * 3)) - 1;
+       if (v >= 0  &&  v <= max) {
+           format_octal_recursive(v, (char *)p, digits);
+           ret = 0;
+       } else {
+           format_octal_recursive(max, (char *)p, digits);
+           ret = -1;
+       }
+       return (ret);
+}
+
+static int64_t
+format_octal_recursive(int64_t v, char *p, int s)
+{
+       if (s == 0)
+               return (v);
+       v = format_octal_recursive(v, p+1, s-1);
+       *p = '0' + ((char)v & 7);
+       return (v >> 3);
+}
+
+static int
+archive_write_odc_close(struct archive_write *a)
+{
+       int er;
+       struct archive_entry *trailer;
+
+       trailer = archive_entry_new2(NULL);
+       /* nlink = 1 here for GNU cpio compat. */
+       archive_entry_set_nlink(trailer, 1);
+       archive_entry_set_size(trailer, 0);
+       archive_entry_set_pathname(trailer, "TRAILER!!!");
+       er = write_header(a, trailer);
+       archive_entry_free(trailer);
+       return (er);
+}
+
+static int
+archive_write_odc_free(struct archive_write *a)
+{
+       struct cpio *cpio;
+
+       cpio = (struct cpio *)a->format_data;
+       free(cpio->ino_list);
+       free(cpio);
+       a->format_data = NULL;
+       return (ARCHIVE_OK);
+}
+
+static int
+archive_write_odc_finish_entry(struct archive_write *a)
+{
+       struct cpio *cpio;
+
+       cpio = (struct cpio *)a->format_data;
+       return (__archive_write_nulls(a,
+               (size_t)cpio->entry_bytes_remaining));
+}
index d4a52e3..dd57358 100644 (file)
@@ -279,7 +279,7 @@ Values between 0 and 9 are supported.
 The interpretation of the compression level depends on the chosen
 compression method.
 .El
-.It Format cpio
+.It Format bin
 .Bl -tag -compact -width indent
 .It Cm hdrcharset
 The value is used as a character set name that will be
@@ -519,6 +519,18 @@ XXX needs explanation XXX
 The value is used as a character set name that will be
 used when translating file names.
 .El
+.It Format odc
+.Bl -tag -compact -width indent
+.It Cm hdrcharset
+The value is used as a character set name that will be
+used when translating file names.
+.El
+.It Format pwb
+.Bl -tag -compact -width indent
+.It Cm hdrcharset
+The value is used as a character set name that will be
+used when translating file names.
+.El
 .It Format pax
 .Bl -tag -compact -width indent
 .It Cm hdrcharset
index a484618..ac651f0 100644 (file)
 #define HAVE_LIBZ 1
 #define HAVE_LIMITS_H 1
 #define HAVE_LINK 1
+#define HAVE_LINKAT 1
 #define HAVE_LOCALE_H 1
 #define HAVE_LOCALTIME_R 1
 #define HAVE_LONG_LONG_INT 1
index a91f0c5..837a456 100644 (file)
@@ -56,40 +56,44 @@ The end of the archive is indicated by a special record with
 the pathname
 .Dq TRAILER!!! .
 .Ss PWB format
-XXX Any documentation of the original PWB/UNIX 1.0 format? XXX
-.Ss Old Binary Format
-The old binary
+The PWB binary
 .Nm
-format stores numbers as 2-byte and 4-byte binary values.
+format is the original format, when cpio was introduced as part of the
+Programmer's Work Bench system, a variant of 6th Edition UNIX.  It
+stores numbers as 2-byte and 4-byte binary values.
 Each entry begins with a header in the following format:
+.Pp
 .Bd -literal -offset indent
-struct header_old_cpio {
-        unsigned short   c_magic;
-        unsigned short   c_dev;
-        unsigned short   c_ino;
-        unsigned short   c_mode;
-        unsigned short   c_uid;
-        unsigned short   c_gid;
-        unsigned short   c_nlink;
-        unsigned short   c_rdev;
-       unsigned short   c_mtime[2];
-        unsigned short   c_namesize;
-       unsigned short   c_filesize[2];
+struct header_pwb_cpio {
+        short   h_magic;
+        short   h_dev;
+        short   h_ino;
+        short   h_mode;
+        short   h_uid;
+        short   h_gid;
+        short   h_nlink;
+        short   h_majmin;
+        long    h_mtime;
+        short   h_namesize;
+        long    h_filesize;
 };
 .Ed
 .Pp
 The
-.Va unsigned short
-fields here are 16-bit integer values; the
-.Va unsigned int
-fields are 32-bit integer values.
-The fields are as follows
+.Va short
+fields here are 16-bit integer values, while the
+.Va long
+fields are 32 bit integers.  Since PWB UNIX, like the 6th Edition UNIX
+it was based on, only ran on PDP-11 computers, they
+are in PDP-endian format, which has little-endian shorts, and
+big-endian longs.  That is, the long integer whose hexadecimal
+representation is 0x12345678 would be stored in four successive bytes
+as 0x34, 0x12, 0x78, 0x56.
+The fields are as follows:
 .Bl -tag -width indent
-.It Va magic
+.It Va h_magic
 The integer value octal 070707.
-This value can be used to determine whether this archive is
-written with little-endian or big-endian integers.
-.It Va dev , Va ino
+.It Va h_dev , Va h_ino
 The device and inode numbers from the disk.
 These are used by programs that read
 .Nm
@@ -97,78 +101,138 @@ archives to determine when two entries refer to the same file.
 Programs that synthesize
 .Nm
 archives should be careful to set these to distinct values for each entry.
-.It Va mode
-The mode specifies both the regular permissions and the file type.
-It consists of several bit fields as follows:
+.It Va h_mode
+The mode specifies both the regular permissions and the file type, and
+it also holds a couple of bits that are irrelevant to the cpio format,
+because the field is actually a raw copy of the mode field in the inode
+representing the file.  These are the IALLOC flag, which shows that
+the inode entry is in use, and the ILARG flag, which shows that the
+file it represents is large enough to have indirect blocks pointers in
+the inode.
+The mode is decoded as follows:
+.Pp
 .Bl -tag -width "MMMMMMM" -compact
-.It 0170000
-This masks the file type bits.
-.It 0140000
-File type value for sockets.
-.It 0120000
-File type value for symbolic links.
-For symbolic links, the link body is stored as file data.
 .It 0100000
-File type value for regular files.
+IALLOC flag - irrelevant to cpio.
 .It 0060000
-File type value for block special devices.
+This masks the file type bits.
 .It 0040000
 File type value for directories.
 .It 0020000
 File type value for character special devices.
+.It 0060000
+File type value for block special devices.
 .It 0010000
-File type value for named pipes or FIFOs.
+ILARG flag - irrelevant to cpio.
 .It 0004000
 SUID bit.
 .It 0002000
 SGID bit.
 .It 0001000
 Sticky bit.
-On some systems, this modifies the behavior of executables and/or directories.
 .It 0000777
 The lower 9 bits specify read/write/execute permissions
 for world, group, and user following standard POSIX conventions.
 .El
-.It Va uid , Va gid
+.It Va h_uid , Va h_gid
 The numeric user id and group id of the owner.
-.It Va nlink
+.It Va h_nlink
 The number of links to this file.
 Directories always have a value of at least two here.
 Note that hardlinked files include file data with every copy in the archive.
-.It Va rdev
+.It Va h_majmin
 For block special and character special entries,
-this field contains the associated device number.
+this field contains the associated device number, with the major
+number in the high byte, and the minor number in the low byte.
 For all other entry types, it should be set to zero by writers
 and ignored by readers.
-.It Va mtime
+.It Va h_mtime
 Modification time of the file, indicated as the number
 of seconds since the start of the epoch,
 00:00:00 UTC January 1, 1970.
-The four-byte integer is stored with the most-significant 16 bits first
-followed by the least-significant 16 bits.
-Each of the two 16 bit values are stored in machine-native byte order.
-.It Va namesize
+.It Va h_namesize
 The number of bytes in the pathname that follows the header.
 This count includes the trailing NUL byte.
-.It Va filesize
-The size of the file.
-Note that this archive format is limited to
-four gigabyte file sizes.
-See
-.Va mtime
-above for a description of the storage of four-byte integers.
+.It Va h_filesize
+The size of the file.  Note that this archive format is limited to 16
+megabyte file sizes, because PWB UNIX, like 6th Edition, only used
+an unsigned 24 bit integer for the file size internally.
 .El
 .Pp
 The pathname immediately follows the fixed header.
-If the
-.Cm namesize
+If
+.Cm h_namesize
 is odd, an additional NUL byte is added after the pathname.
-The file data is then appended, padded with NUL
-bytes to an even length.
+The file data is then appended, again with an additional NUL
+appended if needed to get the next header at an even offset.
 .Pp
 Hardlinked files are not given special treatment;
 the full file contents are included with each copy of the
 file.
+.Ss New Binary Format
+The new binary
+.Nm
+format showed up when cpio was adopted into late 7th Edition UNIX.
+It is exactly like the PWB binary format, described above, except for
+three changes:
+.Pp
+First, UNIX now ran on more than one hardware type, so the endianness
+of 16 bit integers must be determined by observing the magic number at
+the start of the header.  The 32 bit integers are still always stored
+with the most significant word first, though, so each of those two, in
+the struct shown above, was stored as an array of two 16 bit integers,
+in the traditional order.  Those 16 bit integers, like all the others
+in the struct, were accessed using a macro that byte swapped them if
+necessary.
+.Pp
+Next, 7th Edition had more file types to store, and the IALLOC and ILARG
+flag bits were re-purposed to accommodate these.  The revised use of the
+various bits is as follows:
+.Pp
+.Bl -tag -width "MMMMMMM" -compact
+.It 0170000
+This masks the file type bits.
+.It 0140000
+File type value for sockets.
+.It 0120000
+File type value for symbolic links.
+For symbolic links, the link body is stored as file data.
+.It 0100000
+File type value for regular files.
+.It 0060000
+File type value for block special devices.
+.It 0040000
+File type value for directories.
+.It 0020000
+File type value for character special devices.
+.It 0010000
+File type value for named pipes or FIFOs.
+.It 0004000
+SUID bit.
+.It 0002000
+SGID bit.
+.It 0001000
+Sticky bit.
+.It 0000777
+The lower 9 bits specify read/write/execute permissions
+for world, group, and user following standard POSIX conventions.
+.El
+.Pp
+Finally, the file size field now represents a signed 32 bit integer in
+the underlying file system, so the maximum file size has increased to
+2 gigabytes.
+.Pp
+Note that there is no obvious way to tell which of the two binary
+formats an archive uses, other than to see which one makes more
+sense.  The typical error scenario is that a PWB format archive
+unpacked as if it were in the new format will create named sockets
+instead of directories, and then fail to unpack files that should
+go in those directories.  Running
+.Va bsdcpio -itv
+on an unknown archive will make it obvious which it is: if it's
+PWB format, directories will be listed with an 's' instead of
+a 'd' as the first character of the mode string, and the larger
+files will have a '?' in that position.
 .Ss Portable ASCII Format
 .St -susv2
 standardized an ASCII variant that is portable across all
@@ -180,6 +244,7 @@ format or as the
 format.
 It stores the same numeric fields as the old binary format, but
 represents them as 6-character or 11-character octal values.
+.Pp
 .Bd -literal -offset indent
 struct cpio_odc_header {
         char    c_magic[6];
@@ -196,9 +261,9 @@ struct cpio_odc_header {
 };
 .Ed
 .Pp
-The fields are identical to those in the old binary format.
+The fields are identical to those in the new binary format.
 The name and file body follow the fixed header.
-Unlike the old binary format, there is no additional padding
+Unlike the binary formats, there is no additional padding
 after the pathname or file contents.
 If the files being archived are themselves entirely ASCII, then
 the resulting archive will be entirely ASCII, except for the
@@ -207,6 +272,7 @@ NUL byte that terminates the name field.
 The "new" ASCII format uses 8-byte hexadecimal fields for
 all numbers and separates device numbers into separate fields
 for major and minor numbers.
+.Pp
 .Bd -literal -offset indent
 struct cpio_newc_header {
         char    c_magic[6];
@@ -227,7 +293,7 @@ struct cpio_newc_header {
 .Ed
 .Pp
 Except as specified below, the fields here match those specified
-for the old binary format above.
+for the new binary format above.
 .Bl -tag -width indent
 .It Va magic
 The string
@@ -288,9 +354,9 @@ while working in AT&T's Unix Support Group.
 It appeared in 1977 as part of PWB/UNIX 1.0, the
 .Dq Programmer's Work Bench
 derived from
-.At v6
+.At 6th Edition UNIX
 that was used internally at AT&T.
-Both the old binary and old character formats were in use
+Both the new binary and old character formats were in use
 by 1980, according to the System III source released
 by SCO under their
 .Dq Ancient Unix
@@ -304,9 +370,9 @@ The
 format is mis-named, as it uses a simple checksum and
 not a cyclic redundancy check.
 .Pp
-The old binary format is limited to 16 bits for user id,
-group id, device, and inode numbers.
-It is limited to 4 gigabyte file sizes.
+The binary formats are limited to 16 bits for user id, group id,
+device, and inode numbers.  They are limited to 16 megabyte and 2
+gigabyte file sizes for the older and newer variants, respectively.
 .Pp
 The old ASCII format is limited to 18 bits for
 the user id, group id, device, and inode numbers.
index 62359dd..5a118ff 100644 (file)
@@ -201,28 +201,27 @@ POSIX.1-2001 extended the ustar format to create the
 .Dq pax interchange
 format.
 .Ss Cpio Formats
-The libarchive library can read a number of common cpio variants and can write
-.Dq odc
-and
-.Dq newc
-format archives.
-A cpio archive stores each entry as a fixed-size header followed
-by a variable-length filename and variable-length data.
-Unlike the tar format, the cpio format does only minimal padding
-of the header or file data.
-There are several cpio variants, which differ primarily in
-how they store the initial header: some store the values as
-octal or hexadecimal numbers in ASCII, others as binary values of
-varying byte order and length.
+The libarchive library can read and write a number of common cpio
+variants.  A cpio archive stores each entry as a fixed-size header
+followed by a variable-length filename and variable-length data.
+Unlike the tar format, the cpio format does only minimal padding of
+the header or file data.  There are several cpio variants, which
+differ primarily in how they store the initial header: some store the
+values as octal or hexadecimal numbers in ASCII, others as binary
+values of varying byte order and length.
 .Bl -tag -width indent
 .It Cm binary
-The libarchive library transparently reads both big-endian and little-endian
-variants of the original binary cpio format.
-This format used 32-bit binary values for file size and mtime,
-and 16-bit binary values for the other fields.
+The libarchive library transparently reads both big-endian and
+little-endian variants of the the two binary cpio formats; the
+original one from PWB/UNIX, and the later, more widely used, variant.
+This format used 32-bit binary values for file size and mtime, and
+16-bit binary values for the other fields.  The formats support only
+the file types present in UNIX at the time of their creation.  File
+sizes are limited to 24 bits in the PWB format, because of the limits
+of the file system, and to 31 bits in the newer binary format, where
+signed 32 bit longs were used.
 .It Cm odc
-The libarchive library can both read and write this
-POSIX-standard format, which is officially known as the
+This is the POSIX standardized format, which is officially known as the
 .Dq cpio interchange format
 or the
 .Dq octet-oriented cpio archive format
index c6894d2..1ef4b7c 100644 (file)
@@ -105,7 +105,7 @@ POSIX
 .Dq pax interchange format
 archives,
 .It
-POSIX octet-oriented cpio archives,
+cpio archives,
 .It
 Zip archive,
 .It
index 4be5bf4..53cc3e2 100644 (file)
@@ -199,6 +199,7 @@ IF(ENABLE_TEST)
     test_read_too_many_filters.c
     test_read_truncated.c
     test_read_truncated_filter.c
+    test_short_writes.c
     test_sparse_basic.c
     test_tar_filenames.c
     test_tar_large.c
@@ -208,6 +209,7 @@ IF(ENABLE_TEST)
     test_write_disk.c
     test_write_disk_appledouble.c
     test_write_disk_failures.c
+    test_write_disk_fixup.c
     test_write_disk_hardlink.c
     test_write_disk_hfs_compression.c
     test_write_disk_lookup.c
index f77610d..0146e92 100644 (file)
@@ -206,15 +206,15 @@ DEFINE_TEST(test_read_format_ar)
 DEFINE_TEST(test_read_format_cab)
 DEFINE_TEST(test_read_format_cab_filename)
 DEFINE_TEST(test_read_format_cpio_afio)
-DEFINE_TEST(test_read_format_cpio_bin)
-DEFINE_TEST(test_read_format_cpio_bin_Z)
 DEFINE_TEST(test_read_format_cpio_bin_be)
 DEFINE_TEST(test_read_format_cpio_bin_bz2)
+DEFINE_TEST(test_read_format_cpio_bin)
 DEFINE_TEST(test_read_format_cpio_bin_gz)
 DEFINE_TEST(test_read_format_cpio_bin_le)
 DEFINE_TEST(test_read_format_cpio_bin_lzip)
 DEFINE_TEST(test_read_format_cpio_bin_lzma)
 DEFINE_TEST(test_read_format_cpio_bin_xz)
+DEFINE_TEST(test_read_format_cpio_bin_Z)
 DEFINE_TEST(test_read_format_cpio_filename_eucJP_UTF8)
 DEFINE_TEST(test_read_format_cpio_filename_UTF8_eucJP)
 DEFINE_TEST(test_read_format_cpio_filename_UTF8_UTF8_jp)
@@ -233,9 +233,9 @@ DEFINE_TEST(test_read_format_cpio_filename_KOI8R_CP1251)
 DEFINE_TEST(test_read_format_cpio_filename_UTF8_CP1251)
 DEFINE_TEST(test_read_format_cpio_odc)
 DEFINE_TEST(test_read_format_cpio_svr4_bzip2_rpm)
+DEFINE_TEST(test_read_format_cpio_svr4c_Z)
 DEFINE_TEST(test_read_format_cpio_svr4_gzip)
 DEFINE_TEST(test_read_format_cpio_svr4_gzip_rpm)
-DEFINE_TEST(test_read_format_cpio_svr4c_Z)
 DEFINE_TEST(test_read_format_empty)
 DEFINE_TEST(test_read_format_gtar_filename_eucJP_UTF8)
 DEFINE_TEST(test_read_format_gtar_filename_CP866_KOI8R)
@@ -250,20 +250,20 @@ DEFINE_TEST(test_read_format_gtar_gz)
 DEFINE_TEST(test_read_format_gtar_lzma)
 DEFINE_TEST(test_read_format_gtar_sparse)
 DEFINE_TEST(test_read_format_gtar_sparse_skip_entry)
-DEFINE_TEST(test_read_format_iso_Z)
-DEFINE_TEST(test_read_format_iso_multi_extent)
-DEFINE_TEST(test_read_format_iso_xorriso)
 DEFINE_TEST(test_read_format_isojoliet_bz2)
 DEFINE_TEST(test_read_format_isojoliet_long)
 DEFINE_TEST(test_read_format_isojoliet_rr)
 DEFINE_TEST(test_read_format_isojoliet_versioned)
+DEFINE_TEST(test_read_format_iso_multi_extent)
 DEFINE_TEST(test_read_format_isorr_bz2)
 DEFINE_TEST(test_read_format_isorr_ce)
 DEFINE_TEST(test_read_format_isorr_new_bz2)
 DEFINE_TEST(test_read_format_isorr_rr_moved)
+DEFINE_TEST(test_read_format_iso_xorriso)
+DEFINE_TEST(test_read_format_iso_Z)
 DEFINE_TEST(test_read_format_isozisofs_bz2)
-DEFINE_TEST(test_read_format_lha)
 DEFINE_TEST(test_read_format_lha_bugfix_0)
+DEFINE_TEST(test_read_format_lha)
 DEFINE_TEST(test_read_format_lha_filename)
 DEFINE_TEST(test_read_format_lha_filename_UTF16)
 DEFINE_TEST(test_read_format_mtree)
@@ -276,28 +276,6 @@ DEFINE_TEST(test_read_format_mtree_nonexistent_contents_file)
 DEFINE_TEST(test_read_format_mtree_noprint)
 DEFINE_TEST(test_read_format_mtree_crash747)
 DEFINE_TEST(test_read_format_pax_bz2)
-DEFINE_TEST(test_read_format_rar_set_format)
-DEFINE_TEST(test_read_format_rar_basic)
-DEFINE_TEST(test_read_format_rar_subblock)
-DEFINE_TEST(test_read_format_rar_noeof)
-DEFINE_TEST(test_read_format_rar_unicode_UTF8)
-DEFINE_TEST(test_read_format_rar_unicode_CP932)
-DEFINE_TEST(test_read_format_rar_compress_normal)
-DEFINE_TEST(test_read_format_rar_multi_lzss_blocks)
-DEFINE_TEST(test_read_format_rar_compress_best)
-DEFINE_TEST(test_read_format_rar_ppmd_lzss_conversion)
-DEFINE_TEST(test_read_format_rar_binary)
-DEFINE_TEST(test_read_format_rar_windows)
-DEFINE_TEST(test_read_format_rar_multivolume)
-DEFINE_TEST(test_read_format_rar_multivolume_skip)
-DEFINE_TEST(test_read_format_rar_sfx)
-DEFINE_TEST(test_read_format_rar_multivolume_stored_file)
-DEFINE_TEST(test_read_format_rar_multivolume_stored_file_skip)
-DEFINE_TEST(test_read_format_rar_multivolume_seek_data)
-DEFINE_TEST(test_read_format_rar_multivolume_seek_multiple_files)
-DEFINE_TEST(test_read_format_rar_multivolume_uncompressed_files)
-DEFINE_TEST(test_read_format_rar_ppmd_use_after_free)
-DEFINE_TEST(test_read_format_rar_ppmd_use_after_free2)
 DEFINE_TEST(test_read_format_rar5_set_format)
 DEFINE_TEST(test_read_format_rar5_stored)
 DEFINE_TEST(test_read_format_rar5_compressed)
@@ -341,6 +319,28 @@ DEFINE_TEST(test_read_format_rar5_arm_filter_on_window_boundary)
 DEFINE_TEST(test_read_format_rar5_different_solid_window_size)
 DEFINE_TEST(test_read_format_rar5_different_winsize_on_merge)
 DEFINE_TEST(test_read_format_rar5_block_size_is_too_small)
+DEFINE_TEST(test_read_format_rar_set_format)
+DEFINE_TEST(test_read_format_rar_basic)
+DEFINE_TEST(test_read_format_rar_subblock)
+DEFINE_TEST(test_read_format_rar_noeof)
+DEFINE_TEST(test_read_format_rar_unicode_UTF8)
+DEFINE_TEST(test_read_format_rar_unicode_CP932)
+DEFINE_TEST(test_read_format_rar_compress_normal)
+DEFINE_TEST(test_read_format_rar_multi_lzss_blocks)
+DEFINE_TEST(test_read_format_rar_compress_best)
+DEFINE_TEST(test_read_format_rar_ppmd_lzss_conversion)
+DEFINE_TEST(test_read_format_rar_binary)
+DEFINE_TEST(test_read_format_rar_windows)
+DEFINE_TEST(test_read_format_rar_multivolume)
+DEFINE_TEST(test_read_format_rar_multivolume_skip)
+DEFINE_TEST(test_read_format_rar_sfx)
+DEFINE_TEST(test_read_format_rar_multivolume_stored_file)
+DEFINE_TEST(test_read_format_rar_multivolume_stored_file_skip)
+DEFINE_TEST(test_read_format_rar_multivolume_seek_data)
+DEFINE_TEST(test_read_format_rar_multivolume_seek_multiple_files)
+DEFINE_TEST(test_read_format_rar_multivolume_uncompressed_files)
+DEFINE_TEST(test_read_format_rar_ppmd_use_after_free)
+DEFINE_TEST(test_read_format_rar_ppmd_use_after_free2)
 DEFINE_TEST(test_read_format_rar_encryption_data)
 DEFINE_TEST(test_read_format_rar_encryption_header)
 DEFINE_TEST(test_read_format_rar_encryption_partially)
@@ -360,6 +360,7 @@ DEFINE_TEST(test_read_format_tz)
 DEFINE_TEST(test_read_format_ustar_filename)
 DEFINE_TEST(test_read_format_warc)
 DEFINE_TEST(test_read_format_xar)
+DEFINE_TEST(test_read_format_zip_utf8_paths)
 DEFINE_TEST(test_read_format_zip)
 DEFINE_TEST(test_read_format_zip_ppmd_one_file)
 DEFINE_TEST(test_read_format_zip_ppmd_one_file_blockread)
@@ -382,7 +383,7 @@ DEFINE_TEST(test_read_format_zip_lzma_alone_leak)
 DEFINE_TEST(test_read_format_zip_lzma_stream_end)
 DEFINE_TEST(test_read_format_zip_lzma_stream_end_blockread)
 DEFINE_TEST(test_read_format_zip_7z_lzma)
-DEFINE_TEST(test_read_format_zip_utf8_paths)
+DEFINE_TEST(test_read_format_zip_7z_deflate)
 DEFINE_TEST(test_read_format_zip_comment_stored)
 DEFINE_TEST(test_read_format_zip_encryption_data)
 DEFINE_TEST(test_read_format_zip_encryption_header)
@@ -446,6 +447,7 @@ DEFINE_TEST(test_read_truncated_filter_lzip)
 DEFINE_TEST(test_read_truncated_filter_lzma)
 DEFINE_TEST(test_read_truncated_filter_lzop)
 DEFINE_TEST(test_read_truncated_filter_xz)
+DEFINE_TEST(test_short_writes)
 DEFINE_TEST(test_sparse_basic)
 DEFINE_TEST(test_fully_sparse_files)
 DEFINE_TEST(test_tar_filenames)
@@ -461,20 +463,21 @@ DEFINE_TEST(test_ustar_filename_encoding_EUCJP_CP932)
 DEFINE_TEST(test_ustar_filename_encoding_CP932_UTF8)
 DEFINE_TEST(test_ustar_filenames)
 DEFINE_TEST(test_warn_missing_hardlink_target)
-DEFINE_TEST(test_write_disk)
 DEFINE_TEST(test_write_disk_appledouble)
+DEFINE_TEST(test_write_disk)
 DEFINE_TEST(test_write_disk_failures)
+DEFINE_TEST(test_write_disk_fixup)
 DEFINE_TEST(test_write_disk_hardlink)
 DEFINE_TEST(test_write_disk_hfs_compression)
 DEFINE_TEST(test_write_disk_lookup)
 DEFINE_TEST(test_write_disk_mac_metadata)
 DEFINE_TEST(test_write_disk_no_hfs_compression)
 DEFINE_TEST(test_write_disk_perms)
-DEFINE_TEST(test_write_disk_secure)
 DEFINE_TEST(test_write_disk_secure744)
 DEFINE_TEST(test_write_disk_secure745)
 DEFINE_TEST(test_write_disk_secure746a)
 DEFINE_TEST(test_write_disk_secure746b)
+DEFINE_TEST(test_write_disk_secure)
 DEFINE_TEST(test_write_disk_sparse)
 DEFINE_TEST(test_write_disk_symlink)
 DEFINE_TEST(test_write_disk_times)
@@ -521,22 +524,22 @@ DEFINE_TEST(test_write_format_cpio_odc)
 DEFINE_TEST(test_write_format_gnutar)
 DEFINE_TEST(test_write_format_gnutar_filenames)
 DEFINE_TEST(test_write_format_gnutar_linknames)
-DEFINE_TEST(test_write_format_iso9660)
 DEFINE_TEST(test_write_format_iso9660_boot)
+DEFINE_TEST(test_write_format_iso9660)
 DEFINE_TEST(test_write_format_iso9660_empty)
 DEFINE_TEST(test_write_format_iso9660_filename)
 DEFINE_TEST(test_write_format_iso9660_zisofs)
+DEFINE_TEST(test_write_format_mtree_absolute_path)
 DEFINE_TEST(test_write_format_mtree)
 DEFINE_TEST(test_write_format_mtree_no_leading_dotslash)
-DEFINE_TEST(test_write_format_mtree_absolute_path)
 DEFINE_TEST(test_write_format_mtree_classic)
 DEFINE_TEST(test_write_format_mtree_classic_indent)
 DEFINE_TEST(test_write_format_mtree_fflags)
 DEFINE_TEST(test_write_format_mtree_no_separator)
 DEFINE_TEST(test_write_format_mtree_quoted_filename)
 DEFINE_TEST(test_write_format_pax)
-DEFINE_TEST(test_write_format_raw)
 DEFINE_TEST(test_write_format_raw_b64)
+DEFINE_TEST(test_write_format_raw)
 DEFINE_TEST(test_write_format_shar_empty)
 DEFINE_TEST(test_write_format_tar)
 DEFINE_TEST(test_write_format_tar_empty)
index 21cbdd7..0116df0 100644 (file)
@@ -52,6 +52,10 @@ DEFINE_TEST(test_archive_pathmatch)
        assertEqualInt(0, archive_pathmatch("a/b/c", "a/b/", 0));
        assertEqualInt(0, archive_pathmatch("a/b/c", "a/b", 0));
 
+    /* Null string and non-empty pattern returns false. */
+       assertEqualInt(0, archive_pathmatch("a/b/c", NULL, 0));
+       assertEqualInt(0, archive_pathmatch_w(L"a/b/c", NULL, 0));
+
        /* Empty pattern only matches empty string. */
        assertEqualInt(1, archive_pathmatch("","", 0));
        assertEqualInt(0, archive_pathmatch("","a", 0));
index 86a2665..7e6e3a8 100644 (file)
@@ -141,7 +141,7 @@ compat_lzma(const char *name)
 
 DEFINE_TEST(test_compat_lzma)
 {
-       /* This sample has been added junk datas to its tail. */
+       /* This sample has been added junk data to its tail. */
        compat_lzma("test_compat_lzma_1.tlz");
        /* This sample has been made by lzma with option -e,
         * the first byte of which is 0x5e.
index 9efa742..bca3ce5 100644 (file)
@@ -528,7 +528,7 @@ test_basic(void)
         */
 
        /* Save current working directory. */
-#ifdef PATH_MAX
+#if defined(PATH_MAX) && !defined(__GLIBC__)
        initial_cwd = getcwd(NULL, PATH_MAX);/* Solaris getcwd needs the size. */
 #else
        initial_cwd = getcwd(NULL, 0);
@@ -560,7 +560,7 @@ test_basic(void)
        failure(
            "Current working directory does not return to the initial"
            "directory");
-#ifdef PATH_MAX
+#if defined(PATH_MAX) && !defined(__GLIBC__)
        cwd = getcwd(NULL, PATH_MAX);/* Solaris getcwd needs the size. */
 #else
        cwd = getcwd(NULL, 0);
@@ -1047,7 +1047,14 @@ test_restore_atime(void)
        size_t size;
        int64_t offset;
        int file_count;
-
+       const char *skip_test_restore_atime;
+
+        skip_test_restore_atime = getenv("SKIP_TEST_RESTORE_ATIME");
+        if (skip_test_restore_atime != NULL) {
+                skipping("Skipping restore atime tests due to "
+                    "SKIP_TEST_RESTORE_ATIME environment variable");
+                return;
+        }
        if (!atimeIsUpdated()) {
                skipping("Can't test restoring atime on this filesystem");
                return;
index 31f66f0..424d6a0 100644 (file)
@@ -998,3 +998,30 @@ DEFINE_TEST(test_read_format_zip_7z_lzma)
        assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
        assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a));
 }
+
+DEFINE_TEST(test_read_format_zip_7z_deflate)
+{
+       const char *refname = "test_read_format_zip_7z_deflate.zip";
+       struct archive_entry *ae;
+       struct archive *a;
+
+       assert((a = archive_read_new()) != NULL);
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
+       extract_reference_file(refname);
+
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a));
+       assertEqualIntA(a, ARCHIVE_OK,
+               archive_read_open_filename(a, refname, 10240));
+       //read first symlink
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+       assertEqualInt(AE_IFLNK, archive_entry_filetype(ae));
+       assertEqualString("libxkbcommon-x11.so.0.0.0",
+               archive_entry_symlink(ae));
+       //read second symlink
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+       assertEqualInt(AE_IFLNK, archive_entry_filetype(ae));
+       assertEqualString("libxkbcommon-x11.so.0.0.0",
+               archive_entry_symlink(ae));
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a));
+}
diff --git a/libarchive/test/test_read_format_zip_7z_deflate.zip.uu b/libarchive/test/test_read_format_zip_7z_deflate.zip.uu
new file mode 100644 (file)
index 0000000..7513073
--- /dev/null
@@ -0,0 +1,361 @@
+begin 644 test_read_format_zip_7z_deflate.zip
+M4$L#!!0#```(`)@!<%+IO$E_&````!D````3````;&EB>&MB8V]M;6]N+7@Q
+M,2YS;\O)3*K(3DK.S\W-S].M,#34*\[7,P!!`%!+`P04`P``"`"8`7!2Z;Q)
+M?Q@````9````%0```&QI8GAK8F-O;6UO;BUX,3$N<V\N,,O)3*K(3DK.S\W-
+MS].M,#34*\[7,P!!`%!+`P04`P``"``*B"M2@>XSL!\]``!HQ```&0```&QI
+M8GAK8F-O;6UO;BUX,3$N<V\N,"XP+C",6%GH34$8G\NU[R*[A%#V-7F0"%E#
+MR#[./7<NA[-UENN/1"2$$O'@0?)BB11)"HD4S[Q80RF*(AZ\B/G.&<?DS@_G
+M=L[,_+[??-]OOOGF;CMGSI_5K%1BOZ[F;"JCT9%A^7B:PM_=S!J%36:MY+,_
+MZY=Q6S!\N0?TEJX!],CFM91WZ\,THE;B6OM..?U$K3:OF9JWB^912WRMG48$
+MK6VM9I?5_8`"&]K!3&N)J]I%;Y,J]2?LE`]#6VZFM=J\Q7)>2_;_5V?5+LGB
+MX;Q\HSA:6]+T=J/]D_?LA<M8G[&G]H^\ON+*TXN]G_F;#CW>^>K-9J;LE2+_
+M)+0GZ]QZ0)DP(>^:O#O.:-^^:YM/QX<_>G?G6O^[H[H?774:Z1[?EK&N!OQ'
+M:S.^O6S&OP/\2!LS'C(S'I7,^'O2"?(^P("?`?J'`)T3FIGQ&\W-^.669OP$
+M6-<]X/\<T'.LE1F_"/*PHX497P3TCP3^9P+_[8#.AR!N![#>CV!?Y@/_;X">
+MDR#NP58@_\#/BS+0`W0>!7X>`?PVJ(=YX%PX@'\)G(L>P,]^P.=@7[8#_;>`
+M_Q(X=Y-`O4T!>I:#<S0)[,L>H+\[JEN@9RB(NQK4SW-0#VO!NLX#/WME/KN8
+M=`+_5\&ZYH'Z[P/R<QCX?PGR<)^!^@1^)@!\$-"Y%JSK*<#;@'RN!W6R!>Q[
+M+[!?;T#>/@/]KX'_'PQ\7C0#?@#_,=!Y%IS'9>`\?@5^5@(_WP&^&]3)2;!?
+M(X">76"_[@&\!O)_&N1_EKP'&O`GH'X&@KH=F>6A`[NV/A]?4;BC\!U6/@Y*
+M>;NF'9WKSS\:XBK^AXHZ_PJ_U3K'@W7Y>)_RPSC?X`4^CQ,K2CAG?,[2!;PJ
+M(K'!B1,1+5TPPPU\L=2JN"*WF2W<;K)XS?$MU]DFAW/K?(GBS7"M.!8Q\X1G
+MAUM9DUWA39LK?(-(N&>%V9UL#47,HR3RN2O\#<G&?[$<Z==*@HC9ENL&=D'?
+M++9F-.(K5V9;X:"PYG&$GT1;N2^:DL9Y821B$=6%<HP)C=Z]H"IS6@.."36N
+M.-[J&=*"2$58/0*9"YIR`^V,<]HK60<URW%--*S5LA,EPPY2/S$H1M1_<*C7
+ML#1"G<#'<NHRY;D#HUDTA:YC.PG(+B`VRHA%4E"P&*F%&CT6IN&])$)&Q*L&
+MD1`/AZK_-5B#TTB$KO%L&\.G?FC9FUDM$H+I=L>O.C9)^<4T;+S&4>*P"[,%
+M"+8#+[1RC;&C9Q"S0/[HK#B^1,-(Y%4!7!A@(,ZW/!'SNN6F@KM.G*@W#D*5
+MRO^E_YU':ZX+-^:AB+))P/L_9OV=OCG)^?\6I.W:_Y#K3I2DEDNE^S_T#5&0
+MAH;\0>I?.71LX(Y@ME;BL:PF.;68IR@-'Q#`F^4Z5HRB8[[I_"LC"-R(_$?%
+M_M6HWA'^.`]^$@5N;`150(*;QHXEQ?F[P19>BP*/5T7=L45F5J;4CT1-=T5?
+M>!+1B&B>\W$:5JGQK'AS$2^S&,,5%FV4QR[FBB0-LY@RN<*/G>#WCCM5ZF9B
+M"B.7X:V"D<9"FV=$_\A-GK9(4"8J@155E5P*IJV^0/U:@'!MF\DBB\;+MK(1
+M0<SLH2H46+-C4$W#S%QU8ILD9^[(0N>#RQS::21HLO#KM-*L,&0&)+&6?=/T
+M0A:)[,LA#67.,[<$NTY%3K`#SPO\47$P:@PA,M9(B=)XK!H7_1562OU)U+=5
+M3_,Q4B8Y]S,ZC:/1,J+ECI:$21/8<CYFU$1IF#U_SO09?-RH<:,F%O^:LZ*G
+M70!MKIYTEU6?7F7",@1?9>!3P_!<P&]6O!@KJ5?G"U\Z=9/COO*>V"YGEX@K
+MG]-Z#FHO;<7O%J;F?6Y;_)^:<2BB;A_>CNSYE?9VVE#\*MGU_[F5?==/+NP<
+MM,D`C,-XK+9-[_1.[\]J-:U7K%9CO3YKU5BO6*]:K^@41"$X%0<I"B(Z&.L2
+M!"%T,3@%I^`4U"$X!:?@8G"*XA"<BJ`Q[YL/\O!E2/+\`H&7_*>,EE]=-C<M
+M-^!LT_X]#\JO?IL_MCQ@\V>6S]G\I>5!FT<M#]G\M>5AFR];OF#S-Y:GGJOK
+M?_-U^*72\*WP#'PO/`L_#\_!Y^%Y^`VX.U+V6OD-X0:\"NZ!<XU>.'?H@U?#
+M37@-W`^OA0?@3O@<O!X>A#?`0_!&>!C>!%^`-\,7X2WP)W`7/`)OA4?A;?`8
+MO!T>AW?`$_!.>!+>!4_!N^%IN!N>@??`L_!>>`[>!\_#^^$%^`!\!3X(=[RH
+M^!#8"3?@+OA:N!L^##?@Z^`>^'JX%SX"]\$WP$WX1NX?[N'^X:/</WR,^X=O
+MXO[AF[E_^!;N'[Z-^X=[N7_X=NX?/@Z/PG?`8_"=\#A\`IZ`[X(GX;OA*;@/
+MGH;O@6?@D_`L?!\\!]\/S\,/P`OP@_`5N`EW+%7\$-@)GX*[X(?A;O@TW(`?
+M@7O@1^%>^#&X#^Z'F_#CW#]\AON'G^#^X2>Y?_@I[A]^FON'G^'^X0'N'WZ6
+M^X?/<O_P<_`H_`(\!K\(C\,OP1/P.7@2?AF>@E^!I^%7X1GX-7@6?AV>@P?A
+M>?A-N/_1+V?^6[6\^>3\6/'BQ-1=PU$<F2X]MPR9I7?2(?GH1ZY8>HQ,2J^2
+MSFB/2U=)I[3'I%=+)[2'I==(Q[1[I:NE(]IMTC72B]KUTK728>TJ::=T4/O/
+MG5+720>T?TO72YO:/Z4;I+W:WZ4;I0WMK])-TB[M+]+-T@[MS](MTH5_TA^D
+M77J_]GOI5KU?^YUTF]ZO_5:Z7>_77I;NT/NU7TEWZOW:2])=>K_V4^ENO5_[
+MH;1;[]>^+]VC]VO?D^[5^[5O2_?I_=JWI/OU?NUYZ0&]7WM6>E#OUYZ1'M+[
+M_TI/21MZ_W_>ZR36A3B`XWAG.J5]&M/8(A)1^[[ORZ.6X6]Y]CVI`U%!.,BK
+M@^1%&<)H)+A8CFXD+@Z5.-!6+!&1<G0JB:1X$=NA&)[_[V?>3&DUC83+T\^_
+M__]__M^9>H6>!0]D/ST)'L1^>A0\F/WT('@(^^E^\%#VTSW@8>RGF^#A[*=5
+M>`3[Z2][I4>RG_X`CV(__1H>S7[Z!3R&_?0S>"S[Z:?P./;3#^'Q[+?A/#R!
+M_?1->"+[Z>OP)/;35^')[*<OPU/83U^"I[*?/@=/8S]]"I[.?OHH/(/]]"%X
+M)OOI`_`L]M-[X-GLI[?#<]A/;X6;V4^OA>>RGUX&SV/_5W@!'&,_/0N>SWYZ
+M$KR`_?0H>"'[Z4'P(O;3_6"#_70/>#'[Z29X"?MI%1;LI[_LD5[*?OH#O(S]
+M]&MX.?OI%_`*]M//X!;VTT_AE>RG'\*KV/\%SL.KV4_?A->PG[X.KV4_?15>
+MQW[Z,KR>_?0E>`/[Z7/P1O;3I^!-[*>/PIO93Q^"M["?/@!O93^]?5?4ESA3
+M^7M>I`-CY:`XGFU5.PK\A9_0!QQS_A_?/%-N($X'\,<&,;(LK)?"+'<_V%LN
+M>YOXN2P4[RC*)?(IQN_@6R$QKF+]Y]U8/_7#;J[_CO6Y[WYAO1.YTCRAW!-/
+MOK?VE9OEG,W"W(SKJ_=+-5^1^_B2PX79?%XND%M:+UO#\C+Y'5%?J;\L+`GY
+M(WXOD)(3E8_5YSDK)PISGB_9[=4V.?/GN>7U9SK7?X4M.PIQ?E_@M=76?M^P
+ML?I-5].PE2?[VLVV=E_R8]JPXW<XX[U5B)ULLQ-62SEA&9_TC&'K-S:4<R^"
+MH;Q^P_B4*T9"!<RMW"UMM)M%15Y1,UMLA5(=J93F2*."CH)4Q%&$BCJ*4C%'
+M,:FA*7DEZ:Y'6FR\Q)!/<8?PDD.J-Z0Z0Q%O2,.0$RL_,E%AM96$E2R*M%'4
+M,SX]DS7+O?03S^7WM)45IWL=_WFO`Z>7R86:*G84)%(20BET8%7IOKRR)-?'
+M-#U3<%X&],P#YZ5?;FL]MNZ7+LHO'BN/5=;JH/.F*M^\B:O<P@\YJ;5B4MB9
+MI.!@O,4]\48ZIID/E,Y)VB^3U%\FJ;4F\8'HQPP9Z4Z,N!-?C<4XR]2&RVY_
+M:Z#LTK?_5+8_4+ML(\99YF^X[*7=0%G6;JQ,:Z0L6*?LO%:[[##&6:9Y9:I^
+MJ^`<_%_>[2Z59XIZ9WKK[SQ3X+^?*>FO?::X>Z8N=<_D[33N#SOU<7?JZNWD
+M]SY+:N*"?B.;*P9#7)+P-@]XD[2J24V_WY5D9W#J44-W)5;GKNQ4W99PRDM9
+MB6&F!-V4U2I&3N+0I%^0(<Z+:3[^.\-=%Y*LFO@7?POT8W>5BML=],YX#>.\
+M5E/5M6H\M2-*[:>VV]VF&PJVN0Q7E]=Y$O4^>J$?I%L)>%Q3%'Z33(A(.],V
+M91"D!+$'16+2FDGS>&@JEMA+/]1G5R1M+"&,DF<RG['4\MGY^.SB0QH4DQ$U
+M:!E;,RBB@HD)'9HRB,0YY][WWGW3.XVEOGKWW7ONN??\]VSWS&N.I7]6^%I4
+M!Y;H`K!`38A#X!V%6#L*?N6VC.!\!CM-#A/'Y3`"'$:`P]$BA]3%;#K^2<WG
+M,:]FXJ)BH7N.&0J93;CQ70MI#GS3`A'GRZ3O^GL:<-]BW=A8JC2<VBJ<VB*<
+MFA).N<.I">%443BU:3CE#*<<X?#;+-9>,_0`37NU!9(137]Q`3V6G$V/T#Q\
+M!)>PQV+6N0H7>#$-VU?3TK&M?L:F^H"F-S[&1P"$B==%FKSPVD+TRNS0A)UF
+M*?`H^.4PC.03]H,WYKOQK@I\NJE\<-[^H`[KP:8M3BZ"@!CI#3[>"OHP*?%:
+M;WKDM4K&*)FD#46-Q?6&*G,?OBH-=2,,"_"D:?!B6@RWKR9-.JT*TA/,,O2X
+MYHA`DJ'U]#LU1PR(*-O`4[XNTFP7\-%:$G`2$_#H6JF`-TZ'-4NXTW(M!:>W
+M-,8Y.HQP1@%O>#W7F'Y4;Z)0LN-=7*`I1!HACK((F$1`;O@%3V^U\7KV.CJP
+M,!S8G7Q2@3FI#!]!'R:`^_*F'C%$2(;2!"T.`*X5^`10*PC4F7D(:H9`39-A
+MX!)JG!%I%4$U0X@BEGD,TCP&*0(09_$\SM8LKHY>4F,#]PP_@?O"H03N>I\4
+MW#WA'AP>["++%SG&R'SB`+>3X*:Q?!O<BX<YE#&"FR@<V7C/,XD0[Q#(!YV_
+M@[H%U(P#Y/.JJUT=3MPSA_K>GQ'Y7N/UI[6$?!L@WTZ"-D""W5L=O=2N2/?[
+M2-;8(23K9G)9_?L"SN\JB/DP8=Y!F"-SM=O"?#@'YIU`TFWI7_<&^M>TCLO:
+MR32I6Z)_#0*-6PO!VIA=KT4\AAVPME?M=76@&</8`SC6.H1C>#D9\:II5T<`
+M$K9N!_J[S=!+D63,4QT#UX(6N!;<"=>",.&EU[=IP4;XJ[9SSW/D3XAN/*MW
+MJY\L?X3=$$J*V-.W>55T816T[V0X7W0PX;Q`)9P?G"G%^=-*P/9[REB)UR3.
+MJZ@J>JG`ZPC&JYSQ:I3S"B&ONTU>ODFDGM0L`6P=46.?&,8BCNKH5<(*D]@*
+MT3I:8=T,Z0J[XPK5U@I%;(4[]0:/Q9OWE.(CZ"L-9,::]N=M6%7PI/<-D;G3
+M'L`UT!,<`IG[2DPW:9)'5X=2.[%!K2S8.&3WFJ$2O(OJ>0%UR,%7\:I#E[[_
+MEIID#MAI.N"8P43`!TP'&$E=<00MD0?<0+^+-AIA^XS`-@,9YT(1OYF$W[6S
+M"+_G:Z3XI?:"'?W.W'/$<H,1Y@8]')?K4P8N$>X&(Z8;[*;8,D"B59,G:HP%
+MU0%7EY.<$0'@`_<F[*QO!NTL64L[VTJ^LZ-P9Z?QG9%M-PZ(F.1KCA[&<D&5
+M;<ULY-*:[B_,S20&DA2"!P;)+\M)%2IUC,\!`"OC@#7^@(#-<F]\DIL`O!SB
+M2$`=<'#8O2#'#4OA,BX<=D_&&>C/-\Z[E"CQ01.J;3;^9`UAV^$G;%\]2(KM
+M^CT`VWQ85UB#E3TF(-.W?![R4>4T3*'_,F,@#P<VYR_0)A8H\N0A=$[+C-<=
+MR934!+[S@,OWZWH6='Q9=;1)V/6>;->K?+3K3>6[/AAW7>]`=?N8U&US%O@2
+M005"@+50(JA^?-=O?^KJ"U9?C/I^U^,0":Q#>4%VDAJDW-O#+D[$./0&+A':
+M?Z672E]?PB/Y]O<@F<!"K@Q>M7/A_$!KM])TVL:)W<'&3JUG30%TON5S(^[_
+ME#X*04JO]6@!->$,J!\[0$2ONLS5,3AJ!:#9@QB`DC"6]*IQ"$!_&@&HF&?*
+MA"T4+5M.GFNDS&%"O;4=0E$;),LLJPPM8,DR/GCTY@$H\2V>_!!TXACV='U/
+MAY^1DF^6M.*5E$#[7LS7:`0.<2J/'>!_N>ZT,]VY^"#2G9=GDNZ\>Z!4=_)W
+M`WWY%02W,[3>/!B/XCI%)!87[*MXV2K'LE7FRU>Y=U<L.SNL'.5BAYD74JT/
+MQ1M,&MEI!E*,=O5SMHA69M\:I!.YXD"\K?5SI<D/5=+/(0,3=_E%->WRF1FT
+MR]</D.[RMPK8V0^42:5IEX\K5D2RKG?IH)J^Z[=12.>$,A7VD1E1,(HS->W-
+M:0.1A3Z!3*[-$:[]+(]KI.R,:\+*'RQ-ON5[U.2T@TF==MUT.&H,)J)&8CKO
+M.R$1&P)='S5TO4!(M"#/\H%R)T"Y84E83J]'42+(8<XWAMZJ,<@5=X8B"?16
+MH0UE7(NVM'=/@^X07&X+7O8P_!)Z.&Z=?>H*BQP/4^_YZ`<]SFH2IYB'OPY&
+M`A$H.(C8Y&FAA@9DR%!)\N('NEZ0?ITM)7TU*5RT"0Z$(-`Z[')=?\48`B!*
+MW@"2QT#R"$C>#9)W`N"=`N`_DBEGLGH7#1`L"%?"N$:^QC0;]Y>&9]J\NL?(
+M0"^9FMU9"G%J)C;Y_>9`TM02+VGJU.E23:V'WRW106$FP-:+H:&8K&7&D:11
+ML0*T!:+#<IO-L8FIRW+%071B,6L;3A?(.!:Z#$(H/7BRB9TVXCP;<64V<:&-
+M.-]&K&43NZV"5:%0CBRT$979B)P;$$&TMH;SK.&0&L?3/&R-<"?)N#H.&/VW
+M6K*H7Z8E-W^SH9:\J/P'+?%:6C)C?]*2T2K2DK7[2+5DEW)#2U(G_EL5B?/B
+MN0'.T#=V<`[^UR;TV9<R<%Y8LR$XL?\)3MET`N?G`PF<#RNEX!3M:()S_K\`
+MAR[*_':\_'7B=,R`Y6G<!E[W?&G':P\[7O[C_<?Y&_W''@-913<KQ&FL$.>#
+MAPX5P\4UT`@6U(`0X"==2U^L8?D`CN./J^<JN?[SOX3;\I-LU,3]U'R!TWH7
+MZ)!JUD<X'W[)Q_$KO\+5`89`:TQIG@X$&JV'0&Z_'P&YZWY2('NFP9'5\)P9
+M\"E&MUYP'838:=%@P97PK(ZZ%F]M(XCHBZO&S$R^'%)3_=[I5L<T5U=&?[72
+MZMBN#GJ,L%'G6IKF_=M`Y-5#B"T?W`+&]!<KK)D>F)GD[1)H]_.V"]8T4O)*
+MP`:>6FAQ`TQL",+>Z#&=/2KQ@0=6%Z2EZH*+*_"A#];I:_0ODP]^1=!6:J$0
+MSF>AFLZ1HTBE-XC8@32X(-=BS&4W2ENPUJ0=4,:A/7V]2=L]'NT6&9.V8SS:
+M`8.V^<R-TJWYPZ"KV2A=WY\&78D!>_5G1AHR.6ST[81]"FUN?N)D_RG^N?Y3
+M_:?-E?H8\B*8;WQEN1#L`_<.O7?WFR6Z\-D%5IGW,%!$HFHH!-O$:*U`!O*=
+MGIX6QTOGSGF6[PDVCF@ZR\EVY>E'N)^'6W0-D)](X^H4R2^"]J!J(RJ3$SES
+M_XQD#Z*3S9^0Y#3NW#2\,FJ/D_G9@A0+$;?81I1G(\J3$SEM1$XY4:&-J%!.
+MY,Y)1)YY$RIA$GV!K83YW)>"A^84SNP:9H=`5()$3(\>%+H]AG>?DV#>/=`Z
+MLKWK^J?_RHZ%E<9W#.C)H1:\M!ZO-?TOC\$?[F]70PO6J$_C@."(UR5XJAUH
+MS2C->^'"S`M_MR=YX8?WE'IA;RG8T;Y@>^`FZ_MI%N,7'3$,#Y'+8%=DE6!X
+MO.\I[!,O`W);6[**@KCQ>M9G=M.#0R@Z"PZIR@K&M7M2,+ZRDG:O[BK=?>LV
+M8)E%:'K$!$^4F$T\JSHJ,IO(F.W-F&4JI,PJD=FK#L:,!R16JJ]CZ4(=%O-X
+M$VI3Y3Q$OM1G%/-`[`:-K>K3J!9U@</R('/$#)^(D';$K*_GV^KK25(E-__M
+MCFLG:?/54)=<=(;MLY:C]Q`^:U'WX)^U"+_QIO;C+W1\.PL7H-16_"6?BAC\
+M!2>%A57Y5SNN)5'VHVJ9:0W97F"3FK'F"8Q+,:IM:JHQ`&Q"2";:YZ;,9PB<
+MI^&(Q@G!5;IYPC<9%-\PHZ5]]B3I4?-BN@E+S7(;5#,9E"W5P8FD#LAZCT]S
+MV-<;'^>PKQ]V(Z6:M9M4J3[WY+"O]S:TKWD?;6A?LZ'/+M(\$*D;1.JD>H]>
+M_P`PA[_J8QRHEV&C5!UAU_R3^;ZSJ,[LHZ*)0;7^$Z)*&^]+V'L29^"/L7C,
+M%")]W+"ZF6']M2L9UD][$`;W[R3%H&]+T/X`"`:(0GU%G/\MF_\,FW^:?/X=
+M.'^6PRJ+;\LL*1-46$$T35?_/F)+/[T.R.L\,3+>AF*X]/?9Y5C"]K$SVT=?
+MN70?+MS'*[Q$RRK<>_$FN`,GUZ`G/A+=@8>[`X\&U%>`#L3XHD'T?,V=.,,[
+M55&8*LQU=;7V<=_@X81P<$FD/$PGA;A]LD&\'XK!'`9:BIIQ:EC/P=(W(."%
+M$E-'WZBT.CE^X>9;=OX9)EX)]`3Z>#Q+!-LP+^+5AP3#K[6"W2N9+=RQHQ2_
+M]Z>:U8?;%*NN<R4[E1*HW&2E54USV2E33C6<*Z=*V'*J^B1V$<!I@"U.5\@I
+M'+.F3=G-S4-P\<(.1.++C5O6^,B<'+>5M-RL=C5_%2]IV;OGK-IX2>LRBSR[
+MI'62*?IX%:W<<J^9G"5WB2BW:^$U.;(/#,L@,_XP&D>NW&<L^!!]Q@CT$/</
+M/C1]1H+=C"*(SR=FWA-.&)_0M&$+A#K0>A,LIH4@C3+GR$\516JC)DRKIC"9
+M8;WM%@$\2-A^;AN7NPS;*++]*/QOR@U_OB<K-WP;MR<L(&^Q6%L0DXT'=R);
+M**H@6PB626WAC<F\YL>Y31"+$B*W`..V;!?B-D/.K1FY+;"X3<ZUM_F,VX6,
+MV]KMY?4?Y+:#G1MO3J&J/MS7I'O=FW%W,^XWR[F_/0FX]RI67O2(LD%>5":L
+M#&<OK]L'(D[K&J7`H8N?/\W";E/#NE9R#:OG*Q@?/CWN5A2NK6[23=#29FXL
+M%4:Z\=@*>[IQY)BT#CZ^;KTOU:U/-]2MK?CYX6_#!'2%E7I6@.44<KEFKA1C
+M326/-964>GXH0/R\"#$GPEOJ&1_";P7YW(?8$+MN10[$%KELB*7Q&,Q9<_@L
+M2N$TIWWF#&MF@],`NVEO?L.$9KF9WZVT`^X?$_,[:3'LL8T4PZ;>5([%L)!0
+M"6,[NNA]:.4H;#V_,G=A*[`#*7B#W!B3$P'QW?)9FH#E@H(IY:RHM3D\P6*\
+M(K,)M3N0T:S;D7B>4BKE>1OR7)5GI!Z%MCJ8QZARH>9`.\W;4[+K8RZQ/D9Q
+M!VIB26S7!>>5<**)0H7KF7=D%2Y>TYK.:EJ58DWK@A54TRHS)`R%%T"N$`PU
+M9$._'E28UY3&X&0M^A:B/R&;_DV+_GT;?1O1S\NF7V+1WV^C;R?Z,[/IYUOT
+M%XU79[MTV*R'S1J/]M9?3=HMQZ.]YC>3-J6,0WN859-[?3S:O-]-VEO'H]W7
+MK+>=9VII&YXA#F;`=5N]+;QWC:VWC?>NL/6V\]XN[.7*=?%RPZHG&5VG+I>7
+M\;*3,KK-K8!_T;("O1ISH]&WZ=[#;EEQP9+/6<[SE$!K6FG>AZ5)=&O9CDQ.
+MEYO<M,WY!SC\JKH9I%'%1KL&O@RRLM^EVY$)^\J(WUT>*;\/BH#?(+18C:@*
+MOV9;8>346#KBK-'U4Z+X,4]O(<S.&(-Y"_>W5FQF*[ZW/:VXBWS%TV#%U.6,
+MA0<2M]21V&;?6(U(OK$:Z4GFZSVX#_UM5U==88VK"WSC2.#K32DOAZS\YVDQ
+MO*I'VFM+T#_SW7G5D4L?(9^/]=->\52IJQVZ<EW+&U?K]?@##LX(M"84R/4H
+M"B;]^@<@X%_LB)9O*Q7P*OA>G5J#NSIP^FJE91/X_]57`9/5%I-NQN0^.9-J
+MDPE>+F%U$!GG,N5IF:`HEO(4,<)7D!"K"7%^J4_S$'?B=Z:EM>6BF31D6-@\
+MZ7CM6F/<)QD7K+FY3#H>-PH+35.,`SC0,*L456]S5T<(M7YF3[6].2HACT?%
+M2@A/EL[%ZPK+8S/4I.#R>HRW)T([0FWZ@)"ZK:\+,TSOTP@[_D9U/"[S4"^%
+M$C>.TWZB3+'D6D2'O]DUK:O14JZJYO<#4`.F`NM+207>DYOZ`9MR%4@U&E_:
+M#K\A$?)`&^`9#OBSHR+@M-?K;8!GV([UUA&].0-F5@T"SU$S<\6*3DR/Z_7+
+M9NMJYVR]_K&S].9>.)%(H'69TL25KL;\P7[JEGN5*3QYG-TC[I.33B)2@K40
+M](3W_JF8O47MZF_&:;2KOVIOJ0DD`06(0,VY%Y=ALMW[)OM"-H1F$;?Z_Z;L
+M.D.?BH%XW1-;<2*.N*U;4=RB2'&#$T5Q6[?^U?:Y<"]\[HTHBH*BB(CBQE7W
+M0$%!1/Q4<#VM'\2]Z^\N]Y:^OVCA]:672W*YY)*[2]+$-'LL%&N%C+(\K@"\
+M*R7U?KD67[(W7/NXA*]S;8Q,CFQ@+XR*/I=P482?VJB]@8K\CX1XE\$1$/=\
+MC!D!Y("&'`#DJ89$P"5`(N&3_3^M($!Y#2@/P,<5$>DVOL."*"1PT5-\^TC!
+M&V:D$SJ"8'D$8?=O@L#NSDK$5UE#P<E+NT<LO9C-PI#W^Q=,XP&Y%Y;,>Q`R
+MRG#;:NN%Z7UYD(>C!\1;W=;JHC/#`>8A9$`JH+-.L8LN@K;R4#)']QA+MG8S
+MLSG[^RF/,1&Q=?=E'@?EQ0MVXY5T_/\7?%*IE?&I>5D9/_"#E?'=_-JRC5]K
+MUN/5PURV@GZMXA<LB`4X>EN(M6U[4V]A.9.$V8DB4H(K7@+L)@/<?$C#Q'?D
+ML$WVK*?P3F<&(Y2VO>-(2"5CHF-SHS7%P8?>Q;R2"U8$82)9,^70>826[CS"
+M=,;2>3A1F]CIZ3NDN$<ON\D\'5RB4?6WN/4Z#BW-]93$(&G5ZF54C!3O:=Y9
+M%[C%CFAAF!607X\U-?*2C!!V!6K?48_LGZLN4N)+0-3-\=@>M5!P1S-_#1OO
+MR3G$!E`JM1@)1PI'@_5DK&9X'UHN3*Y"<52CS5PC'T-W7&).WLM#.,S)D[I+
+MU5\/\"/6*0@<7GS@)V-:!+(`NAE>_,I>,>NRZ"IU,JB(OC/`Z)+&&Y,VD).,
+MX%F#\"J#!/=S1TY()/1%+B*(2,)"PP/*9^U&*.2U[>&,&^*@LDNNPW"GR`@!
+M3<,1+;C:LVUB[V>*!)8A.$SM@>2\%#M[E3L.16R"[6FZUSD60$DU#A6PY_2[
+MQ?SCEZ0S^ULN,L*HJ;-QXPV2Y%[4L[.^HCBES9Z3DM)?1<%$570[#BIB8T'@
+MWVCKNPZ94R=JT/<6I3>YEL^RN$_EUYI9>&&>5.%H;&$XVG-].-I_=S@ZY$@X
+M&D^%HY/OA:-&.AR=!S)YJP2V,[991ME-'^]`2K=91EG/'7"#C5%%7@XV\QNS
+MV1`#P6S6B<V*7V2"2'+:1PGS1]O.6\I3AB"7?C#MV7OHY5(IVQ6Z:%XZ6PC*
+MM[3I&'%-3BU,4P6^ND39,0MW^\PPQ]V@./YX4.&NG<H_V=4BGLSU%,,#2AYQ
+M?MJ0S[^=;-?'HF1"73BK,/=+,#*"/=0MH<I86\YY9H!D0<HB4PAK@0T0>>O?
+M\\I/>77-):\OI?XKKWM`MWZ<#<[K>JYY(>562GGEK,=J2U8++&()(6Z7(BCO
+M_R!O,*4=ZDD;+"P06/;<?>..6]:6]*$_74>7^,'0M2AFG\8L9V,N]&+V*BRH
+M$9Z)-6I#&W6/#]51?!_ZP.4E!T4SLU-*@:P71ZWW,\)V`ZYGF^0[1NUKLG#<
+MKBHT2:P<\_Q_BO*X[D>HR`C%^2PM\^*M#$DY(-Z\3NL.OQF3>;5OMI?9./?(
+M?OK?%F0K1*'P\C%RYNW&0EH>(?GYK0JF\=3LG[ZP'GZ$BY34ZG0Z0.>)$3]N
+M="A,&+8:>?N4.]29S%0<'C%[28B/.0H3;X'1%/ZSY'LK8FG-@5Z*WK"G,:6:
+M-[E>-\F"%L'.<(O`G8E3)X;N[N-IS:6Q/W7%@-3P="8N+YR7#B6;@D#"TP-M
+M'=0%ZAL6;$+)\JMZOO]-">T-SOG\T$*SM'FF&>&+OU<F(2&O;$`,)BUJ%$UE
+M'1CV,U.<M3,':HT_V8]9;?&Z:Q;KD-F415MM]`8$^O<I.3I$44O2A;"P]546
+MMHQ"E/!Z:)@SM>M9]PB&7BG%:6ZI`R'14)"IK5TG^:O'TLL@Q?PK1%4I@$Z;
+MJ<248PF4UP'@B4(OH!K<9L5\2(!XHZ7TOAX()/RRTHGZ4`0@V+8\LPR'M=#Q
+M8DIX<RK31!#<+1@434NV,DN6%QE9=R*;799"$G=LT4:@V?\]$\7M^,EX?]]"
+MZ\^D0S*KPYA73K+L->\0YN&P*U[6WN/9+$0E9!0'4_(3F?GNQ[]K!_GT#WB[
+MG99.F8F05#X18!U^98(!A*`00,M,Q`V6IJ#4$3WO!A:5!8#E-D@.*@LM!_N7
+M`$481U4T<FDZEC=0PJMZOL:BIVRD^@G)TB((1Y<@^!<T\[G:2&&Q1T:<=`47
+M(R=*JA=[_T>JZSI5E\+03/XX#V&^O6#K0YN.!0DW]^;PTI72R[AT\$M4-QFG
+M;Q[5!R/*:Q2]-05Q?B%F]8Z:\:J;$W:'(2W_=IEMN<RV7&9;/*T`VU%!1/-B
+MP2\NS>'1+JO\K>)`];H7_*M2\#(<8/,.-965Z.NQ=R';]LH,)27O7AXL],D\
+ML*9X!/IE2A08VNE\(97G)KK&[XBDQ\`0JP>\-5VHWL0;P;\'?%OF3[,9<9^T
+M>FOFAI=4(2)(>(ME[P#6RHD?/@;S?D91"G-3S7>AB1(,Q8H4QXR64\Q$/%N'
+M(I9=CI!!K%U&%>G;4(PIS7T+T62!>,JH0%CS_;D7!,_R9$IH>B'ERUI#H+5W
+MH@AY)X@W$8__`D30!$0'3H)7W(&;=F:RIEW6]$3K\B:1-+LR&<Y[71U_D^`6
+M9!IRV2%DWEP1VTMD./(_A-<AYMU!"6]0P@&4P,N1LHA^_0=K)946SMM+_4[,
+MPZN'43D>;WGW#4<6I4BVN.MR/O@EHKN<6"@-1GJ*E/PDY)PUQ-DZ,X:UW3MH
+M""H<O)>]/*BS&1'0FE[<6WBV%ISO.E2:G,X#)0R/K3O6;/PJ8PV2E:97;F/-
+M:<]8\P&")U#1TA"KWS036'D".B1MC@"EH)>30)?`.P+S]=:5,>O)C2E_5?G7
+M3XMSF"(P2@_#8-<*FDHIS`O[\;0Y`SB>7MC[N0+/>SR$VP8::S<\)_%\Q@/8
+M'P__NWZ#]F/&3T\D^^'Z#M6NG6HLY>'?[5LKN@XH/EHE<Q3^<E_I*Q4477V@
+M!BJ^\FAZ:V5,F8RX43FXL(.NYE'CIZB:B3K1UO@N&IHY?GJ<;P9IT'Z*,;D'
+MWQ:BVJ,0CN%KET#`)(*KMLI!E'M%B(XZ!BXW&#LE/CJJY)XEYZH+U;:=FX3S
+M&A]/V/R2NDT>/Z5[?':GG-%QPK:!(V8)4/"$!P#VG3U9M6=$?^H@O'HVVA0-
+M2`06`;0FH`?,8SKE2A%"K5,G@4NS<L;485[(34L-VD_DVT_BLZ*JD1*$NKFA
+MX"/U#488/&&(:BL-Q\7KV[1L>G*,Y+"<,<.FCY@R-JX)&P:<D?'I1)Z?8F:L
+MOST\5TM1S_%3,'/\:(#K_I%+8OJH1NA;C31-#4?I7(4>C3.87T,:$JFJ*O%I
+M1L[XT:INM''TC_;JR/=!H7BI)+<9WV0RBILW&-_7=`)+N)EP\TDFTH#,7WUO
+M%4N)FCM7^4!>;DA[H&,B#\ZB?3!]JE8MY4=L&TQ#:.#$D9WCR9ZX.^@_Y1-B
+MB+I.,^*)I*`7E<RZVE?L(%<?F_IV[8,[,V0PL/GD`FU(OYSDB$E]NX*6%'8R
+MWL7S&,\+/._QZ#(Z\>5&N@!)A48E5@=U2ND'?UYR1/BY7E&D/[^/'4Z/=$&,
+M-SDQ<MC4G$0=H><7>V<9XT00AN&%0G%W+U:<(,4)SF'%2W'*!2B20\+!X>Y!
+M$P@NP3W!(83@P=T"P=W]@$"`CW>[+[L[0(&?_&"2[7,SSWPC>[/3D]R-><Y0
+M=`';O6<[':-_L8^$76M&^NGY#[.LS/KJ^@S7^H_UU!4<[2KB*MZ,L>$63X/0
+M&3[?)]ZO2]<.75SNT-K`;>I8`-%FAA'5>>J.;9RX,;6,#0R[N+Y\E7)N;![4
+M_]5`L!6UJ%XMT*)>M4#UA@V:^@*-:C8)U*O9,E"MCB]0M4F3JBT#3>NTJHE=
+MHZR6-[J\2S]`IT//SCVP"79T!:,B.Z,L;^[^B4.R:U14I\Z142[CG!I7G1IP
+M6-MX$.S+*93GIA0=+A]I;`"L;YWL%FWD>4";Y6-L!3>M?M0#P&!9;C^%RTSJ
+MT624+,?],DO>Y<#SE3A4KC2A')6$](<CD<+?,K;W^R..]$]9C9H159MY?8$F
+MS;PUFVJ=8J"4\OH-:]3T:KTZ%"]62BGW5FW9L)E/ZQNME/JK-JE3M8%/*6O8
+MR%<'ZT+[56K:I6NPC^;MB=.BN"RU^CT[%M=?2N@O)?47C_Y22@N;5HK^I^GC
+M<"70F$2&B7[I[TL=(WOWCAQ0-+2E].B$-5?1E;]8_S)!(V%9EFBFOQDTT]^9
+M<7I6]Z98F/BPA%X_%&L<(1DPSA_"=SE9'!6TN,;_X9^T5"0K/AZ\1J0&N!#L
+M"!X#1X,3UXHL`S]L$CD(+MXN<@\LN%LDJ0-GDNP3*0S&VR_B!0L>%(D":^$7
+MKY/`?H=$UH%KCXI<`YN>$/D,9CB)?O%S@&6G12J"_<Z(M`$/G!,9#%['7CT?
+M/'M!9!>X[2+BP=27$0^.OH+X^'C^KZ-?L,)-]`ONOX5^P1&WT2]8\H[(";`.
+M^`S<<1?C=N+,@GL8-YCA/N+!J0]%^H"'P!G@:W`+&/>1R`6P"A@+]@?3)L!\
+M0`]X'_2!21XC'KP%S@`[/4$\N!&\`'X!8\$Z3Q&/[Z3G@Q[P,N@#ES]#/-CE
+M.>+!.^`6<.X+Q(/OP%BP]4O$XU<7VT$/Z'F%>'`6V`?<\QKQ8(<WB`=7@1?`
+MZK&(!^>`:1-;9ZO$&=A$B],_99PL21,DG!;'./,C*ZXNBT7VQL<'R5-&),]8
+M-T62?@F':Y4S5RA8,D\NC75JX"JV2B144#5YRK%QJR=SMD5#]!UQE8`O;/>=
+M+3\:5R7X?78?=Q<J&'X9KIOP40ELWM$Y`2J$_$%<A3:(K(EG]\OCP8?F<0_7
+MUBTB$YPV7W.4PS',:0R"XTB*>:?']R*WXMK;N1KW>S^%X2_A]ZB?E'&^,\?I
+MA=^`Y\&MQ.<TXZ/@M^T5R09:/F.<[WX2RC?C.2JF^$(AK]^[=2@_@.?+X[#Y
+M1E,=4^+A__HX1R5PY'`H\[F&^H?Q_*U2QK/4',]G^(9'\#PK\]G#^>!"W%OX
+MR4K\>#.^(LK;'Q<YK\2?,N/;P*?!<^Y5XFN9\8/UO>>42&9EONG,^S$?OASV
+MA5BE_9=F^[O@DV&_N*_X6Z:_!G\.OHW2?W-K_BA/COVEM])_=_-^9W5@?MAW
+M7H2[WU?4^^U%O>S8EXXJ[1TTYQ,%?_@*-GC%CS3])/BB5T7V*//9:<YG'?Q)
+M^$V*7V_Z$_"!:R+I[;ZQ]9P]@V\&WU/IOYO9?U)]'\8^.D9I?[C9?F'X1#?P
+M=;3B+\(;^X47_@!\?_O]KCO),2J>HVOHIG,<?5`O#?;E,O9V>EOCG`%?$+Z0
+MW0<MOP6^%'PJN_=:_@*\&[Z2W0^P?"Q\#?BR=A]M^;3QL7;A2]I]#\M[X'O"
+ME[?[OI;WP4^`=]M]I.7[P$^%OZC<QS.HP/G#U[@3_O.P!7XUO%?QM4Q_`?[B
+M;WPL?)R[X7U:[)-%X)LJOH'I/?#MX2O:?3_;_.$'PY]4XH^8\7W@"^!]]X#B
+M=UOSAS\!/U#Q?:WYP[OQ?KU#\9NM^</OAF^M>+\U?_B/\$'%1YI>?U^O_`#[
+MAN*;6_.''P0_1/']3>^#OPS?0?'MK/G#9\'7%?F5YS"W^1S.@,_]2&29$K_(
+MFC_\2OB:BJ]BS1_^!/P\I?V99ONQ\+6>B/B5^,;6_,$A\!.4^-&A^/_I?_J?
+M_MTTO(!ROB@3SQ7]7=Q0@V/)B>1T<C:Y@%Q"KB3C&,#9J6K>D43-I_DAG^.'
+M?"'FDS-?BOD4S-=C/BGSJW(93,9\B[X&,QDPSV/-\CU/9B93TF?]P;_[*CUU
+MON+`XK/\#/MW,I\_KL'$S/>B)[2,I(/4>,XCP[3Q[#`M\PG(#*0KLUH^/J,Z
+MSMD<7Z(?^OLLQOA3LN`+\O9^OS)?FUY^\*^8K\*!?&0^B?9OIN%AUO<EKH\'
+MY'O2F=M@>M)-EB8C2#\9)&/(L>1,<@6YC3Q$7B(?D.])9Q[V3[K)TF0$Z2>#
+M9`PYEIQ)KB"WD8?(2^0#\CWIS,O^23=9FHP@_620C"''DC/)%>0V\A!YB7Q`
+MOB>=;O9/NLG29`3I)X-D##F6G$FN(+>1A\A+Y`/R/>G,Q_Y)-UF:C"#]9)",
+M(<>2,\D5Y#;R$'F)?$"^)YWYV3_I)DN3$:2?#)(Q9*WJU<N[\M=J@!_V>8IZ
+MBI9QE2A6O$2QDL5+NO(WP4\&:T?V,<J+E"A9P%ZY=-&218OKE<L4*U&\M%G9
+M*"^"NG^1'-BMO_%MWS$R1'$<P-_M+<ZYXU8Y+3@2G3UGUUFBM^B]1AEK;_?N
+MW);8HE^LB!XU:A!$C1XED>@M(:*$Z((_$-%R2K0(9KPO;EY^/_XYO\]^_6;F
+MS<R;.??N8@+E%E%$>B+F2=6MF$]5+X%Y1_62F,]4+R6ZDYXDYI%>&O.JZLEX
+MGJA>1IPF/47$&U">*I:27A;/)]7+B3CI:<(Y@W*;<,VDO#R>=ZI7$&FD5Q15
+M2*\D,DA/%W'2*XO32RC7!W\IY55%T7+*U9,BWPNLXMU/U8VDA1CG1DR^A=&+
+M.-Y.Z'-`Z=,%7J3X,+CZ?A4P^A<[K@3X=./OQ/AO09^XTF>_D2?.XU7FN.[\
+MV7_TJ0-_#+\!;P)_"_\!/P,OF2#]5"-9^_'"41G>N+FL=UGEU]JZ)XAR8N=T
+M62>C3S/D;V7+>CY>E-HB?Q3Y5.1[PR\J[D.?,6UE_03S1QCYN\BG(#\3^78=
+M9/T-OA#NZBCK>NBS%GU>H$]9Y'?^V6YG6=?`B3R,_!=EN^>0G]8%QX_\=>23
+M"LW'%2\E\[N[RMJ9B/.%?!7DK<A_1?_'W;%_V/]"F_2YO61]'ODDB_1>O66]
+M"/GJ%MD_`_TK(+\:?>[VE?5->"/TV=T/YPE]6J&/"WW*(=\=^<\#<']B'$8A
+MWQ_YBL@7(&_#C],^PJ?"2PR6]3/X`OA+^"CLSQKTSRLTG\<=R'<;ANL&^U.I
+MO/2CPW$_8/P/H<]D9?Q/PZ<K?@T>AR?#OZ3*_MM'R?H2MOL(^:7*]?`&O@E>
+M"_[=0M_OUD39_Y,FZU/PJHFRSQ/TJ0EOD$CWR42?7+>LT^$.)M\)^6\^63>&
+M]X2OS<=U`L^#/U-\#CQKO-FWP0OA@^`7X-?A;>#/F/W\@/R]`MR?\#2K,3Z5
+M1`?,JQW@=:QRW$[C^]@,>%,KW=]IE?WS0K+VP+NA3P:>U^7A&O(/)\AZ7<+_
+MGU,3?O>QB;SY9I]A./6\9OHLQ':7!'&_P#?`]^3B?,/WPB^'<-U@/X_#KP9D
+M/1+Y:U;YW:;Z'+]MY(GWG(?H4S4/\S#\)?P5]K,0_@2^&N/6%?X=_@$KC;;"
+M1Y>4/@$GY#X\Q?B_;N)]IFH)F6^/_;D%KPU/Q_$>A=OA48R;"]Y.=[V;^**,
+M0V?DZR)O@^?!'\-;PR>ACSJ>FW&\5R)XGN*\S$*?<[@?6R*_&%X1]]UL^#9C
+M'(CWMWW(K_=C_H6?T%T0[Y_7C3[$>7\(5]_WWJ-_=B[&"YZ.\]4K1]:3+;@?
+M#2?>PQL@WQ#7B0_>'/TG87R&PELAGX)YX`I\1$G<F\J?`L9G,;[2<+W_D;&R
+M/@@_Q.3O,5[$>'HIVILPWE'W#,)',_G)C,]C_)#AQOR,YT4H`?,`D__,>)]D
+M(6S$?%4OB<[W93R0)/?G]3CS=;Z,R>]A_"SCMQG_P'BUTK1W9WPLX],8W\+X
+M2<:O,_Z4\2^,UT^FO0WC0QB/,;Z<\1V,'V/\&N//&?_&>.TRM'=@W,OX?,8W
+M,7Y<]PS"+S/Y9XPGI=#N9+PGXQ,97\'X*<;?,EXSE787XWT8+]3=1O@\)K^1
+M\>.,WV&\B/$296EO]MM316B,K.=B_NS'Y`L87\+X#L:O,?Z&<4LYVNLQWI'Q
+M\8PO9/PPXR\9KYA&NYWQ3HR/93S.^*HT^C[=Q>3/,?Z0\8^,U[;1[K#1^].'
+MR<<87\+X=L9/Z5Z'\`=,/K4\[2(S%@EG^O/'9=KMQI=L9Z8G',VWAX3'[?=K
+MN8%0T%CS&XX*G2/1F,]G]PA-Z]EYH-:[A[Y$6Q,YWK`W-S\2-9;=!S2//Q3T
+M1O1$3DC+]8?&N?U:CK%\7G/')@N/OMS?[XUZ<^S9+H>3#FF^_&"^]GNUK/S]
+M'^$+NP->+2<6"$P1FE:LTO1DU!3]^ULC6,8OHF%W,.)W1[W&(NWBY9^UT5K`
+M'2GXYUCK_6^9N+'%6-"C:?8L1XN6K8JO#S=]EIV5I9?]!W8=/'B$UFU(W\[&
+M4F7YB:-9L57DYG_D;/EWP7C$M+3<''/)[>HI=;,MF[5`!^*SYEGBSXI]S1CZ
+M4%`?I8CQB2/+O,`\0JQ/-[7*=IA7JIL__=6ZE?-*#0/AL!P"(7%52#04M$3<
+M1_<X'I>X!`\$E<EN#!O()E&.Y9!H:!`%!4*BHJ("2BHD.BHJ6B0:_@`M+6+&
+M^1:_R3K)0V(E-''L;SP>SXP=WLS10Y+=_)`C>_?]E1.]U$1-D6W3_CFP!Z'`
+M.`H*ZKH?D(PA=QP^@@6B>53`CAP0S:/[ES>/[CGDF5QV,I8J"^G!6%-$IFA>
+MBWT_<,"KRBAFNXH2CTV'TKAW9WDTI5=1H2=9^=!DR*-+L;BAOAU4<:GR*M9%
+M:R_I0\>MO7'P,*W*UNYID$=!TMZ?9L;DX!9&8+O<817%992@(H#<3L=DA'AK
+MW,7??Y2VS=0$T",I@?9VXH\<N>PNR]^_ES1.SAPJAI$W&M.BH:>N'+NPJ!8O
+MGE0*D<0\<U$)I>=S&<I2>I:KTWA=-=A`$\\\E\$P-A4(#+BBBS2>:J[28NOP
+ME*:U!9X)(A;.BN'1=8'A59J!R_&6L[N=:\WQJ$C5.$C"6!MPG-YA&'$__I#E
+MLASC-+U7931=$@KM<V%0749%,H_B*M0J"\IQ89$4*(.8IAH6!0)K$-(^F<ZY
+MC1Q2O&6=G;QY\=B%LR=,OZW@("[T-T6U>`8J/7/R"KU:NG!BIMS3YR\=/W9>
+M73IUZNKBDEHZ=OS\HA)S.$3E>:U(I"7V"Z.]Q6(49)J*M:`*RZ8(V'4>:6/K
+M<.`'HR&S,DS,*_.&4/P6922F.,ACW2\LG#Y_]O@)M<_?YQ_L+#:1?$:F@$RQ
+M0HI(Y66>H.SK[_PDGTX*<@/%EB'`C.)_)M!+,$;9:C.VH()&C":9E%6=7;J@
+M[!E(VN<3<(FM2DJ*`P>+;LCADHM/#(AEJ@@AG-6.+JN,07:-3C8X&YP+_%LV
+M1+$DKK2*:1%J&N5E18'0QNH>K46T<([[K=/7XV:20Q^Y9OT.TR`/L;4J"F<L
+M[&'"3(S^Q:Z07'97:%%R4]PF`M6[A/Q'%=F#"J/GS5U.9@!3GD8LIW4">=(&
+M1:'SVEO;U@F7<BW.F^@)V8I`]D\NE\>FW]2R"`&YOKVP<%WM\0_Z>P1SL8]0
+M2M?D9JJPDE[&2YCSO)$Y>^9$LE'#"L3P[*$8ZM(4WX":)FTYXMSD"Z/EW,9%
+MFE*_<SL,2`3-JM#6S:%&M>QZKM3?H<6R>R0LK1G.9J7R=IG=UE[6);+N:`!I
+MNA?)3^[99JZ?W$[;.=D%,;<5BCU7$KQ2G[;L[7E;)2X39X_FZQ;TW,<>5]BF
+M7=BP9T?5'!7MYJC*-;/4R=1IP>+>[MAQZK9!QW4D=<J-PGR(W%='VK0TGGA%
+M`;5*LF!TSS$&)M%ZYDM[<'O13()<NT)&_^)=%@F)>TX3*9K;"2%=O]ECX+\9
+M?2?[:;>D9F#]:2VL!]^R>.?:<LE+&B)3:T^N^.:I<U-U!3>J$S$??T4K)QNA
+M'3[JBC*=^I,?L9@VC.CJFX>P17/CZ[WO63Y0M@Q_[G$M=B[6+NX02HT>!/RU
+M0S'CD;Q%KSP:M4=3S_-)Q64P)%KF-1W/GI*TU/Z=I/+YFS'<34',M,9!,?;\
+M\&%"2$-I?-TSU3GOKFBH4#9I:*[C@'%XRN+2\\TW"#_Z=U)Z,!]T/G_DT:#4
+M7.Q]/<;_#8W#W+8,%/])5"-FSW='-(RA/`UQ,;(&DVCD\1SUM,.B\'S:APGY
+M@/=??CN02SY`^\LJ27?-Y1;(G\\YK)0+#CSR/2T]@O>K047%$/HW8G[DSPOZ
+M=H.==]4R_';0!?`>V'Q\03-0FS\H?V>0ZPX\\DPM_=J0?]"@UY!+CS;GHX+*
+M]:\!IKG^$+GWP"-OU=*%'GQA^U`/("CJ`2"_0W^/@3^.-O)@05&/`/QV!_XI
+M=+K.UE\(NJG'?IY(/.?52KI6CM_2H,\E'OFWH$)?[O8KB4?^J*5?SC?GE[_7
+M#?R-2M(-/>M_`_Q@)G\EZ8<&@YT-_'N)1WZ&I6L&W?-_E'CD$5MZ8'VW_CYC
+MCV%?G*<*VJ5_4/C79HM'7BS1%>*_0W[@.1\*=&7[_T/@41?%%/A;7K?^?V+O
+M5]NZ$U#X[T#J?7W#CE[(^3EO&A1_)^Q9_R^)YWP;4,3A03?^-YZ!YSP>4(SK
+ML=_5G*<JY13XF\W\;0>%B.)W^65-QYR(B'JL9X[XL\'*+NWZ'?(GMW7'_ZTM
+M^&^?D"^VJAO_!U!+`0(4`Q0#```(`)@!<%+IO$E_&````!D````3````````
+M````((#_H0````!L:6)X:V)C;VUM;VXM>#$Q+G-O4$L!`A0#%`,```@`F`%P
+M4NF\27\8````&0```!4````````````@@/^A20```&QI8GAK8F-O;6UO;BUX
+M,3$N<V\N,%!+`0(4`Q0#```(``J(*U*![C.P'ST``&C$```9````````````
+M((#M@90```!L:6)X:V)C;VUM;VXM>#$Q+G-O+C`N,"XP4$L%!@`````#``,`
+*RP```.H]````````
+`
+end
index f357bad..c760de0 100644 (file)
@@ -201,6 +201,11 @@ DEFINE_TEST(test_read_append_filter_wrong_program)
 {
   struct archive_entry *ae;
   struct archive *a;
+#if !defined(_WIN32) || defined(__CYGWIN__)
+  FILE * fp;
+  int fd;
+  fpos_t pos;
+#endif
 
   /*
    * If we have "bunzip2 -q", try using that.
@@ -210,6 +215,14 @@ DEFINE_TEST(test_read_append_filter_wrong_program)
     return;
   }
 
+#if !defined(_WIN32) || defined(__CYGWIN__)
+  /* bunzip2 will write to stderr, redirect it to a file */
+  fflush(stderr);
+  fgetpos(stderr, &pos);
+  assert((fd = dup(fileno(stderr))) != -1);
+  fp = freopen("stderr1", "w", stderr);
+#endif
+
   assert((a = archive_read_new()) != NULL);
   assertA(0 == archive_read_set_format(a, ARCHIVE_FORMAT_TAR));
   assertEqualIntA(a, ARCHIVE_OK,
@@ -219,4 +232,15 @@ DEFINE_TEST(test_read_append_filter_wrong_program)
   assertA(archive_read_next_header(a, &ae) < (ARCHIVE_WARN));
   assertEqualIntA(a, ARCHIVE_WARN, archive_read_close(a));
   assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+
+#if !defined(_WIN32) || defined(__CYGWIN__)
+  /* restore stderr */
+  if (fp != NULL) {
+    fflush(stderr);
+    dup2(fd, fileno(stderr));
+    clearerr(stderr);
+    (void)fsetpos(stderr, &pos);
+  }
+  close(fd);
+#endif
 }
diff --git a/libarchive/test/test_short_writes.c b/libarchive/test/test_short_writes.c
new file mode 100644 (file)
index 0000000..afa0206
--- /dev/null
@@ -0,0 +1,216 @@
+/*-
+ * Copyright (c) 2021 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+/*
+ * This test checks whether things work correctly when the archive_write_callback
+ * passed to archive_write_open() does a short write and only writes some of the
+ * data passed in. The way the test works is that two archives are constructed
+ * in parallel - one with short writes, one with full writes - and the results
+ * are compared to see if they are identical.
+ */
+
+struct checker {
+        struct archive *short_archive;
+        char *shortbuf;
+        size_t shortbuf_len;
+
+        struct archive *full_archive;
+        char *fullbuf;
+        size_t fullbuf_len;
+};
+
+static ssize_t
+short_write_callback(struct archive *a, void *client_data, const void *buffer, size_t length)
+{
+        (void)a;
+
+        struct checker *checker = client_data;
+        size_t to_write = length < 100 ? length : 100;
+        size_t new_len = checker->shortbuf_len + to_write;
+        char *new_buf = realloc(checker->shortbuf, new_len);
+        assert(new_buf != NULL);
+
+        checker->shortbuf = new_buf;
+        memcpy(checker->shortbuf + checker->shortbuf_len, buffer, to_write);
+        checker->shortbuf_len = new_len;
+
+        return to_write;
+}
+
+static ssize_t
+full_write_callback(struct archive *a, void *client_data, const void *buffer, size_t length)
+{
+        (void)a;
+
+        struct checker *checker = client_data;
+        size_t to_write = length;
+        size_t new_len = checker->fullbuf_len + to_write;
+        char *new_buf = realloc(checker->fullbuf, new_len);
+        assert(new_buf != NULL);
+
+        checker->fullbuf = new_buf;
+        memcpy(checker->fullbuf + checker->fullbuf_len, buffer, to_write);
+        checker->fullbuf_len = new_len;
+
+        return to_write;
+}
+
+static struct archive *
+create_archive(struct checker *checker, archive_write_callback write_cb, int buffered)
+{
+        struct archive *a;
+
+        assert((a = archive_write_new()) != NULL);
+
+        if (!buffered)
+                assertEqualIntA(a, ARCHIVE_OK,
+                    archive_write_set_bytes_per_block(a, 0));
+
+        /* With the default value of bytes_in_last_block, the writing code will
+         * pad out the final write to make it a full block. This causes problems
+         * for us because the size of the final write can be different depending
+         * on the size of previous writes, causing the "short" and "full" paths
+         * to get different amounts of padding. Setting it to 1 results in no
+         * padding other than that defined by the archive format. */
+        assertEqualIntA(a, ARCHIVE_OK,
+            archive_write_set_bytes_in_last_block(a, 1));
+
+        /* We write a pax archive, but other formats would work fine too. */
+        assertEqualIntA(a, ARCHIVE_OK,
+            archive_write_set_format_pax(a));
+        assertEqualIntA(a, ARCHIVE_OK,
+            archive_write_add_filter_none(a));
+
+        assertEqualIntA(a, ARCHIVE_OK,
+            archive_write_open(a, checker, NULL, write_cb, NULL));
+
+        return a;
+}
+
+static struct checker *
+checker_new(int buffered)
+{
+        struct checker *checker;
+
+        assert ((checker = calloc(1, sizeof *checker)) != NULL);
+
+        checker->short_archive = create_archive(checker, short_write_callback, buffered);
+        checker->full_archive = create_archive(checker, full_write_callback, buffered);
+
+        return checker;
+}
+
+static void
+checker_add_file(struct checker *checker, const char *name, char *buffer, size_t len)
+{
+        struct archive_entry *entry;
+        assert((entry = archive_entry_new()) != NULL);
+
+        archive_entry_set_pathname(entry, name);
+        archive_entry_set_mode(entry, AE_IFREG | 0755);
+        archive_entry_set_size(entry, len);
+
+        assertEqualIntA(checker->short_archive, ARCHIVE_OK,
+            archive_write_header(checker->short_archive, entry));
+        assertEqualIntA(checker->short_archive, len,
+            archive_write_data(checker->short_archive, buffer, len));
+
+        assertEqualIntA(checker->full_archive, ARCHIVE_OK,
+            archive_write_header(checker->full_archive, entry));
+        assertEqualIntA(checker->full_archive, len,
+            archive_write_data(checker->full_archive, buffer, len));
+
+        archive_entry_free(entry);
+}
+
+static void
+checker_close(struct checker *checker)
+{
+        assertEqualIntA(checker->short_archive, ARCHIVE_OK,
+            archive_write_close(checker->short_archive));
+        assertEqualIntA(checker->short_archive, ARCHIVE_OK,
+            archive_write_close(checker->full_archive));
+}
+
+static void
+checker_check(struct checker *checker)
+{
+        assertEqualInt(checker->shortbuf_len, checker->fullbuf_len);
+        assert(memcmp(checker->shortbuf, checker->fullbuf, checker->fullbuf_len) == 0);
+}
+
+static void
+checker_free(struct checker *checker)
+{
+        free(checker->shortbuf);
+        free(checker->fullbuf);
+        free(checker);
+}
+
+DEFINE_TEST(test_short_writes)
+{
+        struct checker *checker;
+        uint16_t test_data[16384];
+        int i;
+
+        for (i = 0; i < 16384; i++)
+                test_data[i] = i;
+
+
+        /* Write a file smaller than the default buffer size (10 * 1024);
+         * this will be written out at close.
+         */
+        checker = checker_new(1);
+        checker_add_file(checker, "a", (char *)test_data, 1024);
+        checker_close(checker);
+        assert(checker->shortbuf_len > 1024);
+        checker_check(checker);
+        checker_free(checker);
+
+        /* Write a file larger larger than twice default buffer size (10 * 1024);
+         * this both fills the buffer and writes it out, and also exercises
+         * the "write out full blocks directly" code path.
+         */
+        checker = checker_new(1);
+        checker_add_file(checker, "a", (char *)test_data, 21 * 1024);
+        checker_close(checker);
+        assert(checker->shortbuf_len > 21 * 1024);
+        checker_check(checker);
+        checker_free(checker);
+
+        /* Test unbuffered writes - a different code path.
+         */
+        checker = checker_new(0);
+        checker_add_file(checker, "a", (char *)test_data, 1024);
+        checker_close(checker);
+        assert(checker->shortbuf_len > 1024);
+        checker_check(checker);
+        checker_free(checker);
+}
index 0fbb7f7..43e87df 100644 (file)
@@ -577,7 +577,7 @@ DEFINE_TEST(test_sparse_basic)
 
        /* Check if the filesystem where CWD on can
         * report the number of the holes of a sparse file. */
-#ifdef PATH_MAX
+#if defined(PATH_MAX) && !defined(__GLIBC__)
        cwd = getcwd(NULL, PATH_MAX);/* Solaris getcwd needs the size. */
 #else
        cwd = getcwd(NULL, 0);
@@ -637,7 +637,7 @@ DEFINE_TEST(test_fully_sparse_files)
 
        /* Check if the filesystem where CWD on can
         * report the number of the holes of a sparse file. */
-#ifdef PATH_MAX
+#if defined(PATH_MAX) && !defined(__GLIBC__)
        cwd = getcwd(NULL, PATH_MAX);/* Solaris getcwd needs the size. */
 #else
        cwd = getcwd(NULL, 0);
index 706794a..d82d698 100644 (file)
@@ -67,7 +67,7 @@ has_xattr(const char *filename, const char *xattrname)
 {
        char *nl, *nlp;
        ssize_t r;
-       int exisiting;
+       int existing;
 
        r = listxattr(filename, NULL, 0, XATTR_SHOWCOMPRESSION);
        if (r < 0)
@@ -85,15 +85,15 @@ has_xattr(const char *filename, const char *xattrname)
                return (0);
        }
 
-       exisiting = 0;
+       existing = 0;
        for (nlp = nl; nlp < nl + r; nlp += strlen(nlp) + 1) {
                if (strcmp(nlp, xattrname) == 0) {
-                       exisiting = 1;
+                       existing = 1;
                        break;
                }
        }
        free(nl);
-       return (exisiting);
+       return (existing);
 }
 
 #endif
diff --git a/libarchive/test/test_write_disk_fixup.c b/libarchive/test/test_write_disk_fixup.c
new file mode 100644 (file)
index 0000000..c399c98
--- /dev/null
@@ -0,0 +1,81 @@
+/*-
+ * Copyright (c) 2021 Martin Matuska
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+
+/*
+ * Test fixup entries don't follow symlinks
+ */
+DEFINE_TEST(test_write_disk_fixup)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+       skipping("Skipping test on Windows");
+#else
+       struct archive *ad;
+       struct archive_entry *ae;
+       int r;
+
+       if (!canSymlink()) {
+               skipping("Symlinks not supported");
+               return;
+       }
+
+       /* Write entries to disk. */
+       assert((ad = archive_write_disk_new()) != NULL);
+
+       /*
+        * Create a file
+        */
+       assertMakeFile("victim", 0600, "a");
+
+       /*
+        * Create a directory and a symlink with the same name
+        */
+
+       /* Directory: dir */
+        assert((ae = archive_entry_new()) != NULL);
+        archive_entry_copy_pathname(ae, "dir");
+        archive_entry_set_mode(ae, AE_IFDIR | 0606);
+       assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+       assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+        archive_entry_free(ae);
+
+       /* Symbolic Link: dir -> foo */
+       assert((ae = archive_entry_new()) != NULL);
+       archive_entry_copy_pathname(ae, "dir");
+       archive_entry_set_mode(ae, AE_IFLNK | 0777);
+       archive_entry_set_size(ae, 0);
+       archive_entry_copy_symlink(ae, "victim");
+       assertEqualIntA(ad, 0, r = archive_write_header(ad, ae));
+       if (r >= ARCHIVE_WARN)
+               assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+       archive_entry_free(ae);
+
+       assertEqualInt(ARCHIVE_OK, archive_write_free(ad));
+
+       /* Test the entries on disk. */
+       assertIsSymlink("dir", "victim", 0);
+       assertFileMode("victim", 0600);
+#endif
+}
index f80821c..184f77a 100644 (file)
@@ -49,6 +49,9 @@ DEFINE_TEST(test_write_disk_hardlink)
        static const char data[]="abcdefghijklmnopqrstuvwxyz";
        struct archive *ad;
        struct archive_entry *ae;
+#ifdef HAVE_LINKAT
+       int can_symlink;
+#endif
        int r;
 
        /* Force the umask to something predictable. */
@@ -147,7 +150,7 @@ DEFINE_TEST(test_write_disk_hardlink)
        archive_entry_free(ae);
 
        /*
-        * Finally, try a new-cpio-like approach, where the initial
+        * Third, try a new-cpio-like approach, where the initial
         * regular file is empty and the hardlink has the data.
         */
 
@@ -174,6 +177,41 @@ DEFINE_TEST(test_write_disk_hardlink)
                assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
        }
        archive_entry_free(ae);
+
+#ifdef HAVE_LINKAT
+       /* Finally, try creating a hard link to a dangling symlink */
+       can_symlink = canSymlink();
+       if (can_symlink) {
+               /* Symbolic link: link5a -> foo */
+               assert((ae = archive_entry_new()) != NULL);
+               archive_entry_copy_pathname(ae, "link5a");
+               archive_entry_set_mode(ae, AE_IFLNK | 0642);
+               archive_entry_unset_size(ae);
+               archive_entry_copy_symlink(ae, "foo");
+               assertEqualIntA(ad, 0, r = archive_write_header(ad, ae));
+               if (r >= ARCHIVE_WARN) {
+                       assertEqualInt(ARCHIVE_WARN,
+                           archive_write_data(ad, data, sizeof(data)));
+                       assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+               }
+               archive_entry_free(ae);
+
+
+               /* Link.  Size of zero means this doesn't carry data. */
+               assert((ae = archive_entry_new()) != NULL);
+               archive_entry_copy_pathname(ae, "link5b");
+               archive_entry_set_mode(ae, S_IFREG | 0642);
+               archive_entry_set_size(ae, 0);
+               archive_entry_copy_hardlink(ae, "link5a");
+               assertEqualIntA(ad, 0, r = archive_write_header(ad, ae));
+               if (r >= ARCHIVE_WARN) {
+                       assertEqualInt(ARCHIVE_WARN,
+                           archive_write_data(ad, data, sizeof(data)));
+                       assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+               }
+               archive_entry_free(ae);
+       }
+#endif
        assertEqualInt(0, archive_write_free(ad));
 
        /* Test the entries on disk. */
@@ -211,5 +249,14 @@ DEFINE_TEST(test_write_disk_hardlink)
        assertFileNLinks("link4a", 2);
        assertFileSize("link4a", sizeof(data));
        assertIsHardlink("link4a", "link4b");
+
+#ifdef HAVE_LINKAT
+       if (can_symlink) {
+               /* Test #5 */
+               assertIsSymlink("link5a", "foo", 0);
+               assertFileNLinks("link5a", 2);
+               assertIsHardlink("link5a", "link5b");
+       }
+#endif
 #endif
 }
index 2960fe2..8a2e7df 100644 (file)
@@ -37,7 +37,7 @@ has_xattr(const char *filename, const char *xattrname)
 {
        char *nl, *nlp;
        ssize_t r;
-       int exisiting;
+       int existing;
 
        r = listxattr(filename, NULL, 0, XATTR_SHOWCOMPRESSION);
        if (r < 0)
@@ -55,15 +55,15 @@ has_xattr(const char *filename, const char *xattrname)
                return (0);
        }
 
-       exisiting = 0;
+       existing = 0;
        for (nlp = nl; nlp < nl + r; nlp += strlen(nlp) + 1) {
                if (strcmp(nlp, xattrname) == 0) {
-                       exisiting = 1;
+                       existing = 1;
                        break;
                }
        }
        free(nl);
-       return (exisiting);
+       return (existing);
 }
 static int
 get_rsrc_footer(const char *filename, char *buff, size_t s)
index 6e9e723..be13d96 100644 (file)
@@ -67,7 +67,7 @@ has_xattr(const char *filename, const char *xattrname)
 {
        char *nl, *nlp;
        ssize_t r;
-       int exisiting;
+       int existing;
 
        r = listxattr(filename, NULL, 0, XATTR_SHOWCOMPRESSION);
        if (r < 0)
@@ -85,15 +85,15 @@ has_xattr(const char *filename, const char *xattrname)
                return (0);
        }
 
-       exisiting = 0;
+       existing = 0;
        for (nlp = nl; nlp < nl + r; nlp += strlen(nlp) + 1) {
                if (strcmp(nlp, xattrname) == 0) {
-                       exisiting = 1;
+                       existing = 1;
                        break;
                }
        }
        free(nl);
-       return (exisiting);
+       return (existing);
 }
 
 #endif
index b7210e2..0af44d2 100644 (file)
@@ -37,7 +37,7 @@ has_xattr(const char *filename, const char *xattrname)
 {
        char *nl, *nlp;
        ssize_t r;
-       int exisiting;
+       int existing;
 
        r = listxattr(filename, NULL, 0, XATTR_SHOWCOMPRESSION);
        if (r < 0)
@@ -55,15 +55,15 @@ has_xattr(const char *filename, const char *xattrname)
                return (0);
        }
 
-       exisiting = 0;
+       existing = 0;
        for (nlp = nl; nlp < nl + r; nlp += strlen(nlp) + 1) {
                if (strcmp(nlp, xattrname) == 0) {
-                       exisiting = 1;
+                       existing = 1;
                        break;
                }
        }
        free(nl);
-       return (exisiting);
+       return (existing);
 }
 #endif
 
index acf2967..d5df8a8 100644 (file)
@@ -273,18 +273,28 @@ test_big_entries(int (*set_format)(struct archive *), int64_t size, int expected
 
 DEFINE_TEST(test_write_format_cpio)
 {
+       int64_t size_16m = ((int64_t)1) << 24;
+       int64_t size_2g = ((int64_t)1) << 31;
        int64_t size_4g = ((int64_t)1) << 32;
        int64_t size_8g = ((int64_t)1) << 33;
 
-       test_format(archive_write_set_format_cpio);
+       test_format(archive_write_set_format_cpio_odc);
        test_format(archive_write_set_format_cpio_newc);
 
-       test_big_entries(archive_write_set_format_cpio,
+       test_big_entries(archive_write_set_format_cpio_odc,
            size_8g - 1, ARCHIVE_OK);
-       test_big_entries(archive_write_set_format_cpio,
+       test_big_entries(archive_write_set_format_cpio_odc,
            size_8g, ARCHIVE_FAILED);
        test_big_entries(archive_write_set_format_cpio_newc,
            size_4g - 1, ARCHIVE_OK);
        test_big_entries(archive_write_set_format_cpio_newc,
            size_4g, ARCHIVE_FAILED);
+       test_big_entries(archive_write_set_format_cpio_bin,
+           size_2g - 1, ARCHIVE_OK);
+       test_big_entries(archive_write_set_format_cpio_bin,
+           size_2g, ARCHIVE_FAILED);
+       test_big_entries(archive_write_set_format_cpio_pwb,
+           size_16m - 1, ARCHIVE_OK);
+       test_big_entries(archive_write_set_format_cpio_pwb,
+           size_16m, ARCHIVE_FAILED);
 }
index 2ba415c..3ca5c39 100644 (file)
@@ -52,7 +52,7 @@ DEFINE_TEST(test_write_format_cpio_empty)
 
        /* Create a new archive in memory. */
        assert((a = archive_write_new()) != NULL);
-       assertA(0 == archive_write_set_format_cpio(a));
+       assertA(0 == archive_write_set_format_cpio_odc(a));
        assertA(0 == archive_write_add_filter_none(a));
        /* 1-byte block size ensures we see only the required bytes. */
        /* We're not testing the padding here. */
index ba1fecd..aefb42e 100644 (file)
@@ -54,7 +54,7 @@ DEFINE_TEST(test_write_format_cpio_odc)
 
        /* Create a new archive in memory. */
        assert((a = archive_write_new()) != NULL);
-       assertEqualIntA(a, 0, archive_write_set_format_cpio(a));
+       assertEqualIntA(a, 0, archive_write_set_format_cpio_odc(a));
        assertEqualIntA(a, 0, archive_write_add_filter_none(a));
        assertEqualIntA(a, 0, archive_write_open_memory(a, buff, buffsize, &used));
 
index 70750ba..f96e9d9 100644 (file)
@@ -150,7 +150,11 @@ typedef struct _U32_S { U32 v; } _PACKED U32_S;
 #if GCC_VERSION >= 409
 __attribute__((__no_sanitize_undefined__))
 #endif
-static inline U32 A32(const void * x)
+#if defined(_MSC_VER)
+static __inline U32 A32(const void * x)
+#else
+static inline U32 A32(const void* x)
+#endif
 {
     return (((const U32_S *)(x))->v);
 }
index 01e6721..379b8a3 100644 (file)
@@ -2,42 +2,38 @@ DEFINE_TEST(test_0)
 DEFINE_TEST(test_basic)
 DEFINE_TEST(test_copy)
 DEFINE_TEST(test_empty_mtree)
-DEFINE_TEST(test_extract_tar_Z)
 DEFINE_TEST(test_extract_tar_bz2)
 DEFINE_TEST(test_extract_tar_grz)
 DEFINE_TEST(test_extract_tar_gz)
 DEFINE_TEST(test_extract_tar_lrz)
-DEFINE_TEST(test_extract_tar_lz)
 DEFINE_TEST(test_extract_tar_lz4)
+DEFINE_TEST(test_extract_tar_lz)
 DEFINE_TEST(test_extract_tar_lzma)
 DEFINE_TEST(test_extract_tar_lzo)
 DEFINE_TEST(test_extract_tar_xz)
+DEFINE_TEST(test_extract_tar_Z)
 DEFINE_TEST(test_extract_tar_zstd)
 DEFINE_TEST(test_format_newc)
 DEFINE_TEST(test_help)
 DEFINE_TEST(test_leading_slash)
 DEFINE_TEST(test_missing_file)
-DEFINE_TEST(test_option_C_mtree)
-DEFINE_TEST(test_option_C_upper)
-DEFINE_TEST(test_option_H_upper)
-DEFINE_TEST(test_option_L_upper)
-DEFINE_TEST(test_option_O_upper)
-DEFINE_TEST(test_option_T_upper)
-DEFINE_TEST(test_option_U_upper)
-DEFINE_TEST(test_option_X_upper)
 DEFINE_TEST(test_option_a)
 DEFINE_TEST(test_option_acls)
-DEFINE_TEST(test_option_b)
 DEFINE_TEST(test_option_b64encode)
+DEFINE_TEST(test_option_b)
+DEFINE_TEST(test_option_C_mtree)
+DEFINE_TEST(test_option_C_upper)
 DEFINE_TEST(test_option_exclude)
 DEFINE_TEST(test_option_exclude_vcs)
 DEFINE_TEST(test_option_fflags)
 DEFINE_TEST(test_option_gid_gname)
 DEFINE_TEST(test_option_grzip)
+DEFINE_TEST(test_option_H_upper)
 DEFINE_TEST(test_option_j)
 DEFINE_TEST(test_option_k)
 DEFINE_TEST(test_option_keep_newer_files)
 DEFINE_TEST(test_option_lrzip)
+DEFINE_TEST(test_option_L_upper)
 DEFINE_TEST(test_option_lz4)
 DEFINE_TEST(test_option_lzma)
 DEFINE_TEST(test_option_lzop)
@@ -45,14 +41,18 @@ DEFINE_TEST(test_option_n)
 DEFINE_TEST(test_option_newer_than)
 DEFINE_TEST(test_option_nodump)
 DEFINE_TEST(test_option_older_than)
+DEFINE_TEST(test_option_O_upper)
 DEFINE_TEST(test_option_passphrase)
 DEFINE_TEST(test_option_q)
 DEFINE_TEST(test_option_r)
-DEFINE_TEST(test_option_s)
 DEFINE_TEST(test_option_safe_writes)
+DEFINE_TEST(test_option_s)
+DEFINE_TEST(test_option_T_upper)
 DEFINE_TEST(test_option_uid_uname)
 DEFINE_TEST(test_option_uuencode)
+DEFINE_TEST(test_option_U_upper)
 DEFINE_TEST(test_option_xattrs)
+DEFINE_TEST(test_option_X_upper)
 DEFINE_TEST(test_option_xz)
 DEFINE_TEST(test_option_z)
 DEFINE_TEST(test_option_zstd)
index 8edf5c6..7b42e8f 100644 (file)
@@ -58,7 +58,7 @@ DEFINE_TEST(test_option_safe_writes)
        }
        assertEqualInt(0, chdir(".."));
 
-       /* Extract created archive withe safe writes */
+       /* Extract created archive with safe writes */
        assertEqualInt(0,
            systemf("%s -x -C out --safe-writes -f t.tar "
            ">unpack.out 2>unpack.err", testprog));
index ef066eb..c1c03cd 100644 (file)
@@ -3680,7 +3680,7 @@ get_refdir(const char *d)
        }
 
        /* Get the current dir. */
-#ifdef PATH_MAX
+#if defined(PATH_MAX) && !defined(__GLIBC__)
        pwd = getcwd(NULL, PATH_MAX);/* Solaris getcwd needs the size. */
 #else
        pwd = getcwd(NULL, 0);
@@ -3775,7 +3775,7 @@ main(int argc, char **argv)
        (void)argc; /* UNUSED */
 
        /* Get the current dir. */
-#ifdef PATH_MAX
+#if defined(PATH_MAX) && !defined(__GLIBC__)
        pwd = getcwd(NULL, PATH_MAX);/* Solaris getcwd needs the size. */
 #else
        pwd = getcwd(NULL, 0);