Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Jun 2016 07:00:15 +0000 (UTC)
From:      Martin Matuska <mm@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r302264 - in vendor/libarchive/dist: . build/cmake libarchive libarchive/test libarchive_fe
Message-ID:  <201606290700.u5T70Fmf077042@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mm
Date: Wed Jun 29 07:00:15 2016
New Revision: 302264
URL: https://svnweb.freebsd.org/changeset/base/302264

Log:
  Update vendor/libarchive to git 084ef320b8fc62e3fd3acb762fe6175d48d7829c
  
  Vendor issues fixed:
  #686: Correctly grow buffer in archive_string_append_from_wcs_in_codepage()
  FreeBSD PR #204157: Fix test on filesystems without birthtime support
  
  PR:	204157

Deleted:
  vendor/libarchive/dist/build/cmake/CheckStructMember.cmake
Modified:
  vendor/libarchive/dist/CMakeLists.txt
  vendor/libarchive/dist/configure.ac
  vendor/libarchive/dist/libarchive/archive_read_disk_posix.c
  vendor/libarchive/dist/libarchive/archive_string.c
  vendor/libarchive/dist/libarchive/archive_write_disk_posix.c
  vendor/libarchive/dist/libarchive/test/main.c
  vendor/libarchive/dist/libarchive/test/test_write_format_gnutar_filenames.c
  vendor/libarchive/dist/libarchive_fe/passphrase.c

Modified: vendor/libarchive/dist/CMakeLists.txt
==============================================================================
--- vendor/libarchive/dist/CMakeLists.txt	Wed Jun 29 06:55:30 2016	(r302263)
+++ vendor/libarchive/dist/CMakeLists.txt	Wed Jun 29 07:00:15 2016	(r302264)
@@ -274,7 +274,7 @@ INCLUDE(CheckHeaderDirent)
 INCLUDE(CheckIncludeFile)
 INCLUDE(CheckIncludeFiles)
 INCLUDE(CheckLibraryExists)
-INCLUDE(CheckStructMember)
+INCLUDE(CheckStructHasMember)
 INCLUDE(CheckSymbolExists)
 INCLUDE(CheckTypeExists)
 INCLUDE(CheckTypeSize)
@@ -1332,47 +1332,47 @@ CHECK_SYMBOL_EXISTS(SSIZE_MAX        "li
 # Check struct members
 #
 # Check for tm_gmtoff in struct tm
-CHECK_STRUCT_MEMBER("struct tm" tm_gmtoff
+CHECK_STRUCT_HAS_MEMBER("struct tm" tm_gmtoff
     "time.h" HAVE_STRUCT_TM_TM_GMTOFF)
-CHECK_STRUCT_MEMBER("struct tm" __tm_gmtoff
+CHECK_STRUCT_HAS_MEMBER("struct tm" __tm_gmtoff
     "time.h" HAVE_STRUCT_TM___TM_GMTOFF)
 
 # Check for f_namemax in struct statfs
-CHECK_STRUCT_MEMBER("struct statfs" f_namemax
+CHECK_STRUCT_HAS_MEMBER("struct statfs" f_namemax
     "sys/param.h;sys/mount.h" HAVE_STRUCT_STATFS_F_NAMEMAX)
 
 # Check for birthtime in struct stat
-CHECK_STRUCT_MEMBER("struct stat" st_birthtime
+CHECK_STRUCT_HAS_MEMBER("struct stat" st_birthtime
     "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BIRTHTIME)
 
 # Check for high-resolution timestamps in struct stat
-CHECK_STRUCT_MEMBER("struct stat" st_birthtimespec.tv_nsec
+CHECK_STRUCT_HAS_MEMBER("struct stat" st_birthtimespec.tv_nsec
     "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC)
-CHECK_STRUCT_MEMBER("struct stat" st_mtimespec.tv_nsec
+CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec
     "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC)
-CHECK_STRUCT_MEMBER("struct stat" st_mtim.tv_nsec
+CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec
     "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC)
-CHECK_STRUCT_MEMBER("struct stat" st_mtime_n
+CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtime_n
     "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIME_N)
-CHECK_STRUCT_MEMBER("struct stat" st_umtime
+CHECK_STRUCT_HAS_MEMBER("struct stat" st_umtime
     "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_UMTIME)
-CHECK_STRUCT_MEMBER("struct stat" st_mtime_usec
+CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtime_usec
     "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIME_USEC)
 # Check for block size support in struct stat
-CHECK_STRUCT_MEMBER("struct stat" st_blksize
+CHECK_STRUCT_HAS_MEMBER("struct stat" st_blksize
     "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BLKSIZE)
 # Check for st_flags in struct stat (BSD fflags)
-CHECK_STRUCT_MEMBER("struct stat" st_flags
+CHECK_STRUCT_HAS_MEMBER("struct stat" st_flags
     "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_FLAGS)
 
 IF(HAVE_SYS_STATVFS_H)
-  CHECK_STRUCT_MEMBER("struct statvfs" f_iosize
+  CHECK_STRUCT_HAS_MEMBER("struct statvfs" f_iosize
     "sys/types.h;sys/statvfs.h" HAVE_STRUCT_STATVFS_F_IOSIZE)
 ENDIF()
 
 #
 #
-CHECK_STRUCT_MEMBER("struct tm" tm_sec
+CHECK_STRUCT_HAS_MEMBER("struct tm" tm_sec
     "sys/types.h;sys/time.h;time.h" TIME_WITH_SYS_TIME)
 
 #

Modified: vendor/libarchive/dist/configure.ac
==============================================================================
--- vendor/libarchive/dist/configure.ac	Wed Jun 29 06:55:30 2016	(r302263)
+++ vendor/libarchive/dist/configure.ac	Wed Jun 29 07:00:15 2016	(r302264)
@@ -374,8 +374,11 @@ if test "x$with_lzma" != "xno"; then
   AC_CACHE_CHECK(
     [whether we have multithread support in lzma],
     ac_cv_lzma_has_mt,
-    [AC_COMPILE_IFELSE([
-      AC_LANG_PROGRAM([[#include <lzma.h>]],
+    [AC_LINK_IFELSE([
+      AC_LANG_PROGRAM([[#include <lzma.h>]
+                       [#if LZMA_VERSION < 50020000]
+                       [#error unsupported]
+                       [#endif]],
                       [[lzma_stream_encoder_mt(0, 0);]])],
       [ac_cv_lzma_has_mt=yes], [ac_cv_lzma_has_mt=no])])
   if test "x$ac_cv_lzma_has_mt" != xno; then
@@ -613,6 +616,14 @@ AC_CHECK_FUNCS([_get_timezone _localtime
 # detects cygwin-1.7, as opposed to older versions
 AC_CHECK_FUNCS([cygwin_conv_path])
 
+# DragonFly uses vfsconf, FreeBSD xvfsconf.
+AC_CHECK_TYPES(struct vfsconf,,,
+	[#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(

Modified: vendor/libarchive/dist/libarchive/archive_read_disk_posix.c
==============================================================================
--- vendor/libarchive/dist/libarchive/archive_read_disk_posix.c	Wed Jun 29 06:55:30 2016	(r302263)
+++ vendor/libarchive/dist/libarchive/archive_read_disk_posix.c	Wed Jun 29 07:00:15 2016	(r302264)
@@ -1504,7 +1504,11 @@ setup_current_filesystem(struct archive_
 	struct tree *t = a->tree;
 	struct statfs sfs;
 #if defined(HAVE_GETVFSBYNAME) && defined(VFCF_SYNTHETIC)
+#  if defined(HAVE_STRUCT_VFSCONF)
+	struct vfsconf vfc;
+#  else
 	struct xvfsconf vfc;
+#  endif
 #endif
 	int r, xr = 0;
 #if !defined(HAVE_STRUCT_STATFS_F_NAMEMAX)

Modified: vendor/libarchive/dist/libarchive/archive_string.c
==============================================================================
--- vendor/libarchive/dist/libarchive/archive_string.c	Wed Jun 29 06:55:30 2016	(r302263)
+++ vendor/libarchive/dist/libarchive/archive_string.c	Wed Jun 29 07:00:15 2016	(r302264)
@@ -559,7 +559,8 @@ archive_wstring_append_from_mbs_in_codep
 			}
 			if (count == 0 && length != 0)
 				ret = -1;
-		} while (0);
+			break;
+		} while (1);
 	}
 	dest->length += count;
 	dest->s[dest->length] = L'\0';
@@ -3552,18 +3553,19 @@ win_strncat_from_utf16(struct archive_st
 		ll = WideCharToMultiByte(sc->to_cp, 0,
 		    (LPCWSTR)u16, (int)bytes>>1, mbs, (int)mbs_size,
 			NULL, &defchar);
-		if (ll == 0 &&
-		    GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-			/* Need more buffer for MBS. */
-			ll = WideCharToMultiByte(sc->to_cp, 0,
-			    (LPCWSTR)u16, (int)bytes, NULL, 0, NULL, NULL);
-			if (archive_string_ensure(as, ll +1) == NULL)
-				return (-1);
-			mbs = as->s + as->length;
-			mbs_size = as->buffer_length - as->length -1;
-			continue;
+		/* Exit loop if we succeeded */
+		if (ll != 0 ||
+		    GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
+			break;
 		}
-	} while (0);
+		/* Else expand buffer and loop to try again. */
+		ll = WideCharToMultiByte(sc->to_cp, 0,
+		    (LPCWSTR)u16, (int)bytes, NULL, 0, NULL, NULL);
+		if (archive_string_ensure(as, ll +1) == NULL)
+			return (-1);
+		mbs = as->s + as->length;
+		mbs_size = as->buffer_length - as->length -1;
+	} while (1);
 	archive_string_free(&tmp);
 	as->length += ll;
 	as->s[as->length] = '\0';
@@ -3634,19 +3636,20 @@ win_strncat_to_utf16(struct archive_stri
 	do {
 		count = MultiByteToWideChar(sc->from_cp,
 		    MB_PRECOMPOSED, s, (int)length, (LPWSTR)u16, (int)avail>>1);
-		if (count == 0 &&
-		    GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-			/* Need more buffer for UTF-16 string */
-			count = MultiByteToWideChar(sc->from_cp,
-			    MB_PRECOMPOSED, s, (int)length, NULL, 0);
-			if (archive_string_ensure(as16, (count +1) * 2)
-			    == NULL)
-				return (-1);
-			u16 = as16->s + as16->length;
-			avail = as16->buffer_length - 2;
-			continue;
+		/* Exit loop if we succeeded */
+		if (count != 0 ||
+		    GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
+			break;
 		}
-	} while (0);
+		/* Expand buffer and try again */
+		count = MultiByteToWideChar(sc->from_cp,
+		    MB_PRECOMPOSED, s, (int)length, NULL, 0);
+		if (archive_string_ensure(as16, (count +1) * 2)
+		    == NULL)
+			return (-1);
+		u16 = as16->s + as16->length;
+		avail = as16->buffer_length - 2;
+	} while (1);
 	as16->length += count * 2;
 	as16->s[as16->length] = 0;
 	as16->s[as16->length+1] = 0;

Modified: vendor/libarchive/dist/libarchive/archive_write_disk_posix.c
==============================================================================
--- vendor/libarchive/dist/libarchive/archive_write_disk_posix.c	Wed Jun 29 06:55:30 2016	(r302263)
+++ vendor/libarchive/dist/libarchive/archive_write_disk_posix.c	Wed Jun 29 07:00:15 2016	(r302264)
@@ -3487,6 +3487,9 @@ exit_xattr:
 static int
 copy_acls(struct archive_write_disk *a, int tmpfd, int dffd)
 {
+#ifndef HAVE_SYS_ACL_H
+	return 0;
+#else
 	acl_t acl, dfacl = NULL;
 	int acl_r, ret = ARCHIVE_OK;
 
@@ -3514,6 +3517,7 @@ exit_acl:
 	if (dfacl)
 		acl_free(dfacl);
 	return (ret);
+#endif
 }
 
 static int

Modified: vendor/libarchive/dist/libarchive/test/main.c
==============================================================================
--- vendor/libarchive/dist/libarchive/test/main.c	Wed Jun 29 06:55:30 2016	(r302263)
+++ vendor/libarchive/dist/libarchive/test/main.c	Wed Jun 29 07:00:15 2016	(r302264)
@@ -1292,6 +1292,11 @@ assertion_file_time(const char *file, in
 	switch (type) {
 	case 'a': filet_nsec = st.st_atimespec.tv_nsec; break;
 	case 'b': filet = st.st_birthtime;
+		/* FreeBSD filesystems that don't support birthtime
+		 * (e.g., UFS1) always return -1 here. */
+		if (filet == -1) {
+			return (1);
+		}
 		filet_nsec = st.st_birthtimespec.tv_nsec; break;
 	case 'm': filet_nsec = st.st_mtimespec.tv_nsec; break;
 	default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type);

Modified: vendor/libarchive/dist/libarchive/test/test_write_format_gnutar_filenames.c
==============================================================================
--- vendor/libarchive/dist/libarchive/test/test_write_format_gnutar_filenames.c	Wed Jun 29 06:55:30 2016	(r302263)
+++ vendor/libarchive/dist/libarchive/test/test_write_format_gnutar_filenames.c	Wed Jun 29 07:00:15 2016	(r302264)
@@ -42,6 +42,7 @@ DEFINE_TEST(test_write_format_gnutar_fil
 	struct archive_entry *ae, *template;
 	struct archive *a;
 	size_t used;
+	int i;
 
 	buff = malloc(buffsize); /* million bytes of work area */
 	assert(buff != NULL);
@@ -55,7 +56,7 @@ DEFINE_TEST(test_write_format_gnutar_fil
 	archive_entry_set_mode(template, S_IFREG | 0755);
 	archive_entry_set_size(template, 8);
 
-	for (int i = 0; i < 2000; ++i) {
+	for (i = 0; i < 2000; ++i) {
 		filename[i] = 'a';
 		filename[i + 1] = '\0';
 		archive_entry_copy_pathname(template, filename);
@@ -97,6 +98,7 @@ DEFINE_TEST(test_write_format_gnutar_lin
 	struct archive_entry *ae, *template;
 	struct archive *a;
 	size_t used;
+	int i;
 
 	buff = malloc(buffsize); /* million bytes of work area */
 	assert(buff != NULL);
@@ -110,7 +112,7 @@ DEFINE_TEST(test_write_format_gnutar_lin
 	archive_entry_set_mode(template, S_IFLNK | 0755);
 	archive_entry_copy_pathname(template, "link");
 
-	for (int i = 0; i < 2000; ++i) {
+	for (i = 0; i < 2000; ++i) {
 		filename[i] = 'a';
 		filename[i + 1] = '\0';
 		archive_entry_copy_symlink(template, filename);

Modified: vendor/libarchive/dist/libarchive_fe/passphrase.c
==============================================================================
--- vendor/libarchive/dist/libarchive_fe/passphrase.c	Wed Jun 29 06:55:30 2016	(r302263)
+++ vendor/libarchive/dist/libarchive_fe/passphrase.c	Wed Jun 29 07:00:15 2016	(r302264)
@@ -132,6 +132,10 @@ readpassphrase(const char *prompt, char 
 #include <termios.h>
 #include <unistd.h>
 
+#ifndef _PATH_TTY
+#define _PATH_TTY "/dev/tty"
+#endif
+
 #ifdef TCSASOFT
 # define _T_FLUSH	(TCSAFLUSH|TCSASOFT)
 #else



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