[Midnightbsd-cvs] src: lib/libarchive: Merge changes.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Thu Oct 30 16:54:48 EDT 2008


Log Message:
-----------
Merge changes.

Modified Files:
--------------
    src/lib/libarchive:
        Makefile (r1.4 -> r1.5)
        archive_read_support_compression_none.c (r1.2 -> r1.3)
        archive_read_support_format_tar.c (r1.3 -> r1.4)
        archive_read_support_format_zip.c (r1.2 -> r1.3)
        archive_write_set_format_cpio.c (r1.2 -> r1.3)
        archive_write_set_format_cpio_newc.c (r1.1 -> r1.2)

Removed Files:
-------------
    src/lib/libarchive:
        INSTALL
        Makefile.am
        archive_read_data_into_buffer.c
        configure.ac.in
    src/lib/libarchive/test:
        libarchive_test

-------------- next part --------------
Index: archive_read_support_format_zip.c
===================================================================
RCS file: /home/cvs/src/lib/libarchive/archive_read_support_format_zip.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libarchive/archive_read_support_format_zip.c -L lib/libarchive/archive_read_support_format_zip.c -u -r1.2 -r1.3
--- lib/libarchive/archive_read_support_format_zip.c
+++ lib/libarchive/archive_read_support_format_zip.c
@@ -24,7 +24,7 @@
  */
 
 #include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_zip.c,v 1.14 2007/07/15 19:13:59 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_zip.c,v 1.14.2.2 2007/12/08 07:52:40 kientzle Exp $");
 
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
@@ -335,6 +335,11 @@
 	zip->entry_bytes_remaining = zip->compressed_size;
 	zip->entry_offset = 0;
 
+	/* If there's no body, force read_data() to return EOF immediately. */
+	if (0 == (zip->flags & ZIP_LENGTH_AT_END)
+	    && zip->entry_bytes_remaining < 1)
+		zip->end_of_entry = 1;
+
 	/* Set up a more descriptive format name. */
 	sprintf(zip->format_name, "ZIP %d.%d (%s)",
 	    zip->version / 10, zip->version % 10,
@@ -422,6 +427,9 @@
 			/* End-of-entry cleanup done. */
 			zip->end_of_entry_cleanup = 1;
 		}
+		*offset = zip->entry_uncompressed_bytes_read;
+		*size = 0;
+		*buff = NULL;
 		return (ARCHIVE_EOF);
 	}
 
Index: archive_read_support_format_tar.c
===================================================================
RCS file: /home/cvs/src/lib/libarchive/archive_read_support_format_tar.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -L lib/libarchive/archive_read_support_format_tar.c -L lib/libarchive/archive_read_support_format_tar.c -u -r1.3 -r1.4
--- lib/libarchive/archive_read_support_format_tar.c
+++ lib/libarchive/archive_read_support_format_tar.c
@@ -24,7 +24,7 @@
  */
 
 #include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_tar.c,v 1.61 2007/08/18 21:53:25 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_tar.c,v 1.61.2.1 2007/10/29 03:28:28 kientzle Exp $");
 
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
@@ -164,6 +164,7 @@
 	struct sparse_block	*sparse_last;
 	int64_t			 sparse_offset;
 	int64_t			 sparse_numbytes;
+	int64_t			 sparse_realsize;
 	int			 sparse_gnu_major;
 	int			 sparse_gnu_minor;
 	char			 sparse_gnu_pending;
@@ -440,6 +441,7 @@
 		free(sp);
 	}
 	tar->sparse_last = NULL;
+	tar->sparse_realsize = -1; /* Mark this as "unset" */
 
 	r = tar_read_header(a, tar, entry);
 
@@ -1388,9 +1390,10 @@
 		}
 		if (wcscmp(key, L"GNU.sparse.name") == 0)
 			archive_entry_copy_pathname_w(entry, value);
-		if (wcscmp(key, L"GNU.sparse.realsize") == 0)
-			archive_entry_set_size(entry,
-			    tar_atol10(value, wcslen(value)));
+		if (wcscmp(key, L"GNU.sparse.realsize") == 0) {
+			tar->sparse_realsize = tar_atol10(value, wcslen(value));
+			archive_entry_set_size(entry, tar->sparse_realsize);
+		}
 		break;
 	case 'L':
 		/* Our extensions */
@@ -1471,11 +1474,22 @@
 		/* POSIX has reserved 'security.*' */
 		/* Someday: if (wcscmp(key, L"security.acl")==0) { ... } */
 		if (wcscmp(key, L"size")==0) {
-			tar->entry_bytes_remaining = tar_atol10(value, wcslen(value));
-			archive_entry_set_size(entry, tar->entry_bytes_remaining);
+			/* "size" is the size of the data in the entry. */
+			tar->entry_bytes_remaining
+			    = tar_atol10(value, wcslen(value));
+			/*
+			 * But, "size" is not necessarily the size of
+			 * the file on disk; if this is a sparse file,
+			 * the disk size may have already been set from
+			 * GNU.sparse.realsize.
+			 */
+			if (tar->sparse_realsize < 0) {
+				archive_entry_set_size(entry,
+				    tar->entry_bytes_remaining);
+				tar->sparse_realsize
+				    = tar->entry_bytes_remaining;
+			}
 		}
-		tar->entry_bytes_remaining = 0;
-
 		break;
 	case 'u':
 		if (wcscmp(key, L"uid")==0)
Index: archive_read_support_compression_none.c
===================================================================
RCS file: /home/cvs/src/lib/libarchive/archive_read_support_compression_none.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libarchive/archive_read_support_compression_none.c -L lib/libarchive/archive_read_support_compression_none.c -u -r1.2 -r1.3
--- lib/libarchive/archive_read_support_compression_none.c
+++ lib/libarchive/archive_read_support_compression_none.c
@@ -24,7 +24,7 @@
  */
 
 #include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_compression_none.c,v 1.17 2007/05/29 01:00:19 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_compression_none.c,v 1.17.2.1 2007/11/02 08:42:14 kientzle Exp $");
 
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
@@ -334,7 +334,7 @@
 		const void* dummy_buffer;
 		ssize_t bytes_read;
 		bytes_read = archive_decompressor_none_read_ahead(a,
-		    &dummy_buffer, request);
+		    &dummy_buffer, 1);
 		if (bytes_read < 0)
 			return (bytes_read);
 		if (bytes_read == 0) {
--- lib/libarchive/archive_read_data_into_buffer.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * Copyright (c) 2003-2007 Tim Kientzle
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_data_into_buffer.c,v 1.4.8.1 2007/01/27 06:44:52 kientzle Exp $");
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-#include "archive.h"
-
-int
-archive_read_data_into_buffer(struct archive *a, void *d, ssize_t len)
-{
-	char *dest;
-	ssize_t bytes_read, total_bytes;
-
-	dest = (char *)d;
-	total_bytes = 0;
-	bytes_read = archive_read_data(a, dest, len);
-	while (bytes_read > 0) {
-		total_bytes += bytes_read;
-		bytes_read = archive_read_data(a, dest + total_bytes,
-		    len - total_bytes);
-	}
-	return (ARCHIVE_OK);
-}
--- lib/libarchive/configure.ac.in
+++ /dev/null
@@ -1,87 +0,0 @@
-# $FreeBSD: src/lib/libarchive/configure.ac.in,v 1.6 2005/06/04 22:30:36 kientzle Exp $
-
-#Process this file with autoconf to produce a configure script.
-AC_INIT(libarchive, @VERSION@, kientzle at freebsd.org)
-AM_INIT_AUTOMAKE(libarchive, @VERSION@)
-AC_CONFIG_SRCDIR([archive_write_set_format_ustar.c])
-AM_CONFIG_HEADER([config.h])
-
-# Checks for programs.
-AC_PROG_CC
-AC_PROG_RANLIB
-AC_CHECK_TOOL([STRIP],[strip])
-
-# Checks for libraries.
-# Since libarchive is a library, we don't need this for linkage,
-# but we do need it for later ACL function tests.
-AC_CHECK_LIB(acl,acl_set_file)
-
-# Checks for header files.
-AC_HEADER_STDC
-AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS([bzlib.h errno.h ext2fs/ext2_fs.h fcntl.h])
-AC_CHECK_HEADERS([inttypes.h limits.h linux/ext2_fs.h])
-AC_CHECK_HEADERS([stdint.h stdlib.h string.h sys/acl.h sys/ioctl.h])
-AC_CHECK_HEADERS([sys/time.h unistd.h wchar.h zlib.h])
-
-# Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST
-AC_TYPE_UID_T
-AC_TYPE_MODE_T
-AC_CHECK_TYPE(off_t, [int64_t])
-AC_TYPE_SIZE_T
-AC_CHECK_TYPE(id_t, [unsigned long])
-
-#
-# If any of the common 64-bit types is defined, set "int64_t"
-#
-AC_CHECK_TYPE(__int64_t, [long long])
-AC_CHECK_TYPE(_int64_t, [__int64_t])
-AC_CHECK_TYPE(int64_t, [_int64_t])
-
-# Likewise, consider defining "intmax_t" in terms of int64_t
-AC_CHECK_TYPE(intmax_t, [int64_t])
-
-#
-# If any of the common 64-bit unsigned types is defined, set "uint64_t"
-#
-AC_CHECK_TYPE(__uint64_t, [unsigned long long])
-AC_CHECK_TYPE(_uint64_t, [__uint64_t])
-AC_CHECK_TYPE(u_int64_t, [_uint64_t])
-AC_CHECK_TYPE(uint64_t, [u_int64_t])
-
-# Likewise, consider defining "uintmax_t" in terms of uint64_t
-AC_CHECK_TYPE(uintmax_t, [uint64_t])
-
-AC_CHECK_MEMBERS([struct stat.st_rdev, struct stat.st_mtimespec.tv_nsec, struct stat.st_mtim.tv_nsec])
-
-AC_CHECK_DECL([EFTYPE],
-		[AC_DEFINE(HAVE_EFTYPE, 1, [A possible errno value for invalid file format errors])],
-		[],
-		[#include <errno.h>])
-AC_CHECK_DECL([EILSEQ],
-		[AC_DEFINE(HAVE_EILSEQ, 1, [A possible errno value for invalid file format errors])],
-		[],
-		[#include <errno.h>])
-AC_HEADER_TIME
-
-# Checks for library functions.
-AC_PROG_GCC_TRADITIONAL
-AC_HEADER_MAJOR
-AC_FUNC_MALLOC
-AC_FUNC_MEMCMP
-AC_FUNC_STAT
-AC_FUNC_STRERROR_R
-AC_CHECK_FUNCS([acl_create_entry acl_init acl_set_fd acl_set_fd_np acl_set_file])
-AC_CHECK_FUNCS([chflags fchdir fchflags fchmod fchown futimes])
-AC_CHECK_FUNCS([lchflags lchmod lchown lutimes memmove])
-AC_CHECK_FUNCS([memset mkdir mkfifo strchr strdup strerror strrchr])
-
-# Additional requirements
-AC_SYS_LARGEFILE
-AC_SUBST(ARCHIVE_API_VERSION,[1])
-AC_SUBST(ARCHIVE_API_FEATURE,[1])
-
-AC_CONFIG_FILES([Makefile])
-AC_CONFIG_FILES([archive.h])
-AC_OUTPUT
--- lib/libarchive/Makefile.am
+++ /dev/null
@@ -1,62 +0,0 @@
-# $FreeBSD: src/lib/libarchive/Makefile.am,v 1.3 2005/01/25 06:07:28 kientzle Exp $
-
-lib_LIBRARIES=	libarchive.a
-
-include_HEADERS= archive_entry.h
-# Note: archive.h is built from archive.h.in, so don't
-# include archive.h in the distfile, but do install it.
-nodist_include_HEADERS= archive.h
-
-libarchive_a_SOURCES=					\
-	archive_check_magic.c				\
-	archive_entry.c					\
-	archive_entry.h					\
-	archive_platform.h				\
-	archive_private.h				\
-	archive_read.c					\
-	archive_read_data_into_buffer.c			\
-	archive_read_data_into_fd.c			\
-	archive_read_extract.c				\
-	archive_read_open_fd.c				\
-	archive_read_open_file.c			\
-	archive_read_support_compression_all.c		\
-	archive_read_support_compression_bzip2.c	\
-	archive_read_support_compression_compress.c	\
-	archive_read_support_compression_gzip.c		\
-	archive_read_support_compression_none.c		\
-	archive_read_support_format_all.c		\
-	archive_read_support_format_cpio.c		\
-	archive_read_support_format_iso9660.c		\
-	archive_read_support_format_tar.c		\
-	archive_read_support_format_zip.c		\
-	archive_string.c				\
-	archive_string.h				\
-	archive_string_sprintf.c			\
-	archive_util.c					\
-	archive_write.c					\
-	archive_write_open_fd.c				\
-	archive_write_open_file.c			\
-	archive_write_set_compression_bzip2.c		\
-	archive_write_set_compression_gzip.c		\
-	archive_write_set_compression_none.c		\
-	archive_write_set_format.c			\
-	archive_write_set_format_by_name.c		\
-	archive_write_set_format_cpio.c			\
-	archive_write_set_format_pax.c			\
-	archive_write_set_format_shar.c			\
-	archive_write_set_format_ustar.c
-
-dist_man_MANS=	archive_entry.3				\
-	archive_read.3					\
-	archive_util.3					\
-	archive_write.3					\
-	libarchive.3					\
-	libarchive-formats.5				\
-	tar.5
-
-distclean-local:
-	-rm -rf autom4te.cache/
-	-rm -f *~
-
-maintainer-clean-local:
-	make -f Makefile.freebsd maintainer-clean
Index: archive_write_set_format_cpio_newc.c
===================================================================
RCS file: /home/cvs/src/lib/libarchive/archive_write_set_format_cpio_newc.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -L lib/libarchive/archive_write_set_format_cpio_newc.c -L lib/libarchive/archive_write_set_format_cpio_newc.c -u -r1.1 -r1.2
--- lib/libarchive/archive_write_set_format_cpio_newc.c
+++ lib/libarchive/archive_write_set_format_cpio_newc.c
@@ -25,7 +25,7 @@
  */
 
 #include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_cpio_newc.c,v 1.1 2007/06/22 05:47:00 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_cpio_newc.c,v 1.1.4.1 2007/10/21 22:17:25 kientzle Exp $");
 
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
@@ -148,12 +148,17 @@
 	format_hex(pathlength, &h.c_namesize, sizeof(h.c_namesize));
 	format_hex(0, &h.c_checksum, sizeof(h.c_checksum));
 
+	/* Non-regular files don't store bodies. */
+	if (archive_entry_filetype(entry) != AE_IFREG)
+		archive_entry_set_size(entry, 0);
+
 	/* Symlinks get the link written as the body of the entry. */
 	p = archive_entry_symlink(entry);
 	if (p != NULL  &&  *p != '\0')
 		format_hex(strlen(p), &h.c_filesize, sizeof(h.c_filesize));
 	else
-		format_hex(archive_entry_size(entry), &h.c_filesize, sizeof(h.c_filesize));
+		format_hex(archive_entry_size(entry),
+		    &h.c_filesize, sizeof(h.c_filesize));
 
 	ret = (a->compressor.write)(a, &h, sizeof(h));
 	if (ret != ARCHIVE_OK)
Index: archive_write_set_format_cpio.c
===================================================================
RCS file: /home/cvs/src/lib/libarchive/archive_write_set_format_cpio.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libarchive/archive_write_set_format_cpio.c -L lib/libarchive/archive_write_set_format_cpio.c -u -r1.2 -r1.3
--- lib/libarchive/archive_write_set_format_cpio.c
+++ lib/libarchive/archive_write_set_format_cpio.c
@@ -24,7 +24,7 @@
  */
 
 #include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_cpio.c,v 1.11 2007/05/29 01:00:19 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_cpio.c,v 1.11.2.1 2007/10/21 22:17:25 kientzle Exp $");
 
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
@@ -142,12 +142,17 @@
 	format_octal(archive_entry_mtime(entry), &h.c_mtime, sizeof(h.c_mtime));
 	format_octal(pathlength, &h.c_namesize, sizeof(h.c_namesize));
 
+	/* Non-regular files don't store bodies. */
+	if (archive_entry_filetype(entry) != AE_IFREG)
+		archive_entry_set_size(entry, 0);
+
 	/* Symlinks get the link written as the body of the entry. */
 	p = archive_entry_symlink(entry);
 	if (p != NULL  &&  *p != '\0')
 		format_octal(strlen(p), &h.c_filesize, sizeof(h.c_filesize));
 	else
-		format_octal(archive_entry_size(entry), &h.c_filesize, sizeof(h.c_filesize));
+		format_octal(archive_entry_size(entry),
+		    &h.c_filesize, sizeof(h.c_filesize));
 
 	ret = (a->compressor.write)(a, &h, sizeof(h));
 	if (ret != ARCHIVE_OK)
--- lib/libarchive/INSTALL
+++ /dev/null
@@ -1,39 +0,0 @@
-How you install this depends on which distribution you
-are using and what target you're compiling for:
-
-FROM A PACKAGED DISTRIBUTION TO ANY SYSTEM
-
-If you unpacked this from a tar.gz archive and have a "configure"
-file, then you should be able to install it using the following common
-steps:
-    ./configure
-    make
-    make install
-
-If you need to customize the target directories, use
-    ./configure --help
-to list the configure options.
-
-FROM CVS TO FreeBSD
-
-The source code from the FreeBSD CVS server can be
-compiled as-is on any FreeBSD system, just use:
-    make
-    make install
-
-FROM CVS TO A PACKAGED DISTRIBUTION
-
-The source code from the FreeBSD CVS server can be used
-to build a tar.gz archive suitable for later installation on
-any system.  You'll need the following GNU tools installed:
-    autoconf (including aclocal and autoheader)
-    automake
-
-You should be able to use the following command to build a distribution:
-    make distfile
-
-The result will be a file named libarchive-<version>.tar.gz in
-the object directory.
-
-$FreeBSD: src/lib/libarchive/INSTALL,v 1.1 2004/08/07 03:09:28 kientzle Exp $
-
Index: Makefile
===================================================================
RCS file: /home/cvs/src/lib/libarchive/Makefile,v
retrieving revision 1.4
retrieving revision 1.5
diff -L lib/libarchive/Makefile -L lib/libarchive/Makefile -u -r1.4 -r1.5
--- lib/libarchive/Makefile
+++ lib/libarchive/Makefile
@@ -1,9 +1,8 @@
 # $FreeBSD: src/lib/libarchive/Makefile,v 1.77 2007/07/15 19:10:34 kientzle Exp $
-# $MidnightBSD$
 
 LIB=	archive
-#DPADD=	${LIBBZ2} ${LIBZ}
-#LDADD=	-lbz2 -lz
+DPADD=	${LIBBZ2} ${LIBZ}
+LDADD=	-lbz2 -lz
 
 # The libarchive version stamp.
 # Version is three numbers:
@@ -20,8 +19,9 @@
 # that's not available during installworld.  Fortunately, awk is.
 ARCHIVE_VERSION_STAMP!=	echo ${ARCHIVE_API_MAJOR} ${ARCHIVE_API_MINOR} ${ARCHIVE_API_REV} | awk '{printf("%d%03d%03d",$$1,$$2,$$3)}'
 
-
-SHLIB_MAJOR= 2
+# FreeBSD SHLIB_MAJOR value is managed as part of the FreeBSD system.
+# It has no real relation to the version number above.
+SHLIB_MAJOR= 4
 
 CFLAGS+=	-DPACKAGE_NAME=\"lib${LIB}\"
 CFLAGS+=	-DPACKAGE_VERSION=\"${VERSION}\"
@@ -34,7 +34,7 @@
 INCS=	archive.h archive_entry.h
 
 # Build archive.h from archive.h.in by substituting version information.
-# Note: mbsd has inttypes.h, so enable that include in archive.h.in
+# Note: FreeBSD has inttypes.h, so enable that include in archive.h.in
 archive.h:	archive.h.in Makefile
 	cat ${.CURDIR}/archive.h.in | sed				\
 		-e 's/@ARCHIVE_VERSION@/${VERSION}/g'	 		\
@@ -246,8 +246,6 @@
 MLINKS+=	archive_write_disk.3 archive_write_disk_set_user_lookup.3
 MLINKS+=	libarchive.3 archive.3
 
-.PHONY: test
-
 test:
 	cd ${.CURDIR}/test && make test
 
Binary files - and /dev/null differ


More information about the Midnightbsd-cvs mailing list