Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/external/bsd/libarchive/dist/test_utils Apply patch, requ...
details: https://anonhg.NetBSD.org/src/rev/945b596148b6
branches: netbsd-9
changeset: 984091:945b596148b6
user: martin <martin%NetBSD.org@localhost>
date: Mon Jun 21 15:41:38 2021 +0000
description:
Apply patch, requested by christos in ticket #1297:
external/bsd/libarchive/dist/cat/test/test_0.c up to 1.2
external/bsd/libarchive/dist/cpio/test/test_basic.c up to 1.2
external/bsd/libarchive/dist/cpio/test/test_format_newc.c up to 1.3
external/bsd/libarchive/dist/libarchive/archive_read.c up to 1.2
external/bsd/libarchive/dist/libarchive/archive_read_disk_posix.c up to 1.2
external/bsd/libarchive/dist/libarchive/archive_read_open_filename.c up to 1.2
external/bsd/libarchive/dist/libarchive/archive_read_support_format_xar.c up to 1.2
external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c up to 1.6
external/bsd/libarchive/dist/libarchive/test/test_acl_platform_nfs4.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_acl_platform_posix1e.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_compat_zip.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_fuzz.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_read_extract.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_read_format_gtar_sparse.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_7075_utf8_paths.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_comment_stored.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_extra_padding.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_high_compression.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_jar.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_mac_metadata.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_malformed.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_msdos.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_nested.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_nofiletype.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_padded.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_sfx.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_with_invalid_traditional_eocd.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_zip64.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_read_pax_truncated.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_read_truncated_filter.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_sparse_basic.c up to 1.3
external/bsd/libarchive/dist/libarchive/test/test_write_disk.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_write_disk_secure.c up to 1.4
external/bsd/libarchive/dist/libarchive/test/test_write_format_cpio_empty.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_write_format_shar_empty.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_write_format_tar.c up to 1.2
external/bsd/libarchive/dist/libarchive/test/test_write_format_tar_sparse.c up to 1.2
external/bsd/libarchive/dist/tar/write.c up to 1.3
external/bsd/libarchive/dist/tar/test/test_basic.c up to 1.2
external/bsd/libarchive/dist/tar/test/test_copy.c up to 1.3
external/bsd/libarchive/dist/tar/test/test_option_C_upper.c up to 1.2
external/bsd/libarchive/dist/tar/test/test_option_s.c up to 1.2
external/bsd/libarchive/dist/test_utils/test_common.h up to 1.2
external/bsd/libarchive/dist/test_utils/test_main.c up to 1.2
PR 56257: sync libarchive with -current (leaving out changes not relevant
for this branch).
diffstat:
external/bsd/libarchive/dist/cat/test/test_0.c | 2 +-
external/bsd/libarchive/dist/cpio/test/test_basic.c | 14 +-
external/bsd/libarchive/dist/cpio/test/test_format_newc.c | 48 +++++---
external/bsd/libarchive/dist/libarchive/archive_read.c | 17 +-
external/bsd/libarchive/dist/libarchive/archive_read_disk_posix.c | 53 +++++----
external/bsd/libarchive/dist/libarchive/archive_read_open_filename.c | 4 +
external/bsd/libarchive/dist/libarchive/archive_read_support_format_xar.c | 17 ++-
external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c | 5 +-
external/bsd/libarchive/dist/libarchive/test/test_acl_platform_nfs4.c | 2 +
external/bsd/libarchive/dist/libarchive/test/test_acl_platform_posix1e.c | 4 +-
external/bsd/libarchive/dist/libarchive/test/test_compat_zip.c | 10 +-
external/bsd/libarchive/dist/libarchive/test/test_fuzz.c | 3 +-
external/bsd/libarchive/dist/libarchive/test/test_read_extract.c | 2 +-
external/bsd/libarchive/dist/libarchive/test/test_read_format_gtar_sparse.c | 5 +-
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip.c | 8 +-
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_7075_utf8_paths.c | 2 +-
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_comment_stored.c | 2 +-
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_extra_padding.c | 2 +-
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_high_compression.c | 2 +-
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_jar.c | 2 +-
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_mac_metadata.c | 2 +-
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_malformed.c | 2 +-
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_msdos.c | 2 +-
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_nested.c | 2 +-
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_nofiletype.c | 2 +-
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_padded.c | 2 +-
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_sfx.c | 2 +-
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_with_invalid_traditional_eocd.c | 2 +-
external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_zip64.c | 4 +-
external/bsd/libarchive/dist/libarchive/test/test_read_pax_truncated.c | 6 +-
external/bsd/libarchive/dist/libarchive/test/test_read_truncated_filter.c | 4 +-
external/bsd/libarchive/dist/libarchive/test/test_sparse_basic.c | 4 +-
external/bsd/libarchive/dist/libarchive/test/test_write_disk.c | 2 +-
external/bsd/libarchive/dist/libarchive/test/test_write_disk_secure.c | 41 +++++--
external/bsd/libarchive/dist/libarchive/test/test_write_format_cpio_empty.c | 2 +-
external/bsd/libarchive/dist/libarchive/test/test_write_format_shar_empty.c | 2 +-
external/bsd/libarchive/dist/libarchive/test/test_write_format_tar.c | 2 +-
external/bsd/libarchive/dist/libarchive/test/test_write_format_tar_sparse.c | 4 +-
external/bsd/libarchive/dist/tar/test/test_basic.c | 2 +-
external/bsd/libarchive/dist/tar/test/test_copy.c | 4 +-
external/bsd/libarchive/dist/tar/test/test_option_C_upper.c | 2 +-
external/bsd/libarchive/dist/tar/test/test_option_s.c | 6 +-
external/bsd/libarchive/dist/tar/write.c | 11 +-
external/bsd/libarchive/dist/test_utils/test_common.h | 15 ++-
external/bsd/libarchive/dist/test_utils/test_main.c | 14 +-
45 files changed, 200 insertions(+), 145 deletions(-)
diffs (truncated from 1172 to 300 lines):
diff -r de679f12d16d -r 945b596148b6 external/bsd/libarchive/dist/cat/test/test_0.c
--- a/external/bsd/libarchive/dist/cat/test/test_0.c Mon Jun 21 14:52:58 2021 +0000
+++ b/external/bsd/libarchive/dist/cat/test/test_0.c Mon Jun 21 15:41:38 2021 +0000
@@ -59,7 +59,7 @@
* we know some option that will succeed.
*/
if (0 != systemf("%s --version >" DEV_NULL, testprog)) {
- failure("Unable to successfully run: %s --version\n", testprog, testprog);
+ failure("Unable to successfully run: %s --version\n", testprog);
assert(0);
}
diff -r de679f12d16d -r 945b596148b6 external/bsd/libarchive/dist/cpio/test/test_basic.c
--- a/external/bsd/libarchive/dist/cpio/test/test_basic.c Mon Jun 21 14:52:58 2021 +0000
+++ b/external/bsd/libarchive/dist/cpio/test/test_basic.c Mon Jun 21 15:41:38 2021 +0000
@@ -33,15 +33,15 @@
*/
/* Regular file with 2 links. */
- failure(msg);
+ failure("%s", msg);
assertIsReg("file", 0644);
- failure(msg);
+ failure("%s", msg);
assertFileSize("file", 10);
- failure(msg);
+ failure("%s", msg);
assertFileNLinks("file", 2);
/* Another name for the same file. */
- failure(msg);
+ failure("%s", msg);
assertIsHardlink("linkfile", "file");
/* Symlink */
@@ -49,11 +49,11 @@
assertIsSymlink("symlink", "file", 0);
/* Another file with 1 link and different permissions. */
- failure(msg);
+ failure("%s", msg);
assertIsReg("file2", 0777);
- failure(msg);
+ failure("%s", msg);
assertFileSize("file2", 10);
- failure(msg);
+ failure("%s", msg);
assertFileNLinks("file2", 1);
/* dir */
diff -r de679f12d16d -r 945b596148b6 external/bsd/libarchive/dist/cpio/test/test_format_newc.c
--- a/external/bsd/libarchive/dist/cpio/test/test_format_newc.c Mon Jun 21 14:52:58 2021 +0000
+++ b/external/bsd/libarchive/dist/cpio/test/test_format_newc.c Mon Jun 21 15:41:38 2021 +0000
@@ -49,10 +49,11 @@
return (1);
}
-static int
+/* Convert up to 8 hex characters to unsigned 32-bit decimal integer */
+static uint32_t
from_hex(const char *p, size_t l)
{
- int r = 0;
+ uint32_t r = 0;
while (l > 0) {
r *= 16;
@@ -82,11 +83,11 @@
{
FILE *list;
int r;
- int devmajor, devminor, ino, gid;
- int uid = -1;
+ uint32_t devmajor, devminor, ino, gid, uid;
time_t t, t2, now;
char *p, *e;
- size_t s, fs, ns;
+ size_t s;
+ uint64_t fs, ns;
char result[1024];
assertUmask(0);
@@ -199,28 +200,32 @@
#else
assertEqualInt(0x81a4, from_hex(e + 14, 8)); /* Mode */
#endif
- if (uid < 0)
- uid = from_hex(e + 22, 8);
+#if defined(_WIN32)
+ uid = from_hex(e + 22, 8);
+#else
assertEqualInt(from_hex(e + 22, 8), uid); /* uid */
+#endif
gid = from_hex(e + 30, 8); /* gid */
assertEqualMem(e + 38, "00000003", 8); /* nlink */
t = from_hex(e + 46, 8); /* mtime */
- failure("t=0x%08x now=0x%08x=%d", t, now, now);
+ failure("t=%#08jx now=%#08jx=%jd", (intmax_t)t, (intmax_t)now,
+ (intmax_t)now);
assert(t <= now); /* File wasn't created in future. */
- failure("t=0x%08x now - 2=0x%08x = %d", t, now - 2, now - 2);
+ failure("t=%#08jx now - 2=%#08jx=%jd", (intmax_t)t, (intmax_t)now - 2,
+ (intmax_t)now - 2);
assert(t >= now - 2); /* File was created w/in last 2 secs. */
failure("newc format stores body only with last appearance of a link\n"
" first appearance should be empty, so this file size\n"
" field should be zero");
assertEqualInt(0, from_hex(e + 54, 8)); /* File size */
- fs = from_hex(e + 54, 8);
+ fs = (uint64_t)from_hex(e + 54, 8);
fs += PAD(fs, 4);
devmajor = from_hex(e + 62, 8); /* devmajor */
devminor = from_hex(e + 70, 8); /* devminor */
assert(is_hex(e + 78, 8)); /* rdevmajor */
assert(is_hex(e + 86, 8)); /* rdevminor */
assertEqualMem(e + 94, "00000006", 8); /* Name size */
- ns = from_hex(e + 94, 8);
+ ns = (uint64_t)from_hex(e + 94, 8);
ns += PAD(ns + 2, 4);
assertEqualInt(0, from_hex(e + 102, 8)); /* check field */
assertEqualMem(e + 110, "file1\0", 6); /* Name contents */
@@ -243,17 +248,18 @@
assertEqualInt(gid, from_hex(e + 30, 8)); /* gid */
assertEqualMem(e + 38, "00000001", 8); /* nlink */
t2 = from_hex(e + 46, 8); /* mtime */
- failure("First entry created at t=0x%08x this entry created at t2=0x%08x", t, t2);
+ failure("First entry created at t=%#08jx this entry created"
+ " at t2=%#08jx", (intmax_t)t, (intmax_t)t2);
assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
assertEqualMem(e + 54, "00000005", 8); /* File size */
- fs = from_hex(e + 54, 8);
+ fs = (uint64_t)from_hex(e + 54, 8);
fs += PAD(fs, 4);
assertEqualInt(devmajor, from_hex(e + 62, 8)); /* devmajor */
assertEqualInt(devminor, from_hex(e + 70, 8)); /* devminor */
assert(is_hex(e + 78, 8)); /* rdevmajor */
assert(is_hex(e + 86, 8)); /* rdevminor */
assertEqualMem(e + 94, "00000008", 8); /* Name size */
- ns = from_hex(e + 94, 8);
+ ns = (uint64_t)from_hex(e + 94, 8);
ns += PAD(ns + 2, 4);
assertEqualInt(0, from_hex(e + 102, 8)); /* check field */
assertEqualMem(e + 110, "symlink\0\0\0", 10); /* Name contents */
@@ -278,17 +284,18 @@
assertEqualInt(nlinks("dir"), from_hex(e + 38, 8)); /* nlinks */
#endif
t2 = from_hex(e + 46, 8); /* mtime */
- failure("First entry created at t=0x%08x this entry created at t2=0x%08x", t, t2);
+ failure("First entry created at t=%#08jx this entry created at"
+ "t2=%#08jx", (intmax_t)t, (intmax_t)t2);
assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
assertEqualMem(e + 54, "00000000", 8); /* File size */
- fs = from_hex(e + 54, 8);
+ fs = (uint64_t)from_hex(e + 54, 8);
fs += PAD(fs, 4);
assertEqualInt(devmajor, from_hex(e + 62, 8)); /* devmajor */
assertEqualInt(devminor, from_hex(e + 70, 8)); /* devminor */
assert(is_hex(e + 78, 8)); /* rdevmajor */
assert(is_hex(e + 86, 8)); /* rdevminor */
assertEqualMem(e + 94, "00000004", 8); /* Name size */
- ns = from_hex(e + 94, 8);
+ ns = (uint64_t)from_hex(e + 94, 8);
ns += PAD(ns + 2, 4);
assertEqualInt(0, from_hex(e + 102, 8)); /* check field */
assertEqualMem(e + 110, "dir\0\0\0", 6); /* Name contents */
@@ -311,17 +318,18 @@
assertEqualInt(gid, from_hex(e + 30, 8)); /* gid */
assertEqualMem(e + 38, "00000003", 8); /* nlink */
t2 = from_hex(e + 46, 8); /* mtime */
- failure("First entry created at t=0x%08x this entry created at t2=0x%08x", t, t2);
+ failure("First entry created at t=%#08jx this entry created at"
+ "t2=%#08jx", (intmax_t)t, (intmax_t)t2);
assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
assertEqualInt(10, from_hex(e + 54, 8)); /* File size */
- fs = from_hex(e + 54, 8);
+ fs = (uint64_t)from_hex(e + 54, 8);
fs += PAD(fs, 4);
assertEqualInt(devmajor, from_hex(e + 62, 8)); /* devmajor */
assertEqualInt(devminor, from_hex(e + 70, 8)); /* devminor */
assert(is_hex(e + 78, 8)); /* rdevmajor */
assert(is_hex(e + 86, 8)); /* rdevminor */
assertEqualMem(e + 94, "00000009", 8); /* Name size */
- ns = from_hex(e + 94, 8);
+ ns = (uint64_t)from_hex(e + 94, 8);
ns += PAD(ns + 2, 4);
assertEqualInt(0, from_hex(e + 102, 8)); /* check field */
assertEqualMem(e + 110, "hardlink\0\0", 10); /* Name contents */
diff -r de679f12d16d -r 945b596148b6 external/bsd/libarchive/dist/libarchive/archive_read.c
--- a/external/bsd/libarchive/dist/libarchive/archive_read.c Mon Jun 21 14:52:58 2021 +0000
+++ b/external/bsd/libarchive/dist/libarchive/archive_read.c Mon Jun 21 15:41:38 2021 +0000
@@ -891,15 +891,16 @@
len = a->read_data_remaining;
if (len > s)
len = s;
- if (len)
+ if (len) {
memcpy(dest, a->read_data_block, len);
- s -= len;
- a->read_data_block += len;
- a->read_data_remaining -= len;
- a->read_data_output_offset += len;
- a->read_data_offset += len;
- dest += len;
- bytes_read += len;
+ s -= len;
+ a->read_data_block += len;
+ a->read_data_remaining -= len;
+ a->read_data_output_offset += len;
+ a->read_data_offset += len;
+ dest += len;
+ bytes_read += len;
+ }
}
}
a->read_data_is_posix_read = 0;
diff -r de679f12d16d -r 945b596148b6 external/bsd/libarchive/dist/libarchive/archive_read_disk_posix.c
--- a/external/bsd/libarchive/dist/libarchive/archive_read_disk_posix.c Mon Jun 21 14:52:58 2021 +0000
+++ b/external/bsd/libarchive/dist/libarchive/archive_read_disk_posix.c Mon Jun 21 15:41:38 2021 +0000
@@ -1527,6 +1527,15 @@
#if defined(HAVE_STATFS) && defined(HAVE_FSTATFS) && defined(MNT_LOCAL) \
&& !defined(ST_LOCAL)
+static void
+set_transfer_size(struct filesystem *fs, const struct statfs *sfs)
+{
+ fs->xfer_align = sfs->f_bsize > 0 ? (long)sfs->fs_bsize : -1;
+ fs->max_xfer_size = -1;
+ fs->min_xfer_size = sfs->f_iosize > 0 ? (long)sfs->f_iosize : -1;
+ fs->incr_xfer_size = sfs->f_iosize > 0 ? (long)sfs->f_iosize : -1;
+}
+
/*
* Gather current filesystem properties on FreeBSD, OpenBSD and Mac OS X.
*/
@@ -1595,10 +1604,7 @@
return (ARCHIVE_FAILED);
} else if (xr == 1) {
/* pathconf(_PC_REX_*) operations are not supported. */
- t->current_filesystem->xfer_align = sfs.f_bsize;
- t->current_filesystem->max_xfer_size = -1;
- t->current_filesystem->min_xfer_size = sfs.f_iosize;
- t->current_filesystem->incr_xfer_size = sfs.f_iosize;
+ set_transfer_size(t->current_filesystem, &sfs);
}
if (sfs.f_flags & MNT_LOCAL)
t->current_filesystem->remote = 0;
@@ -1653,6 +1659,20 @@
#elif (defined(HAVE_STATVFS) || defined(HAVE_FSTATVFS)) && defined(ST_LOCAL)
+static void
+set_transfer_size(struct filesystem *fs, const struct statvfs *sfs)
+{
+ fs->xfer_align = sfs->f_frsize > 0 ? (long)sfs->f_frsize : -1;
+ fs->max_xfer_size = -1;
+#if defined(HAVE_STRUCT_STATVFS_F_IOSIZE)
+ fs->min_xfer_size = sfs->f_iosize > 0 ? (long)sfs->f_iosize : -1;
+ fs->incr_xfer_size = sfs->f_iosize > 0 ? (long)sfs->f_iosize : -1;
+#else
+ fs->min_xfer_size = sfs->f_bsize > 0 : (long)sfs->f_bsize : -1;
+ fs->incr_xfer_size = sfs->f_bsize > 0 : (long)sfs->f_bsize : -1;
+#endif
+}
+
/*
* Gather current filesystem properties on NetBSD
*/
@@ -1690,15 +1710,7 @@
} 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->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;
-#else
- t->current_filesystem->min_xfer_size = sfs.f_bsize;
- t->current_filesystem->incr_xfer_size = sfs.f_bsize;
-#endif
+ set_transfer_size(t->current_filesystem, &sfs);
}
if (sfs.f_flag & ST_LOCAL)
t->current_filesystem->remote = 0;
@@ -1805,15 +1817,9 @@
} else if (xr == 1) {
/* pathconf(_PC_REX_*) operations are not supported. */
#if defined(HAVE_STATVFS)
- t->current_filesystem->xfer_align = svfs.f_frsize;
- t->current_filesystem->max_xfer_size = -1;
- t->current_filesystem->min_xfer_size = svfs.f_bsize;
- t->current_filesystem->incr_xfer_size = svfs.f_bsize;
+ set_transfer_size(t->current_filesystem, &svfs);
#else
- t->current_filesystem->xfer_align = sfs.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;
+ set_transfer_size(t->current_filesystem, &sfs);
#endif
Home |
Main Index |
Thread Index |
Old Index