MFV r307859:
Update libarchive to 3.2.2
This commit is contained in:
parent
26ea906520
commit
7fe6ca699f
@ -1,3 +1,6 @@
|
||||
Oct 23, 2016: libarchive 3.2.2 released
|
||||
Security release
|
||||
|
||||
Jun 20, 2016: libarchive 3.2.1 released
|
||||
This fixes a handful of security and other critical issues with 3.2.0
|
||||
|
||||
|
@ -129,6 +129,13 @@
|
||||
# include <crtdbg.h>
|
||||
#endif
|
||||
|
||||
mode_t umasked(mode_t expected_mode)
|
||||
{
|
||||
mode_t mode = umask(0);
|
||||
umask(mode);
|
||||
return expected_mode & ~mode;
|
||||
}
|
||||
|
||||
/* Path to working directory for current test */
|
||||
const char *testworkdir;
|
||||
#ifdef PROGRAM
|
||||
@ -1156,6 +1163,35 @@ assertion_file_contains_lines_any_order(const char *file, int line,
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Verify that a text file does not contains the specified strings */
|
||||
int
|
||||
assertion_file_contains_no_invalid_strings(const char *file, int line,
|
||||
const char *pathname, const char *strings[])
|
||||
{
|
||||
char *buff;
|
||||
int i;
|
||||
|
||||
buff = slurpfile(NULL, "%s", pathname);
|
||||
if (buff == NULL) {
|
||||
failure_start(file, line, "Can't read file: %s", pathname);
|
||||
failure_finish(NULL);
|
||||
return (0);
|
||||
}
|
||||
|
||||
for (i = 0; strings[i] != NULL; ++i) {
|
||||
if (strstr(buff, strings[i]) != NULL) {
|
||||
failure_start(file, line, "Invalid string in %s: %s", pathname,
|
||||
strings[i]);
|
||||
failure_finish(NULL);
|
||||
free(buff);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
free(buff);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Test that two paths point to the same file. */
|
||||
/* As a side-effect, asserts that both files exist. */
|
||||
static int
|
||||
@ -1293,6 +1329,11 @@ assertion_file_time(const char *file, int line,
|
||||
switch (type) {
|
||||
case 'a': filet_nsec = st.st_atimespec.tv_nsec; break;
|
||||
case 'b': filet = st.st_birthtime;
|
||||
/* FreeBSD filesystems that don't support birthtime
|
||||
* (e.g., UFS1) always return -1 here. */
|
||||
if (filet == -1) {
|
||||
return (1);
|
||||
}
|
||||
filet_nsec = st.st_birthtimespec.tv_nsec; break;
|
||||
case 'm': filet_nsec = st.st_mtimespec.tv_nsec; break;
|
||||
default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type);
|
||||
@ -1370,6 +1411,8 @@ assertion_file_mode(const char *file, int line, const char *pathname, int expect
|
||||
assertion_count(file, line);
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
failure_start(file, line, "assertFileMode not yet implemented for Windows");
|
||||
(void)mode; /* UNUSED */
|
||||
(void)r; /* UNUSED */
|
||||
#else
|
||||
{
|
||||
struct stat st;
|
||||
@ -1424,7 +1467,7 @@ assertion_file_nlinks(const char *file, int line,
|
||||
assertion_count(file, line);
|
||||
r = lstat(pathname, &st);
|
||||
if (r == 0 && (int)st.st_nlink == nlinks)
|
||||
return (1);
|
||||
return (1);
|
||||
failure_start(file, line, "File %s has %d links, expected %d",
|
||||
pathname, st.st_nlink, nlinks);
|
||||
failure_finish(NULL);
|
||||
@ -1660,6 +1703,7 @@ assertion_make_file(const char *file, int line,
|
||||
if (0 != chmod(path, mode)) {
|
||||
failure_start(file, line, "Could not chmod %s", path);
|
||||
failure_finish(NULL);
|
||||
close(fd);
|
||||
return (0);
|
||||
}
|
||||
if (contents != NULL) {
|
||||
@ -1674,6 +1718,7 @@ assertion_make_file(const char *file, int line,
|
||||
failure_start(file, line,
|
||||
"Could not write to %s", path);
|
||||
failure_finish(NULL);
|
||||
close(fd);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
@ -174,6 +174,9 @@
|
||||
/* Assert that file contents match a string. */
|
||||
#define assertFileContents(data, data_size, pathname) \
|
||||
assertion_file_contents(__FILE__, __LINE__, data, data_size, pathname)
|
||||
/* Verify that a file does not contain invalid strings */
|
||||
#define assertFileContainsNoInvalidStrings(pathname, strings) \
|
||||
assertion_file_contains_no_invalid_strings(__FILE__, __LINE__, pathname, strings)
|
||||
#define assertFileMtime(pathname, sec, nsec) \
|
||||
assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec)
|
||||
#define assertFileMtimeRecent(pathname) \
|
||||
@ -182,6 +185,8 @@
|
||||
assertion_file_nlinks(__FILE__, __LINE__, pathname, nlinks)
|
||||
#define assertFileSize(pathname, size) \
|
||||
assertion_file_size(__FILE__, __LINE__, pathname, size)
|
||||
#define assertFileMode(pathname, mode) \
|
||||
assertion_file_mode(__FILE__, __LINE__, pathname, mode)
|
||||
#define assertTextFileContents(text, pathname) \
|
||||
assertion_text_file_contents(__FILE__, __LINE__, text, pathname)
|
||||
#define assertFileContainsLinesAnyOrder(pathname, lines) \
|
||||
@ -239,6 +244,7 @@ int assertion_file_atime_recent(const char *, int, const char *);
|
||||
int assertion_file_birthtime(const char *, int, const char *, long, long);
|
||||
int assertion_file_birthtime_recent(const char *, int, const char *);
|
||||
int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **);
|
||||
int assertion_file_contains_no_invalid_strings(const char *, int, const char *, const char **);
|
||||
int assertion_file_contents(const char *, int, const void *, int, const char *);
|
||||
int assertion_file_exists(const char *, int, const char *);
|
||||
int assertion_file_mode(const char *, int, const char *, int);
|
||||
@ -327,6 +333,9 @@ void copy_reference_file(const char *);
|
||||
*/
|
||||
void extract_reference_files(const char **);
|
||||
|
||||
/* Subtract umask from mode */
|
||||
mode_t umasked(mode_t expected_mode);
|
||||
|
||||
/* Path to working directory for current test */
|
||||
extern const char *testworkdir;
|
||||
|
||||
|
@ -1164,6 +1164,35 @@ assertion_file_contains_lines_any_order(const char *file, int line,
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Verify that a text file does not contains the specified strings */
|
||||
int
|
||||
assertion_file_contains_no_invalid_strings(const char *file, int line,
|
||||
const char *pathname, const char *strings[])
|
||||
{
|
||||
char *buff;
|
||||
int i;
|
||||
|
||||
buff = slurpfile(NULL, "%s", pathname);
|
||||
if (buff == NULL) {
|
||||
failure_start(file, line, "Can't read file: %s", pathname);
|
||||
failure_finish(NULL);
|
||||
return (0);
|
||||
}
|
||||
|
||||
for (i = 0; strings[i] != NULL; ++i) {
|
||||
if (strstr(buff, strings[i]) != NULL) {
|
||||
failure_start(file, line, "Invalid string in %s: %s", pathname,
|
||||
strings[i]);
|
||||
failure_finish(NULL);
|
||||
free(buff);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
free(buff);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Test that two paths point to the same file. */
|
||||
/* As a side-effect, asserts that both files exist. */
|
||||
static int
|
||||
@ -1383,6 +1412,8 @@ assertion_file_mode(const char *file, int line, const char *pathname, int expect
|
||||
assertion_count(file, line);
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
failure_start(file, line, "assertFileMode not yet implemented for Windows");
|
||||
(void)mode; /* UNUSED */
|
||||
(void)r; /* UNUSED */
|
||||
#else
|
||||
{
|
||||
struct stat st;
|
||||
|
@ -174,6 +174,9 @@
|
||||
/* Assert that file contents match a string. */
|
||||
#define assertFileContents(data, data_size, pathname) \
|
||||
assertion_file_contents(__FILE__, __LINE__, data, data_size, pathname)
|
||||
/* Verify that a file does not contain invalid strings */
|
||||
#define assertFileContainsNoInvalidStrings(pathname, strings) \
|
||||
assertion_file_contains_no_invalid_strings(__FILE__, __LINE__, pathname, strings)
|
||||
#define assertFileMtime(pathname, sec, nsec) \
|
||||
assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec)
|
||||
#define assertFileMtimeRecent(pathname) \
|
||||
@ -241,6 +244,7 @@ int assertion_file_atime_recent(const char *, int, const char *);
|
||||
int assertion_file_birthtime(const char *, int, const char *, long, long);
|
||||
int assertion_file_birthtime_recent(const char *, int, const char *);
|
||||
int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **);
|
||||
int assertion_file_contains_no_invalid_strings(const char *, int, const char *, const char **);
|
||||
int assertion_file_contents(const char *, int, const void *, int, const char *);
|
||||
int assertion_file_exists(const char *, int, const char *);
|
||||
int assertion_file_mode(const char *, int, const char *, int);
|
||||
|
@ -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 3002001
|
||||
#define ARCHIVE_VERSION_NUMBER 3002002
|
||||
|
||||
#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.2.1"
|
||||
#define ARCHIVE_VERSION_ONLY_STRING "3.2.2"
|
||||
#define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING
|
||||
__LA_DECL const char * archive_version_string(void);
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#define ARCHIVE_ENTRY_H_INCLUDED
|
||||
|
||||
/* Note: Compiler will complain if this does not match archive.h! */
|
||||
#define ARCHIVE_VERSION_NUMBER 3002001
|
||||
#define ARCHIVE_VERSION_NUMBER 3002002
|
||||
|
||||
/*
|
||||
* Note: archive_entry.h is for use outside of libarchive; the
|
||||
|
@ -1162,6 +1162,35 @@ assertion_file_contains_lines_any_order(const char *file, int line,
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Verify that a text file does not contains the specified strings */
|
||||
int
|
||||
assertion_file_contains_no_invalid_strings(const char *file, int line,
|
||||
const char *pathname, const char *strings[])
|
||||
{
|
||||
char *buff;
|
||||
int i;
|
||||
|
||||
buff = slurpfile(NULL, "%s", pathname);
|
||||
if (buff == NULL) {
|
||||
failure_start(file, line, "Can't read file: %s", pathname);
|
||||
failure_finish(NULL);
|
||||
return (0);
|
||||
}
|
||||
|
||||
for (i = 0; strings[i] != NULL; ++i) {
|
||||
if (strstr(buff, strings[i]) != NULL) {
|
||||
failure_start(file, line, "Invalid string in %s: %s", pathname,
|
||||
strings[i]);
|
||||
failure_finish(NULL);
|
||||
free(buff);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
free(buff);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Test that two paths point to the same file. */
|
||||
/* As a side-effect, asserts that both files exist. */
|
||||
static int
|
||||
@ -1381,6 +1410,8 @@ assertion_file_mode(const char *file, int line, const char *pathname, int expect
|
||||
assertion_count(file, line);
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
failure_start(file, line, "assertFileMode not yet implemented for Windows");
|
||||
(void)mode; /* UNUSED */
|
||||
(void)r; /* UNUSED */
|
||||
#else
|
||||
{
|
||||
struct stat st;
|
||||
|
@ -174,6 +174,9 @@
|
||||
/* Assert that file contents match a string. */
|
||||
#define assertFileContents(data, data_size, pathname) \
|
||||
assertion_file_contents(__FILE__, __LINE__, data, data_size, pathname)
|
||||
/* Verify that a file does not contain invalid strings */
|
||||
#define assertFileContainsNoInvalidStrings(pathname, strings) \
|
||||
assertion_file_contains_no_invalid_strings(__FILE__, __LINE__, pathname, strings)
|
||||
#define assertFileMtime(pathname, sec, nsec) \
|
||||
assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec)
|
||||
#define assertFileMtimeRecent(pathname) \
|
||||
@ -241,6 +244,7 @@ int assertion_file_atime_recent(const char *, int, const char *);
|
||||
int assertion_file_birthtime(const char *, int, const char *, long, long);
|
||||
int assertion_file_birthtime_recent(const char *, int, const char *);
|
||||
int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **);
|
||||
int assertion_file_contains_no_invalid_strings(const char *, int, const char *, const char **);
|
||||
int assertion_file_contents(const char *, int, const void *, int, const char *);
|
||||
int assertion_file_exists(const char *, int, const char *);
|
||||
int assertion_file_mode(const char *, int, const char *, int);
|
||||
|
@ -33,6 +33,11 @@ DEFINE_TEST(test_read_format_mtree_crash747)
|
||||
const char *reffile = "test_read_format_mtree_crash747.mtree.bz2";
|
||||
struct archive *a;
|
||||
|
||||
if (archive_bzlib_version() == NULL) {
|
||||
skipping("This test requires bzlib");
|
||||
return;
|
||||
}
|
||||
|
||||
extract_reference_file(reffile);
|
||||
|
||||
assert((a = archive_read_new()) != NULL);
|
||||
|
@ -50,6 +50,11 @@ DEFINE_TEST(test_read_format_zip_high_compression)
|
||||
size_t s;
|
||||
int64_t o;
|
||||
|
||||
if (archive_zlib_version() == NULL) {
|
||||
skipping("Zip compression test requires zlib");
|
||||
return;
|
||||
}
|
||||
|
||||
extract_reference_file(refname);
|
||||
p = slurpfile(&archive_size, refname);
|
||||
|
||||
@ -82,6 +87,11 @@ DEFINE_TEST(test_read_format_zip_high_compression2)
|
||||
char *body, *body_read, *buff;
|
||||
int n;
|
||||
|
||||
if (archive_zlib_version() == NULL) {
|
||||
skipping("Zip compression test requires zlib");
|
||||
return;
|
||||
}
|
||||
|
||||
assert((body = malloc(body_size)) != NULL);
|
||||
assert((body_read = malloc(body_size)) != NULL);
|
||||
assert((buff = malloc(buff_size)) != NULL);
|
||||
|
@ -133,11 +133,12 @@ DEFINE_TEST(test_read_append_filter)
|
||||
assert((a = archive_read_new()) != NULL);
|
||||
assertA(0 == archive_read_set_format(a, ARCHIVE_FORMAT_TAR));
|
||||
r = archive_read_append_filter(a, ARCHIVE_FILTER_GZIP);
|
||||
if (r == ARCHIVE_WARN && !canGzip()) {
|
||||
skipping("gzip reading not fully supported on this platform");
|
||||
if (r != ARCHIVE_OK && archive_zlib_version() == NULL && !canGzip()) {
|
||||
skipping("gzip tests require zlib or working gzip command");
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||
return;
|
||||
}
|
||||
assertEqualIntA(a, ARCHIVE_OK, r);
|
||||
assertEqualInt(ARCHIVE_OK,
|
||||
archive_read_open_memory(a, archive, sizeof(archive)));
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
@ -200,8 +201,11 @@ DEFINE_TEST(test_read_append_filter_wrong_program)
|
||||
{
|
||||
struct archive_entry *ae;
|
||||
struct archive *a;
|
||||
#if !defined(_WIN32) || defined(__CYGWIN__)
|
||||
FILE * fp;
|
||||
int fd;
|
||||
fpos_t pos;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If we have "bunzip2 -q", try using that.
|
||||
@ -211,11 +215,13 @@ DEFINE_TEST(test_read_append_filter_wrong_program)
|
||||
return;
|
||||
}
|
||||
|
||||
#if !defined(_WIN32) || defined(__CYGWIN__)
|
||||
/* bunzip2 will write to stderr, redirect it to a file */
|
||||
fflush(stderr);
|
||||
fgetpos(stderr, &pos);
|
||||
fd = dup(fileno(stderr));
|
||||
freopen("stderr1", "w", stderr);
|
||||
fp = freopen("stderr1", "w", stderr);
|
||||
#endif
|
||||
|
||||
assert((a = archive_read_new()) != NULL);
|
||||
assertA(0 == archive_read_set_format(a, ARCHIVE_FORMAT_TAR));
|
||||
@ -227,12 +233,15 @@ DEFINE_TEST(test_read_append_filter_wrong_program)
|
||||
assertEqualIntA(a, ARCHIVE_WARN, archive_read_close(a));
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||
|
||||
/* restore stderr */
|
||||
fflush(stderr);
|
||||
dup2(fd, fileno(stderr));
|
||||
close(fd);
|
||||
clearerr(stderr);
|
||||
fsetpos(stderr, &pos);
|
||||
|
||||
#if !defined(_WIN32) || defined(__CYGWIN__)
|
||||
/* restore stderr and verify results */
|
||||
if (fp != NULL) {
|
||||
fflush(stderr);
|
||||
dup2(fd, fileno(stderr));
|
||||
close(fd);
|
||||
clearerr(stderr);
|
||||
fsetpos(stderr, &pos);
|
||||
}
|
||||
assertTextFileContents("bunzip2: (stdin) is not a bzip2 file.\n", "stderr1");
|
||||
#endif
|
||||
}
|
||||
|
@ -117,8 +117,8 @@ DEFINE_TEST(test_write_format_iso9660)
|
||||
*/
|
||||
dirname[0] = '\0';
|
||||
strcpy(dir, "/dir0");
|
||||
for (i = 0; i < 10; i++) {
|
||||
dir[4] = '0' + i;
|
||||
for (i = 0; i < 13; i++) {
|
||||
dir[4] = "0123456789ABCDEF"[i];
|
||||
if (i == 0)
|
||||
strcat(dirname, dir+1);
|
||||
else
|
||||
@ -134,6 +134,19 @@ DEFINE_TEST(test_write_format_iso9660)
|
||||
archive_entry_free(ae);
|
||||
}
|
||||
|
||||
strcat(dirname, "/file");
|
||||
assert((ae = archive_entry_new()) != NULL);
|
||||
archive_entry_set_atime(ae, 2, 20);
|
||||
archive_entry_set_birthtime(ae, 3, 30);
|
||||
archive_entry_set_ctime(ae, 4, 40);
|
||||
archive_entry_set_mtime(ae, 5, 50);
|
||||
archive_entry_copy_pathname(ae, dirname);
|
||||
archive_entry_set_mode(ae, S_IFREG | 0755);
|
||||
archive_entry_set_size(ae, 8);
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
|
||||
archive_entry_free(ae);
|
||||
assertEqualIntA(a, 8, archive_write_data(a, "12345678", 9));
|
||||
|
||||
/*
|
||||
* "dir0/dir1/file1" has 8 bytes of data.
|
||||
*/
|
||||
@ -332,6 +345,45 @@ DEFINE_TEST(test_write_format_iso9660)
|
||||
assert((S_IFDIR | 0555) == archive_entry_mode(ae));
|
||||
assertEqualInt(2048, archive_entry_size(ae));
|
||||
|
||||
/*
|
||||
* Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA"
|
||||
*/
|
||||
assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
|
||||
assertEqualInt(2, archive_entry_atime(ae));
|
||||
assertEqualInt(3, archive_entry_birthtime(ae));
|
||||
assertEqualInt(4, archive_entry_ctime(ae));
|
||||
assertEqualInt(5, archive_entry_mtime(ae));
|
||||
assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA",
|
||||
archive_entry_pathname(ae));
|
||||
assert((S_IFDIR | 0555) == archive_entry_mode(ae));
|
||||
assertEqualInt(2048, archive_entry_size(ae));
|
||||
|
||||
/*
|
||||
* Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB"
|
||||
*/
|
||||
assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
|
||||
assertEqualInt(2, archive_entry_atime(ae));
|
||||
assertEqualInt(3, archive_entry_birthtime(ae));
|
||||
assertEqualInt(4, archive_entry_ctime(ae));
|
||||
assertEqualInt(5, archive_entry_mtime(ae));
|
||||
assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB",
|
||||
archive_entry_pathname(ae));
|
||||
assert((S_IFDIR | 0555) == archive_entry_mode(ae));
|
||||
assertEqualInt(2048, archive_entry_size(ae));
|
||||
|
||||
/*
|
||||
* Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC"
|
||||
*/
|
||||
assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
|
||||
assertEqualInt(2, archive_entry_atime(ae));
|
||||
assertEqualInt(3, archive_entry_birthtime(ae));
|
||||
assertEqualInt(4, archive_entry_ctime(ae));
|
||||
assertEqualInt(5, archive_entry_mtime(ae));
|
||||
assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC",
|
||||
archive_entry_pathname(ae));
|
||||
assert((S_IFDIR | 0555) == archive_entry_mode(ae));
|
||||
assertEqualInt(2048, archive_entry_size(ae));
|
||||
|
||||
/*
|
||||
* Read "hardlnk"
|
||||
*/
|
||||
@ -385,6 +437,21 @@ DEFINE_TEST(test_write_format_iso9660)
|
||||
assertEqualIntA(a, 8, archive_read_data(a, buff2, 10));
|
||||
assertEqualMem(buff2, "12345678", 8);
|
||||
|
||||
/*
|
||||
* Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC/file"
|
||||
*/
|
||||
assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
|
||||
assertEqualInt(2, archive_entry_atime(ae));
|
||||
assertEqualInt(3, archive_entry_birthtime(ae));
|
||||
assertEqualInt(4, archive_entry_ctime(ae));
|
||||
assertEqualInt(5, archive_entry_mtime(ae));
|
||||
assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC/file", archive_entry_pathname(ae));
|
||||
assert((AE_IFREG | 0555) == archive_entry_mode(ae));
|
||||
assertEqualInt(1, archive_entry_nlink(ae));
|
||||
assertEqualInt(8, archive_entry_size(ae));
|
||||
assertEqualIntA(a, 8, archive_read_data(a, buff2, 10));
|
||||
assertEqualMem(buff2, "12345678", 8);
|
||||
|
||||
/*
|
||||
* Read "dir0/dir1/file1"
|
||||
*/
|
||||
@ -580,18 +647,40 @@ DEFINE_TEST(test_write_format_iso9660)
|
||||
assertEqualInt(2048, archive_entry_size(ae));
|
||||
|
||||
/*
|
||||
* Read "hardlnk"
|
||||
* Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA"
|
||||
*/
|
||||
assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
|
||||
assertEqualInt(5, archive_entry_atime(ae));
|
||||
assertEqualInt(5, archive_entry_ctime(ae));
|
||||
assertEqualInt(5, archive_entry_mtime(ae));
|
||||
assertEqualString("hardlnk", archive_entry_pathname(ae));
|
||||
assert((AE_IFREG | 0400) == archive_entry_mode(ae));
|
||||
assertEqualInt(2, archive_entry_nlink(ae));
|
||||
assertEqualInt(8, archive_entry_size(ae));
|
||||
assertEqualIntA(a, 8, archive_read_data(a, buff2, 10));
|
||||
assertEqualMem(buff2, "12345678", 8);
|
||||
assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA",
|
||||
archive_entry_pathname(ae));
|
||||
assert((S_IFDIR | 0700) == archive_entry_mode(ae));
|
||||
assertEqualInt(2048, archive_entry_size(ae));
|
||||
|
||||
/*
|
||||
* Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB"
|
||||
*/
|
||||
assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
|
||||
assertEqualInt(5, archive_entry_atime(ae));
|
||||
assertEqualInt(5, archive_entry_ctime(ae));
|
||||
assertEqualInt(5, archive_entry_mtime(ae));
|
||||
assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB",
|
||||
archive_entry_pathname(ae));
|
||||
assert((S_IFDIR | 0700) == archive_entry_mode(ae));
|
||||
assertEqualInt(2048, archive_entry_size(ae));
|
||||
|
||||
/*
|
||||
* Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC"
|
||||
*/
|
||||
assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
|
||||
assertEqualInt(5, archive_entry_atime(ae));
|
||||
assertEqualInt(5, archive_entry_ctime(ae));
|
||||
assertEqualInt(5, archive_entry_mtime(ae));
|
||||
assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC",
|
||||
archive_entry_pathname(ae));
|
||||
assert((S_IFDIR | 0700) == archive_entry_mode(ae));
|
||||
assertEqualInt(2048, archive_entry_size(ae));
|
||||
|
||||
/*
|
||||
* Read "file"
|
||||
@ -601,8 +690,22 @@ DEFINE_TEST(test_write_format_iso9660)
|
||||
assertEqualInt(5, archive_entry_ctime(ae));
|
||||
assertEqualInt(5, archive_entry_mtime(ae));
|
||||
assertEqualString("file", archive_entry_pathname(ae));
|
||||
assertEqualString("hardlnk", archive_entry_hardlink(ae));
|
||||
assert((AE_IFREG | 0400) == archive_entry_mode(ae));
|
||||
assertEqualInt(8, archive_entry_size(ae));
|
||||
assertEqualIntA(a, 8, archive_read_data(a, buff2, 10));
|
||||
assertEqualMem(buff2, "12345678", 8);
|
||||
|
||||
/*
|
||||
* Read "hardlnk"
|
||||
*/
|
||||
assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
|
||||
assertEqualInt(5, archive_entry_atime(ae));
|
||||
assertEqualInt(5, archive_entry_ctime(ae));
|
||||
assertEqualInt(5, archive_entry_mtime(ae));
|
||||
assertEqualString("hardlnk", archive_entry_pathname(ae));
|
||||
assertEqualString("file", archive_entry_hardlink(ae));
|
||||
assert((AE_IFREG | 0400) == archive_entry_mode(ae));
|
||||
assertEqualInt(2, archive_entry_nlink(ae));
|
||||
assertEqualInt(0, archive_entry_size(ae));
|
||||
assertEqualIntA(a, 0, archive_read_data(a, buff2, 10));
|
||||
|
||||
@ -624,6 +727,22 @@ DEFINE_TEST(test_write_format_iso9660)
|
||||
assertEqualIntA(a, 8, archive_read_data(a, buff2, 10));
|
||||
assertEqualMem(buff2, "12345678", 8);
|
||||
|
||||
/*
|
||||
* Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC/file"
|
||||
*/
|
||||
assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
|
||||
assertEqualInt(5, archive_entry_atime(ae));
|
||||
assertEqualInt(5, archive_entry_ctime(ae));
|
||||
assertEqualInt(5, archive_entry_mtime(ae));
|
||||
assertEqualString(
|
||||
"dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC/file",
|
||||
archive_entry_pathname(ae));
|
||||
assert((AE_IFREG | 0400) == archive_entry_mode(ae));
|
||||
assertEqualInt(1, archive_entry_nlink(ae));
|
||||
assertEqualInt(8, archive_entry_size(ae));
|
||||
assertEqualIntA(a, 8, archive_read_data(a, buff2, 10));
|
||||
assertEqualMem(buff2, "12345678", 8);
|
||||
|
||||
/*
|
||||
* Read "dir0/dir1/file1"
|
||||
*/
|
||||
@ -745,6 +864,42 @@ DEFINE_TEST(test_write_format_iso9660)
|
||||
assert((S_IFDIR | 0700) == archive_entry_mode(ae));
|
||||
assertEqualInt(2048, archive_entry_size(ae));
|
||||
|
||||
/*
|
||||
* Read "rr_moved/dir7/dir8/dir9/dira"
|
||||
*/
|
||||
assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
|
||||
assertEqualInt(5, archive_entry_atime(ae));
|
||||
assertEqualInt(5, archive_entry_ctime(ae));
|
||||
assertEqualInt(5, archive_entry_mtime(ae));
|
||||
assertEqualString("RR_MOVED/DIR7/DIR8/DIR9/DIRA",
|
||||
archive_entry_pathname(ae));
|
||||
assert((S_IFDIR | 0700) == archive_entry_mode(ae));
|
||||
assertEqualInt(2048, archive_entry_size(ae));
|
||||
|
||||
/*
|
||||
* Read "rr_moved/dir7/dir8/dir9/dira/dirB"
|
||||
*/
|
||||
assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
|
||||
assertEqualInt(5, archive_entry_atime(ae));
|
||||
assertEqualInt(5, archive_entry_ctime(ae));
|
||||
assertEqualInt(5, archive_entry_mtime(ae));
|
||||
assertEqualString("RR_MOVED/DIR7/DIR8/DIR9/DIRA/DIRB",
|
||||
archive_entry_pathname(ae));
|
||||
assert((S_IFDIR | 0700) == archive_entry_mode(ae));
|
||||
assertEqualInt(2048, archive_entry_size(ae));
|
||||
|
||||
/*
|
||||
* Read "rr_moved/dir7/dir8/dir9/dirA/dirB/dirC"
|
||||
*/
|
||||
assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
|
||||
assertEqualInt(5, archive_entry_atime(ae));
|
||||
assertEqualInt(5, archive_entry_ctime(ae));
|
||||
assertEqualInt(5, archive_entry_mtime(ae));
|
||||
assertEqualString("RR_MOVED/DIR7/DIR8/DIR9/DIRA/DIRB/DIRC",
|
||||
archive_entry_pathname(ae));
|
||||
assert((S_IFDIR | 0700) == archive_entry_mode(ae));
|
||||
assertEqualInt(2048, archive_entry_size(ae));
|
||||
|
||||
/*
|
||||
* Read "dir0"
|
||||
*/
|
||||
@ -826,6 +981,20 @@ DEFINE_TEST(test_write_format_iso9660)
|
||||
assert((S_IFDIR | 0700) == archive_entry_mode(ae));
|
||||
assertEqualInt(2048, archive_entry_size(ae));
|
||||
|
||||
/*
|
||||
* Read "hardlink"
|
||||
*/
|
||||
assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
|
||||
assertEqualInt(5, archive_entry_atime(ae));
|
||||
assertEqualInt(5, archive_entry_ctime(ae));
|
||||
assertEqualInt(5, archive_entry_mtime(ae));
|
||||
assertEqualString("HARDLNK", archive_entry_pathname(ae));
|
||||
assertEqualString(NULL, archive_entry_hardlink(ae));
|
||||
assert((AE_IFREG | 0400) == archive_entry_mode(ae));
|
||||
assertEqualInt(8, archive_entry_size(ae));
|
||||
assertEqualIntA(a, 8, archive_read_data(a, buff2, 10));
|
||||
assertEqualMem(buff2, "12345678", 8);
|
||||
|
||||
/*
|
||||
* Read "file"
|
||||
*/
|
||||
@ -835,25 +1004,13 @@ DEFINE_TEST(test_write_format_iso9660)
|
||||
assertEqualInt(5, archive_entry_ctime(ae));
|
||||
assertEqualInt(5, archive_entry_mtime(ae));
|
||||
assertEqualString("FILE", archive_entry_pathname(ae));
|
||||
assertEqualString("HARDLNK", archive_entry_hardlink(ae));
|
||||
assert((AE_IFREG | 0400) == archive_entry_mode(ae));
|
||||
assertEqualInt(2, archive_entry_nlink(ae));
|
||||
assertEqualInt(8, archive_entry_size(ae));
|
||||
assertEqualIntA(a, 8, archive_read_data(a, buff2, 10));
|
||||
assertEqualMem(buff2, "12345678", 8);
|
||||
|
||||
/*
|
||||
* Read "hardlink"
|
||||
*/
|
||||
assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
|
||||
assertEqualInt(5, archive_entry_atime(ae));
|
||||
assertEqualInt(5, archive_entry_ctime(ae));
|
||||
assertEqualInt(5, archive_entry_mtime(ae));
|
||||
assertEqualString("HARDLNK", archive_entry_pathname(ae));
|
||||
assertEqualString("FILE", archive_entry_hardlink(ae));
|
||||
assert((AE_IFREG | 0400) == archive_entry_mode(ae));
|
||||
assertEqualInt(0, archive_entry_size(ae));
|
||||
assertEqualIntA(a, 0, archive_read_data(a, buff2, 10));
|
||||
|
||||
|
||||
/*
|
||||
* Read longname
|
||||
*/
|
||||
@ -870,6 +1027,22 @@ DEFINE_TEST(test_write_format_iso9660)
|
||||
assertEqualIntA(a, 8, archive_read_data(a, buff2, 10));
|
||||
assertEqualMem(buff2, "12345678", 8);
|
||||
|
||||
/*
|
||||
* Read "rr_moved/dir7/dir8/dir9/dirA/dirB/dirC/file"
|
||||
*/
|
||||
assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
|
||||
assertEqualInt(5, archive_entry_atime(ae));
|
||||
assertEqualInt(5, archive_entry_ctime(ae));
|
||||
assertEqualInt(5, archive_entry_mtime(ae));
|
||||
assertEqualString(
|
||||
"RR_MOVED/DIR7/DIR8/DIR9/DIRA/DIRB/DIRC/FILE",
|
||||
archive_entry_pathname(ae));
|
||||
assert((AE_IFREG | 0400) == archive_entry_mode(ae));
|
||||
assertEqualInt(1, archive_entry_nlink(ae));
|
||||
assertEqualInt(8, archive_entry_size(ae));
|
||||
assertEqualIntA(a, 8, archive_read_data(a, buff2, 10));
|
||||
assertEqualMem(buff2, "12345678", 8);
|
||||
|
||||
/*
|
||||
* Read "dir0/dir1/file1"
|
||||
*/
|
||||
|
@ -1188,7 +1188,7 @@ assertion_file_contains_no_invalid_strings(const char *file, int line,
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
free(buff);
|
||||
return (0);
|
||||
}
|
||||
@ -1412,6 +1412,8 @@ assertion_file_mode(const char *file, int line, const char *pathname, int expect
|
||||
assertion_count(file, line);
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
failure_start(file, line, "assertFileMode not yet implemented for Windows");
|
||||
(void)mode; /* UNUSED */
|
||||
(void)r; /* UNUSED */
|
||||
#else
|
||||
{
|
||||
struct stat st;
|
||||
|
@ -244,7 +244,7 @@ int assertion_file_atime_recent(const char *, int, const char *);
|
||||
int assertion_file_birthtime(const char *, int, const char *, long, long);
|
||||
int assertion_file_birthtime_recent(const char *, int, const char *);
|
||||
int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **);
|
||||
int assertion_file_contains_no_invalid_strings(const char *, int, const char *, const char **);
|
||||
int assertion_file_contains_no_invalid_strings(const char *, int, const char *, const char **);
|
||||
int assertion_file_contents(const char *, int, const void *, int, const char *);
|
||||
int assertion_file_exists(const char *, int, const char *);
|
||||
int assertion_file_mode(const char *, int, const char *, int);
|
||||
|
@ -33,7 +33,7 @@ DEFINE_TEST(test_option_b)
|
||||
|
||||
assertMakeFile("file1", 0644, "file1");
|
||||
if (systemf("cat file1 > test_cat.out 2> test_cat.err") != 0) {
|
||||
skipping("Platform doesn't have cat");
|
||||
skipping("This test requires a `cat` program");
|
||||
return;
|
||||
}
|
||||
testprog_ustar = malloc(strlen(testprog) + sizeof(USTAR_OPT) + 1);
|
||||
|
@ -63,7 +63,7 @@ DEFINE_TEST(test_symlink_dir)
|
||||
/* "dir2" is a symlink to a non-existing "real_dir2" */
|
||||
assertMakeSymlink("dest1/dir2", "real_dir2");
|
||||
} else {
|
||||
skipping("some symlink checks");
|
||||
skipping("Symlinks are not supported on this platform");
|
||||
}
|
||||
/* "dir3" is a symlink to an existing "non_dir3" */
|
||||
assertMakeFile("dest1/non_dir3", 0755, "abcdef");
|
||||
|
@ -6,7 +6,7 @@ _LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive
|
||||
_LIBARCHIVECONFDIR= ${.CURDIR}/../../lib/libarchive
|
||||
|
||||
PROG= bsdcat
|
||||
BSDCAT_VERSION_STRING= 3.2.1
|
||||
BSDCAT_VERSION_STRING= 3.2.2
|
||||
|
||||
.PATH: ${_LIBARCHIVEDIR}/cat
|
||||
SRCS= bsdcat.c cmdline.c
|
||||
|
@ -6,7 +6,7 @@ _LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive
|
||||
_LIBARCHIVECONFDIR= ${.CURDIR}/../../lib/libarchive
|
||||
|
||||
PROG= bsdcpio
|
||||
BSDCPIO_VERSION_STRING= 3.2.1
|
||||
BSDCPIO_VERSION_STRING= 3.2.2
|
||||
|
||||
.PATH: ${_LIBARCHIVEDIR}/cpio
|
||||
SRCS= cpio.c cmdline.c
|
||||
|
@ -4,7 +4,7 @@
|
||||
_LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive
|
||||
|
||||
PROG= bsdtar
|
||||
BSDTAR_VERSION_STRING= 3.2.1
|
||||
BSDTAR_VERSION_STRING= 3.2.2
|
||||
|
||||
.PATH: ${_LIBARCHIVEDIR}/tar
|
||||
SRCS= bsdtar.c \
|
||||
|
Loading…
x
Reference in New Issue
Block a user