From 6ab7c326485b4af46a4e45faef2ac7d469df8840 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 15 Apr 2014 09:07:48 -0400 Subject: [PATCH 1/6] libarchive: Avoid left-shift overflow of signed integer In libarchive/archive_write_set_format_zip.c there are two calls to archive_le32enc whose second argument is of the form archive_entry_mode(zip->entry) << 16 However, the return type from archive_entry_mode may be a signed integer so the shift may overflow. Since the second argument of archive_le32enc expects uint32_t anyway, simply cast to that prior to shifting. --- .../cmlibarchive/libarchive/archive_write_set_format_zip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_zip.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_zip.c index d856b2a12..157f10014 100644 --- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_zip.c +++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_zip.c @@ -621,7 +621,7 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry) archive_le16enc(zip->file_header + 28, filename_length); /* Following Info-Zip, store mode in the "external attributes" field. */ archive_le32enc(zip->file_header + 38, - archive_entry_mode(zip->entry) << 16); + ((uint32_t)archive_entry_mode(zip->entry)) << 16); e = cd_alloc(zip, filename_length); /* If (e == NULL) XXXX */ copy_path(zip->entry, e); @@ -714,7 +714,7 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry) } if (included & 4) { archive_le32enc(e, /* external file attributes */ - archive_entry_mode(zip->entry) << 16); + ((uint32_t)archive_entry_mode(zip->entry)) << 16); e += 4; } if (included & 8) { From 37f225b72c8e4c440025a98f68eda9914f7ba5f7 Mon Sep 17 00:00:00 2001 From: LibArchive Upstream Date: Mon, 14 Apr 2014 19:19:05 -0700 Subject: [PATCH 2/6] libarchive 3.1.2-246-ga5a5d28b (reduced) Extract upstream libarchive using the following shell code. url=git://github.com/libarchive/libarchive.git && v=3.1.2-246-ga5a5d28b && r=a5a5d28b && paths=" CMakeLists.txt COPYING CTestConfig.cmake build/cmake build/pkgconfig build/utils build/version libarchive/*.* " && mkdir libarchive-$v-g$r-reduced && git clone $url libarchive-git && date=$(cd libarchive-git && git log -n 1 --format='%cd' $r) && (cd libarchive-git && git archive --format=tar $r -- $paths) | (cd libarchive-$v-g$r-reduced && tar xv) && fromdos libarchive-$v-g$r-reduced/build/cmake/Find*.cmake && echo "g$r date: $date" --- CMakeLists.txt | 10 ++ build/cmake/config.h.in | 3 + libarchive/CMakeLists.txt | 1 + libarchive/archive_read_extract.c | 134 ++---------------- libarchive/archive_read_extract2.c | 137 +++++++++++++++++++ libarchive/archive_read_private.h | 11 +- libarchive/archive_read_support_format_zip.c | 5 +- libarchive/archive_write_disk_posix.c | 3 +- libarchive/archive_write_set_format_zip.c | 30 ++-- 9 files changed, 195 insertions(+), 139 deletions(-) create mode 100644 libarchive/archive_read_extract2.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 2069c23a4..4bfb7f362 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,7 @@ STRING(REGEX REPLACE "[0]*([^0]*[0-9])$" "\\1" _trimmed_revision ${_revision}) SET(VERSION "${_major}.${_trimmed_minor}.${_trimmed_revision}${_quality}") SET(BSDCPIO_VERSION_STRING "${VERSION}") SET(BSDTAR_VERSION_STRING "${VERSION}") +SET(BSDCAT_VERSION_STRING "${VERSION}") SET(LIBARCHIVE_VERSION_NUMBER "${_version_number}") SET(LIBARCHIVE_VERSION_STRING "${VERSION}") @@ -168,6 +169,8 @@ OPTION(ENABLE_TAR "Enable tar building" ON) OPTION(ENABLE_TAR_SHARED "Enable dynamic build of tar" FALSE) OPTION(ENABLE_CPIO "Enable cpio building" ON) OPTION(ENABLE_CPIO_SHARED "Enable dynamic build of cpio" FALSE) +OPTION(ENABLE_CAT "Enable cat building" ON) +OPTION(ENABLE_CAT_SHARED "Enable dynamic build of cat" FALSE) OPTION(ENABLE_XATTR "Enable extended attribute support" ON) OPTION(ENABLE_ACL "Enable ACL support" ON) OPTION(ENABLE_ICONV "Enable iconv support" ON) @@ -1535,6 +1538,12 @@ ADD_DEFINITIONS(-DHAVE_CONFIG_H) # Handle generation of the libarchive.pc file for pkg-config INCLUDE(CreatePkgConfigFile) +# +# Expose ADDITIONAL_LIBS for projects using libarchive as a subdirectory +# and linking against archive_static. +# +set(LIBARCHIVE_ADDITIONAL_LIBS ${ADDITIONAL_LIBS} CACHE INTERNAL "libarchive dependencies") + # # Register installation of PDF documents. # @@ -1565,5 +1574,6 @@ IF(ENABLE_TEST) ENDIF(ENABLE_TEST) add_subdirectory(libarchive) +add_subdirectory(cat) add_subdirectory(tar) add_subdirectory(cpio) diff --git a/build/cmake/config.h.in b/build/cmake/config.h.in index a6933f694..179ffa7ca 100644 --- a/build/cmake/config.h.in +++ b/build/cmake/config.h.in @@ -289,6 +289,9 @@ typedef uint64_t uintmax_t; /* Version number of bsdtar */ #cmakedefine BSDTAR_VERSION_STRING "${BSDTAR_VERSION_STRING}" +/* Version number of bsdcat */ +#cmakedefine BSDCAT_VERSION_STRING "${BSDCAT_VERSION_STRING}" + /* Define to 1 if you have the `acl_create_entry' function. */ #cmakedefine HAVE_ACL_CREATE_ENTRY 1 diff --git a/libarchive/CMakeLists.txt b/libarchive/CMakeLists.txt index 986af97e6..4a0c15d55 100644 --- a/libarchive/CMakeLists.txt +++ b/libarchive/CMakeLists.txt @@ -54,6 +54,7 @@ SET(libarchive_SOURCES archive_read_disk_private.h archive_read_disk_set_standard_lookup.c archive_read_extract.c + archive_read_extract2.c archive_read_open_fd.c archive_read_open_file.c archive_read_open_filename.c diff --git a/libarchive/archive_read_extract.c b/libarchive/archive_read_extract.c index 795f2abea..ce76a6cad 100644 --- a/libarchive/archive_read_extract.c +++ b/libarchive/archive_read_extract.c @@ -26,146 +26,40 @@ #include "archive_platform.h" __FBSDID("$FreeBSD: src/lib/libarchive/archive_read_extract.c,v 1.61 2008/05/26 17:00:22 kientzle Exp $"); -#ifdef HAVE_SYS_TYPES_H -#include -#endif #ifdef HAVE_ERRNO_H #include #endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_STRING_H -#include -#endif #include "archive.h" #include "archive_entry.h" #include "archive_private.h" #include "archive_read_private.h" -#include "archive_write_disk_private.h" - -struct extract { - struct archive *ad; /* archive_write_disk object */ - - /* Progress function invoked during extract. */ - void (*extract_progress)(void *); - void *extract_progress_user_data; -}; static int archive_read_extract_cleanup(struct archive_read *); -static int copy_data(struct archive *ar, struct archive *aw); -static struct extract *get_extract(struct archive_read *); - -static struct extract * -get_extract(struct archive_read *a) -{ - /* If we haven't initialized, do it now. */ - /* This also sets up a lot of global state. */ - if (a->extract == NULL) { - a->extract = (struct extract *)malloc(sizeof(*a->extract)); - if (a->extract == NULL) { - archive_set_error(&a->archive, ENOMEM, "Can't extract"); - return (NULL); - } - memset(a->extract, 0, sizeof(*a->extract)); - a->extract->ad = archive_write_disk_new(); - if (a->extract->ad == NULL) { - archive_set_error(&a->archive, ENOMEM, "Can't extract"); - return (NULL); - } - archive_write_disk_set_standard_lookup(a->extract->ad); - a->cleanup_archive_extract = archive_read_extract_cleanup; - } - return (a->extract); -} int archive_read_extract(struct archive *_a, struct archive_entry *entry, int flags) { - struct extract *extract; + struct archive_read_extract *extract; + struct archive_read * a = (struct archive_read *)_a; - extract = get_extract((struct archive_read *)_a); + extract = __archive_read_get_extract(a); if (extract == NULL) return (ARCHIVE_FATAL); - archive_write_disk_set_options(extract->ad, flags); - return (archive_read_extract2(_a, entry, extract->ad)); -} -int -archive_read_extract2(struct archive *_a, struct archive_entry *entry, - struct archive *ad) -{ - struct archive_read *a = (struct archive_read *)_a; - int r, r2; - - /* Set up for this particular entry. */ - if (a->skip_file_set) - archive_write_disk_set_skip_file(ad, - a->skip_file_dev, a->skip_file_ino); - r = archive_write_header(ad, entry); - if (r < ARCHIVE_WARN) - r = ARCHIVE_WARN; - if (r != ARCHIVE_OK) - /* If _write_header failed, copy the error. */ - archive_copy_error(&a->archive, ad); - else if (!archive_entry_size_is_set(entry) || archive_entry_size(entry) > 0) - /* Otherwise, pour data into the entry. */ - r = copy_data(_a, ad); - r2 = archive_write_finish_entry(ad); - if (r2 < ARCHIVE_WARN) - r2 = ARCHIVE_WARN; - /* Use the first message. */ - if (r2 != ARCHIVE_OK && r == ARCHIVE_OK) - archive_copy_error(&a->archive, ad); - /* Use the worst error return. */ - if (r2 < r) - r = r2; - return (r); -} - -void -archive_read_extract_set_progress_callback(struct archive *_a, - void (*progress_func)(void *), void *user_data) -{ - struct archive_read *a = (struct archive_read *)_a; - struct extract *extract = get_extract(a); - if (extract != NULL) { - extract->extract_progress = progress_func; - extract->extract_progress_user_data = user_data; - } -} - -static int -copy_data(struct archive *ar, struct archive *aw) -{ - int64_t offset; - const void *buff; - struct extract *extract; - size_t size; - int r; - - extract = get_extract((struct archive_read *)ar); - if (extract == NULL) - return (ARCHIVE_FATAL); - for (;;) { - r = archive_read_data_block(ar, &buff, &size, &offset); - if (r == ARCHIVE_EOF) - return (ARCHIVE_OK); - if (r != ARCHIVE_OK) - return (r); - r = (int)archive_write_data_block(aw, buff, size, offset); - if (r < ARCHIVE_WARN) - r = ARCHIVE_WARN; - if (r != ARCHIVE_OK) { - archive_set_error(ar, archive_errno(aw), - "%s", archive_error_string(aw)); - return (r); + /* If we haven't initialized the archive_write_disk object, do it now. */ + if (extract->ad == NULL) { + extract->ad = archive_write_disk_new(); + if (extract->ad == NULL) { + archive_set_error(&a->archive, ENOMEM, "Can't extract"); + return (ARCHIVE_FATAL); } - if (extract->extract_progress) - (extract->extract_progress) - (extract->extract_progress_user_data); + archive_write_disk_set_standard_lookup(extract->ad); + a->cleanup_archive_extract = archive_read_extract_cleanup; } + + archive_write_disk_set_options(extract->ad, flags); + return (archive_read_extract2(&a->archive, entry, extract->ad)); } /* diff --git a/libarchive/archive_read_extract2.c b/libarchive/archive_read_extract2.c new file mode 100644 index 000000000..3c65e8040 --- /dev/null +++ b/libarchive/archive_read_extract2.c @@ -0,0 +1,137 @@ +/*- + * 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_extract.c,v 1.61 2008/05/26 17:00:22 kientzle Exp $"); + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_ERRNO_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif + +#include "archive.h" +#include "archive_entry.h" +#include "archive_private.h" +#include "archive_read_private.h" + +static int copy_data(struct archive *ar, struct archive *aw); + +/* Retrieve an extract object without initialising the associated + * archive_write_disk object. + */ +struct archive_read_extract * +__archive_read_get_extract(struct archive_read *a) +{ + if (a->extract == NULL) { + a->extract = (struct archive_read_extract *)malloc(sizeof(*a->extract)); + if (a->extract == NULL) { + archive_set_error(&a->archive, ENOMEM, "Can't extract"); + return (NULL); + } + memset(a->extract, 0, sizeof(*a->extract)); + } + return (a->extract); +} + +int +archive_read_extract2(struct archive *_a, struct archive_entry *entry, + struct archive *ad) +{ + struct archive_read *a = (struct archive_read *)_a; + int r, r2; + + /* Set up for this particular entry. */ + if (a->skip_file_set) + archive_write_disk_set_skip_file(ad, + a->skip_file_dev, a->skip_file_ino); + r = archive_write_header(ad, entry); + if (r < ARCHIVE_WARN) + r = ARCHIVE_WARN; + if (r != ARCHIVE_OK) + /* If _write_header failed, copy the error. */ + archive_copy_error(&a->archive, ad); + else if (!archive_entry_size_is_set(entry) || archive_entry_size(entry) > 0) + /* Otherwise, pour data into the entry. */ + r = copy_data(_a, ad); + r2 = archive_write_finish_entry(ad); + if (r2 < ARCHIVE_WARN) + r2 = ARCHIVE_WARN; + /* Use the first message. */ + if (r2 != ARCHIVE_OK && r == ARCHIVE_OK) + archive_copy_error(&a->archive, ad); + /* Use the worst error return. */ + if (r2 < r) + r = r2; + return (r); +} + +void +archive_read_extract_set_progress_callback(struct archive *_a, + void (*progress_func)(void *), void *user_data) +{ + struct archive_read *a = (struct archive_read *)_a; + struct archive_read_extract *extract = __archive_read_get_extract(a); + if (extract != NULL) { + extract->extract_progress = progress_func; + extract->extract_progress_user_data = user_data; + } +} + +static int +copy_data(struct archive *ar, struct archive *aw) +{ + int64_t offset; + const void *buff; + struct archive_read_extract *extract; + size_t size; + int r; + + extract = __archive_read_get_extract((struct archive_read *)ar); + if (extract == NULL) + return (ARCHIVE_FATAL); + for (;;) { + r = archive_read_data_block(ar, &buff, &size, &offset); + if (r == ARCHIVE_EOF) + return (ARCHIVE_OK); + if (r != ARCHIVE_OK) + return (r); + r = (int)archive_write_data_block(aw, buff, size, offset); + if (r < ARCHIVE_WARN) + r = ARCHIVE_WARN; + if (r != ARCHIVE_OK) { + archive_set_error(ar, archive_errno(aw), + "%s", archive_error_string(aw)); + return (r); + } + if (extract->extract_progress) + (extract->extract_progress) + (extract->extract_progress_user_data); + } +} diff --git a/libarchive/archive_read_private.h b/libarchive/archive_read_private.h index 6636a5968..27e203b7f 100644 --- a/libarchive/archive_read_private.h +++ b/libarchive/archive_read_private.h @@ -142,6 +142,14 @@ struct archive_read_client { struct archive_read_data_node *dataset; }; +struct archive_read_extract { + struct archive *ad; /* archive_write_disk object */ + + /* Progress function invoked during extract. */ + void (*extract_progress)(void *); + void *extract_progress_user_data; +}; + struct archive_read { struct archive archive; @@ -215,7 +223,7 @@ struct archive_read { /* * Various information needed by archive_extract. */ - struct extract *extract; + struct archive_read_extract *extract; int (*cleanup_archive_extract)(struct archive_read *); }; @@ -245,4 +253,5 @@ int64_t __archive_read_filter_consume(struct archive_read_filter *, int64_t); int __archive_read_program(struct archive_read_filter *, const char *); void __archive_read_free_filters(struct archive_read *); int __archive_read_close_filters(struct archive_read *); +struct archive_read_extract *__archive_read_get_extract(struct archive_read *); #endif diff --git a/libarchive/archive_read_support_format_zip.c b/libarchive/archive_read_support_format_zip.c index 4460b304b..dbe245e15 100644 --- a/libarchive/archive_read_support_format_zip.c +++ b/libarchive/archive_read_support_format_zip.c @@ -204,10 +204,11 @@ compression_name(const int compression) { static const int num_compression_methods = sizeof(compression_methods)/sizeof(compression_methods[0]); int i=0; - while(compression >= 0 && i++ < num_compression_methods) { + while(compression >= 0 && i < num_compression_methods) { if (compression_methods[i].id == compression) { return compression_methods[i].name; } + i++; } return "??"; } @@ -743,7 +744,7 @@ zip_read_local_file_header(struct archive_read *a, struct archive_entry *entry, zip->end_of_entry = 1; /* Set up a more descriptive format name. */ - sprintf(zip->format_name, "ZIP %d.%d (%s)", + snprintf(zip->format_name, sizeof(zip->format_name), "ZIP %d.%d (%s)", version / 10, version % 10, compression_name(zip->entry->compression)); a->archive.archive_format_name = zip->format_name; diff --git a/libarchive/archive_write_disk_posix.c b/libarchive/archive_write_disk_posix.c index bbd50a637..1fac4cecf 100644 --- a/libarchive/archive_write_disk_posix.c +++ b/libarchive/archive_write_disk_posix.c @@ -2215,7 +2215,8 @@ _archive_write_disk_free(struct archive *_a) free(a->resource_fork); free(a->compressed_buffer); free(a->uncompressed_buffer); -#ifdef HAVE_ZLIB_H +#if defined(__APPLE__) && defined(UF_COMPRESSED) && defined(HAVE_SYS_XATTR_H)\ + && defined(HAVE_ZLIB_H) if (a->stream_valid) { switch (deflateEnd(&a->stream)) { case Z_OK: diff --git a/libarchive/archive_write_set_format_zip.c b/libarchive/archive_write_set_format_zip.c index ccd50ea90..6ecf468c4 100644 --- a/libarchive/archive_write_set_format_zip.c +++ b/libarchive/archive_write_set_format_zip.c @@ -405,8 +405,8 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry) unsigned char *e; unsigned char *cd_extra; size_t filename_length; - const char *symlink = NULL; - size_t symlink_size = 0; + const char *slink = NULL; + size_t slink_size = 0; struct archive_string_conv *sconv = get_sconv(a, zip); int ret, ret2 = ARCHIVE_OK; int64_t size; @@ -528,16 +528,16 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry) /* Determine appropriate compression and size for this entry. */ if (type == AE_IFLNK) { - symlink = archive_entry_symlink(zip->entry); - if (symlink != NULL) - symlink_size = strlen(symlink); + slink = archive_entry_symlink(zip->entry); + if (slink != NULL) + slink_size = strlen(slink); else - symlink_size = 0; - zip->entry_uncompressed_limit = symlink_size; - zip->entry_compressed_size = symlink_size; - zip->entry_uncompressed_size = symlink_size; + slink_size = 0; + zip->entry_uncompressed_limit = slink_size; + zip->entry_compressed_size = slink_size; + zip->entry_uncompressed_size = slink_size; zip->entry_crc32 = zip->crc32func(zip->entry_crc32, - (const unsigned char *)symlink, symlink_size); + (const unsigned char *)slink, slink_size); zip->entry_compression = COMPRESSION_STORE; version_needed = 20; } else if (type != AE_IFREG) { @@ -742,13 +742,13 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry) zip->written_bytes += e - local_extra; /* For symlinks, write the body now. */ - if (symlink != NULL) { - ret = __archive_write_output(a, symlink, (size_t)symlink_size); + if (slink != NULL) { + ret = __archive_write_output(a, slink, slink_size); if (ret != ARCHIVE_OK) return (ARCHIVE_FATAL); - zip->entry_compressed_written += symlink_size; - zip->entry_uncompressed_written += symlink_size; - zip->written_bytes += symlink_size; + zip->entry_compressed_written += slink_size; + zip->entry_uncompressed_written += slink_size; + zip->written_bytes += slink_size; } #ifdef HAVE_ZLIB_H From 44d6b82f4351dc3941fd9794ad8f3909148c0314 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 15 Apr 2014 16:34:17 -0400 Subject: [PATCH 3/6] libarchive: Disable all whitespace checks in third-party code --- Utilities/cmlibarchive/.gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/cmlibarchive/.gitattributes b/Utilities/cmlibarchive/.gitattributes index a87f192bd..562b12e16 100644 --- a/Utilities/cmlibarchive/.gitattributes +++ b/Utilities/cmlibarchive/.gitattributes @@ -1 +1 @@ -* whitespace=-indent-with-non-tab,-tab-in-indent,-blank-at-eol,-blank-at-eof +* -whitespace From 61a649d974b7810ec6073ef088e1b65c1277dbda Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 15 Apr 2014 16:36:44 -0400 Subject: [PATCH 4/6] libarchive: Update README-CMake.txt for new snapshot --- Utilities/cmlibarchive/README-CMake.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Utilities/cmlibarchive/README-CMake.txt b/Utilities/cmlibarchive/README-CMake.txt index 7cbee4c88..8f3b29b71 100644 --- a/Utilities/cmlibarchive/README-CMake.txt +++ b/Utilities/cmlibarchive/README-CMake.txt @@ -11,7 +11,7 @@ branch, but it is merged into our history. Update libarchive from upstream as follows. Create a local branch to explicitly reference the upstream snapshot branch head: - git branch libarchive-upstream 64713ae3 + git branch libarchive-upstream 37f225b7 Use a temporary directory to checkout the branch: @@ -24,7 +24,7 @@ Use a temporary directory to checkout the branch: Now place the (reduced) libarchive content in this directory. See instructions shown by - git log 64713ae3 + git log 37f225b7 for help extracting the content from the upstream svn repo. Then run the following commands to commit the new version. Substitute the @@ -34,8 +34,8 @@ appropriate date and version number: GIT_AUTHOR_NAME='LibArchive Upstream' \ GIT_AUTHOR_EMAIL='libarchive-discuss@googlegroups.com' \ - GIT_AUTHOR_DATE='Mon Mar 17 20:43:07 2014 -0700' \ - git commit -m 'libarchive 3.1.2-218-g00f4bd83 (reduced)' && + GIT_AUTHOR_DATE='Mon Apr 14 19:19:05 2014 -0700' \ + git commit -m 'libarchive 3.1.2-246-ga5a5d28b (reduced)' && git commit --amend Edit the commit message to describe the procedure used to obtain the From fcfbb0a9244ff52d03fec67de7a2a8d0ff406db3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 15 Apr 2014 16:37:52 -0400 Subject: [PATCH 5/6] libarchive: Drop LIBARCHIVE_ADDITIONAL_LIBS, CMake does not need it --- Utilities/cmlibarchive/CMakeLists.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt index 77010c55a..4bfc2056a 100644 --- a/Utilities/cmlibarchive/CMakeLists.txt +++ b/Utilities/cmlibarchive/CMakeLists.txt @@ -1291,12 +1291,6 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) ADD_DEFINITIONS(-DHAVE_CONFIG_H) -# -# Expose ADDITIONAL_LIBS for projects using libarchive as a subdirectory -# and linking against archive_static. -# -set(LIBARCHIVE_ADDITIONAL_LIBS ${ADDITIONAL_LIBS} CACHE INTERNAL "libarchive dependencies") - # # Register installation of PDF documents. # From 67f5f0a9fd012f3da7cadf653102671a8f316718 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 15 Apr 2014 16:52:18 -0400 Subject: [PATCH 6/6] libarchive: Use _snprintf on Windows, not snprintf --- .../cmlibarchive/libarchive/archive_read_support_format_zip.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c index b2614a021..5ef29523b 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c @@ -64,6 +64,10 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_zip.c 201102 #include "archive_crc32.h" #endif +#if defined(_WIN32) && !defined(__CYGWIN__) +# define snprintf _snprintf +#endif + struct zip_entry { struct archive_rb_node node; struct zip_entry *next;