Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Jul 2012 06:38:44 +0000 (UTC)
From:      Martin Matuska <mm@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r238856 - in head: contrib/libarchive contrib/libarchive/cpio contrib/libarchive/cpio/test contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/libarchive...
Message-ID:  <201207280638.q6S6ciQj093496@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mm
Date: Sat Jul 28 06:38:44 2012
New Revision: 238856
URL: http://svn.freebsd.org/changeset/base/238856

Log:
  Update libarchive to 3.0.4

Added:
  head/contrib/libarchive/libarchive/archive_getdate.c
     - copied unchanged from r238825, vendor/libarchive/dist/libarchive/archive_getdate.c
  head/contrib/libarchive/libarchive/archive_match.c
     - copied unchanged from r238825, vendor/libarchive/dist/libarchive/archive_match.c
  head/contrib/libarchive/libarchive/archive_pathmatch.c
     - copied unchanged from r238825, vendor/libarchive/dist/libarchive/archive_pathmatch.c
  head/contrib/libarchive/libarchive/archive_pathmatch.h
     - copied unchanged from r238825, vendor/libarchive/dist/libarchive/archive_pathmatch.h
  head/contrib/libarchive/libarchive/archive_write_add_filter.c
     - copied unchanged from r238825, vendor/libarchive/dist/libarchive/archive_write_add_filter.c
  head/contrib/libarchive/libarchive/test/test_archive_getdate.c
     - copied unchanged from r238825, vendor/libarchive/dist/libarchive/test/test_archive_getdate.c
  head/contrib/libarchive/libarchive/test/test_archive_match_owner.c
     - copied unchanged from r238825, vendor/libarchive/dist/libarchive/test/test_archive_match_owner.c
  head/contrib/libarchive/libarchive/test/test_archive_match_path.c
     - copied unchanged from r238825, vendor/libarchive/dist/libarchive/test/test_archive_match_path.c
  head/contrib/libarchive/libarchive/test/test_archive_match_time.c
     - copied unchanged from r238825, vendor/libarchive/dist/libarchive/test/test_archive_match_time.c
  head/contrib/libarchive/libarchive/test/test_archive_pathmatch.c
     - copied unchanged from r238825, vendor/libarchive/dist/libarchive/test/test_archive_pathmatch.c
  head/contrib/libarchive/tar/test/test_format_newc.c
     - copied unchanged from r238825, vendor/libarchive/dist/tar/test/test_format_newc.c
  head/contrib/libarchive/tar/test/test_option_nodump.c
     - copied unchanged from r238825, vendor/libarchive/dist/tar/test/test_option_nodump.c
Deleted:
  head/contrib/libarchive/cpio/test/test_pathmatch.c
  head/contrib/libarchive/libarchive_fe/matching.c
  head/contrib/libarchive/libarchive_fe/matching.h
  head/contrib/libarchive/libarchive_fe/pathmatch.c
  head/contrib/libarchive/libarchive_fe/pathmatch.h
  head/contrib/libarchive/tar/getdate.c
  head/contrib/libarchive/tar/test/test_getdate.c
  head/contrib/libarchive/tar/tree.c
  head/contrib/libarchive/tar/tree.h
Modified:
  head/contrib/libarchive/NEWS
  head/contrib/libarchive/README
  head/contrib/libarchive/cpio/bsdcpio.1
  head/contrib/libarchive/cpio/cmdline.c
  head/contrib/libarchive/cpio/cpio.c
  head/contrib/libarchive/cpio/cpio.h
  head/contrib/libarchive/cpio/test/main.c
  head/contrib/libarchive/cpio/test/test.h
  head/contrib/libarchive/libarchive/archive.h
  head/contrib/libarchive/libarchive/archive_acl.c
  head/contrib/libarchive/libarchive/archive_check_magic.c
  head/contrib/libarchive/libarchive/archive_endian.h
  head/contrib/libarchive/libarchive/archive_entry.3
  head/contrib/libarchive/libarchive/archive_entry.c
  head/contrib/libarchive/libarchive/archive_entry.h
  head/contrib/libarchive/libarchive/archive_entry_acl.3
  head/contrib/libarchive/libarchive/archive_entry_link_resolver.c
  head/contrib/libarchive/libarchive/archive_entry_linkify.3
  head/contrib/libarchive/libarchive/archive_entry_paths.3
  head/contrib/libarchive/libarchive/archive_entry_perms.3
  head/contrib/libarchive/libarchive/archive_entry_stat.3
  head/contrib/libarchive/libarchive/archive_entry_stat.c
  head/contrib/libarchive/libarchive/archive_entry_time.3
  head/contrib/libarchive/libarchive/archive_ppmd7.c
  head/contrib/libarchive/libarchive/archive_private.h
  head/contrib/libarchive/libarchive/archive_read.3
  head/contrib/libarchive/libarchive/archive_read.c
  head/contrib/libarchive/libarchive/archive_read_data.3
  head/contrib/libarchive/libarchive/archive_read_disk.3
  head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c
  head/contrib/libarchive/libarchive/archive_read_disk_posix.c
  head/contrib/libarchive/libarchive/archive_read_disk_private.h
  head/contrib/libarchive/libarchive/archive_read_extract.3
  head/contrib/libarchive/libarchive/archive_read_filter.3
  head/contrib/libarchive/libarchive/archive_read_format.3
  head/contrib/libarchive/libarchive/archive_read_free.3
  head/contrib/libarchive/libarchive/archive_read_header.3
  head/contrib/libarchive/libarchive/archive_read_new.3
  head/contrib/libarchive/libarchive/archive_read_open.3
  head/contrib/libarchive/libarchive/archive_read_open_fd.c
  head/contrib/libarchive/libarchive/archive_read_open_filename.c
  head/contrib/libarchive/libarchive/archive_read_private.h
  head/contrib/libarchive/libarchive/archive_read_set_options.3
  head/contrib/libarchive/libarchive/archive_read_support_filter_rpm.c
  head/contrib/libarchive/libarchive/archive_read_support_format_7zip.c
  head/contrib/libarchive/libarchive/archive_read_support_format_cab.c
  head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c
  head/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c
  head/contrib/libarchive/libarchive/archive_read_support_format_lha.c
  head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c
  head/contrib/libarchive/libarchive/archive_read_support_format_rar.c
  head/contrib/libarchive/libarchive/archive_read_support_format_tar.c
  head/contrib/libarchive/libarchive/archive_read_support_format_xar.c
  head/contrib/libarchive/libarchive/archive_read_support_format_zip.c
  head/contrib/libarchive/libarchive/archive_string.c
  head/contrib/libarchive/libarchive/archive_string.h
  head/contrib/libarchive/libarchive/archive_string_composition.h
  head/contrib/libarchive/libarchive/archive_string_sprintf.c
  head/contrib/libarchive/libarchive/archive_util.3
  head/contrib/libarchive/libarchive/archive_util.c
  head/contrib/libarchive/libarchive/archive_write.3
  head/contrib/libarchive/libarchive/archive_write.c
  head/contrib/libarchive/libarchive/archive_write_add_filter_bzip2.c
  head/contrib/libarchive/libarchive/archive_write_add_filter_compress.c
  head/contrib/libarchive/libarchive/archive_write_add_filter_gzip.c
  head/contrib/libarchive/libarchive/archive_write_add_filter_program.c
  head/contrib/libarchive/libarchive/archive_write_add_filter_xz.c
  head/contrib/libarchive/libarchive/archive_write_blocksize.3
  head/contrib/libarchive/libarchive/archive_write_data.3
  head/contrib/libarchive/libarchive/archive_write_disk.3
  head/contrib/libarchive/libarchive/archive_write_disk_posix.c
  head/contrib/libarchive/libarchive/archive_write_disk_set_standard_lookup.c
  head/contrib/libarchive/libarchive/archive_write_filter.3
  head/contrib/libarchive/libarchive/archive_write_finish_entry.3
  head/contrib/libarchive/libarchive/archive_write_format.3
  head/contrib/libarchive/libarchive/archive_write_free.3
  head/contrib/libarchive/libarchive/archive_write_header.3
  head/contrib/libarchive/libarchive/archive_write_new.3
  head/contrib/libarchive/libarchive/archive_write_open.3
  head/contrib/libarchive/libarchive/archive_write_open_filename.c
  head/contrib/libarchive/libarchive/archive_write_private.h
  head/contrib/libarchive/libarchive/archive_write_set_format_7zip.c
  head/contrib/libarchive/libarchive/archive_write_set_format_ar.c
  head/contrib/libarchive/libarchive/archive_write_set_format_cpio.c
  head/contrib/libarchive/libarchive/archive_write_set_format_cpio_newc.c
  head/contrib/libarchive/libarchive/archive_write_set_format_gnutar.c
  head/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c
  head/contrib/libarchive/libarchive/archive_write_set_format_mtree.c
  head/contrib/libarchive/libarchive/archive_write_set_format_pax.c
  head/contrib/libarchive/libarchive/archive_write_set_format_ustar.c
  head/contrib/libarchive/libarchive/archive_write_set_format_xar.c
  head/contrib/libarchive/libarchive/archive_write_set_format_zip.c
  head/contrib/libarchive/libarchive/archive_write_set_options.3
  head/contrib/libarchive/libarchive/cpio.5
  head/contrib/libarchive/libarchive/libarchive-formats.5
  head/contrib/libarchive/libarchive/libarchive.3
  head/contrib/libarchive/libarchive/libarchive_changes.3
  head/contrib/libarchive/libarchive/libarchive_internals.3
  head/contrib/libarchive/libarchive/tar.5
  head/contrib/libarchive/libarchive/test/main.c
  head/contrib/libarchive/libarchive/test/read_open_memory.c
  head/contrib/libarchive/libarchive/test/test.h
  head/contrib/libarchive/libarchive/test/test_archive_string_conversion.c
  head/contrib/libarchive/libarchive/test/test_compat_zip.c
  head/contrib/libarchive/libarchive/test/test_read_disk_directory_traversals.c
  head/contrib/libarchive/libarchive/test/test_read_format_7zip.c
  head/contrib/libarchive/libarchive/test/test_read_format_cab.c
  head/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c
  head/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c
  head/contrib/libarchive/libarchive/test/test_read_format_rar.c
  head/contrib/libarchive/libarchive/test/test_read_format_rar_unicode.rar.uu
  head/contrib/libarchive/libarchive/test/test_read_format_tar_filename.c
  head/contrib/libarchive/libarchive/test/test_read_pax_truncated.c
  head/contrib/libarchive/libarchive/test/test_read_position.c
  head/contrib/libarchive/libarchive/test/test_sparse_basic.c
  head/contrib/libarchive/libarchive/test/test_write_format_zip.c
  head/contrib/libarchive/libarchive_fe/err.c
  head/contrib/libarchive/libarchive_fe/err.h
  head/contrib/libarchive/tar/bsdtar.1
  head/contrib/libarchive/tar/bsdtar.c
  head/contrib/libarchive/tar/bsdtar.h
  head/contrib/libarchive/tar/read.c
  head/contrib/libarchive/tar/test/main.c
  head/contrib/libarchive/tar/test/test.h
  head/contrib/libarchive/tar/write.c
  head/lib/libarchive/Makefile
  head/lib/libarchive/test/Makefile
  head/usr.bin/cpio/Makefile
  head/usr.bin/cpio/test/Makefile
  head/usr.bin/tar/Makefile
  head/usr.bin/tar/test/Makefile
Directory Properties:
  head/contrib/libarchive/   (props changed)
  head/contrib/libarchive/cpio/   (props changed)
  head/contrib/libarchive/libarchive/   (props changed)
  head/contrib/libarchive/libarchive_fe/   (props changed)
  head/contrib/libarchive/tar/   (props changed)

Modified: head/contrib/libarchive/NEWS
==============================================================================
--- head/contrib/libarchive/NEWS	Sat Jul 28 04:42:05 2012	(r238855)
+++ head/contrib/libarchive/NEWS	Sat Jul 28 06:38:44 2012	(r238856)
@@ -1,14 +1,10 @@
-Jan 10, 2012: Issue 223: Skip atime tests if atime not supported
-Jan 09, 2012: Issue 222: Errors saving sparse files to pax archives
-Jan 09, 2012: Issue 221: allow archive_*_free(NULL)
-Dec 31, 2011: Issue 212: configure script on Solaris
-Dec 30, 2011: Issue 218: empty contents extracting Zip files with bsdcpio
-Dec 30, 2011: Issue 217: fix compile warning
-Dec 30, 2011: Issue 216: truncated filenames in listings
-Dec 28, 2011: Issue 210: memory leak on Windows
-Dec 28, 2011: Issue 206: fix hardlink tests on Windows 2000
-Dec 27, 2011: Issue 208: Don't hang when using external compression
-   program on Windows
+Mar 27, 2012: libarchive 3.0.4 released
+
+Feb 05, 2012: libarchive development now hosted at GitHub.
+    http://libarchive.github.com/
+Feb 05, 2012: libarchive's issue tracker remains at Google Code.
+    http://code.google.com/p/libarchive/issues/list
+Feb 05, 2012: libarchive's mailing lists remain at Google Groups.
 
 Dec 24, 2011: libarchive 3.0.2 released
 Dec 23, 2011: Various fixes merged from FreeBSD

Modified: head/contrib/libarchive/README
==============================================================================
--- head/contrib/libarchive/README	Sat Jul 28 04:42:05 2012	(r238855)
+++ head/contrib/libarchive/README	Sat Jul 28 06:38:44 2012	(r238856)
@@ -1,9 +1,14 @@
 README for libarchive bundle.
 
 Questions?  Issues?
-   * http://libarchive.googlecode.com/ is the home for ongoing
-     libarchive development, including issue tracker, additional
-     documentation, and links to the libarchive mailing lists.
+   * http://libarchive.github.com/ is the home for ongoing
+     libarchive development, including documentation, and
+     links to the libarchive mailing lists.
+   * To report an issue, use the issue tracker at
+     http://code.google.com/p/libarchive/issues/list
+   * To submit an enhancement to libarchive, please submit
+     a pull request via GitHub.
+     https://github.com/libarchive/libarchive/pulls
 
 This distribution bundle includes the following components:
    * libarchive: a library for reading and writing streaming archives
@@ -66,6 +71,7 @@ Currently, the library automatically det
   * ZIP archives (with uncompressed or "deflate" compressed entries)
   * GNU and BSD 'ar' archives
   * 'mtree' format
+  * 7-Zip archives
   * Microsoft CAB format
   * LHA and LZH archives
   * RAR archives
@@ -92,6 +98,7 @@ The library can create archives in any o
   * GNU and BSD 'ar' archives
   * 'mtree' format
   * ISO9660 format
+  * 7-Zip archives
   * XAR archives
 
 When creating archives, the result can be filtered with any of the following:

Modified: head/contrib/libarchive/cpio/bsdcpio.1
==============================================================================
--- head/contrib/libarchive/cpio/bsdcpio.1	Sat Jul 28 04:42:05 2012	(r238855)
+++ head/contrib/libarchive/cpio/bsdcpio.1	Sat Jul 28 06:38:44 2012	(r238856)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 21, 2007
+.Dd December 24, 2011
 .Dt CPIO 1
 .Os
 .Sh NAME

Modified: head/contrib/libarchive/cpio/cmdline.c
==============================================================================
--- head/contrib/libarchive/cpio/cmdline.c	Sat Jul 28 04:42:05 2012	(r238855)
+++ head/contrib/libarchive/cpio/cmdline.c	Sat Jul 28 06:38:44 2012	(r238856)
@@ -346,6 +346,7 @@ owner_parse(const char *spec, int *uid, 
 				snprintf(errbuff, sizeof(errbuff),
 				    "Couldn't lookup user ``%s''", user);
 				errbuff[sizeof(errbuff) - 1] = '\0';
+				free(user);
 				return (errbuff);
 			}
 		}

Modified: head/contrib/libarchive/cpio/cpio.c
==============================================================================
--- head/contrib/libarchive/cpio/cpio.c	Sat Jul 28 04:42:05 2012	(r238855)
+++ head/contrib/libarchive/cpio/cpio.c	Sat Jul 28 06:38:44 2012	(r238856)
@@ -82,7 +82,6 @@ __FBSDID("$FreeBSD$");
 #include "cpio.h"
 #include "err.h"
 #include "line_reader.h"
-#include "matching.h"
 
 /* Fixed size of uname/gname caches. */
 #define	name_cache_size 101
@@ -190,6 +189,10 @@ main(int argc, char *argv[])
 	cpio->bytes_per_block = 512;
 	cpio->filename = NULL;
 
+	cpio->matching = archive_match_new();
+	if (cpio->matching == NULL)
+		lafe_errc(1, 0, "Out of memory");
+
 	while ((opt = cpio_getopt(cpio)) != -1) {
 		switch (opt) {
 		case '0': /* GNU convention: --null, -0 */
@@ -216,14 +219,20 @@ main(int argc, char *argv[])
 			cpio->extract_flags &= ~ARCHIVE_EXTRACT_NO_AUTODIR;
 			break;
 		case 'E': /* NetBSD/OpenBSD */
-			lafe_include_from_file(&cpio->matching,
-			    cpio->argument, cpio->option_null);
+			if (archive_match_include_pattern_from_file(
+			    cpio->matching, cpio->argument,
+			    cpio->option_null) != ARCHIVE_OK)
+				lafe_errc(1, 0, "Error : %s",
+				    archive_error_string(cpio->matching));
 			break;
 		case 'F': /* NetBSD/OpenBSD/GNU cpio */
 			cpio->filename = cpio->argument;
 			break;
 		case 'f': /* POSIX 1997 */
-			lafe_exclude(&cpio->matching, cpio->argument);
+			if (archive_match_exclude_pattern(cpio->matching,
+			    cpio->argument) != ARCHIVE_OK)
+				lafe_errc(1, 0, "Error : %s",
+				    archive_error_string(cpio->matching));
 			break;
 		case 'H': /* GNU cpio (also --format) */
 			cpio->format = cpio->argument;
@@ -369,9 +378,6 @@ main(int argc, char *argv[])
 	/* -v overrides -V */
 	if (cpio->dot && cpio->verbose)
 		cpio->dot = 0;
-	/* -v overrides -V */
-	if (cpio->dot && cpio->verbose)
-		cpio->dot = 0;
 	/* TODO: Flag other nonsensical combinations. */
 
 	switch (cpio->mode) {
@@ -385,7 +391,10 @@ main(int argc, char *argv[])
 		break;
 	case 'i':
 		while (*cpio->argv != NULL) {
-			lafe_include(&cpio->matching, *cpio->argv);
+			if (archive_match_include_pattern(cpio->matching,
+			    *cpio->argv) != ARCHIVE_OK)
+				lafe_errc(1, 0, "Error : %s",
+				    archive_error_string(cpio->matching));
 			--cpio->argc;
 			++cpio->argv;
 		}
@@ -405,6 +414,7 @@ main(int argc, char *argv[])
 		    "Must specify at least one of -i, -o, or -p");
 	}
 
+	archive_match_free(cpio->matching);
 	free_cache(cpio->gname_cache);
 	free_cache(cpio->uname_cache);
 	return (cpio->return_value);
@@ -909,7 +919,7 @@ mode_in(struct cpio *cpio)
 			lafe_errc(1, archive_errno(a),
 			    "%s", archive_error_string(a));
 		}
-		if (lafe_excluded(cpio->matching, archive_entry_pathname(entry)))
+		if (archive_match_path_excluded(cpio->matching, entry))
 			continue;
 		if (cpio->option_rename) {
 			destpath = cpio_rename(archive_entry_pathname(entry));
@@ -1011,7 +1021,7 @@ mode_list(struct cpio *cpio)
 			lafe_errc(1, archive_errno(a),
 			    "%s", archive_error_string(a));
 		}
-		if (lafe_excluded(cpio->matching, archive_entry_pathname(entry)))
+		if (archive_match_path_excluded(cpio->matching, entry))
 			continue;
 		if (cpio->verbose)
 			list_item_verbose(cpio, entry);
@@ -1306,7 +1316,8 @@ lookup_uname_helper(struct cpio *cpio, c
 	if (pwent == NULL) {
 		*name = NULL;
 		if (errno != 0 && errno != ENOENT)
-			lafe_warnc(errno, "getpwuid(%d) failed", id);
+			lafe_warnc(errno, "getpwuid(%s) failed",
+			    cpio_i64toa((int64_t)id));
 		return (errno);
 	}
 
@@ -1333,7 +1344,8 @@ lookup_gname_helper(struct cpio *cpio, c
 	if (grent == NULL) {
 		*name = NULL;
 		if (errno != 0)
-			lafe_warnc(errno, "getgrgid(%d) failed", id);
+			lafe_warnc(errno, "getgrgid(%s) failed",
+			    cpio_i64toa((int64_t)id));
 		return (errno);
 	}
 

Modified: head/contrib/libarchive/cpio/cpio.h
==============================================================================
--- head/contrib/libarchive/cpio/cpio.h	Sat Jul 28 04:42:05 2012	(r238855)
+++ head/contrib/libarchive/cpio/cpio.h	Sat Jul 28 06:38:44 2012	(r238856)
@@ -31,8 +31,6 @@
 #include "cpio_platform.h"
 #include <stdio.h>
 
-#include "matching.h"
-
 /*
  * The internal state for the "cpio" program.
  *
@@ -88,7 +86,7 @@ struct cpio {
 	struct name_cache *gname_cache;
 
 	/* Work data. */
-	struct lafe_matching  *matching;
+	struct archive   *matching;
 	char		 *buff;
 	size_t		  buff_size;
 };

Modified: head/contrib/libarchive/cpio/test/main.c
==============================================================================
--- head/contrib/libarchive/cpio/test/main.c	Sat Jul 28 04:42:05 2012	(r238855)
+++ head/contrib/libarchive/cpio/test/main.c	Sat Jul 28 06:38:44 2012	(r238856)
@@ -24,6 +24,9 @@
  */
 
 #include "test.h"
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
@@ -31,6 +34,16 @@
 #ifdef HAVE_ICONV_H
 #include <iconv.h>
 #endif
+/*
+ * Some Linux distributions have both linux/ext2_fs.h and ext2fs/ext2_fs.h.
+ * As the include guards don't agree, the order of include is important.
+ */
+#ifdef HAVE_LINUX_EXT2_FS_H
+#include <linux/ext2_fs.h>      /* for Linux file flags */
+#endif
+#if defined(HAVE_EXT2FS_EXT2_FS_H) && !defined(__CYGWIN__)
+#include <ext2fs/ext2_fs.h>     /* Linux file flags, broken on Cygwin */
+#endif
 #include <limits.h>
 #include <locale.h>
 #ifdef HAVE_SIGNAL_H
@@ -116,7 +129,14 @@ __FBSDID("$FreeBSD$");
 #endif
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
-void *GetFunctionKernel32(const char *name)
+static void	*GetFunctionKernel32(const char *);
+static int	 my_CreateSymbolicLinkA(const char *, const char *, int);
+static int	 my_CreateHardLinkA(const char *, const char *);
+static int	 my_GetFileInformationByName(const char *,
+		     BY_HANDLE_FILE_INFORMATION *);
+
+static void *
+GetFunctionKernel32(const char *name)
 {
 	static HINSTANCE lib;
 	static int set;
@@ -155,7 +175,7 @@ my_CreateHardLinkA(const char *linkname,
 	return f == NULL ? 0 : (*f)(linkname, target, NULL);
 }
 
-int
+static int
 my_GetFileInformationByName(const char *path, BY_HANDLE_FILE_INFORMATION *bhfi)
 {
 	HANDLE h;
@@ -1507,7 +1527,7 @@ assertion_make_dir(const char *file, int
 /* Create a file with the specified contents and report any failures. */
 int
 assertion_make_file(const char *file, int line,
-    const char *path, int mode, const char *contents)
+    const char *path, int mode, int csize, const void *contents)
 {
 #if defined(_WIN32) && !defined(__CYGWIN__)
 	/* TODO: Rework this to set file mode as well. */
@@ -1521,8 +1541,13 @@ assertion_make_file(const char *file, in
 		return (0);
 	}
 	if (contents != NULL) {
-		if (strlen(contents)
-		    != fwrite(contents, 1, strlen(contents), f)) {
+		size_t wsize;
+
+		if (csize < 0)
+			wsize = strlen(contents);
+		else
+			wsize = (size_t)csize;
+		if (wsize != fwrite(contents, 1, wsize, f)) {
 			fclose(f);
 			failure_start(file, line,
 			    "Could not write file %s", path);
@@ -1542,10 +1567,16 @@ assertion_make_file(const char *file, in
 		return (0);
 	}
 	if (contents != NULL) {
-		if ((ssize_t)strlen(contents)
-		    != write(fd, contents, strlen(contents))) {
+		ssize_t wsize;
+
+		if (csize < 0)
+			wsize = (ssize_t)strlen(contents);
+		else
+			wsize = (ssize_t)csize;
+		if (wsize != write(fd, contents, wsize)) {
 			close(fd);
-			failure_start(file, line, "Could not write to %s", path);
+			failure_start(file, line,
+			    "Could not write to %s", path);
 			failure_finish(NULL);
 			return (0);
 		}
@@ -1716,6 +1747,52 @@ assertion_utimes(const char *file, int l
 #endif /* defined(_WIN32) && !defined(__CYGWIN__) */
 }
 
+/* Set nodump, report failures. */
+int
+assertion_nodump(const char *file, int line, const char *pathname)
+{
+#if defined(HAVE_STRUCT_STAT_ST_FLAGS) && defined(UF_NODUMP)
+	int r;
+
+	assertion_count(file, line);
+	r = chflags(pathname, UF_NODUMP);
+	if (r < 0) {
+		failure_start(file, line, "Can't set nodump %s\n", pathname);
+		failure_finish(NULL);
+		return (0);
+	}
+#elif defined(EXT2_IOC_GETFLAGS) && defined(HAVE_WORKING_EXT2_IOC_GETFLAGS)\
+	 && defined(EXT2_NODUMP_FL)
+	int fd, r, flags;
+
+	assertion_count(file, line);
+	fd = open(pathname, O_RDONLY | O_NONBLOCK);
+	if (fd < 0) {
+		failure_start(file, line, "Can't open %s\n", pathname);
+		failure_finish(NULL);
+		return (0);
+	}
+	r = ioctl(fd, EXT2_IOC_GETFLAGS, &flags);
+	if (r < 0) {
+		failure_start(file, line, "Can't get flags %s\n", pathname);
+		failure_finish(NULL);
+		return (0);
+	}
+	flags |= EXT2_NODUMP_FL;
+	r = ioctl(fd, EXT2_IOC_SETFLAGS, &flags);
+	if (r < 0) {
+		failure_start(file, line, "Can't set nodump %s\n", pathname);
+		failure_finish(NULL);
+		return (0);
+	}
+	close(fd);
+#else
+	(void)pathname; /* UNUSED */
+	assertion_count(file, line);
+#endif
+	return (1);
+}
+
 /*
  *
  *  UTILITIES for use by tests.
@@ -1744,7 +1821,7 @@ canSymlink(void)
 		return (value);
 
 	++tested;
-	assertion_make_file(__FILE__, __LINE__, "canSymlink.0", 0644, "a");
+	assertion_make_file(__FILE__, __LINE__, "canSymlink.0", 0644, 1, "a");
 	/* Note: Cygwin has its own symlink() emulation that does not
 	 * use the Win32 CreateSymbolicLink() function. */
 #if defined(_WIN32) && !defined(__CYGWIN__)
@@ -1794,6 +1871,70 @@ canGunzip(void)
 }
 
 /*
+ * Can this filesystem handle nodump flags.
+ */
+#if defined(HAVE_STRUCT_STAT_ST_FLAGS) && defined(UF_NODUMP)
+
+int
+canNodump(void)
+{
+	const char *path = "cannodumptest";
+	struct stat sb;
+
+	assertion_make_file(__FILE__, __LINE__, path, 0644, 0, NULL);
+	if (chflags(path, UF_NODUMP) < 0)
+		return (0);
+	if (stat(path, &sb) < 0)
+		return (0);
+	if (sb.st_flags & UF_NODUMP)
+		return (1);
+	return (0);
+}
+
+#elif defined(EXT2_IOC_GETFLAGS) && defined(HAVE_WORKING_EXT2_IOC_GETFLAGS)\
+	 && defined(EXT2_NODUMP_FL)
+
+int
+canNodump(void)
+{
+	const char *path = "cannodumptest";
+	int fd, r, flags;
+
+	assertion_make_file(__FILE__, __LINE__, path, 0644, 0, NULL);
+	fd = open(path, O_RDONLY | O_NONBLOCK);
+	if (fd < 0)
+		return (0);
+	r = ioctl(fd, EXT2_IOC_GETFLAGS, &flags);
+	if (r < 0)
+		return (0);
+	flags |= EXT2_NODUMP_FL;
+	r = ioctl(fd, EXT2_IOC_SETFLAGS, &flags);
+	if (r < 0)
+		return (0);
+	close(fd);
+	fd = open(path, O_RDONLY | O_NONBLOCK);
+	if (fd < 0)
+		return (0);
+	r = ioctl(fd, EXT2_IOC_GETFLAGS, &flags);
+	if (r < 0)
+		return (0);
+	close(fd);
+	if (flags & EXT2_NODUMP_FL)
+		return (1);
+	return (0);
+}
+
+#else
+
+int
+canNodump()
+{
+	return (0);
+}
+
+#endif
+
+/*
  * Sleep as needed; useful for verifying disk timestamp changes by
  * ensuring that the wall-clock time has actually changed before we
  * go back to re-read something from disk.
@@ -2236,17 +2377,77 @@ success:
 	return strdup(buff);
 }
 
+static int
+get_test_set(int *test_set, int limit, const char *test)
+{
+	int start, end;
+	int idx = 0;
+
+	if (test == NULL) {
+		/* Default: Run all tests. */
+		for (;idx < limit; idx++)
+			test_set[idx] = idx;
+		return (limit);
+	}
+	if (*test >= '0' && *test <= '9') {
+		const char *vp = test;
+		start = 0;
+		while (*vp >= '0' && *vp <= '9') {
+			start *= 10;
+			start += *vp - '0';
+			++vp;
+		}
+		if (*vp == '\0') {
+			end = start;
+		} else if (*vp == '-') {
+			++vp;
+			if (*vp == '\0') {
+				end = limit - 1;
+			} else {
+				end = 0;
+				while (*vp >= '0' && *vp <= '9') {
+					end *= 10;
+					end += *vp - '0';
+					++vp;
+				}
+			}
+		} else
+			return (-1);
+		if (start < 0 || end >= limit || start > end)
+			return (-1);
+		while (start <= end)
+			test_set[idx++] = start++;
+	} else {
+		size_t len = strlen(test);
+		for (start = 0; start < limit; ++start) {
+			const char *name = tests[start].name;
+			const char *p;
+
+			while ((p = strchr(name, test[0])) != NULL) {
+				if (strncmp(p, test, len) == 0) {
+					test_set[idx++] = start;
+					break;
+				} else
+					name = p + 1;
+			}
+
+		}
+	}
+	return ((idx == 0)?-1:idx);
+}
+
 int
 main(int argc, char **argv)
 {
 	static const int limit = sizeof(tests) / sizeof(tests[0]);
-	int i = 0, j = 0, start, end, tests_run = 0, tests_failed = 0, option;
+	int test_set[sizeof(tests) / sizeof(tests[0])];
+	int i = 0, j = 0, tests_run = 0, tests_failed = 0, option;
 	time_t now;
 	char *refdir_alloc = NULL;
 	const char *progname;
 	char **saved_argv;
 	const char *tmp, *option_arg, *p;
-	char tmpdir[256], *pwd, *testprogdir, *tmp2 = NULL;
+	char tmpdir[256], *pwd, *testprogdir, *tmp2 = NULL, *vlevel = NULL;
 	char tmpdir_timestamp[256];
 
 	(void)argc; /* UNUSED */
@@ -2332,6 +2533,19 @@ main(int argc, char **argv)
 	if (getenv(ENVBASE "_DEBUG") != NULL)
 		dump_on_failure = 1;
 
+	/* Allow -v to be controlled through the environment. */
+	if (getenv("_VERBOSITY_LEVEL") != NULL)
+	{
+		vlevel = getenv("_VERBOSITY_LEVEL");
+		verbosity = atoi(vlevel);
+		if (verbosity < VERBOSITY_SUMMARY_ONLY || verbosity > VERBOSITY_FULL)
+		{
+			/* Unsupported verbosity levels are silently ignored */
+			vlevel = NULL;
+			verbosity = VERBOSITY_PASSFAIL;
+		}
+	}
+
 	/* Get the directory holding test files from environment. */
 	refdir = getenv(ENVBASE "_TEST_FILES");
 
@@ -2379,7 +2593,8 @@ main(int argc, char **argv)
 #endif
 				break;
 			case 'q':
-				verbosity--;
+				if (!vlevel)
+					verbosity--;
 				break;
 			case 'r':
 				refdir = option_arg;
@@ -2388,7 +2603,8 @@ main(int argc, char **argv)
 				until_failure++;
 				break;
 			case 'v':
-				verbosity++;
+				if (!vlevel)
+					verbosity++;
 				break;
 			default:
 				fprintf(stderr, "Unrecognized option '%c'\n",
@@ -2501,78 +2717,27 @@ main(int argc, char **argv)
 	saved_argv = argv;
 	do {
 		argv = saved_argv;
-		if (*argv == NULL) {
-			/* Default: Run all tests. */
-			for (i = 0; i < limit; i++) {
+		do {
+			int test_num;
+
+			test_num = get_test_set(test_set, limit, *argv);
+			if (test_num < 0) {
+				printf("*** INVALID Test %s\n", *argv);
+				free(refdir_alloc);
+				usage(progname);
+				return (1);
+			}
+			for (i = 0; i < test_num; i++) {
 				tests_run++;
-				if (test_run(i, tmpdir)) {
+				if (test_run(test_set[i], tmpdir)) {
 					tests_failed++;
 					if (until_failure)
 						goto finish;
 				}
 			}
-		} else {
-			while (*(argv) != NULL) {
-				if (**argv >= '0' && **argv <= '9') {
-					char *vp = *argv;
-					start = 0;
-					while (*vp >= '0' && *vp <= '9') {
-						start *= 10;
-						start += *vp - '0';
-						++vp;
-					}
-					if (*vp == '\0') {
-						end = start;
-					} else if (*vp == '-') {
-						++vp;
-						if (*vp == '\0') {
-							end = limit - 1;
-						} else {
-							end = 0;
-							while (*vp >= '0' && *vp <= '9') {
-								end *= 10;
-								end += *vp - '0';
-								++vp;
-							}
-						}
-					} else {
-						printf("*** INVALID Test %s\n", *argv);
-						free(refdir_alloc);
-						usage(progname);
-						return (1);
-					}
-					if (start < 0 || end >= limit || start > end) {
-						printf("*** INVALID Test %s\n", *argv);
-						free(refdir_alloc);
-						usage(progname);
-						return (1);
-					}
-				} else {
-					for (start = 0; start < limit; ++start) {
-						if (strcmp(*argv, tests[start].name) == 0)
-							break;
-					}
-					end = start;
-					if (start >= limit) {
-						printf("*** INVALID Test ``%s''\n",
-						    *argv);
-						free(refdir_alloc);
-						usage(progname);
-						/* usage() never returns */
-					}
-				}
-				while (start <= end) {
-					tests_run++;
-					if (test_run(start, tmpdir)) {
-						tests_failed++;
-						if (until_failure)
-							goto finish;
-					}
-					++start;
-				}
+			if (*argv != NULL)
 				argv++;
-			}
-		}
+		} while (*argv != NULL);
 	} while (until_failure);
 
 finish:

Modified: head/contrib/libarchive/cpio/test/test.h
==============================================================================
--- head/contrib/libarchive/cpio/test/test.h	Sat Jul 28 04:42:05 2012	(r238855)
+++ head/contrib/libarchive/cpio/test/test.h	Sat Jul 28 06:38:44 2012	(r238856)
@@ -194,11 +194,15 @@
 #define assertMakeDir(dirname, mode)	\
   assertion_make_dir(__FILE__, __LINE__, dirname, mode)
 #define assertMakeFile(path, mode, contents) \
-  assertion_make_file(__FILE__, __LINE__, path, mode, contents)
+  assertion_make_file(__FILE__, __LINE__, path, mode, -1, contents)
+#define assertMakeBinFile(path, mode, csize, contents) \
+  assertion_make_file(__FILE__, __LINE__, path, mode, csize, contents)
 #define assertMakeHardlink(newfile, oldfile)	\
   assertion_make_hardlink(__FILE__, __LINE__, newfile, oldfile)
 #define assertMakeSymlink(newfile, linkto)	\
   assertion_make_symlink(__FILE__, __LINE__, newfile, linkto)
+#define assertNodump(path)      \
+  assertion_nodump(__FILE__, __LINE__, path)
 #define assertUmask(mask)	\
   assertion_umask(__FILE__, __LINE__, mask)
 #define assertUtimes(pathname, atime, atime_nsec, mtime, mtime_nsec)	\
@@ -241,9 +245,10 @@ int assertion_is_not_hardlink(const char
 int assertion_is_reg(const char *, int, const char *, int);
 int assertion_is_symlink(const char *, int, const char *, const char *);
 int assertion_make_dir(const char *, int, const char *, int);
-int assertion_make_file(const char *, int, const char *, int, const char *);
+int assertion_make_file(const char *, int, const char *, int, int, const void *);
 int assertion_make_hardlink(const char *, int, const char *newpath, const char *);
 int assertion_make_symlink(const char *, int, const char *newpath, const char *);
+int assertion_nodump(const char *, int, const char *);
 int assertion_non_empty_file(const char *, int, const char *);
 int assertion_text_file_contents(const char *, int, const char *buff, const char *f);
 int assertion_umask(const char *, int, int);
@@ -267,6 +272,9 @@ int canGzip(void);
 /* Return true if this platform can run the "gunzip" program. */
 int canGunzip(void);
 
+/* Return true if this filesystem can handle nodump flags. */
+int canNodump(void);
+
 /* Return true if the file has large i-node number(>0xffffffff). */
 int is_LargeInode(const char *);
 

Modified: head/contrib/libarchive/libarchive/archive.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive.h	Sat Jul 28 04:42:05 2012	(r238855)
+++ head/contrib/libarchive/libarchive/archive.h	Sat Jul 28 06:38:44 2012	(r238856)
@@ -56,23 +56,14 @@
 # else
 #  define	__LA_SSIZE_T	long
 # endif
-# if defined(__BORLANDC__)
-#  define	__LA_UID_T	uid_t
-#  define	__LA_GID_T	gid_t
-# else
-#  define	__LA_UID_T	short
-#  define	__LA_GID_T	short
-# endif
 #else
-# include <unistd.h>  /* ssize_t, uid_t, and gid_t */
+# include <unistd.h>  /* ssize_t */
 # if defined(_SCO_DS)
 #  define	__LA_INT64_T	long long
 # else
 #  define	__LA_INT64_T	int64_t
 # endif
 # define	__LA_SSIZE_T	ssize_t
-# define	__LA_UID_T	uid_t
-# define	__LA_GID_T	gid_t
 #endif
 
 /*
@@ -127,13 +118,13 @@ extern "C" {
  * assert that ARCHIVE_VERSION_NUMBER >= 2012108.
  */
 /* Note: Compiler will complain if this does not match archive_entry.h! */
-#define	ARCHIVE_VERSION_NUMBER 3000003
+#define	ARCHIVE_VERSION_NUMBER 3000004
 __LA_DECL int		archive_version_number(void);
 
 /*
  * Textual name/version of the library, useful for version displays.
  */
-#define	ARCHIVE_VERSION_STRING "libarchive 3.0.3"
+#define	ARCHIVE_VERSION_STRING "libarchive 3.0.4"
 __LA_DECL const char *	archive_version_string(void);
 
 /* Declare our basic types. */
@@ -567,6 +558,8 @@ __LA_DECL int archive_write_set_compress
 __LA_DECL int archive_write_set_compression_xz(struct archive *);
 #endif
 
+/* A convenience function to set the filter based on the code. */
+__LA_DECL int archive_write_add_filter(struct archive *, int filter_code);
 __LA_DECL int archive_write_add_filter_bzip2(struct archive *);
 __LA_DECL int archive_write_add_filter_compress(struct archive *);
 __LA_DECL int archive_write_add_filter_gzip(struct archive *);
@@ -758,11 +751,42 @@ __LA_DECL int	archive_read_disk_open_w(s
  * traversal.
  */
 __LA_DECL int	archive_read_disk_descend(struct archive *);
+__LA_DECL int	archive_read_disk_can_descend(struct archive *);
 __LA_DECL int	archive_read_disk_current_filesystem(struct archive *);
 __LA_DECL int	archive_read_disk_current_filesystem_is_synthetic(struct archive *);
 __LA_DECL int	archive_read_disk_current_filesystem_is_remote(struct archive *);
 /* Request that the access time of the entry visited by travesal be restored. */
 __LA_DECL int  archive_read_disk_set_atime_restored(struct archive *);
+/*
+ * Set behavior. The "flags" argument selects optional behavior.
+ */
+/* Request that the access time of the entry visited by travesal be restored.
+ * This is the same as archive_read_disk_set_atime_restored. */
+#define	ARCHIVE_READDISK_RESTORE_ATIME		(0x0001)
+/* Default: Do not skip an entry which has nodump flags. */
+#define	ARCHIVE_READDISK_HONOR_NODUMP		(0x0002)
+/* Default: Skip a mac resource fork file whose prefix is "._" because of
+ * using copyfile. */
+#define	ARCHIVE_READDISK_MAC_COPYFILE		(0x0004)
+/* Default: Do not traverse mount points. */
+#define	ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS	(0x0008)
+
+__LA_DECL int  archive_read_disk_set_behavior(struct archive *,
+		    int flags);
+
+/*
+ * Set archive_match object that will be used in archive_read_disk to
+ * know whether an entry should be skipped. The callback function
+ * _excluded_func will be invoked when an entry is skipped by the result
+ * of archive_match.
+ */
+__LA_DECL int	archive_read_disk_set_matching(struct archive *,
+		    struct archive *_matching, void (*_excluded_func)
+		    (struct archive *, void *, struct archive_entry *),
+		    void *_client_data);
+__LA_DECL int	archive_read_disk_set_metadata_filter_callback(struct archive *,
+		    int (*_metadata_filter_func)(struct archive *, void *,
+		    	struct archive_entry *), void *_client_data);
 
 /*
  * Accessor functions to read/set various information in
@@ -802,14 +826,116 @@ __LA_DECL void		 archive_copy_error(stru
 			    struct archive *src);
 __LA_DECL int		 archive_file_count(struct archive *);
 
+/*
+ * ARCHIVE_MATCH API
+ */
+__LA_DECL struct archive *archive_match_new(void);
+__LA_DECL int	archive_match_free(struct archive *);
+
+/*
+ * Test if archive_entry is excluded.
+ * This is a convenience function. This is the same as calling all
+ * archive_match_path_excluded, archive_match_time_excluded
+ * and archive_match_owner_excluded.
+ */
+__LA_DECL int	archive_match_excluded(struct archive *,
+		    struct archive_entry *);
+
+/*
+ * Test if pathname is excluded. The conditions are set by following functions.
+ */
+__LA_DECL int	archive_match_path_excluded(struct archive *,
+		    struct archive_entry *);
+/* Add exclusion pathname pattern. */
+__LA_DECL int	archive_match_exclude_pattern(struct archive *, const char *);
+__LA_DECL int	archive_match_exclude_pattern_w(struct archive *,
+		    const wchar_t *);
+/* Add exclusion pathname pattern from file. */
+__LA_DECL int	archive_match_exclude_pattern_from_file(struct archive *,
+		    const char *, int _nullSeparator);
+__LA_DECL int	archive_match_exclude_pattern_from_file_w(struct archive *,
+		    const wchar_t *, int _nullSeparator);
+/* Add inclusion pathname pattern. */
+__LA_DECL int	archive_match_include_pattern(struct archive *, const char *);
+__LA_DECL int	archive_match_include_pattern_w(struct archive *,
+		    const wchar_t *);
+/* Add inclusion pathname pattern from file. */
+__LA_DECL int	archive_match_include_pattern_from_file(struct archive *,
+		    const char *, int _nullSeparator);
+__LA_DECL int	archive_match_include_pattern_from_file_w(struct archive *,
+		    const wchar_t *, int _nullSeparator);
+/*
+ * How to get statistic information for inclusion patterns.
+ */
+/* Return the amount number of unmatched inclusion patterns. */
+__LA_DECL int	archive_match_path_unmatched_inclusions(struct archive *);
+/* Return the pattern of unmatched inclusion with ARCHIVE_OK.
+ * Return ARCHIVE_EOF if there is no inclusion pattern. */
+__LA_DECL int	archive_match_path_unmatched_inclusions_next(
+		    struct archive *, const char **);
+__LA_DECL int	archive_match_path_unmatched_inclusions_next_w(
+		    struct archive *, const wchar_t **);
+
+/*
+ * Test if a file is excluded by its time stamp.
+ * The conditions are set by following functions.
+ */
+__LA_DECL int	archive_match_time_excluded(struct archive *,
+		    struct archive_entry *);
+
+/*
+ * Flags to tell a matching type of time stamps. These are used for
+ * following functinos.
+ */
+/* Time flag: mtime to be tested. */
+#define ARCHIVE_MATCH_MTIME	(0x0100)
+/* Time flag: ctime to be tested. */
+#define ARCHIVE_MATCH_CTIME	(0x0200)
+/* Comparison flag: Match the time if it is newer than. */
+#define ARCHIVE_MATCH_NEWER	(0x0001)
+/* Comparison flag: Match the time if it is older than. */
+#define ARCHIVE_MATCH_OLDER	(0x0002)
+/* Comparison flag: Match the time if it is equal to. */
+#define ARCHIVE_MATCH_EQUAL	(0x0010)
+/* Set inclusion time. */
+__LA_DECL int	archive_match_include_time(struct archive *, int _flag,
+		    time_t _sec, long _nsec);
+/* Set inclusion time by a date string. */
+__LA_DECL int	archive_match_include_date(struct archive *, int _flag,
+		    const char *_datestr);
+__LA_DECL int	archive_match_include_date_w(struct archive *, int _flag,
+		    const wchar_t *_datestr);
+/* Set inclusion time by a particluar file. */
+__LA_DECL int	archive_match_include_file_time(struct archive *,
+		    int _flag, const char *_pathname);
+__LA_DECL int	archive_match_include_file_time_w(struct archive *,
+		    int _flag, const wchar_t *_pathname);
+/* Add exclusion entry. */
+__LA_DECL int	archive_match_exclude_entry(struct archive *,
+		    int _flag, struct archive_entry *);
+
+/*
+ * Test if a file is excluded by its uid ,gid, uname or gname.
+ * The conditions are set by following functions.
+ */
+__LA_DECL int	archive_match_owner_excluded(struct archive *,
+		    struct archive_entry *);
+/* Add inclusion uid, gid, uname and gname. */
+__LA_DECL int	archive_match_include_uid(struct archive *, __LA_INT64_T);
+__LA_DECL int	archive_match_include_gid(struct archive *, __LA_INT64_T);
+__LA_DECL int	archive_match_include_uname(struct archive *, const char *);
+__LA_DECL int	archive_match_include_uname_w(struct archive *,
+		    const wchar_t *);
+__LA_DECL int	archive_match_include_gname(struct archive *, const char *);
+__LA_DECL int	archive_match_include_gname_w(struct archive *,
+		    const wchar_t *);
+
 #ifdef __cplusplus
 }
 #endif
 
 /* These are meaningless outside of this header. */
 #undef __LA_DECL
-#undef __LA_GID_T
-#undef __LA_UID_T
 
 /* These need to remain defined because they're used in the
  * callback type definitions.  XXX Fix this.  This is ugly. XXX */

Modified: head/contrib/libarchive/libarchive/archive_acl.c
==============================================================================
--- head/contrib/libarchive/libarchive/archive_acl.c	Sat Jul 28 04:42:05 2012	(r238855)
+++ head/contrib/libarchive/libarchive/archive_acl.c	Sat Jul 28 06:38:44 2012	(r238856)
@@ -422,8 +422,11 @@ archive_acl_next(struct archive *a, stru
 	*permset = acl->acl_p->permset;
 	*tag = acl->acl_p->tag;
 	*id = acl->acl_p->id;
-	if (archive_mstring_get_mbs(a, &acl->acl_p->name, name) != 0)
+	if (archive_mstring_get_mbs(a, &acl->acl_p->name, name) != 0) {
+		if (errno == ENOMEM)
+			return (ARCHIVE_FATAL);
 		*name = NULL;
+	}
 	acl->acl_p = acl->acl_p->next;
 	return (ARCHIVE_OK);
 }
@@ -441,7 +444,7 @@ archive_acl_text_w(struct archive *a, st
 	const wchar_t *prefix;
 	wchar_t separator;
 	struct archive_acl_entry *ap;
-	int id;
+	int id, r;
 	wchar_t *wp;
 
 	if (acl->acl_text_w != NULL) {
@@ -461,9 +464,11 @@ archive_acl_text_w(struct archive *a, st
 				length += 8; /* "default:" */
 			length += 5; /* tag name */
 			length += 1; /* colon */
-			if (archive_mstring_get_wcs(a, &ap->name, &wname) == 0 &&
-			    wname != NULL)
+			r = archive_mstring_get_wcs(a, &ap->name, &wname);
+			if (r == 0 && wname != NULL)
 				length += wcslen(wname);
+			else if (r < 0 && errno == ENOMEM)
+				return (NULL);
 			else
 				length += sizeof(uid_t) * 3 + 1;
 			length ++; /* colon */
@@ -487,7 +492,7 @@ archive_acl_text_w(struct archive *a, st
 	/* Now, allocate the string and actually populate it. */
 	wp = acl->acl_text_w = (wchar_t *)malloc(length * sizeof(wchar_t));
 	if (wp == NULL)
-		__archive_errx(1, "No memory to generate the text version of the ACL");
+		return (NULL);
 	count = 0;
 	if ((flags & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
 		append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_USER_OBJ, NULL,
@@ -502,16 +507,19 @@ archive_acl_text_w(struct archive *a, st
 
 		ap = acl->acl_head;
 		while (ap != NULL) {
-			if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0 &&
-				archive_mstring_get_wcs(a, &ap->name, &wname) == 0) {
-				*wp++ = separator;
-				if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID)
-					id = ap->id;
-				else
-					id = -1;
-				append_entry_w(&wp, NULL, ap->tag, wname,
-				    ap->permset, id);
-				count++;
+			if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
+				r = archive_mstring_get_wcs(a, &ap->name, &wname);
+				if (r == 0) {
+					*wp++ = separator;
+					if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID)
+						id = ap->id;
+					else
+						id = -1;
+					append_entry_w(&wp, NULL, ap->tag, wname,
+					    ap->permset, id);
+					count++;
+				} else if (r < 0 && errno == ENOMEM)
+					return (NULL);
 			}
 			ap = ap->next;
 		}
@@ -526,17 +534,20 @@ archive_acl_text_w(struct archive *a, st
 		ap = acl->acl_head;
 		count = 0;
 		while (ap != NULL) {
-			if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0 &&
-				archive_mstring_get_wcs(a, &ap->name, &wname) == 0) {
-				if (count > 0)
-					*wp++ = separator;
-				if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID)

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207280638.q6S6ciQj093496>