libarchive 3.2 - Update to new version

Update to new version 3.2 and rekey msys2.patch.  Remove
0001-mtree-fix-line-filename-length-calculation.patch',
libarchive-3.1.3-CVE-2013-0211_read_buffer_overflow.patch,
libarchive-3.1.2-acl.patch, and  'libarchive-3.1.2-sparce-mtree.patch
because they are in the source-code now.
Add validpgpkeys array
This commit is contained in:
J. Peter Mugaas
2016-05-17 06:39:03 -04:00
parent f4207b1a3d
commit 73649cd0a3
9 changed files with 50 additions and 822 deletions

View File

@@ -1,29 +0,0 @@
From e65bf287f0133426b26611fe3e80b51267987106 Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Thu, 21 Feb 2013 19:01:06 -0500
Subject: [PATCH] mtree: fix line filename length calculation. Fixes #301.
Signed-off-by: Andres Mejia <amejia004@gmail.com>
---
libarchive/archive_write_set_format_mtree.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libarchive/archive_write_set_format_mtree.c b/libarchive/archive_write_set_format_mtree.c
index 9c0613c..f37f723 100644
--- a/libarchive/archive_write_set_format_mtree.c
+++ b/libarchive/archive_write_set_format_mtree.c
@@ -1855,9 +1855,9 @@ mtree_entry_setup_filenames(struct archive_write *a, struct mtree_entry *file,
return (ret);
}
- /* Make a basename from dirname and slash */
+ /* Make a basename from file->parentdir.s and slash */
*slash = '\0';
- file->parentdir.length = slash - dirname;
+ file->parentdir.length = slash - file->parentdir.s;
archive_strcpy(&(file->basename), slash + 1);
return (ret);
}
--
1.8.1.4

View File

@@ -1,8 +1,8 @@
# Maintainer: Alexey Pavlov <alexpux@gmail.com>
pkgname=('libarchive' 'libarchive-devel' 'bsdcpio' 'bsdtar')
pkgver=3.1.2
pkgrel=5
pkgver=3.2.0
pkgrel=1
pkgdesc="library that can create and read several streaming archive formats"
arch=('i686' 'x86_64')
url="http://libarchive.org/"
@@ -13,36 +13,15 @@ makedepends=('libbz2-devel' 'libiconv-devel' 'liblzma-devel' 'liblzo2-devel' 'li
options=('!strip' 'debug' 'libtool')
# provides=('libarchive.so')
source=("http://libarchive.org/downloads/$pkgname-$pkgver.tar.gz"
'0001-mtree-fix-line-filename-length-calculation.patch'
'libarchive-3.1.3-CVE-2013-0211_read_buffer_overflow.patch'
'libarchive-3.1.2-acl.patch'
'libarchive-3.1.2-msys2.patch'
'libarchive-3.1.2-sparce-mtree.patch')
sha256sums=('eb87eacd8fe49e8d90c8fdc189813023ccc319c5e752b01fb6ad0cc7b2c53d5e'
'd6f82f33bb35680d391476225fcdbb1bf67b4ffb1e8c8094d89fbf907ebd1e63'
'2e390980be2bce0da109847e61164e38fb41f5ad203ddbf7f0426bad4d16b980'
'41f94b16da2acb8af4c441b221736f0f7fec4ac5ba6ed29e3ccfb8b30e2322e6'
'031e4c9f096e007c50e6d5f7ef955a2f0527f80f301e6832ca0b24dd409f26c5'
'0964edfa27c189b667e3a3424ab7e6a03460e9735210f6e4f07fcecef596e7d6')
'libarchive-3.2.0-msys2.patch')
sha256sums=('7bce45fd71ff01dc20d19edd78322d4965583d81b8bed8e26cacb65d6f5baa87'
'639f316243509470c6f8132e59104a49bfb8df61be9722887d145a1b7262286c')
prepare() {
cd "$pkgname-$pkgver"
# https://code.google.com/p/libarchive/issues/detail?id=301
# upstream commit e65bf287f0133426b26611fe3e80b51267987106
patch -Np1 -i "$srcdir/0001-mtree-fix-line-filename-length-calculation.patch"
# https://code.google.com/p/libarchive/issues/detail?id=329
patch -Np1 -i "$srcdir/libarchive-3.1.2-acl.patch"
# CVE-2013-0211
patch -Np1 -i "$srcdir/libarchive-3.1.3-CVE-2013-0211_read_buffer_overflow.patch"
# upstream commit 977bf2a4 - improved mtree support
patch -p1 -i $srcdir/libarchive-3.1.2-sparce-mtree.patch
# msysize patch
patch -Np1 -i "$srcdir/libarchive-3.1.2-msys2.patch"
patch -Np1 -i "$srcdir/libarchive-3.2.0-msys2.patch"
autoreconf -ivf
}
@@ -63,7 +42,7 @@ build() {
check() {
cd "$pkgname-$pkgver"
#make check
#make check | true
}
package_bsdcpio() {

View File

@@ -1,219 +0,0 @@
diff -ruN libarchive-3.1.2/libarchive/archive_read_disk_entry_from_file.c libarchive-3.1.2.fixed/libarchive/archive_read_disk_entry_from_file.c
--- libarchive-3.1.2/libarchive/archive_read_disk_entry_from_file.c 2013-02-08 01:52:07.000000000 +0100
+++ libarchive-3.1.2.fixed/libarchive/archive_read_disk_entry_from_file.c 2013-08-08 10:47:41.000000000 +0200
@@ -399,7 +399,7 @@
#endif
-#if defined(HAVE_POSIX_ACL) && defined(ACL_TYPE_NFS4)
+#ifdef HAVE_POSIX_ACL
static int translate_acl(struct archive_read_disk *a,
struct archive_entry *entry, acl_t acl, int archive_entry_acl_type);
@@ -419,6 +419,7 @@
archive_entry_acl_clear(entry);
+#ifdef ACL_TYPE_NFS4
/* Try NFS4 ACL first. */
if (*fd >= 0)
acl = acl_get_fd(*fd);
@@ -447,6 +448,7 @@
acl_free(acl);
return (ARCHIVE_OK);
}
+#endif
/* Retrieve access ACL from file. */
if (*fd >= 0)
@@ -492,6 +494,7 @@
{ARCHIVE_ENTRY_ACL_EXECUTE, ACL_EXECUTE},
{ARCHIVE_ENTRY_ACL_WRITE, ACL_WRITE},
{ARCHIVE_ENTRY_ACL_READ, ACL_READ},
+#ifdef ACL_TYPE_NFS4
{ARCHIVE_ENTRY_ACL_READ_DATA, ACL_READ_DATA},
{ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, ACL_LIST_DIRECTORY},
{ARCHIVE_ENTRY_ACL_WRITE_DATA, ACL_WRITE_DATA},
@@ -508,8 +511,10 @@
{ARCHIVE_ENTRY_ACL_WRITE_ACL, ACL_WRITE_ACL},
{ARCHIVE_ENTRY_ACL_WRITE_OWNER, ACL_WRITE_OWNER},
{ARCHIVE_ENTRY_ACL_SYNCHRONIZE, ACL_SYNCHRONIZE}
+#endif
};
+#ifdef ACL_TYPE_NFS4
static struct {
int archive_inherit;
int platform_inherit;
@@ -519,21 +524,25 @@
{ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACL_ENTRY_NO_PROPAGATE_INHERIT},
{ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_INHERIT_ONLY}
};
-
+#endif
static int
translate_acl(struct archive_read_disk *a,
struct archive_entry *entry, acl_t acl, int default_entry_acl_type)
{
acl_tag_t acl_tag;
+#ifdef ACL_TYPE_NFS4
acl_entry_type_t acl_type;
acl_flagset_t acl_flagset;
+ int brand, r;
+#endif
acl_entry_t acl_entry;
acl_permset_t acl_permset;
- int brand, i, r, entry_acl_type;
+ int i, entry_acl_type;
int s, ae_id, ae_tag, ae_perm;
const char *ae_name;
+#ifdef ACL_TYPE_NFS4
// FreeBSD "brands" ACLs as POSIX.1e or NFSv4
// Make sure the "brand" on this ACL is consistent
// with the default_entry_acl_type bits provided.
@@ -560,6 +569,7 @@
return ARCHIVE_FAILED;
break;
}
+#endif
s = acl_get_entry(acl, ACL_FIRST_ENTRY, &acl_entry);
@@ -592,9 +602,11 @@
case ACL_OTHER:
ae_tag = ARCHIVE_ENTRY_ACL_OTHER;
break;
+#ifdef ACL_TYPE_NFS4
case ACL_EVERYONE:
ae_tag = ARCHIVE_ENTRY_ACL_EVERYONE;
break;
+#endif
default:
/* Skip types that libarchive can't support. */
s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry);
@@ -605,6 +617,7 @@
// XXX acl_get_entry_type_np on FreeBSD returns EINVAL for
// non-NFSv4 ACLs
entry_acl_type = default_entry_acl_type;
+#ifdef ACL_TYPE_NFS4
r = acl_get_entry_type_np(acl_entry, &acl_type);
if (r == 0) {
switch (acl_type) {
@@ -634,9 +647,10 @@
ae_perm |= acl_inherit_map[i].archive_inherit;
}
+#endif
acl_get_permset(acl_entry, &acl_permset);
- for (i = 0; i < (int)(sizeof(acl_perm_map) / sizeof(acl_perm_map[0])); ++i) {
+ for (i = 0; i < (int)(sizeof(acl_perm_map) / sizeof(acl_perm_map[0])); ++i) {
/*
* acl_get_perm() is spelled differently on different
* platforms; see above.
diff -ruN libarchive-3.1.2/libarchive/archive_write_disk_acl.c libarchive-3.1.2.fixed/libarchive/archive_write_disk_acl.c
--- libarchive-3.1.2/libarchive/archive_write_disk_acl.c 2013-01-14 02:43:45.000000000 +0100
+++ libarchive-3.1.2.fixed/libarchive/archive_write_disk_acl.c 2013-08-08 10:31:35.000000000 +0200
@@ -43,7 +43,7 @@
#include "archive_acl_private.h"
#include "archive_write_disk_private.h"
-#if !defined(HAVE_POSIX_ACL) || !defined(ACL_TYPE_NFS4)
+#ifndef HAVE_POSIX_ACL
/* Default empty function body to satisfy mainline code. */
int
archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
@@ -79,10 +79,12 @@
ret = set_acl(a, fd, name, abstract_acl, ACL_TYPE_DEFAULT,
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default");
return (ret);
+#ifdef ACL_TYPE_NFS4
} else if (archive_acl_count(abstract_acl, ARCHIVE_ENTRY_ACL_TYPE_NFS4) > 0) {
ret = set_acl(a, fd, name, abstract_acl, ACL_TYPE_NFS4,
ARCHIVE_ENTRY_ACL_TYPE_NFS4, "nfs4");
return (ret);
+#endif
} else
return ARCHIVE_OK;
}
@@ -94,6 +96,7 @@
{ARCHIVE_ENTRY_ACL_EXECUTE, ACL_EXECUTE},
{ARCHIVE_ENTRY_ACL_WRITE, ACL_WRITE},
{ARCHIVE_ENTRY_ACL_READ, ACL_READ},
+#ifdef ACL_TYPE_NFS4
{ARCHIVE_ENTRY_ACL_READ_DATA, ACL_READ_DATA},
{ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, ACL_LIST_DIRECTORY},
{ARCHIVE_ENTRY_ACL_WRITE_DATA, ACL_WRITE_DATA},
@@ -110,8 +113,10 @@
{ARCHIVE_ENTRY_ACL_WRITE_ACL, ACL_WRITE_ACL},
{ARCHIVE_ENTRY_ACL_WRITE_OWNER, ACL_WRITE_OWNER},
{ARCHIVE_ENTRY_ACL_SYNCHRONIZE, ACL_SYNCHRONIZE}
+#endif
};
+#ifdef ACL_TYPE_NFS4
static struct {
int archive_inherit;
int platform_inherit;
@@ -121,6 +126,7 @@
{ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACL_ENTRY_NO_PROPAGATE_INHERIT},
{ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_INHERIT_ONLY}
};
+#endif
static int
set_acl(struct archive *a, int fd, const char *name,
@@ -130,7 +136,9 @@
acl_t acl;
acl_entry_t acl_entry;
acl_permset_t acl_permset;
+#ifdef ACL_TYPE_NFS4
acl_flagset_t acl_flagset;
+#endif
int ret;
int ae_type, ae_permset, ae_tag, ae_id;
uid_t ae_uid;
@@ -171,14 +179,17 @@
case ARCHIVE_ENTRY_ACL_OTHER:
acl_set_tag_type(acl_entry, ACL_OTHER);
break;
+#ifdef ACL_TYPE_NFS4
case ARCHIVE_ENTRY_ACL_EVERYONE:
acl_set_tag_type(acl_entry, ACL_EVERYONE);
break;
+#endif
default:
/* XXX */
break;
}
+#ifdef ACL_TYPE_NFS4
switch (ae_type) {
case ARCHIVE_ENTRY_ACL_TYPE_ALLOW:
acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALLOW);
@@ -200,6 +211,7 @@
// XXX error handling here.
break;
}
+#endif
acl_get_permset(acl_entry, &acl_permset);
acl_clear_perms(acl_permset);
@@ -210,6 +222,7 @@
acl_perm_map[i].platform_perm);
}
+#ifdef ACL_TYPE_NFS4
acl_get_flagset_np(acl_entry, &acl_flagset);
acl_clear_flags_np(acl_flagset);
for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) {
@@ -217,6 +230,7 @@
acl_add_flag_np(acl_flagset,
acl_inherit_map[i].platform_inherit);
}
+#endif
}
/* Try restoring the ACL through 'fd' if we can. */

View File

@@ -1,478 +0,0 @@
From 977bf2a49484239f7a7b6ce08bfa9da413a27ead Mon Sep 17 00:00:00 2001
From: Florian Pritz <bluewind@xinu.at>
Date: Sat, 1 Mar 2014 17:21:47 +0100
Subject: [PATCH] mtree: Make reading additional information from the fs
optional
This feature is not needed if users just want to read in the content of
an mtree file and do validation against the file system themselves.
It is needed for `bsdtar cvf out.tar @input.mtree` which is why the
option is enabled in bsdtar.
Since the mtree tests rely on this feature, this patch also enables it
there.
Signed-off-by: Florian Pritz <bluewind@xinu.at>
---
libarchive/archive_read_support_format_mtree.c | 290 ++++++++++++++-----------
libarchive/test/test_read_format_mtree.c | 20 ++
tar/write.c | 1 +
3 files changed, 179 insertions(+), 132 deletions(-)
diff --git a/libarchive/archive_read_support_format_mtree.c b/libarchive/archive_read_support_format_mtree.c
index 44799df..d82d4c1 100644
--- a/libarchive/archive_read_support_format_mtree.c
+++ b/libarchive/archive_read_support_format_mtree.c
@@ -104,6 +104,7 @@ struct mtree {
struct archive_entry_linkresolver *resolver;
int64_t cur_size;
+ char checkfs;
};
static int bid_keycmp(const char *, const char *, ssize_t);
@@ -174,6 +175,29 @@ static int read_header(struct archive_read *,
#endif
}
+static int
+archive_read_format_mtree_options(struct archive_read *a,
+ const char *key, const char *val)
+{
+ struct mtree *mtree;
+
+ mtree = (struct mtree *)(a->format->data);
+ if (strcmp(key, "checkfs") == 0) {
+ /* Allows to read information missing from the mtree from the file system */
+ if (val == NULL || val[0] == 0) {
+ mtree->checkfs = 0;
+ } else {
+ mtree->checkfs = 1;
+ }
+ return (ARCHIVE_OK);
+ }
+
+ /* Note: The "warn" return is just to inform the options
+ * supervisor that we didn't handle it. It will generate
+ * a suitable error if no one used this option. */
+ return (ARCHIVE_WARN);
+}
+
static void
free_options(struct mtree_option *head)
{
@@ -206,7 +230,7 @@ static int read_header(struct archive_read *,
mtree->fd = -1;
r = __archive_read_register_format(a, mtree, "mtree",
- mtree_bid, NULL, read_header, read_data, skip, NULL, cleanup);
+ mtree_bid, archive_read_format_mtree_options, read_header, read_data, skip, NULL, cleanup);
if (r != ARCHIVE_OK)
free(mtree);
@@ -1104,162 +1128,164 @@ static int read_header(struct archive_read *,
mtree->current_dir.length = n;
}
- /*
- * Try to open and stat the file to get the real size
- * and other file info. It would be nice to avoid
- * this here so that getting a listing of an mtree
- * wouldn't require opening every referenced contents
- * file. But then we wouldn't know the actual
- * contents size, so I don't see a really viable way
- * around this. (Also, we may want to someday pull
- * other unspecified info from the contents file on
- * disk.)
- */
- mtree->fd = -1;
- if (archive_strlen(&mtree->contents_name) > 0)
- path = mtree->contents_name.s;
- else
- path = archive_entry_pathname(entry);
-
- if (archive_entry_filetype(entry) == AE_IFREG ||
- archive_entry_filetype(entry) == AE_IFDIR) {
- mtree->fd = open(path, O_RDONLY | O_BINARY | O_CLOEXEC);
- __archive_ensure_cloexec_flag(mtree->fd);
- if (mtree->fd == -1 &&
- (errno != ENOENT ||
- archive_strlen(&mtree->contents_name) > 0)) {
- archive_set_error(&a->archive, errno,
- "Can't open %s", path);
- r = ARCHIVE_WARN;
+ if (mtree->checkfs) {
+ /*
+ * Try to open and stat the file to get the real size
+ * and other file info. It would be nice to avoid
+ * this here so that getting a listing of an mtree
+ * wouldn't require opening every referenced contents
+ * file. But then we wouldn't know the actual
+ * contents size, so I don't see a really viable way
+ * around this. (Also, we may want to someday pull
+ * other unspecified info from the contents file on
+ * disk.)
+ */
+ mtree->fd = -1;
+ if (archive_strlen(&mtree->contents_name) > 0)
+ path = mtree->contents_name.s;
+ else
+ path = archive_entry_pathname(entry);
+
+ if (archive_entry_filetype(entry) == AE_IFREG ||
+ archive_entry_filetype(entry) == AE_IFDIR) {
+ mtree->fd = open(path, O_RDONLY | O_BINARY | O_CLOEXEC);
+ __archive_ensure_cloexec_flag(mtree->fd);
+ if (mtree->fd == -1 &&
+ (errno != ENOENT ||
+ archive_strlen(&mtree->contents_name) > 0)) {
+ archive_set_error(&a->archive, errno,
+ "Can't open %s", path);
+ r = ARCHIVE_WARN;
+ }
}
- }
- st = &st_storage;
- if (mtree->fd >= 0) {
- if (fstat(mtree->fd, st) == -1) {
- archive_set_error(&a->archive, errno,
- "Could not fstat %s", path);
- r = ARCHIVE_WARN;
- /* If we can't stat it, don't keep it open. */
- close(mtree->fd);
- mtree->fd = -1;
+ st = &st_storage;
+ if (mtree->fd >= 0) {
+ if (fstat(mtree->fd, st) == -1) {
+ archive_set_error(&a->archive, errno,
+ "Could not fstat %s", path);
+ r = ARCHIVE_WARN;
+ /* If we can't stat it, don't keep it open. */
+ close(mtree->fd);
+ mtree->fd = -1;
+ st = NULL;
+ }
+ } else if (lstat(path, st) == -1) {
st = NULL;
}
- } else if (lstat(path, st) == -1) {
- st = NULL;
- }
- /*
- * Check for a mismatch between the type in the specification and
- * the type of the contents object on disk.
- */
- if (st != NULL) {
- if (
- ((st->st_mode & S_IFMT) == S_IFREG &&
- archive_entry_filetype(entry) == AE_IFREG)
+ /*
+ * Check for a mismatch between the type in the specification and
+ * the type of the contents object on disk.
+ */
+ if (st != NULL) {
+ if (
+ ((st->st_mode & S_IFMT) == S_IFREG &&
+ archive_entry_filetype(entry) == AE_IFREG)
#ifdef S_IFLNK
- || ((st->st_mode & S_IFMT) == S_IFLNK &&
- archive_entry_filetype(entry) == AE_IFLNK)
+ || ((st->st_mode & S_IFMT) == S_IFLNK &&
+ archive_entry_filetype(entry) == AE_IFLNK)
#endif
#ifdef S_IFSOCK
- || ((st->st_mode & S_IFSOCK) == S_IFSOCK &&
- archive_entry_filetype(entry) == AE_IFSOCK)
+ || ((st->st_mode & S_IFSOCK) == S_IFSOCK &&
+ archive_entry_filetype(entry) == AE_IFSOCK)
#endif
#ifdef S_IFCHR
- || ((st->st_mode & S_IFMT) == S_IFCHR &&
- archive_entry_filetype(entry) == AE_IFCHR)
+ || ((st->st_mode & S_IFMT) == S_IFCHR &&
+ archive_entry_filetype(entry) == AE_IFCHR)
#endif
#ifdef S_IFBLK
- || ((st->st_mode & S_IFMT) == S_IFBLK &&
- archive_entry_filetype(entry) == AE_IFBLK)
+ || ((st->st_mode & S_IFMT) == S_IFBLK &&
+ archive_entry_filetype(entry) == AE_IFBLK)
#endif
- || ((st->st_mode & S_IFMT) == S_IFDIR &&
- archive_entry_filetype(entry) == AE_IFDIR)
+ || ((st->st_mode & S_IFMT) == S_IFDIR &&
+ archive_entry_filetype(entry) == AE_IFDIR)
#ifdef S_IFIFO
- || ((st->st_mode & S_IFMT) == S_IFIFO &&
- archive_entry_filetype(entry) == AE_IFIFO)
+ || ((st->st_mode & S_IFMT) == S_IFIFO &&
+ archive_entry_filetype(entry) == AE_IFIFO)
#endif
- ) {
- /* Types match. */
- } else {
- /* Types don't match; bail out gracefully. */
- if (mtree->fd >= 0)
- close(mtree->fd);
- mtree->fd = -1;
- if (parsed_kws & MTREE_HAS_OPTIONAL) {
- /* It's not an error for an optional entry
- to not match disk. */
- *use_next = 1;
- } else if (r == ARCHIVE_OK) {
- archive_set_error(&a->archive,
- ARCHIVE_ERRNO_MISC,
- "mtree specification has different type for %s",
- archive_entry_pathname(entry));
- r = ARCHIVE_WARN;
- }
- return r;
+ ) {
+ /* Types match. */
+ } else {
+ /* Types don't match; bail out gracefully. */
+ if (mtree->fd >= 0)
+ close(mtree->fd);
+ mtree->fd = -1;
+ if (parsed_kws & MTREE_HAS_OPTIONAL) {
+ /* It's not an error for an optional entry
+ to not match disk. */
+ *use_next = 1;
+ } else if (r == ARCHIVE_OK) {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_MISC,
+ "mtree specification has different type for %s",
+ archive_entry_pathname(entry));
+ r = ARCHIVE_WARN;
+ }
+ return r;
+ }
}
- }
- /*
- * If there is a contents file on disk, pick some of the metadata
- * from that file. For most of these, we only set it from the contents
- * if it wasn't already parsed from the specification.
- */
- if (st != NULL) {
- if (((parsed_kws & MTREE_HAS_DEVICE) == 0 ||
- (parsed_kws & MTREE_HAS_NOCHANGE) != 0) &&
- (archive_entry_filetype(entry) == AE_IFCHR ||
- archive_entry_filetype(entry) == AE_IFBLK))
- archive_entry_set_rdev(entry, st->st_rdev);
- if ((parsed_kws & (MTREE_HAS_GID | MTREE_HAS_GNAME)) == 0 ||
- (parsed_kws & MTREE_HAS_NOCHANGE) != 0)
- archive_entry_set_gid(entry, st->st_gid);
- if ((parsed_kws & (MTREE_HAS_UID | MTREE_HAS_UNAME)) == 0 ||
- (parsed_kws & MTREE_HAS_NOCHANGE) != 0)
- archive_entry_set_uid(entry, st->st_uid);
- if ((parsed_kws & MTREE_HAS_MTIME) == 0 ||
- (parsed_kws & MTREE_HAS_NOCHANGE) != 0) {
+ /*
+ * If there is a contents file on disk, pick some of the metadata
+ * from that file. For most of these, we only set it from the contents
+ * if it wasn't already parsed from the specification.
+ */
+ if (st != NULL) {
+ if (((parsed_kws & MTREE_HAS_DEVICE) == 0 ||
+ (parsed_kws & MTREE_HAS_NOCHANGE) != 0) &&
+ (archive_entry_filetype(entry) == AE_IFCHR ||
+ archive_entry_filetype(entry) == AE_IFBLK))
+ archive_entry_set_rdev(entry, st->st_rdev);
+ if ((parsed_kws & (MTREE_HAS_GID | MTREE_HAS_GNAME)) == 0 ||
+ (parsed_kws & MTREE_HAS_NOCHANGE) != 0)
+ archive_entry_set_gid(entry, st->st_gid);
+ if ((parsed_kws & (MTREE_HAS_UID | MTREE_HAS_UNAME)) == 0 ||
+ (parsed_kws & MTREE_HAS_NOCHANGE) != 0)
+ archive_entry_set_uid(entry, st->st_uid);
+ if ((parsed_kws & MTREE_HAS_MTIME) == 0 ||
+ (parsed_kws & MTREE_HAS_NOCHANGE) != 0) {
#if HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
- archive_entry_set_mtime(entry, st->st_mtime,
- st->st_mtimespec.tv_nsec);
+ archive_entry_set_mtime(entry, st->st_mtime,
+ st->st_mtimespec.tv_nsec);
#elif HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
- archive_entry_set_mtime(entry, st->st_mtime,
- st->st_mtim.tv_nsec);
+ archive_entry_set_mtime(entry, st->st_mtime,
+ st->st_mtim.tv_nsec);
#elif HAVE_STRUCT_STAT_ST_MTIME_N
- archive_entry_set_mtime(entry, st->st_mtime,
- st->st_mtime_n);
+ archive_entry_set_mtime(entry, st->st_mtime,
+ st->st_mtime_n);
#elif HAVE_STRUCT_STAT_ST_UMTIME
- archive_entry_set_mtime(entry, st->st_mtime,
- st->st_umtime*1000);
+ archive_entry_set_mtime(entry, st->st_mtime,
+ st->st_umtime*1000);
#elif HAVE_STRUCT_STAT_ST_MTIME_USEC
- archive_entry_set_mtime(entry, st->st_mtime,
- st->st_mtime_usec*1000);
+ archive_entry_set_mtime(entry, st->st_mtime,
+ st->st_mtime_usec*1000);
#else
- archive_entry_set_mtime(entry, st->st_mtime, 0);
+ archive_entry_set_mtime(entry, st->st_mtime, 0);
#endif
+ }
+ if ((parsed_kws & MTREE_HAS_NLINK) == 0 ||
+ (parsed_kws & MTREE_HAS_NOCHANGE) != 0)
+ archive_entry_set_nlink(entry, st->st_nlink);
+ if ((parsed_kws & MTREE_HAS_PERM) == 0 ||
+ (parsed_kws & MTREE_HAS_NOCHANGE) != 0)
+ archive_entry_set_perm(entry, st->st_mode);
+ if ((parsed_kws & MTREE_HAS_SIZE) == 0 ||
+ (parsed_kws & MTREE_HAS_NOCHANGE) != 0)
+ archive_entry_set_size(entry, st->st_size);
+ archive_entry_set_ino(entry, st->st_ino);
+ archive_entry_set_dev(entry, st->st_dev);
+
+ archive_entry_linkify(mtree->resolver, &entry, &sparse_entry);
+ } else if (parsed_kws & MTREE_HAS_OPTIONAL) {
+ /*
+ * Couldn't open the entry, stat it or the on-disk type
+ * didn't match. If this entry is optional, just ignore it
+ * and read the next header entry.
+ */
+ *use_next = 1;
+ return ARCHIVE_OK;
}
- if ((parsed_kws & MTREE_HAS_NLINK) == 0 ||
- (parsed_kws & MTREE_HAS_NOCHANGE) != 0)
- archive_entry_set_nlink(entry, st->st_nlink);
- if ((parsed_kws & MTREE_HAS_PERM) == 0 ||
- (parsed_kws & MTREE_HAS_NOCHANGE) != 0)
- archive_entry_set_perm(entry, st->st_mode);
- if ((parsed_kws & MTREE_HAS_SIZE) == 0 ||
- (parsed_kws & MTREE_HAS_NOCHANGE) != 0)
- archive_entry_set_size(entry, st->st_size);
- archive_entry_set_ino(entry, st->st_ino);
- archive_entry_set_dev(entry, st->st_dev);
-
- archive_entry_linkify(mtree->resolver, &entry, &sparse_entry);
- } else if (parsed_kws & MTREE_HAS_OPTIONAL) {
- /*
- * Couldn't open the entry, stat it or the on-disk type
- * didn't match. If this entry is optional, just ignore it
- * and read the next header entry.
- */
- *use_next = 1;
- return ARCHIVE_OK;
}
mtree->cur_size = archive_entry_size(entry);
diff --git a/libarchive/test/test_read_format_mtree.c b/libarchive/test/test_read_format_mtree.c
index 830fa0a..f96529d 100644
--- a/libarchive/test/test_read_format_mtree.c
+++ b/libarchive/test/test_read_format_mtree.c
@@ -58,6 +58,8 @@
assertEqualIntA(a, ARCHIVE_OK,
archive_read_support_format_all(a));
assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_set_options(a, "mtree:checkfs"));
+ assertEqualIntA(a, ARCHIVE_OK,
archive_read_open_filename(a, reffile, 11));
/*
@@ -209,6 +211,8 @@
assertEqualIntA(a, ARCHIVE_OK,
archive_read_support_format_all(a));
assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_set_options(a, "mtree:checkfs"));
+ assertEqualIntA(a, ARCHIVE_OK,
archive_read_open_memory(a, archive, sizeof(archive)));
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
assertEqualInt(archive_format(a), ARCHIVE_FORMAT_MTREE);
@@ -246,6 +250,8 @@
assertEqualIntA(a, ARCHIVE_OK,
archive_read_support_format_all(a));
assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_set_options(a, "mtree:checkfs"));
+ assertEqualIntA(a, ARCHIVE_OK,
archive_read_open_memory(a, archive, sizeof(archive)));
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
assertEqualString(archive_entry_pathname(ae), "a");
@@ -299,6 +305,8 @@
assertEqualIntA(a, ARCHIVE_OK,
archive_read_support_format_all(a));
assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_set_options(a, "mtree:checkfs"));
+ assertEqualIntA(a, ARCHIVE_OK,
archive_read_open_memory(a, archive, sizeof(archive)));
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
assertEqualString(archive_entry_pathname(ae), "./a");
@@ -365,6 +373,8 @@
assertEqualIntA(a, ARCHIVE_OK,
archive_read_support_format_all(a));
assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_set_options(a, "mtree:checkfs"));
+ assertEqualIntA(a, ARCHIVE_OK,
archive_read_open_memory(a, archive, sizeof(archive)));
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
assertEqualString(archive_entry_pathname(ae), "./a");
@@ -402,6 +412,8 @@
assertEqualIntA(a, ARCHIVE_OK,
archive_read_support_format_all(a));
assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_set_options(a, "mtree:checkfs"));
+ assertEqualIntA(a, ARCHIVE_OK,
archive_read_open_memory(a, archive2, sizeof(archive2)));
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
assertEqualString(archive_entry_pathname(ae), "./a");
@@ -449,6 +461,8 @@
assertEqualIntA(a, ARCHIVE_OK,
archive_read_support_format_all(a));
assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_set_options(a, "mtree:checkfs"));
+ assertEqualIntA(a, ARCHIVE_OK,
archive_read_open_filename(a, reffile, 11));
/*
@@ -552,6 +566,8 @@
assertEqualIntA(a, ARCHIVE_OK,
archive_read_support_format_all(a));
assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_set_options(a, "mtree:checkfs"));
+ assertEqualIntA(a, ARCHIVE_OK,
archive_read_open_filename(a, reffile, 11));
/*
@@ -617,6 +633,8 @@
assertEqualIntA(a, ARCHIVE_OK,
archive_read_support_format_all(a));
assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_set_options(a, "mtree:checkfs"));
+ assertEqualIntA(a, ARCHIVE_OK,
archive_read_open_filename(a, reffile, 11));
/*
@@ -680,6 +698,8 @@
assertEqualIntA(a, ARCHIVE_OK,
archive_read_support_format_all(a));
assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_set_options(a, "mtree:checkfs"));
+ assertEqualIntA(a, ARCHIVE_OK,
archive_read_open_memory(a, archive, sizeof(archive)));
assertEqualIntA(a, ARCHIVE_WARN, archive_read_next_header(a, &ae));
assert(strlen(archive_error_string(a)) > 0);
diff --git a/tar/write.c b/tar/write.c
index 40d2fb0..7e8cb13 100644
--- a/tar/write.c
+++ b/tar/write.c
@@ -648,6 +648,7 @@ static void write_hierarchy(struct bsdtar *, struct archive *,
archive_read_support_format_all(ina);
archive_read_support_filter_all(ina);
set_reader_options(bsdtar, a);
+ archive_read_set_options(ina, "mtree:checkfs");
if (archive_read_open_filename(ina, filename,
bsdtar->bytes_per_block)) {
lafe_warnc(0, "%s", archive_error_string(ina));
--
1.8.5.5

View File

@@ -1,31 +0,0 @@
From 22531545514043e04633e1c015c7540b9de9dbe4 Mon Sep 17 00:00:00 2001
From: Tim Kientzle <kientzle@acm.org>
Date: Fri, 22 Mar 2013 23:48:41 -0700
Subject: [PATCH] Limit write requests to at most INT_MAX. This prevents a
certain common programming error (passing -1 to write) from leading to other
problems deeper in the library.
---
libarchive/archive_write.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libarchive/archive_write.c b/libarchive/archive_write.c
index eede5e0..be85621 100644
--- a/libarchive/archive_write.c
+++ b/libarchive/archive_write.c
@@ -673,8 +673,13 @@ static ssize_t
_archive_write_data(struct archive *_a, const void *buff, size_t s)
{
struct archive_write *a = (struct archive_write *)_a;
+ const size_t max_write = INT_MAX;
+
archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
ARCHIVE_STATE_DATA, "archive_write_data");
+ /* In particular, this catches attempts to pass negative values. */
+ if (s > max_write)
+ s = max_write;
archive_clear_error(&a->archive);
return ((a->format_write_data)(a, buff, s));
}
--
1.8.1

View File

@@ -1,6 +1,6 @@
diff -Naur libarchive-3.1.2-orig/build/autoconf/compile libarchive-3.1.2/build/autoconf/compile
--- libarchive-3.1.2-orig/build/autoconf/compile 2013-02-09 17:23:09.000000000 +0000
+++ libarchive-3.1.2/build/autoconf/compile 2013-06-16 08:22:38.561343800 +0000
diff -Naur libarchive-3.2.0-orig/build/autoconf/compile libarchive-3.2.0/build/autoconf/compile
--- libarchive-3.2.0-orig/build/autoconf/compile 2013-02-09 17:23:09.000000000 +0000
+++ libarchive-3.2.0/build/autoconf/compile 2013-06-16 08:22:38.561343800 +0000
@@ -54,7 +54,7 @@
MINGW*)
file_conv=mingw
@@ -19,9 +19,9 @@ diff -Naur libarchive-3.1.2-orig/build/autoconf/compile libarchive-3.1.2/build/a
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
diff -Naur libarchive-3.1.2-orig/build/autoconf/config.guess libarchive-3.1.2/build/autoconf/config.guess
--- libarchive-3.1.2-orig/build/autoconf/config.guess 2013-02-09 17:23:11.000000000 +0000
+++ libarchive-3.1.2/build/autoconf/config.guess 2013-06-16 08:23:10.436343800 +0000
diff -Naur libarchive-3.2.0-orig/build/autoconf/config.guess libarchive-3.2.0/build/autoconf/config.guess
--- libarchive-3.2.0-orig/build/autoconf/config.guess 2013-02-09 17:23:11.000000000 +0000
+++ libarchive-3.2.0/build/autoconf/config.guess 2013-06-16 08:23:10.436343800 +0000
@@ -845,6 +845,9 @@
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
echo x86_64-unknown-cygwin
@@ -32,9 +32,9 @@ diff -Naur libarchive-3.1.2-orig/build/autoconf/config.guess libarchive-3.1.2/bu
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin
exit ;;
diff -Naur libarchive-3.1.2-orig/build/autoconf/config.rpath libarchive-3.1.2/build/autoconf/config.rpath
--- libarchive-3.1.2-orig/build/autoconf/config.rpath 2013-01-13 21:10:46.000000000 +0000
+++ libarchive-3.1.2/build/autoconf/config.rpath 2013-06-16 08:23:47.826968800 +0000
diff -Naur libarchive-3.2.0-orig/build/autoconf/config.rpath libarchive-3.2.0/build/autoconf/config.rpath
--- libarchive-3.2.0-orig/build/autoconf/config.rpath 2013-01-13 21:10:46.000000000 +0000
+++ libarchive-3.2.0/build/autoconf/config.rpath 2013-06-16 08:23:47.826968800 +0000
@@ -63,7 +63,7 @@
aix*)
wl='-Wl,'
@@ -80,10 +80,10 @@ diff -Naur libarchive-3.1.2-orig/build/autoconf/config.rpath libarchive-3.1.2/bu
shrext=.dll
library_names_spec='$libname.dll.a $libname.lib'
;;
diff -Naur libarchive-3.1.2-orig/configure.ac libarchive-3.1.2/configure.ac
--- libarchive-3.1.2-orig/configure.ac 2013-02-09 17:23:03.000000000 +0000
+++ libarchive-3.1.2/configure.ac 2013-06-16 08:22:04.123843800 +0000
@@ -83,7 +83,7 @@
diff -aur libarchive-3.2.0-orig/configure.ac libarchive-3.2.0/configure.ac
--- libarchive-3.2.0/configure.ac.orig 2016-04-30 00:44:07.000000000 -0400
+++ libarchive-3.2.0/configure.ac 2016-05-16 10:09:17.332631100 -0400
@@ -88,7 +88,7 @@
inc_cygwin_files=no
case "$host_os" in
*mingw* ) inc_windows_files=yes ;;
@@ -92,16 +92,16 @@ diff -Naur libarchive-3.1.2-orig/configure.ac libarchive-3.1.2/configure.ac
esac
AM_CONDITIONAL([INC_WINDOWS_FILES], [test $inc_windows_files = yes])
AM_CONDITIONAL([INC_CYGWIN_FILES], [test $inc_cygwin_files = yes])
@@ -192,7 +192,7 @@
@@ -242,7 +242,7 @@
# Set up defines needed before including any headers
case $host in
- *mingw* | *cygwin* )
+ *mingw* | *cygwin* | *msys* )
AC_DEFINE([_WIN32_WINNT], 0x0500, [Define to '0x0500' for Windows 2000 APIs.])
AC_DEFINE([WINVER], 0x0500, [Define to '0x0500' for Windows 2000 APIs.])
;;
@@ -248,7 +248,7 @@
+ *mingw* | *cygwin* | *msys* )
AC_DEFINE([_WIN32_WINNT], 0x0502, [Define to '0x0502' for Windows Server 2003 APIs.])
AC_DEFINE([WINVER], 0x0502, [Define to '0x0502' for Windows Server 2003 APIs.])
AC_DEFINE([NTDDI_VERSION], 0x05020000, [Define to '0x05020000' for Windows Server 2003 APIs.])
@@ -301,7 +301,7 @@
if test "x$with_bz2lib" != "xno"; then
AC_CHECK_HEADERS([bzlib.h])
case "$host_os" in
@@ -110,7 +110,7 @@ diff -Naur libarchive-3.1.2-orig/configure.ac libarchive-3.1.2/configure.ac
dnl AC_CHECK_LIB cannot be used on the Windows port of libbz2, therefore
dnl use AC_LINK_IFELSE.
AC_MSG_CHECKING([for BZ2_bzDecompressInit in -lbz2])
@@ -692,7 +692,7 @@
@@ -770,7 +770,7 @@
])
case "$host_os" in
@@ -119,7 +119,7 @@ diff -Naur libarchive-3.1.2-orig/configure.ac libarchive-3.1.2/configure.ac
;;
*)
CRYPTO_CHECK(MD5, LIBC, md5)
@@ -733,7 +733,7 @@
@@ -813,7 +813,7 @@
AC_CHECK_HEADERS([openssl/evp.h])
saved_LIBS=$LIBS
case "$host_os" in
@@ -127,8 +127,8 @@ diff -Naur libarchive-3.1.2-orig/configure.ac libarchive-3.1.2/configure.ac
+ *mingw* | *cygwin* | *msys*)
case "$host_cpu" in
x86_64)
AC_CHECK_LIB(eay64,main)
@@ -776,7 +776,7 @@
AC_CHECK_LIB(eay64,OPENSSL_config)
@@ -858,7 +858,7 @@
fi
case "$host_os" in

View File

@@ -1,11 +0,0 @@
--- nettle-3.2/testsuite/dlopen-test.c.orig 2016-05-16 12:09:42.904653700 -0400
+++ nettle-3.2/testsuite/dlopen-test.c 2016-05-16 12:13:04.290831000 -0400
@@ -9,7 +9,7 @@
main (int argc UNUSED, char **argv UNUSED)
{
#if HAVE_LIBDL
- void *handle = dlopen ("../libnettle.so", RTLD_NOW);
+ void *handle = dlopen ("../msys-nettle-6.dll", RTLD_NOW);
int (*get_version)(void);
if (!handle)
{

View File

@@ -0,0 +1,15 @@
diff -aur nettle-3.2/testsuite/dlopen-test.c.orig nettle-3.2/testsuite/dlopen-test.c > ../3.2-dlopen-test-msys-test.patch
--- nettle-3.2/testsuite/dlopen-test.c.orig 2016-05-17 07:17:36.777183000 -0400
+++ nettle-3.2/testsuite/dlopen-test.c 2016-05-17 07:18:23.983817400 -0400
@@ -9,7 +9,11 @@
main (int argc UNUSED, char **argv UNUSED)
{
#if HAVE_LIBDL
+ #ifdef __MSYS__
+ void *handle = dlopen ("../msys-nettle-6.dll", RTLD_NOW);
+ #else
void *handle = dlopen ("../libnettle.so", RTLD_NOW);
+ #endif
int (*get_version)(void);
if (!handle)
{

View File

@@ -12,19 +12,21 @@ depends=('gmp')
makedepends=('gmp-devel')
source=(https://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${pkgver}.tar.gz{,.sig}
2.6-soname.patch
nettle-2.6-msys2.patch)
nettle-2.6-msys2.patch
3.2-dlopen-test-msys-test.patch)
validpgpkeys=('343C2FF0FBEE5EC2EDBEF399F3599FF828C67298')
sha256sums=('ea4283def236413edab5a4cf9cf32adf540c8df1b9b67641cfc2302fca849d97'
'SKIP'
'489c8de40d074a8555e40ff4a82069cee260481c5ecace64d4b2acf9d7a64409'
'fa52086b5a246a1536293c9a53fbc053ac06c028e3cd501295660c044b436a9f')
'fa52086b5a246a1536293c9a53fbc053ac06c028e3cd501295660c044b436a9f'
'b682165983572d89c491e6d2d8307d7a04662b2de332cebd0f6766459519151c')
prepare() {
cd "${srcdir}/${pkgname}-${pkgver}"
patch -p2 -i ${srcdir}/2.6-soname.patch
patch -p1 -i ${srcdir}/nettle-2.6-msys2.patch
patch -p1 -i ${srcdir}/3.0-dlopen-test-msys-test.patch
patch -p1 -i ${srcdir}/3.2-dlopen-test-msys-test.patch
autoreconf -fi
}