PERFORCE change 152875 for review
Anselm Strauss
strauss at FreeBSD.org
Wed Nov 12 08:50:01 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=152875
Change 152875 by strauss at strauss_hellboy on 2008/11/12 16:49:39
Integrated last changes from libarchive-portable, some merge fixes.
Affected files ...
.. //depot/projects/soc2008/strauss_libarchive/Makefile.am#12 edit
.. //depot/projects/soc2008/strauss_libarchive/NEWS#7 integrate
.. //depot/projects/soc2008/strauss_libarchive/README#9 integrate
.. //depot/projects/soc2008/strauss_libarchive/configure.ac#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/contrib/shar/Makefile#1 branch
.. //depot/projects/soc2008/strauss_libarchive/contrib/shar/shar.1#1 branch
.. //depot/projects/soc2008/strauss_libarchive/contrib/shar/shar.c#1 branch
.. //depot/projects/soc2008/strauss_libarchive/contrib/shar/tree.c#1 branch
.. //depot/projects/soc2008/strauss_libarchive/contrib/shar/tree.h#1 branch
.. //depot/projects/soc2008/strauss_libarchive/contrib/shar/tree_config.h#1 branch
.. //depot/projects/soc2008/strauss_libarchive/cpio/Makefile#7 branch
.. //depot/projects/soc2008/strauss_libarchive/cpio/cmdline.c#8 integrate
.. //depot/projects/soc2008/strauss_libarchive/cpio/config_freebsd.h#6 integrate
.. //depot/projects/soc2008/strauss_libarchive/cpio/cpio.c#9 integrate
.. //depot/projects/soc2008/strauss_libarchive/cpio/cpio.h#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/cpio/cpio_platform.h#6 integrate
.. //depot/projects/soc2008/strauss_libarchive/cpio/test/Makefile#6 branch
.. //depot/projects/soc2008/strauss_libarchive/libarchive/Makefile#7 branch
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive.h#8 edit
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_check_magic.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_endian.h#4 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_entry.c#8 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_entry.h#6 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_entry_copy_stat.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_entry_link_resolver.c#9 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_entry_private.h#6 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_entry_stat.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_platform.h#9 edit
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_private.h#4 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_read.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_read_private.h#3 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_read_support_compression_all.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_read_support_compression_bzip2.c#6 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_read_support_compression_compress.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_read_support_compression_gzip.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_read_support_compression_lzma.c#1 branch
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_read_support_compression_none.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_read_support_compression_program.c#7 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_read_support_format_ar.c#6 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_read_support_format_cpio.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_read_support_format_empty.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_read_support_format_iso9660.c#7 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_read_support_format_mtree.c#8 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_read_support_format_tar.c#8 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_read_support_format_zip.c#9 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_util.c#7 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_windows.h#2 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_write.3#4 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_write_disk.3#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_write_disk.c#9 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_write_set_format.c#6 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_write_set_format_by_name.c#8 edit
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_write_set_format_mtree.c#2 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_write_set_format_pax.c#8 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_write_set_format_shar.c#6 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/config_freebsd.h#6 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/config_windows.h#3 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/filter_fork.c#7 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/Makefile#7 branch
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/main.c#9 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/read_open_memory.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_acl_basic.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_acl_freebsd.c#1 branch
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_acl_pax.c#7 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_bad_fd.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_compat_gtar.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_compat_zip.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_empty_write.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_entry.c#7 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_compress_program.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_data_large.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_extract.c#6 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_ar.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_cpio_bin.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_cpio_bin_Z.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_cpio_bin_bz2.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_cpio_bin_gz.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_cpio_odc.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_cpio_svr4_gzip.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_cpio_svr4c_Z.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_empty.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_gtar_gz.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_gtar_lzma.c#1 branch
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_gtar_sparse.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_iso_gz.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_isorr_bz2.c#6 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_isorr_bz2.iso.bz2.uu#3 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_mtree.c#7 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_pax_bz2.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_tar.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_tar_empty_filename.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_tbz.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_tgz.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_tz.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_zip.c#7 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_format_zip.zip.uu#3 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_large.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_pax_truncated.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_position.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_read_truncated.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_tar_filenames.c#7 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_tar_large.c#8 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_write_compress.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_write_compress_program.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_write_disk.c#7 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_write_disk_hardlink.c#7 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_write_disk_perms.c#6 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_write_disk_secure.c#6 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_write_disk_times.c#1 branch
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_write_format_ar.c#7 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_write_format_cpio.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_write_format_cpio_empty.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_write_format_cpio_newc.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_write_format_cpio_odc.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_write_format_pax.c#1 branch
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_write_format_shar_empty.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_write_format_tar.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_write_format_tar_empty.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_write_open_memory.c#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/release.sh#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/tar/Makefile#7 branch
.. //depot/projects/soc2008/strauss_libarchive/tar/bsdtar.1#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/tar/bsdtar.c#9 integrate
.. //depot/projects/soc2008/strauss_libarchive/tar/bsdtar.h#5 integrate
.. //depot/projects/soc2008/strauss_libarchive/tar/bsdtar_platform.h#6 integrate
.. //depot/projects/soc2008/strauss_libarchive/tar/cmdline.c#1 branch
.. //depot/projects/soc2008/strauss_libarchive/tar/config_freebsd.h#6 integrate
.. //depot/projects/soc2008/strauss_libarchive/tar/test/Makefile#6 branch
.. //depot/projects/soc2008/strauss_libarchive/tar/test/main.c#8 integrate
.. //depot/projects/soc2008/strauss_libarchive/tar/test/test_symlink_dir.c#1 branch
.. //depot/projects/soc2008/strauss_libarchive/tar/write.c#9 integrate
.. //depot/projects/soc2008/strauss_libarchive/version#4 integrate
.. //depot/projects/soc2008/strauss_libarchive/windows/vc71/libarchive.sln#1 branch
.. //depot/projects/soc2008/strauss_libarchive/windows/vc71/libarchive.vcproj#1 branch
.. //depot/projects/soc2008/strauss_libarchive/windows/vc80/libarchive.sln#1 branch
.. //depot/projects/soc2008/strauss_libarchive/windows/vc80/libarchive.vcproj#1 branch
.. //depot/projects/soc2008/strauss_libarchive/windows/vc90/libarchive.sln#1 branch
.. //depot/projects/soc2008/strauss_libarchive/windows/vc90/libarchive.vcproj#1 branch
Differences ...
==== //depot/projects/soc2008/strauss_libarchive/Makefile.am#12 (text+ko) ====
@@ -98,6 +98,7 @@
libarchive/archive_read_support_compression_gzip.c \
libarchive/archive_read_support_compression_none.c \
libarchive/archive_read_support_compression_program.c \
+ libarchive/archive_read_support_compression_lzma.c \
libarchive/archive_read_support_format_all.c \
libarchive/archive_read_support_format_ar.c \
libarchive/archive_read_support_format_cpio.c \
@@ -177,6 +178,7 @@
libarchive/test/read_open_memory.c \
libarchive/test/test.h \
libarchive/test/test_acl_basic.c \
+ libarchive/test/test_acl_freebsd.c \
libarchive/test/test_acl_pax.c \
libarchive/test/test_archive_api_feature.c \
libarchive/test/test_bad_fd.c \
@@ -201,6 +203,7 @@
libarchive/test/test_read_format_cpio_svr4c_Z.c \
libarchive/test/test_read_format_empty.c \
libarchive/test/test_read_format_gtar_gz.c \
+ libarchive/test/test_read_format_gtar_lzma.c \
libarchive/test/test_read_format_gtar_sparse.c \
libarchive/test/test_read_format_iso_gz.c \
libarchive/test/test_read_format_isorr_bz2.c \
@@ -225,18 +228,20 @@
libarchive/test/test_write_disk_hardlink.c \
libarchive/test/test_write_disk_perms.c \
libarchive/test/test_write_disk_secure.c \
+ libarchive/test/test_write_disk_times.c \
libarchive/test/test_write_format_ar.c \
libarchive/test/test_write_format_cpio.c \
libarchive/test/test_write_format_cpio_empty.c \
libarchive/test/test_write_format_cpio_odc.c \
libarchive/test/test_write_format_cpio_newc.c \
+ libarchive/test/test_write_format_pax.c \
libarchive/test/test_write_format_shar_empty.c \
libarchive/test/test_write_format_tar.c \
libarchive/test/test_write_format_tar_empty.c \
libarchive/test/test_write_format_tar_ustar.c \
libarchive/test/test_write_format_zip_empty.c \
libarchive/test/test_write_format_zip_no_compression.c \
- libarchive/test/test_write_format_zip.c \
+ libarchive/test/test_write_format_zip.c \
libarchive/test/test_write_open_memory.c
libarchive_test_CPPFLAGS= -I$(top_builddir)/libarchive -I$(top_srcdir)/libarchive -I$(top_builddir)/libarchive/test
@@ -274,6 +279,7 @@
tar/bsdtar.c \
tar/bsdtar.h \
tar/bsdtar_platform.h \
+ tar/cmdline.c \
tar/getdate.y \
tar/matching.c \
tar/read.c \
@@ -323,6 +329,7 @@
tar/test/test_option_T.c \
tar/test/test_patterns.c \
tar/test/test_stdio.c \
+ tar/test/test_symlink_dir.c \
tar/test/test_version.c
bsdtar_test_CPPFLAGS= -I$(top_builddir)/tar/test
==== //depot/projects/soc2008/strauss_libarchive/NEWS#7 (text+ko) ====
@@ -1,3 +1,30 @@
+Nov 09, 2008: libarchive 2.5.902a released
+Nov 08, 2008: libarchive 2.5.901a released
+Nov 08, 2008: Start of pre-release testing for libarchive 2.6
+
+Nov 07, 2008: Read filter refactor: The decompression routines just
+ consume and produce arbitrarily-sized blocks. The reblocking
+ from read_support_compression_none() has been pulled into the
+ read core. Also, the decompression bid now makes multiple
+ passes and stacks read filters.
+Oct 21, 2008: bsdcpio: New command-line parser.
+Oct 19, 2008: Internal read_ahead change: short reads are now an error
+Oct 06, 2008: bsdtar: option parser no longer uses getopt_long(),
+ gives consistent option parsing on all platforms.
+Sep 19, 2008: Jaakko Heinonen: shar utility built on libarchive
+Sep 17, 2008: Pedro Giffuni: birthtime support
+Sep 17, 2008: Miklos Vajna: lzma reader and test. Note: I still have
+ some concerns about the auto-detection (LZMA file format
+ doesn't support auto-detection well), so this is not yet
+ enabled under archive_read_support_compression_all(). For
+ now, you must call archive_read_support_compression_lzma() if
+ you want LZMA read support.
+Sep 11, 2008: Ivailo Petrov: Many fixes to Windows build, new solution files
+Jul 26, 2008: archive_entry now tracks which values have not been set.
+ This helps zip extraction (file size is often "unknown") and
+ time restores (tar usually doesn't know atime).
+Jul 26, 2008: Joerg Sonnenberger: Performance improvements to shar writer
+Jul 25, 2008: Joerg Sonnenberger: mtree write support
Jul 02, 2008: libarchive 2.5.5 released
==== //depot/projects/soc2008/strauss_libarchive/README#9 (text+ko) ====
==== //depot/projects/soc2008/strauss_libarchive/configure.ac#5 (text+ko) ====
@@ -4,13 +4,13 @@
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],[2.5.5])
-m4_define([LIBARCHIVE_VERSION_N],[2005005])
+m4_define([LIBARCHIVE_VERSION_S],[2.5.902a])
+m4_define([LIBARCHIVE_VERSION_N],[2005902])
dnl bsdtar versioning tracks libarchive
m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S())
dnl bsdcpio is still versioning separately, as it's less mature.
-m4_define([BSDCPIO_VERSION_S],[1.0.0])
+m4_define([BSDCPIO_VERSION_S],[1.1.0])
#
# Now starts the "real" configure script.
@@ -164,7 +164,7 @@
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([bzlib.h errno.h ext2fs/ext2_fs.h fcntl.h grp.h])
AC_CHECK_HEADERS([inttypes.h langinfo.h limits.h linux/fs.h])
-AC_CHECK_HEADERS([locale.h paths.h poll.h pwd.h regex.h stdarg.h])
+AC_CHECK_HEADERS([locale.h lzmadec.h paths.h poll.h pwd.h regex.h stdarg.h])
AC_CHECK_HEADERS([stdint.h stdlib.h string.h sys/acl.h sys/ioctl.h])
AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/select.h sys/time.h sys/utime.h])
AC_CHECK_HEADERS([time.h unistd.h utime.h wchar.h zlib.h])
@@ -172,6 +172,7 @@
# Checks for libraries.
AC_CHECK_LIB(bz2,BZ2_bzDecompressInit)
AC_CHECK_LIB(z,inflate)
+AC_CHECK_LIB(lzmadec,lzmadec_decode)
# TODO: Give the user the option of using a pre-existing system
# libarchive. This will define HAVE_LIBARCHIVE which will cause
@@ -190,9 +191,18 @@
AC_TYPE_SIZE_T
AC_CHECK_TYPE(id_t, [unsigned long])
AC_CHECK_TYPE(uintptr_t, [unsigned int])
+
+# Check for birthtime in struct stat
+AC_CHECK_MEMBERS([struct stat.st_birthtime])
+
# Check for high-resolution timestamps in struct stat
+AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec])
AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec])
AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec])
+# Check for block size support in struct stat
+AC_CHECK_MEMBERS([struct stat.st_blksize])
+# Check for st_flags in struct stat (BSD fflags)
+AC_CHECK_MEMBERS([struct stat.st_flags])
# If you have uintmax_t, we assume printf supports %ju
# If you have unsigned long long, we assume printf supports %llu
@@ -206,7 +216,7 @@
AC_TYPE_UINT64_T
# TODO: If any of these are missing, define them right here.
-AC_CHECK_DECLS([SIZE_MAX, INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX])
+AC_CHECK_DECLS([SIZE_MAX, SSIZE_MAX, INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX])
AC_CHECK_DECL([EFTYPE],
[AC_DEFINE(HAVE_EFTYPE, 1, [A possible errno value for invalid file format errors])],
@@ -229,7 +239,7 @@
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([chflags chown chroot fchdir fchflags fchmod fchown fcntl fork])
-AC_CHECK_FUNCS([fstat ftruncate futimes geteuid getopt_long getpid])
+AC_CHECK_FUNCS([fstat ftruncate futimes geteuid getpid])
AC_CHECK_FUNCS([lchflags lchmod lchown])
AC_CHECK_FUNCS([lutimes memmove memset mkdir mkfifo mknod])
AC_CHECK_FUNCS([nl_langinfo pipe poll select setenv setlocale])
==== //depot/projects/soc2008/strauss_libarchive/cpio/cmdline.c#8 (ktext) ====
@@ -31,18 +31,6 @@
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
-#ifdef HAVE_GETOPT_LONG
-#include <getopt.h>
-#else
-struct option {
- const char *name;
- int has_arg;
- int *flag;
- int val;
-};
-#define no_argument 0
-#define required_argument 1
-#endif
#ifdef HAVE_GRP_H
#include <grp.h>
#endif
@@ -60,119 +48,215 @@
#include "cpio.h"
/*
- *
- * Option parsing routines for bsdcpio.
- *
+ * Short options for cpio. Please keep this sorted.
*/
-
+static const char *short_options = "0AaBC:F:O:cdE:f:H:hijLlmopR:rtuvW:yZz";
-static const char *cpio_opts = "0AaBC:F:O:cdE:f:H:hijLlmopR:rtuvW:yZz";
-
/*
- * On systems that lack getopt_long, long options can be specified
- * using -W longopt and -W longopt=value, e.g. "-W version" is the
- * same as "--version" and "-W format=ustar" is the same as "--format
- * ustar". This does not rely the GNU getopt() "W;" extension, so
- * should work correctly on any system with a POSIX-compliant
- * getopt().
+ * Long options for cpio. Please keep this sorted.
*/
-
-/*
- * If you add anything, be very careful to keep this list properly
- * sorted, as the -W logic below relies on it.
- */
-static const struct option cpio_longopts[] = {
- { "create", no_argument, NULL, 'o' },
- { "extract", no_argument, NULL, 'i' },
- { "file", required_argument, NULL, 'F' },
- { "format", required_argument, NULL, 'H' },
- { "help", no_argument, NULL, 'h' },
- { "insecure", no_argument, NULL, OPTION_INSECURE },
- { "link", no_argument, NULL, 'l' },
- { "list", no_argument, NULL, 't' },
- { "make-directories", no_argument, NULL, 'd' },
- { "no-preserve-owner", no_argument, NULL, OPTION_NO_PRESERVE_OWNER },
- { "null", no_argument, NULL, '0' },
- { "owner", required_argument, NULL, 'R' },
- { "pass-through", no_argument, NULL, 'p' },
- { "preserve-modification-time", no_argument, NULL, 'm' },
- { "quiet", no_argument, NULL, OPTION_QUIET },
- { "unconditional", no_argument, NULL, 'u' },
- { "verbose", no_argument, NULL, 'v' },
- { "version", no_argument, NULL, OPTION_VERSION },
- { NULL, 0, NULL, 0 }
+static const struct option {
+ const char *name;
+ int required; /* 1 if this option requires an argument */
+ int equivalent; /* Equivalent short option. */
+} cpio_longopts[] = {
+ { "create", 0, 'o' },
+ { "extract", 0, 'i' },
+ { "file", 1, 'F' },
+ { "format", 1, 'H' },
+ { "help", 0, 'h' },
+ { "insecure", 0, OPTION_INSECURE },
+ { "link", 0, 'l' },
+ { "list", 0, 't' },
+ { "make-directories", 0, 'd' },
+ { "no-preserve-owner", 0, OPTION_NO_PRESERVE_OWNER },
+ { "null", 0, '0' },
+ { "owner", 1, 'R' },
+ { "pass-through", 0, 'p' },
+ { "preserve-modification-time", 0, 'm' },
+ { "quiet", 0, OPTION_QUIET },
+ { "unconditional", 0, 'u' },
+ { "verbose", 0, 'v' },
+ { "version", 0, OPTION_VERSION },
+ { NULL, 0, 0 }
};
/*
- * Parse command-line options using system-provided getopt() or getopt_long().
- * If option is -W, then parse argument as a long option.
+ * I used to try to select platform-provided getopt() or
+ * getopt_long(), but that caused a lot of headaches. In particular,
+ * I couldn't consistently use long options in the test harness
+ * because not all platforms have getopt_long(). That in turn led to
+ * overuse of the -W hack in the test harness, which made it rough to
+ * run the test harness against GNU cpio. (I periodically run the
+ * test harness here against GNU cpio as a sanity-check. Yes,
+ * I've found a couple of bugs in GNU cpio that way.)
*/
int
cpio_getopt(struct cpio *cpio)
{
- char *p, *q;
- const struct option *option, *option2;
- int opt;
- int option_index;
- size_t option_length;
+ enum { state_start = 0, state_next_word, state_short, state_long };
+ static int state = state_start;
+ static char *opt_word;
+
+ const struct option *popt, *match = NULL, *match2 = NULL;
+ const char *p, *long_prefix = "--";
+ size_t optlength;
+ int opt = '?';
+ int required = 0;
- option_index = -1;
+ cpio->optarg = NULL;
-#ifdef HAVE_GETOPT_LONG
- opt = getopt_long(cpio->argc, cpio->argv, cpio_opts,
- cpio_longopts, &option_index);
-#else
- opt = getopt(cpio->argc, cpio->argv, cpio_opts);
-#endif
+ /* First time through, initialize everything. */
+ if (state == state_start) {
+ /* Skip program name. */
+ ++cpio->argv;
+ --cpio->argc;
+ state = state_next_word;
+ }
- /* Support long options through -W longopt=value */
- if (opt == 'W') {
- p = optarg;
- q = strchr(optarg, '=');
- if (q != NULL) {
- option_length = (size_t)(q - p);
- optarg = q + 1;
+ /*
+ * We're ready to look at the next word in argv.
+ */
+ if (state == state_next_word) {
+ /* No more arguments, so no more options. */
+ if (cpio->argv[0] == NULL)
+ return (-1);
+ /* Doesn't start with '-', so no more options. */
+ if (cpio->argv[0][0] != '-')
+ return (-1);
+ /* "--" marks end of options; consume it and return. */
+ if (strcmp(cpio->argv[0], "--") == 0) {
+ ++cpio->argv;
+ --cpio->argc;
+ return (-1);
+ }
+ /* Get next word for parsing. */
+ opt_word = *cpio->argv++;
+ --cpio->argc;
+ if (opt_word[1] == '-') {
+ /* Set up long option parser. */
+ state = state_long;
+ opt_word += 2; /* Skip leading '--' */
} else {
- option_length = strlen(p);
- optarg = NULL;
+ /* Set up short option parser. */
+ state = state_short;
+ ++opt_word; /* Skip leading '-' */
}
- option = cpio_longopts;
- while (option->name != NULL &&
- (strlen(option->name) < option_length ||
- strncmp(p, option->name, option_length) != 0 )) {
- option++;
+ }
+
+ /*
+ * We're parsing a group of POSIX-style single-character options.
+ */
+ if (state == state_short) {
+ /* Peel next option off of a group of short options. */
+ opt = *opt_word++;
+ if (opt == '\0') {
+ /* End of this group; recurse to get next option. */
+ state = state_next_word;
+ return cpio_getopt(cpio);
}
- if (option->name != NULL) {
- option2 = option;
- opt = option->val;
+ /* Does this option take an argument? */
+ p = strchr(short_options, opt);
+ if (p == NULL)
+ return ('?');
+ if (p[1] == ':')
+ required = 1;
- /* If the first match was exact, we're done. */
- if (strncmp(p, option->name, strlen(option->name)) == 0) {
- while (option->name != NULL)
- option++;
+ /* If it takes an argument, parse that. */
+ if (required) {
+ /* If arg is run-in, opt_word already points to it. */
+ if (opt_word[0] == '\0') {
+ /* Otherwise, pick up the next word. */
+ opt_word = *cpio->argv;
+ if (opt_word == NULL) {
+ cpio_warnc(0,
+ "Option -%c requires an argument",
+ opt);
+ return ('?');
+ }
+ ++cpio->argv;
+ --cpio->argc;
+ }
+ if (opt == 'W') {
+ state = state_long;
+ long_prefix = "-W "; /* For clearer errors. */
} else {
- /* Check if there's another match. */
- option++;
- while (option->name != NULL &&
- (strlen(option->name) < option_length ||
- strncmp(p, option->name, option_length) != 0)) {
- option++;
+ state = state_next_word;
+ cpio->optarg = opt_word;
+ }
+ }
+ }
+
+ /* We're reading a long option, including -W long=arg convention. */
+ if (state == state_long) {
+ /* After this long option, we'll be starting a new word. */
+ state = state_next_word;
+
+ /* Option name ends at '=' if there is one. */
+ p = strchr(opt_word, '=');
+ if (p != NULL) {
+ optlength = (size_t)(p - opt_word);
+ cpio->optarg = (char *)(uintptr_t)(p + 1);
+ } else {
+ optlength = strlen(opt_word);
+ }
+
+ /* Search the table for an unambiguous match. */
+ for (popt = cpio_longopts; popt->name != NULL; popt++) {
+ /* Short-circuit if first chars don't match. */
+ if (popt->name[0] != opt_word[0])
+ continue;
+ /* If option is a prefix of name in table, record it.*/
+ if (strncmp(opt_word, popt->name, optlength) == 0) {
+ match2 = match; /* Record up to two matches. */
+ match = popt;
+ /* If it's an exact match, we're done. */
+ if (strlen(popt->name) == optlength) {
+ match2 = NULL; /* Forget the others. */
+ break;
}
}
- if (option->name != NULL)
- cpio_errc(1, 0,
- "Ambiguous option %s "
- "(matches both %s and %s)",
- p, option2->name, option->name);
+ }
+
+ /* Fail if there wasn't a unique match. */
+ if (match == NULL) {
+ cpio_warnc(0,
+ "Option %s%s is not supported",
+ long_prefix, opt_word);
+ return ('?');
+ }
+ if (match2 != NULL) {
+ cpio_warnc(0,
+ "Ambiguous option %s%s (matches --%s and --%s)",
+ long_prefix, opt_word, match->name, match2->name);
+ return ('?');
+ }
- if (option2->has_arg == required_argument
- && optarg == NULL)
- cpio_errc(1, 0,
- "Option \"%s\" requires argument", p);
+ /* We've found a unique match; does it need an argument? */
+ if (match->required) {
+ /* Argument required: get next word if necessary. */
+ if (cpio->optarg == NULL) {
+ cpio->optarg = *cpio->argv;
+ if (cpio->optarg == NULL) {
+ cpio_warnc(0,
+ "Option %s%s requires an argument",
+ long_prefix, match->name);
+ return ('?');
+ }
+ ++cpio->argv;
+ --cpio->argc;
+ }
} else {
- opt = '?';
+ /* Argument forbidden: fail if there is one. */
+ if (cpio->optarg != NULL) {
+ cpio_warnc(0,
+ "Option %s%s does not allow an argument",
+ long_prefix, match->name);
+ return ('?');
+ }
}
+ return (match->equivalent);
}
return (opt);
==== //depot/projects/soc2008/strauss_libarchive/cpio/config_freebsd.h#6 (ktext) ====
@@ -52,7 +52,6 @@
#define HAVE_FNM_LEADING_DIR 1
#define HAVE_FTRUNCATE 1
#define HAVE_FUTIMES 1
-#define HAVE_GETOPT_LONG 1
#undef HAVE_GETXATTR
#define HAVE_GRP_H 1
#define HAVE_INTTYPES_H 1
==== //depot/projects/soc2008/strauss_libarchive/cpio/cpio.c#9 (ktext) ====
@@ -26,7 +26,7 @@
#include "cpio_platform.h"
-__FBSDID("$FreeBSD: src/usr.bin/cpio/cpio.c,v 1.12 2008/08/24 06:21:00 kientzle Exp $");
+__FBSDID("$FreeBSD: src/usr.bin/cpio/cpio.c,v 1.13 2008/09/04 05:20:46 kientzle Exp $");
#include <sys/types.h>
#include <archive.h>
@@ -134,9 +134,9 @@
cpio->bytes_per_block = 5120;
break;
case 'C': /* NetBSD/OpenBSD */
- cpio->bytes_per_block = atoi(optarg);
+ cpio->bytes_per_block = atoi(cpio->optarg);
if (cpio->bytes_per_block <= 0)
- cpio_errc(1, 0, "Invalid blocksize %s", optarg);
+ cpio_errc(1, 0, "Invalid blocksize %s", cpio->optarg);
break;
case 'c': /* POSIX 1997 */
cpio->format = "odc";
@@ -145,22 +145,22 @@
cpio->extract_flags &= ~ARCHIVE_EXTRACT_NO_AUTODIR;
break;
case 'E': /* NetBSD/OpenBSD */
- include_from_file(cpio, optarg);
+ include_from_file(cpio, cpio->optarg);
break;
case 'F': /* NetBSD/OpenBSD/GNU cpio */
- cpio->filename = optarg;
+ cpio->filename = cpio->optarg;
break;
case 'f': /* POSIX 1997 */
- exclude(cpio, optarg);
+ exclude(cpio, cpio->optarg);
break;
case 'H': /* GNU cpio (also --format) */
- cpio->format = optarg;
+ cpio->format = cpio->optarg;
break;
case 'h':
long_help();
break;
case 'I': /* NetBSD/OpenBSD */
- cpio->filename = optarg;
+ cpio->filename = cpio->optarg;
break;
case 'i': /* POSIX 1997 */
cpio->mode = opt;
@@ -182,7 +182,7 @@
cpio->extract_flags &= ~ARCHIVE_EXTRACT_OWNER;
break;
case 'O': /* GNU cpio */
- cpio->filename = optarg;
+ cpio->filename = cpio->optarg;
break;
case 'o': /* POSIX 1997 */
cpio->mode = opt;
@@ -195,7 +195,7 @@
cpio->quiet = 1;
break;
case 'R': /* GNU cpio, also --owner */
- if (owner_parse(optarg, &uid, &gid))
+ if (owner_parse(cpio->optarg, &uid, &gid))
usage();
if (uid != -1)
cpio->uid_override = uid;
@@ -242,9 +242,6 @@
/* TODO: Sanity-check args, error out on nonsensical combinations. */
- cpio->argc -= optind;
- cpio->argv += optind;
-
switch (cpio->mode) {
case 'o':
mode_out(cpio);
@@ -285,11 +282,7 @@
fprintf(stderr, " List: %s -it < archive\n", p);
fprintf(stderr, " Extract: %s -i < archive\n", p);
fprintf(stderr, " Create: %s -o < filenames > archive\n", p);
-#ifdef HAVE_GETOPT_LONG
fprintf(stderr, " Help: %s --help\n", p);
-#else
- fprintf(stderr, " Help: %s -h\n", p);
-#endif
exit(1);
}
@@ -863,7 +856,6 @@
r = archive_write_close(cpio->archive);
if (r != ARCHIVE_OK)
cpio_errc(1, 0, archive_error_string(cpio->archive));
- archive_write_finish(cpio->archive);
if (!cpio->quiet) {
blocks = (archive_position_uncompressed(cpio->archive) + 511)
@@ -872,6 +864,7 @@
blocks == 1 ? "block" : "blocks");
}
+ archive_write_finish(cpio->archive);
}
/*
==== //depot/projects/soc2008/strauss_libarchive/cpio/cpio.h#5 (text+ko) ====
@@ -42,8 +42,11 @@
* functions.
*/
struct cpio {
+ /* Option parsing */
+ const char *optarg;
+
/* Options */
- char *filename;
+ const char *filename;
char mode; /* -i -o -p */
char compress; /* -j, -y, or -z */
const char *format; /* -H format */
@@ -85,7 +88,7 @@
/* Name of this program; used in error reporting, initialized in main(). */
const char *cpio_progname;
-void cpio_errc(int _eval, int _code, const char *fmt, ...) __dead2;
+void cpio_errc(int _eval, int _code, const char *fmt, ...) __LA_DEAD;
void cpio_warnc(int _code, const char *fmt, ...);
int owner_parse(const char *, int *, int *);
==== //depot/projects/soc2008/strauss_libarchive/cpio/cpio_platform.h#6 (ktext) ====
@@ -81,4 +81,12 @@
#endif
#endif
+/* How to mark functions that don't return. */
+#if defined(__GNUC__) && (__GNUC__ > 2 || \
+ (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
+#define __LA_DEAD __attribute__((__noreturn__))
+#else
+#define __LA_DEAD
+#endif
+
#endif /* !CPIO_PLATFORM_H_INCLUDED */
==== //depot/projects/soc2008/strauss_libarchive/libarchive/archive.h#8 (ktext) ====
@@ -46,11 +46,13 @@
/* Get appropriate definitions of standard POSIX-style types. */
/* These should match the types used in 'struct stat' */
#ifdef _WIN32
+#define __LA_INT64_T __int64
#define __LA_SSIZE_T long
#define __LA_UID_T unsigned int
#define __LA_GID_T unsigned int
#else
#include <unistd.h> /* ssize_t, uid_t, and gid_t */
+#define __LA_INT64_T int64_t
#define __LA_SSIZE_T ssize_t
#define __LA_UID_T uid_t
#define __LA_GID_T gid_t
@@ -80,7 +82,6 @@
# define __LA_DECL
#endif
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -112,13 +113,13 @@
* (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000)
* #endif
*/
-#define ARCHIVE_VERSION_NUMBER 2005005
+#define ARCHIVE_VERSION_NUMBER 2005902
__LA_DECL int archive_version_number(void);
/*
* Textual name/version of the library, useful for version displays.
*/
-#define ARCHIVE_VERSION_STRING "libarchive 2.5.5"
+#define ARCHIVE_VERSION_STRING "libarchive 2.5.902a"
__LA_DECL const char * archive_version_string(void);
#if ARCHIVE_VERSION_NUMBER < 3000000
@@ -183,20 +184,37 @@
*/
/* Returns pointer and size of next block of data from archive. */
-typedef __LA_SSIZE_T archive_read_callback(struct archive *, void *_client_data,
- const void **_buffer);
+typedef __LA_SSIZE_T archive_read_callback(struct archive *,
+ void *_client_data, const void **_buffer);
+
/* Skips at most request bytes from archive and returns the skipped amount */
#if ARCHIVE_VERSION_NUMBER < 2000000
-typedef __LA_SSIZE_T archive_skip_callback(struct archive *, void *_client_data,
- size_t request);
+/* Libarchive 1.0 used ssize_t for the return, which is only 32 bits
+ * on most 32-bit platforms; not large enough. */
+typedef __LA_SSIZE_T archive_skip_callback(struct archive *,
+ void *_client_data, size_t request);
+#elif ARCHIVE_VERSION_NUMBER < 3000000
+/* Libarchive 2.0 used off_t here, but that is a bad idea on Linux and a
+ * few other platforms where off_t varies with build settings. */
+typedef off_t archive_skip_callback(struct archive *,
+ void *_client_data, off_t request);
#else
-typedef off_t archive_skip_callback(struct archive *, void *_client_data,
- off_t request);
+/* Libarchive 3.0 uses int64_t here, which is actually guaranteed to be
+ * 64 bits on every platform. */
+typedef __LA_INT64_T archive_skip_callback(struct archive *,
+ void *_client_data, __LA_INT64_T request);
#endif
+
/* Returns size actually written, zero on EOF, -1 on error. */
-typedef __LA_SSIZE_T archive_write_callback(struct archive *, void *_client_data,
- const void *_buffer, size_t _length);
+typedef __LA_SSIZE_T archive_write_callback(struct archive *,
+ void *_client_data,
+ const void *_buffer, size_t _length);
+
+#if ARCHIVE_VERSION_NUMBER < 3000000
+/* Open callback is actually never needed; remove it in libarchive 3.0. */
typedef int archive_open_callback(struct archive *, void *_client_data);
+#endif
+
typedef int archive_close_callback(struct archive *, void *_client_data);
/*
@@ -207,6 +225,7 @@
#define ARCHIVE_COMPRESSION_BZIP2 2
#define ARCHIVE_COMPRESSION_COMPRESS 3
#define ARCHIVE_COMPRESSION_PROGRAM 4
+#define ARCHIVE_COMPRESSION_LZMA 5
/*
* Codes returned by archive_format.
@@ -273,6 +292,7 @@
__LA_DECL int archive_read_support_compression_bzip2(struct archive *);
__LA_DECL int archive_read_support_compression_compress(struct archive *);
__LA_DECL int archive_read_support_compression_gzip(struct archive *);
+__LA_DECL int archive_read_support_compression_lzma(struct archive *);
__LA_DECL int archive_read_support_compression_none(struct archive *);
__LA_DECL int archive_read_support_compression_program(struct archive *,
const char *command);
@@ -328,18 +348,26 @@
* Retrieve the byte offset in UNCOMPRESSED data where last-read
* header started.
*/
-__LA_DECL int64_t archive_read_header_position(struct archive *);
+__LA_DECL __LA_INT64_T archive_read_header_position(struct archive *);
/* Read data from the body of an entry. Similar to read(2). */
-__LA_DECL __LA_SSIZE_T archive_read_data(struct archive *, void *, size_t);
+__LA_DECL __LA_SSIZE_T archive_read_data(struct archive *,
+ void *, size_t);
+
/*
* A zero-copy version of archive_read_data that also exposes the file offset
* of each returned block. Note that the client has no way to specify
* the desired size of the block. The API does guarantee that offsets will
* be strictly increasing and that returned blocks will not overlap.
*/
+#if ARCHIVE_VERSION_NUMBER < 3000000
__LA_DECL int archive_read_data_block(struct archive *a,
- const void **buff, size_t *size, off_t *offset);
+ const void **buff, size_t *size, off_t *offset);
+#else
+__LA_DECL int archive_read_data_block(struct archive *a,
+ const void **buff, size_t *size,
+ __LA_INT64_T *offset);
+#endif
/*-
* Some convenience functions that are built on archive_read_data:
@@ -348,8 +376,8 @@
* 'into_fd': writes data to specified filedes
*/
__LA_DECL int archive_read_data_skip(struct archive *);
-__LA_DECL int archive_read_data_into_buffer(struct archive *, void *buffer,
- __LA_SSIZE_T len);
+__LA_DECL int archive_read_data_into_buffer(struct archive *,
+ void *buffer, __LA_SSIZE_T len);
__LA_DECL int archive_read_data_into_fd(struct archive *, int fd);
/*-
@@ -412,12 +440,11 @@
__LA_DECL int archive_read_close(struct archive *);
/* Release all resources and destroy the object. */
/* Note that archive_read_finish will call archive_read_close for you. */
-#if ARCHIVE_VERSION_NUMBER >= 2000000
-__LA_DECL int archive_read_finish(struct archive *);
-#else
-/* Temporarily allow library to compile with either 1.x or 2.0 API. */
+#if ARCHIVE_VERSION_NUMBER < 2000000
/* Erroneously declared to return void in libarchive 1.x */
__LA_DECL void archive_read_finish(struct archive *);
+#else
+__LA_DECL int archive_read_finish(struct archive *);
#endif
/*-
@@ -470,7 +497,6 @@
__LA_DECL int archive_write_set_format_shar(struct archive *);
__LA_DECL int archive_write_set_format_shar_dump(struct archive *);
__LA_DECL int archive_write_set_format_ustar(struct archive *);
-__LA_DECL int archive_write_set_format_zip(struct archive *);
__LA_DECL int archive_write_open(struct archive *, void *,
archive_open_callback *, archive_write_callback *,
archive_close_callback *);
@@ -483,6 +509,7 @@
* will be updated after each write into the buffer. */
__LA_DECL int archive_write_open_memory(struct archive *,
void *_buffer, size_t _buffSize, size_t *_used);
+__LA_DECL int archive_write_set_format_zip(struct archive *);
/*
* Note that the library will truncate writes beyond the size provided
@@ -490,22 +517,36 @@
*/
__LA_DECL int archive_write_header(struct archive *,
struct archive_entry *);
-#if ARCHIVE_VERSION_NUMBER >= 2000000
-__LA_DECL __LA_SSIZE_T archive_write_data(struct archive *, const void *, size_t);
+#if ARCHIVE_VERSION_NUMBER < 2000000
+/* This was erroneously declared to return "int" in libarchive 1.x. */
+__LA_DECL int archive_write_data(struct archive *,
+ const void *, size_t);
+#else
+/* Libarchive 2.0 and later return ssize_t here. */
+__LA_DECL __LA_SSIZE_T archive_write_data(struct archive *,
+ const void *, size_t);
+#endif
+
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list