Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
baulktar: 1.0.4 sync libarchive
Browse files Browse the repository at this point in the history
  • Loading branch information
fcharlie committed Aug 28, 2021
1 parent 8c5038a commit 6bc2d67
Show file tree
Hide file tree
Showing 35 changed files with 285 additions and 2,084 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ endif()

set(BAULKTAR_VERSION_MAJOR 1)
set(BAULKTAR_VERSION_MINOR 0)
set(BAULKTAR_VERSION_PATCH 3)
set(BAULKTAR_VERSION_PATCH 4)
set(PACKAGE_VERSION "${BAULKTAR_VERSION_MAJOR}.${BAULKTAR_VERSION_MINOR}.${BAULKTAR_VERSION_PATCH}")

set(CPACK_PACKAGE_NAME "BaulkTar")
Expand Down
4 changes: 2 additions & 2 deletions lib/libarchive.lock
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#https://github.com/libarchive/libarchive/tree/833821f55b1807cac22a63a58b759a7802df2fb7
3.5.1
#https://github.com/libarchive/libarchive/tree/3aeea1ea8de681738814aa12138a4fc0a20906f4
3.5.3dev
4 changes: 2 additions & 2 deletions lib/libarchive/archive.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* assert that ARCHIVE_VERSION_NUMBER >= 2012108.
*/
/* Note: Compiler will complain if this does not match archive_entry.h! */
#define ARCHIVE_VERSION_NUMBER 3005002
#define ARCHIVE_VERSION_NUMBER 3005003

#include <sys/stat.h>
#include <stddef.h> /* for wchar_t */
Expand Down Expand Up @@ -155,7 +155,7 @@ __LA_DECL int archive_version_number(void);
/*
* Textual name/version of the library, useful for version displays.
*/
#define ARCHIVE_VERSION_ONLY_STRING "3.5.2dev"
#define ARCHIVE_VERSION_ONLY_STRING "3.5.3dev"
#define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING
__LA_DECL const char * archive_version_string(void);

Expand Down
20 changes: 15 additions & 5 deletions lib/libarchive/archive_disk_acl_freebsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ translate_acl(struct archive_read_disk *a,

static int
set_acl(struct archive *a, int fd, const char *name,
struct archive_acl *abstract_acl,
struct archive_acl *abstract_acl, __LA_MODE_T mode,
int ae_requested_type, const char *tname)
{
int acl_type = 0;
Expand Down Expand Up @@ -364,6 +364,13 @@ set_acl(struct archive *a, int fd, const char *name,
return (ARCHIVE_FAILED);
}

if (acl_type == ACL_TYPE_DEFAULT && !S_ISDIR(mode)) {
errno = EINVAL;
archive_set_error(a, errno,
"Cannot set default ACL on non-directory");
return (ARCHIVE_WARN);
}

acl = acl_init(entries);
if (acl == (acl_t)NULL) {
archive_set_error(a, errno,
Expand Down Expand Up @@ -542,7 +549,10 @@ set_acl(struct archive *a, int fd, const char *name,
else if (acl_set_link_np(name, acl_type, acl) != 0)
#else
/* FreeBSD older than 8.0 */
else if (acl_set_file(name, acl_type, acl) != 0)
else if (S_ISLNK(mode)) {
/* acl_set_file() follows symbolic links, skip */
ret = ARCHIVE_OK;
} else if (acl_set_file(name, acl_type, acl) != 0)
#endif
{
if (errno == EOPNOTSUPP) {
Expand Down Expand Up @@ -677,14 +687,14 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
& ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) {
if ((archive_acl_types(abstract_acl)
& ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
ret = set_acl(a, fd, name, abstract_acl,
ret = set_acl(a, fd, name, abstract_acl, mode,
ARCHIVE_ENTRY_ACL_TYPE_ACCESS, "access");
if (ret != ARCHIVE_OK)
return (ret);
}
if ((archive_acl_types(abstract_acl)
& ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0)
ret = set_acl(a, fd, name, abstract_acl,
ret = set_acl(a, fd, name, abstract_acl, mode,
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default");

/* Simultaneous POSIX.1e and NFSv4 is not supported */
Expand All @@ -693,7 +703,7 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
#if ARCHIVE_ACL_FREEBSD_NFS4
else if ((archive_acl_types(abstract_acl) &
ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {
ret = set_acl(a, fd, name, abstract_acl,
ret = set_acl(a, fd, name, abstract_acl, mode,
ARCHIVE_ENTRY_ACL_TYPE_NFS4, "nfs4");
}
#endif
Expand Down
23 changes: 20 additions & 3 deletions lib/libarchive/archive_disk_acl_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,11 @@ set_richacl(struct archive *a, int fd, const char *name,
return (ARCHIVE_FAILED);
}

if (S_ISLNK(mode)) {
/* Linux does not support RichACLs on symbolic links */
return (ARCHIVE_OK);
}

richacl = richacl_alloc(entries);
if (richacl == NULL) {
archive_set_error(a, errno,
Expand Down Expand Up @@ -455,7 +460,7 @@ set_richacl(struct archive *a, int fd, const char *name,
#if ARCHIVE_ACL_LIBACL
static int
set_acl(struct archive *a, int fd, const char *name,
struct archive_acl *abstract_acl,
struct archive_acl *abstract_acl, __LA_MODE_T mode,
int ae_requested_type, const char *tname)
{
int acl_type = 0;
Expand Down Expand Up @@ -488,6 +493,18 @@ set_acl(struct archive *a, int fd, const char *name,
return (ARCHIVE_FAILED);
}

if (S_ISLNK(mode)) {
/* Linux does not support ACLs on symbolic links */
return (ARCHIVE_OK);
}

if (acl_type == ACL_TYPE_DEFAULT && !S_ISDIR(mode)) {
errno = EINVAL;
archive_set_error(a, errno,
"Cannot set default ACL on non-directory");
return (ARCHIVE_WARN);
}

acl = acl_init(entries);
if (acl == (acl_t)NULL) {
archive_set_error(a, errno,
Expand Down Expand Up @@ -727,14 +744,14 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
& ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) {
if ((archive_acl_types(abstract_acl)
& ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
ret = set_acl(a, fd, name, abstract_acl,
ret = set_acl(a, fd, name, abstract_acl, mode,
ARCHIVE_ENTRY_ACL_TYPE_ACCESS, "access");
if (ret != ARCHIVE_OK)
return (ret);
}
if ((archive_acl_types(abstract_acl)
& ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0)
ret = set_acl(a, fd, name, abstract_acl,
ret = set_acl(a, fd, name, abstract_acl, mode,
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default");
}
#endif /* ARCHIVE_ACL_LIBACL */
Expand Down
13 changes: 9 additions & 4 deletions lib/libarchive/archive_disk_acl_sunos.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ translate_acl(struct archive_read_disk *a,

static int
set_acl(struct archive *a, int fd, const char *name,
struct archive_acl *abstract_acl,
struct archive_acl *abstract_acl, __LA_MODE_T mode,
int ae_requested_type, const char *tname)
{
aclent_t *aclent;
Expand All @@ -467,7 +467,6 @@ set_acl(struct archive *a, int fd, const char *name,
if (entries == 0)
return (ARCHIVE_OK);


switch (ae_requested_type) {
case ARCHIVE_ENTRY_ACL_TYPE_POSIX1E:
cmd = SETACL;
Expand All @@ -492,6 +491,12 @@ set_acl(struct archive *a, int fd, const char *name,
return (ARCHIVE_FAILED);
}

if (S_ISLNK(mode)) {
/* Skip ACLs on symbolic links */
ret = ARCHIVE_OK;
goto exit_free;
}

e = 0;

while (archive_acl_next(a, abstract_acl, ae_requested_type, &ae_type,
Expand Down Expand Up @@ -801,7 +806,7 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
if ((archive_acl_types(abstract_acl)
& ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) {
/* Solaris writes POSIX.1e access and default ACLs together */
ret = set_acl(a, fd, name, abstract_acl,
ret = set_acl(a, fd, name, abstract_acl, mode,
ARCHIVE_ENTRY_ACL_TYPE_POSIX1E, "posix1e");

/* Simultaneous POSIX.1e and NFSv4 is not supported */
Expand All @@ -810,7 +815,7 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
#if ARCHIVE_ACL_SUNOS_NFS4
else if ((archive_acl_types(abstract_acl) &
ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {
ret = set_acl(a, fd, name, abstract_acl,
ret = set_acl(a, fd, name, abstract_acl, mode,
ARCHIVE_ENTRY_ACL_TYPE_NFS4, "nfs4");
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion lib/libarchive/archive_entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define ARCHIVE_ENTRY_H_INCLUDED

/* Note: Compiler will complain if this does not match archive.h! */
#define ARCHIVE_VERSION_NUMBER 3005002
#define ARCHIVE_VERSION_NUMBER 3005003

/*
* Note: archive_entry.h is for use outside of libarchive; the
Expand Down
2 changes: 1 addition & 1 deletion lib/libarchive/archive_read_disk_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -1844,7 +1844,7 @@ tree_next(struct tree *t)
continue;
return (r);
} else {
HANDLE h = FindFirstFileW(d, &t->_findData);
HANDLE h = FindFirstFileW(t->stack->full_path.s, &t->_findData);
if (h == INVALID_HANDLE_VALUE) {
la_dosmaperr(GetLastError());
t->tree_errno = errno;
Expand Down
2 changes: 1 addition & 1 deletion lib/libarchive/archive_read_support_filter_rpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ rpm_filter_read(struct archive_read_filter *self, const void **buff)
archive_set_error(
&self->archive->archive,
ARCHIVE_ERRNO_FILE_FORMAT,
"Unrecoginized rpm header");
"Unrecognized rpm header");
return (ARCHIVE_FATAL);
}
rpm->state = ST_ARCHIVE;
Expand Down
2 changes: 1 addition & 1 deletion lib/libarchive/archive_read_support_filter_uu.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ bid_get_line(struct archive_read_filter *filter,
*ravail = *avail;
*b += diff;
*avail -= diff;
tested = len;/* Skip some bytes we already determinated. */
tested = len;/* Skip some bytes we already determined. */
len = get_line(*b + tested, *avail - tested, nl);
if (len >= 0)
len += tested;
Expand Down
2 changes: 1 addition & 1 deletion lib/libarchive/archive_read_support_format_7zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ decompress(struct archive_read *a, struct _7zip *zip,
zip->ppmd7_stat = -1;
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC,
"Failed to initialize PPMd range decorder");
"Failed to initialize PPMd range decoder");
return (ARCHIVE_FAILED);
}
if (zip->ppstream.overconsumed) {
Expand Down
6 changes: 3 additions & 3 deletions lib/libarchive/archive_read_support_format_mtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ next_line(struct archive_read *a,
*ravail = *avail;
*b += diff;
*avail -= diff;
tested = len;/* Skip some bytes we already determinated. */
tested = len;/* Skip some bytes we already determined. */
len = get_line_size(*b + len, *avail - len, nl);
if (len >= 0)
len += tested;
Expand Down Expand Up @@ -2035,13 +2035,13 @@ mtree_atol(char **p, int base)

if (**p == '-') {
limit = INT64_MIN / base;
last_digit_limit = INT64_MIN % base;
last_digit_limit = -(INT64_MIN % base);
++(*p);

l = 0;
digit = parsedigit(**p);
while (digit >= 0 && digit < base) {
if (l < limit || (l == limit && digit > last_digit_limit))
if (l < limit || (l == limit && digit >= last_digit_limit))
return INT64_MIN;
l = (l * base) - digit;
digit = parsedigit(*++(*p));
Expand Down
6 changes: 3 additions & 3 deletions lib/libarchive/archive_read_support_format_tar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1906,7 +1906,7 @@ pax_attribute(struct archive_read *a, struct tar *tar,
}
if (strcmp(key, "GNU.sparse.numbytes") == 0) {
tar->sparse_numbytes = tar_atol10(value, strlen(value));
if (tar->sparse_numbytes != -1) {
if (tar->sparse_offset != -1) {
if (gnu_add_sparse_entry(a, tar,
tar->sparse_offset, tar->sparse_numbytes)
!= ARCHIVE_OK)
Expand Down Expand Up @@ -2643,14 +2643,14 @@ tar_atol_base_n(const char *p, size_t char_cnt, int base)

maxval = INT64_MIN;
limit = -(INT64_MIN / base);
last_digit_limit = INT64_MIN % base;
last_digit_limit = -(INT64_MIN % base);
}

l = 0;
if (char_cnt != 0) {
digit = *p - '0';
while (digit >= 0 && digit < base && char_cnt != 0) {
if (l>limit || (l == limit && digit > last_digit_limit)) {
if (l>limit || (l == limit && digit >= last_digit_limit)) {
return maxval; /* Truncate on overflow. */
}
l = (l * base) + digit;
Expand Down
Loading

0 comments on commit 6bc2d67

Please sign in to comment.