MFV r361280:

Update libarchive to 3.4.3

Relevant vendor changes:
  PR #1352: support negative zstd compression levels
  PR #1359: improve zstd version checking
  PR #1348: support RHT.security.selinux from GNU tar
  PR #1357: support for archives compressed with pzstd
  PR #1367: fix issues in acl tests
  PR #1372: child handling cleanup
  PR #1378: fix memory leak from passphrase callback
This commit is contained in:
Martin Matuska 2020-05-20 20:58:48 +00:00
commit de6fa6b43b
32 changed files with 655 additions and 466 deletions

View File

@ -1,3 +1,9 @@
May 20, 2020: libarchive 3.4.3 released
Apr 30, 2020: Support for pzstd compressed files
Apr 16, 2020: Support for RHT.security.selinux tar extended attribute
Feb 11, 2020: libarchive 3.4.2 released
Jan 23, 2020: Important fixes for writing XAR archives

View File

@ -70,7 +70,7 @@ know about any errors or omissions you find.
## Supported Formats
Currently, the library automatically detects and reads the following fomats:
Currently, the library automatically detects and reads the following formats:
* Old V7 tar archives
* POSIX ustar
* GNU tar format (including GNU long filenames, long link names, and sparse files)

View File

@ -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 3004002
#define ARCHIVE_VERSION_NUMBER 3004003
#include <sys/stat.h>
#include <stddef.h> /* for wchar_t */
@ -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.4.2"
#define ARCHIVE_VERSION_ONLY_STRING "3.4.3"
#define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING
__LA_DECL const char * archive_version_string(void);

File diff suppressed because it is too large Load Diff

View File

@ -353,7 +353,7 @@ archive_entry_devminor(struct archive_entry *entry)
return minor(entry->ae_stat.aest_dev);
}
mode_t
__LA_MODE_T
archive_entry_filetype(struct archive_entry *entry)
{
return (AE_IFMT & entry->acl.mode);
@ -525,7 +525,7 @@ archive_entry_ino64(struct archive_entry *entry)
return (entry->ae_stat.aest_ino);
}
mode_t
__LA_MODE_T
archive_entry_mode(struct archive_entry *entry)
{
return (entry->acl.mode);
@ -598,7 +598,7 @@ _archive_entry_pathname_l(struct archive_entry *entry,
return (archive_mstring_get_mbs_l(&entry->ae_pathname, p, len, sc));
}
mode_t
__LA_MODE_T
archive_entry_perm(struct archive_entry *entry)
{
return (~AE_IFMT & entry->acl.mode);

View File

@ -30,7 +30,7 @@
#define ARCHIVE_ENTRY_H_INCLUDED
/* Note: Compiler will complain if this does not match archive.h! */
#define ARCHIVE_VERSION_NUMBER 3004002
#define ARCHIVE_VERSION_NUMBER 3004003
/*
* Note: archive_entry.h is for use outside of libarchive; the

View File

@ -215,9 +215,9 @@ and
set and unset the size, respectively.
.Pp
The number of references (hardlinks) can be obtained by calling
.Fn archive_entry_nlinks
.Fn archive_entry_nlink
and set with
.Fn archive_entry_set_nlinks .
.Fn archive_entry_set_nlink .
.Ss Identifying unique files
The functions
.Fn archive_entry_dev

View File

@ -57,6 +57,10 @@ insert_passphrase_to_head(struct archive_read *a,
{
p->next = a->passphrases.first;
a->passphrases.first = p;
if (&a->passphrases.first == a->passphrases.last) {
a->passphrases.last = &p->next;
p->next = NULL;
}
}
static struct archive_read_passphrase *

View File

@ -1658,7 +1658,7 @@ static int
setup_current_filesystem(struct archive_read_disk *a)
{
struct tree *t = a->tree;
struct statvfs sfs;
struct statvfs svfs;
int r, xr = 0;
t->current_filesystem->synthetic = -1;
@ -1667,16 +1667,16 @@ setup_current_filesystem(struct archive_read_disk *a)
return (ARCHIVE_FAILED);
}
if (tree_current_is_symblic_link_target(t)) {
r = statvfs(tree_current_access_path(t), &sfs);
r = statvfs(tree_current_access_path(t), &svfs);
if (r == 0)
xr = get_xfer_size(t, -1, tree_current_access_path(t));
} else {
#ifdef HAVE_FSTATVFS
r = fstatvfs(tree_current_dir_fd(t), &sfs);
r = fstatvfs(tree_current_dir_fd(t), &svfs);
if (r == 0)
xr = get_xfer_size(t, tree_current_dir_fd(t), NULL);
#else
r = statvfs(".", &sfs);
r = statvfs(".", &svfs);
if (r == 0)
xr = get_xfer_size(t, -1, ".");
#endif
@ -1688,30 +1688,30 @@ setup_current_filesystem(struct archive_read_disk *a)
} else if (xr == 1) {
/* Usually come here unless NetBSD supports _PC_REC_XFER_ALIGN
* for pathconf() function. */
t->current_filesystem->xfer_align = sfs.f_frsize;
t->current_filesystem->xfer_align = svfs.f_frsize;
t->current_filesystem->max_xfer_size = -1;
#if defined(HAVE_STRUCT_STATVFS_F_IOSIZE)
t->current_filesystem->min_xfer_size = sfs.f_iosize;
t->current_filesystem->incr_xfer_size = sfs.f_iosize;
t->current_filesystem->min_xfer_size = svfs.f_iosize;
t->current_filesystem->incr_xfer_size = svfs.f_iosize;
#else
t->current_filesystem->min_xfer_size = sfs.f_bsize;
t->current_filesystem->incr_xfer_size = sfs.f_bsize;
t->current_filesystem->min_xfer_size = svfs.f_bsize;
t->current_filesystem->incr_xfer_size = svfs.f_bsize;
#endif
}
if (sfs.f_flag & ST_LOCAL)
if (svfs.f_flag & ST_LOCAL)
t->current_filesystem->remote = 0;
else
t->current_filesystem->remote = 1;
#if defined(ST_NOATIME)
if (sfs.f_flag & ST_NOATIME)
if (svfs.f_flag & ST_NOATIME)
t->current_filesystem->noatime = 1;
else
#endif
t->current_filesystem->noatime = 0;
/* Set maximum filename length. */
t->current_filesystem->name_max = sfs.f_namemax;
t->current_filesystem->name_max = svfs.f_namemax;
return (ARCHIVE_OK);
}
@ -1840,7 +1840,7 @@ setup_current_filesystem(struct archive_read_disk *a)
#if defined(HAVE_STATVFS)
if (svfs.f_flag & ST_NOATIME)
#else
if (sfs.f_flag & ST_NOATIME)
if (sfs.f_flags & ST_NOATIME)
#endif
t->current_filesystem->noatime = 1;
else
@ -1864,7 +1864,7 @@ static int
setup_current_filesystem(struct archive_read_disk *a)
{
struct tree *t = a->tree;
struct statvfs sfs;
struct statvfs svfs;
int r, xr = 0;
t->current_filesystem->synthetic = -1;/* Not supported */
@ -1883,7 +1883,7 @@ setup_current_filesystem(struct archive_read_disk *a)
"openat failed");
return (ARCHIVE_FAILED);
}
r = fstatvfs(fd, &sfs);
r = fstatvfs(fd, &svfs);
if (r == 0)
xr = get_xfer_size(t, fd, NULL);
close(fd);
@ -1892,13 +1892,13 @@ setup_current_filesystem(struct archive_read_disk *a)
archive_set_error(&a->archive, errno, "fchdir failed");
return (ARCHIVE_FAILED);
}
r = statvfs(tree_current_access_path(t), &sfs);
r = statvfs(tree_current_access_path(t), &svfs);
if (r == 0)
xr = get_xfer_size(t, -1, tree_current_access_path(t));
#endif
} else {
#ifdef HAVE_FSTATVFS
r = fstatvfs(tree_current_dir_fd(t), &sfs);
r = fstatvfs(tree_current_dir_fd(t), &svfs);
if (r == 0)
xr = get_xfer_size(t, tree_current_dir_fd(t), NULL);
#else
@ -1906,7 +1906,7 @@ setup_current_filesystem(struct archive_read_disk *a)
archive_set_error(&a->archive, errno, "fchdir failed");
return (ARCHIVE_FAILED);
}
r = statvfs(".", &sfs);
r = statvfs(".", &svfs);
if (r == 0)
xr = get_xfer_size(t, -1, ".");
#endif
@ -1918,14 +1918,14 @@ setup_current_filesystem(struct archive_read_disk *a)
return (ARCHIVE_FAILED);
} else if (xr == 1) {
/* pathconf(_PC_REX_*) operations are not supported. */
t->current_filesystem->xfer_align = sfs.f_frsize;
t->current_filesystem->xfer_align = svfs.f_frsize;
t->current_filesystem->max_xfer_size = -1;
t->current_filesystem->min_xfer_size = sfs.f_bsize;
t->current_filesystem->incr_xfer_size = sfs.f_bsize;
t->current_filesystem->min_xfer_size = svfs.f_bsize;
t->current_filesystem->incr_xfer_size = svfs.f_bsize;
}
#if defined(ST_NOATIME)
if (sfs.f_flag & ST_NOATIME)
if (svfs.f_flag & ST_NOATIME)
t->current_filesystem->noatime = 1;
else
#endif
@ -1933,7 +1933,7 @@ setup_current_filesystem(struct archive_read_disk *a)
#if defined(USE_READDIR_R)
/* Set maximum filename length. */
t->current_filesystem->name_max = sfs.f_namemax;
t->current_filesystem->name_max = svfs.f_namemax;
#endif
return (ARCHIVE_OK);
}

View File

@ -400,7 +400,7 @@ __archive_read_program(struct archive_read_filter *self, const char *cmd)
static const size_t out_buf_len = 65536;
char *out_buf;
const char *prefix = "Program: ";
pid_t child;
int ret;
size_t l;
l = strlen(prefix) + strlen(cmd) + 1;
@ -426,9 +426,9 @@ __archive_read_program(struct archive_read_filter *self, const char *cmd)
state->out_buf = out_buf;
state->out_buf_len = out_buf_len;
child = __archive_create_child(cmd, &state->child_stdin,
&state->child_stdout);
if (child == -1) {
ret = __archive_create_child(cmd, &state->child_stdin,
&state->child_stdout, &state->child);
if (ret != ARCHIVE_OK) {
free(state->out_buf);
archive_string_free(&state->description);
free(state);
@ -437,21 +437,6 @@ __archive_read_program(struct archive_read_filter *self, const char *cmd)
cmd);
return (ARCHIVE_FATAL);
}
#if defined(_WIN32) && !defined(__CYGWIN__)
state->child = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, child);
if (state->child == NULL) {
child_stop(self, state);
free(state->out_buf);
archive_string_free(&state->description);
free(state);
archive_set_error(&self->archive->archive, EINVAL,
"Can't initialize filter; unable to run program \"%s\"",
cmd);
return (ARCHIVE_FATAL);
}
#else
state->child = child;
#endif
self->data = state;
self->read = program_filter_read;

View File

@ -119,6 +119,8 @@ zstd_bidder_bid(struct archive_read_filter_bidder *self,
/* Zstd frame magic values */
const unsigned zstd_magic = 0xFD2FB528U;
const unsigned zstd_magic_skippable_start = 0x184D2A50U;
const unsigned zstd_magic_skippable_mask = 0xFFFFFFF0;
(void) self; /* UNUSED */
@ -129,6 +131,8 @@ zstd_bidder_bid(struct archive_read_filter_bidder *self,
prefix = archive_le32dec(buffer);
if (prefix == zstd_magic)
return (32);
if ((prefix & zstd_magic_skippable_mask) == zstd_magic_skippable_start)
return (32);
return (0);
}

View File

@ -3084,12 +3084,6 @@ static int do_uncompress_block(struct archive_read* a, const uint8_t* p) {
continue;
}
/* The program counter shouldn't reach here. */
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Unsupported block code: 0x%x", num);
return ARCHIVE_FATAL;
}
return ARCHIVE_OK;

View File

@ -1796,6 +1796,16 @@ pax_attribute_schily_xattr(struct archive_entry *entry,
return 0;
}
static int
pax_attribute_rht_security_selinux(struct archive_entry *entry,
const char *value, size_t value_length)
{
archive_entry_xattr_add_entry(entry, "security.selinux",
value, value_length);
return 0;
}
static int
pax_attribute_acl(struct archive_read *a, struct tar *tar,
struct archive_entry *entry, const char *value, int type)
@ -1968,6 +1978,14 @@ pax_attribute(struct archive_read *a, struct tar *tar,
if (memcmp(key, "LIBARCHIVE.xattr.", 17) == 0)
pax_attribute_xattr(entry, key, value);
break;
case 'R':
/* GNU tar uses RHT.security header to store SELinux xattrs
* SCHILY.xattr.security.selinux == RHT.security.selinux */
if (strcmp(key, "RHT.security.selinux") == 0) {
pax_attribute_rht_security_selinux(entry, value,
value_length);
}
break;
case 'S':
/* We support some keys used by the "star" archiver */
if (strcmp(key, "SCHILY.acl.access") == 0) {

View File

@ -196,10 +196,6 @@ __archive_write_program_free(struct archive_write_program_data *data)
{
if (data) {
#if defined(_WIN32) && !defined(__CYGWIN__)
if (data->child)
CloseHandle(data->child);
#endif
free(data->program_name);
free(data->child_buf);
free(data);
@ -211,7 +207,7 @@ int
__archive_write_program_open(struct archive_write_filter *f,
struct archive_write_program_data *data, const char *cmd)
{
pid_t child;
int ret;
if (data->child_buf == NULL) {
data->child_buf_len = 65536;
@ -225,27 +221,13 @@ __archive_write_program_open(struct archive_write_filter *f,
}
}
child = __archive_create_child(cmd, &data->child_stdin,
&data->child_stdout);
if (child == -1) {
ret = __archive_create_child(cmd, &data->child_stdin,
&data->child_stdout, &data->child);
if (ret != ARCHIVE_OK) {
archive_set_error(f->archive, EINVAL,
"Can't launch external program: %s", cmd);
return (ARCHIVE_FATAL);
}
#if defined(_WIN32) && !defined(__CYGWIN__)
data->child = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, child);
if (data->child == NULL) {
close(data->child_stdin);
data->child_stdin = -1;
close(data->child_stdout);
data->child_stdout = -1;
archive_set_error(f->archive, EINVAL,
"Can't launch external program: %s", cmd);
return (ARCHIVE_FATAL);
}
#else
data->child = child;
#endif
return (ARCHIVE_OK);
}

View File

@ -59,6 +59,16 @@ struct private_data {
#endif
};
/* If we don't have the library use default range values (zstdcli.c v1.4.0) */
#define CLEVEL_MIN -99
#define CLEVEL_STD_MIN 0 /* prior to 1.3.4 and more recent without using --fast */
#define CLEVEL_DEFAULT 3
#define CLEVEL_STD_MAX 19 /* without using --ultra */
#define CLEVEL_MAX 22
#define MINVER_NEGCLEVEL 10304
#define MINVER_MINCLEVEL 10306
static int archive_compressor_zstd_options(struct archive_write_filter *,
const char *, const char *);
static int archive_compressor_zstd_open(struct archive_write_filter *);
@ -96,7 +106,7 @@ archive_write_add_filter_zstd(struct archive *_a)
f->free = &archive_compressor_zstd_free;
f->code = ARCHIVE_FILTER_ZSTD;
f->name = "zstd";
data->compression_level = 3; /* Default level used by the zstd CLI */
data->compression_level = CLEVEL_DEFAULT;
#if HAVE_ZSTD_H && HAVE_LIBZSTD
data->cstream = ZSTD_createCStream();
if (data->cstream == NULL) {
@ -135,6 +145,31 @@ archive_compressor_zstd_free(struct archive_write_filter *f)
return (ARCHIVE_OK);
}
static int string_is_numeric (const char* value)
{
size_t len = strlen(value);
size_t i;
if (len == 0) {
return (ARCHIVE_WARN);
}
else if (len == 1 && !(value[0] >= '0' && value[0] <= '9')) {
return (ARCHIVE_WARN);
}
else if (!(value[0] >= '0' && value[0] <= '9') &&
value[0] != '-' && value[0] != '+') {
return (ARCHIVE_WARN);
}
for (i = 1; i < len; i++) {
if (!(value[i] >= '0' && value[i] <= '9')) {
return (ARCHIVE_WARN);
}
}
return (ARCHIVE_OK);
}
/*
* Set write options.
*/
@ -146,12 +181,25 @@ archive_compressor_zstd_options(struct archive_write_filter *f, const char *key,
if (strcmp(key, "compression-level") == 0) {
int level = atoi(value);
#if HAVE_ZSTD_H && HAVE_LIBZSTD
if (level < 1 || level > ZSTD_maxCLevel()) {
#else
/* If we don't have the library, hard-code the max level */
if (level < 1 || level > 22) {
int minimum = CLEVEL_MIN;
int maximum = CLEVEL_MAX;
if (string_is_numeric(value) != ARCHIVE_OK) {
return (ARCHIVE_WARN);
}
#if HAVE_ZSTD_H && HAVE_LIBZSTD
maximum = ZSTD_maxCLevel();
#if ZSTD_VERSION_NUMBER >= MINVER_MINCLEVEL
if (ZSTD_versionNumber() >= MINVER_MINCLEVEL) {
minimum = ZSTD_minCLevel();
}
else
#endif
if (ZSTD_versionNumber() < MINVER_NEGCLEVEL) {
minimum = CLEVEL_STD_MIN;
}
#endif
if (level < minimum || level > maximum) {
return (ARCHIVE_WARN);
}
data->compression_level = level;
@ -297,7 +345,26 @@ archive_compressor_zstd_open(struct archive_write_filter *f)
int r;
archive_string_init(&as);
archive_string_sprintf(&as, "zstd -%d", data->compression_level);
/* --no-check matches library default */
archive_strcpy(&as, "zstd --no-check");
if (data->compression_level < CLEVEL_STD_MIN) {
struct archive_string as2;
archive_string_init(&as2);
archive_string_sprintf(&as2, " --fast=%d", -data->compression_level);
archive_string_concat(&as, &as2);
archive_string_free(&as2);
} else {
struct archive_string as2;
archive_string_init(&as2);
archive_string_sprintf(&as2, " -%d", data->compression_level);
archive_string_concat(&as, &as2);
archive_string_free(&as2);
}
if (data->compression_level > CLEVEL_STD_MAX) {
archive_strcat(&as, " --ultra");
}
f->write = archive_compressor_zstd_write;
r = __archive_write_program_open(f, data->pdata, as.s);

View File

@ -255,7 +255,8 @@ If supported, the default value is read from
.Bl -tag -compact -width indent
.It Cm compression-level
The value is interpreted as a decimal integer specifying the
compression level. Supported values are from 1 to 22.
compression level. Supported values depend on the library version,
common values are from 1 to 22.
.El
.It Format 7zip
.Bl -tag -compact -width indent

View File

@ -32,8 +32,13 @@
#error This header is only to be used internally to libarchive.
#endif
pid_t
__archive_create_child(const char *cmd, int *child_stdin, int *child_stdout);
int
__archive_create_child(const char *cmd, int *child_stdin, int *child_stdout,
#if defined(_WIN32) && !defined(__CYGWIN__)
HANDLE *out_child);
#else
pid_t *out_child);
#endif
void
__archive_check_child(int in, int out);

View File

@ -72,8 +72,9 @@ __FBSDID("$FreeBSD: head/lib/libarchive/filter_fork.c 182958 2008-09-12 05:33:00
#include "filter_fork.h"
pid_t
__archive_create_child(const char *cmd, int *child_stdin, int *child_stdout)
int
__archive_create_child(const char *cmd, int *child_stdin, int *child_stdout,
pid_t *out_child)
{
pid_t child;
int stdin_pipe[2], stdout_pipe[2], tmp;
@ -177,7 +178,8 @@ __archive_create_child(const char *cmd, int *child_stdin, int *child_stdout)
fcntl(*child_stdout, F_SETFL, O_NONBLOCK);
__archive_cmdline_free(cmdline);
return child;
*out_child = child;
return ARCHIVE_OK;
#if HAVE_POSIX_SPAWNP
actions_inited:
@ -192,7 +194,7 @@ __archive_create_child(const char *cmd, int *child_stdin, int *child_stdout)
close(stdin_pipe[1]);
state_allocated:
__archive_cmdline_free(cmdline);
return -1;
return ARCHIVE_FAILED;
}
void

View File

@ -634,9 +634,11 @@ acl_match(acl_entry_t aclent, struct myacl_t *myacl)
case ACL_ENTRY_TYPE_AUDIT:
if (myacl->type != ARCHIVE_ENTRY_ACL_TYPE_AUDIT)
return (0);
break;
case ACL_ENTRY_TYPE_ALARM:
if (myacl->type != ARCHIVE_ENTRY_ACL_TYPE_ALARM)
return (0);
break;
default:
return (0);
}

View File

@ -364,8 +364,8 @@ DEFINE_TEST(test_acl_platform_posix1e_read)
struct archive *a;
struct archive_entry *ae;
int n, fd, flags, dflags;
char *func, *acl_text;
const char *acl1_text, *acl2_text, *acl3_text;
char *acl_text;
const char *func, *acl1_text, *acl2_text, *acl3_text;
#if ARCHIVE_ACL_SUNOS
void *aclp;
int aclcnt;

View File

@ -79,4 +79,7 @@ DEFINE_TEST(test_compat_zstd)
/* This sample was compressed as 3 separate streams with a zstd skippable
* frame placed in the middle */
compat_zstd("test_compat_zstd_1.tar.zst");
/* The same sample compressed with pzstd */
compat_zstd("test_compat_zstd_2.tar.zst");
}

View File

@ -0,0 +1,8 @@
begin 664 test_compat_zstd_2.tar.zst
M4"I-&`0```"J````*+4O_018[00`\L41%I`I!%(KMV]N7BR&@9(I29\:P8D9
ML"GMK=GZS(ZZ!!ZT[%K7J3*`"W$0PR(Y((0".0A!DE`,:6K4D_ZNQG_J=DP.
M&<:1G$L?`/U!!?M`/3*@&,!$`:C[!RHC`TH`#!.`8O]`%61`!UAQ`E"Z#U1&
M!E0#@C0`=?Q`961`"<#N`;(9'$PC'ZA$`A16ZL#%$IP``!*"=UWAE$]@"$B5
"Q>,`
`
end

View File

@ -0,0 +1,62 @@
/*-
* Copyright (c) 2016 IBM Corporation
* 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.
*
* This test case's code has been derived from test_entry.c
*/
#include "test.h"
DEFINE_TEST(test_read_pax_xattr_rht_security_selinux)
{
struct archive *a;
struct archive_entry *ae;
const char *refname = "test_read_pax_xattr_rht_security_selinux.tar";
const char *xname; /* For xattr tests. */
const void *xval; /* For xattr tests. */
size_t xsize; /* For xattr tests. */
const char *string;
assert((a = archive_read_new()) != NULL);
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
extract_reference_file(refname);
assertEqualIntA(a, ARCHIVE_OK,
archive_read_open_filename(a, refname, 10240));
assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae));
assertEqualInt(1, archive_entry_xattr_count(ae));
assertEqualInt(1, archive_entry_xattr_reset(ae));
assertEqualInt(0, archive_entry_xattr_next(ae, &xname, &xval, &xsize));
assertEqualString(xname, "security.selinux");
string = "system_u:object_r:admin_home_t:s0";
assertEqualMem(xval, string, xsize);
assertEqualInt((int)xsize, strlen(string));
/* Close the archive. */
assertEqualInt(ARCHIVE_OK, archive_read_close(a));
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
}

View File

@ -0,0 +1,231 @@
begin 664 test_read_pax_xattr_rht_security_selinux.tar
M+B]087A(96%D97)S+C$V-C0O=&5S="YT>'0`````````````````````````
M````````````````````````````````````````````````````````````
M`````````````#`P,#`V-#0`,#`P,#`P,``P,#`P,#`P`#`P,#`P,#`P,C(R
M`#$S-#8T-S<U-30U`#`Q,C0S-``@>```````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````````````!U<W1A<@`P,```````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M```````````````````````R.2!M=&EM93TQ-34W,SDV,S(U+C@P-C`V-#<Q
M"C(Y(&%T:6UE/3$U-3<S.38S,C4N.#`V,#8T-S$*,S`@8W1I;64],34X-CDY
M-C,R,RXR-S@P,C`V-3@*-3@@4DA4+G-E8W5R:71Y+G-E;&EN=7@]<WES=&5M
M7W4Z;V)J96-T7W(Z861M:6Y?:&]M95]T.G,P"@``````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````````````````'1E<W0N='AT````
M````````````````````````````````````````````````````````````
M```````````````````````````````````````````````````````````P
M,#`P-C0T`#`P,#`P,#``,#`P,#`P,``P,#`P,#`P,#`P,``Q,S0V-#<W-34T
M-0`P,3(V,#8`(#``````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````=7-T87(`,#!R;V]T````````````````
M`````````````````````')O;W0`````````````````````````````````
M````,#`P,#`P,``P,#`P,#`P````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
9````````````````````````````````````
`
end

View File

@ -28,11 +28,11 @@
*/
#include "test.h"
DEFINE_TEST(test_schily_xattr_pax)
DEFINE_TEST(test_read_pax_xattr_schily)
{
struct archive *a;
struct archive_entry *ae;
const char *refname = "test_read_pax_schily_xattr.tar";
const char *refname = "test_read_pax_xattr_schily.tar";
const char *xname; /* For xattr tests. */
const void *xval; /* For xattr tests. */
size_t xsize; /* For xattr tests. */

View File

@ -1,4 +1,4 @@
begin 644 test_schily_xattr_pax.tar
begin 644 test_read_pax_xattr_schily.tar.uu
M+B]087A(96%D97)S+C$U,C4O8V]N9F9I;&5S````````````````````````
M````````````````````````````````````````````````````````````
M`````````````#`P,#`V-#0`,#`P,#`P,``P,#`P,#`P`#`P,#`P,#`P-C0W

View File

@ -124,6 +124,9 @@ DEFINE_TEST(test_write_filter_zstd)
archive_write_set_filter_option(a, NULL, "compression-level", "25")); /* too big */
assertEqualIntA(a, ARCHIVE_OK,
archive_write_set_filter_option(a, NULL, "compression-level", "9"));
/* Following is disabled as it will fail on library versions < 1.3.4 */
/* assertEqualIntA(a, ARCHIVE_OK,
archive_write_set_filter_option(a, NULL, "compression-level", "-1")); */
assertEqualIntA(a, ARCHIVE_OK,
archive_write_set_filter_option(a, NULL, "compression-level", "7"));
assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2));

View File

@ -631,7 +631,8 @@ A decimal integer from 4 to 7 specifying the lz4 compression block size
Use the previous block of the block being compressed for
a compression dictionary to improve compression ratio.
.It Cm zstd:compression-level
A decimal integer from 1 to 22 specifying the zstd compression level.
A decimal integer specifying the zstd compression level. Supported values depend
on the library version, common values are from 1 to 22.
.It Cm lzop:compression-level
A decimal integer from 1 to 9 specifying the lzop compression level.
.It Cm xz:compression-level

View File

@ -205,7 +205,8 @@ TESTS_SRCS= \
test_read_format_zip_with_invalid_traditional_eocd.c \
test_read_format_zip_zip64.c \
test_read_large.c \
test_read_pax_schily_xattr.c \
test_read_pax_xattr_rht_security_selinux.c \
test_read_pax_xattr_schily.c \
test_read_pax_truncated.c \
test_read_position.c \
test_read_set_format.c \
@ -383,6 +384,7 @@ ${PACKAGE}FILES+= test_compat_zip_6.zip.uu
${PACKAGE}FILES+= test_compat_zip_7.xps.uu
${PACKAGE}FILES+= test_compat_zip_8.zip.uu
${PACKAGE}FILES+= test_compat_zstd_1.tar.zst.uu
${PACKAGE}FILES+= test_compat_zstd_2.tar.zst.uu
${PACKAGE}FILES+= test_fuzz.cab.uu
${PACKAGE}FILES+= test_fuzz.lzh.uu
${PACKAGE}FILES+= test_fuzz_1.iso.Z.uu
@ -628,7 +630,8 @@ ${PACKAGE}FILES+= test_read_large_splitted_rar_ab.uu
${PACKAGE}FILES+= test_read_large_splitted_rar_ac.uu
${PACKAGE}FILES+= test_read_large_splitted_rar_ad.uu
${PACKAGE}FILES+= test_read_large_splitted_rar_ae.uu
${PACKAGE}FILES+= test_read_pax_schily_xattr.tar.uu
${PACKAGE}FILES+= test_read_pax_xattr_rht_security_selinux.tar.uu
${PACKAGE}FILES+= test_read_pax_xattr_schily.tar.uu
${PACKAGE}FILES+= test_read_splitted_rar_aa.uu
${PACKAGE}FILES+= test_read_splitted_rar_ab.uu
${PACKAGE}FILES+= test_read_splitted_rar_ac.uu

View File

@ -6,7 +6,7 @@ _LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive
_LIBARCHIVECONFDIR= ${SRCTOP}/lib/libarchive
PROG= bsdcat
BSDCAT_VERSION_STRING= 3.4.2
BSDCAT_VERSION_STRING= 3.4.3
.PATH: ${_LIBARCHIVEDIR}/cat
SRCS= bsdcat.c cmdline.c

View File

@ -6,7 +6,7 @@ _LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive
_LIBARCHIVECONFDIR= ${SRCTOP}/lib/libarchive
PROG= bsdcpio
BSDCPIO_VERSION_STRING= 3.4.2
BSDCPIO_VERSION_STRING= 3.4.3
.PATH: ${_LIBARCHIVEDIR}/cpio
SRCS= cpio.c cmdline.c

View File

@ -5,7 +5,7 @@ _LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive
PACKAGE= runtime
PROG= bsdtar
BSDTAR_VERSION_STRING= 3.4.2
BSDTAR_VERSION_STRING= 3.4.3
.PATH: ${_LIBARCHIVEDIR}/tar
SRCS= bsdtar.c \