CVS commit: src/external/bsd/libarchive/dist/libarchive/test
Module Name:src Committed By: christos Date: Fri Aug 28 18:44:54 UTC 2020 Modified Files: src/external/bsd/libarchive/dist/libarchive/test: test_write_disk_secure.c Log Message: PR/55612: Martin Husemann: libarchive tests pollute /tmp w/o cleanup Make tests obey $TMPDIR. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 \ src/external/bsd/libarchive/dist/libarchive/test/test_write_disk_secure.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libarchive/dist/libarchive/test/test_write_disk_secure.c diff -u src/external/bsd/libarchive/dist/libarchive/test/test_write_disk_secure.c:1.3 src/external/bsd/libarchive/dist/libarchive/test/test_write_disk_secure.c:1.4 --- src/external/bsd/libarchive/dist/libarchive/test/test_write_disk_secure.c:1.3 Thu Jan 16 19:37:03 2020 +++ src/external/bsd/libarchive/dist/libarchive/test/test_write_disk_secure.c Fri Aug 28 14:44:54 2020 @@ -40,6 +40,16 @@ DEFINE_TEST(test_write_disk_secure) struct archive *a; struct archive_entry *ae; struct stat st; + char tmp[2048]; + const char *tmpdir; + const char *lname = + "libarchive_test-test_write_disk_secure-absolute_symlink"; +#if 0 + const char *fname = + "libarchive_test-test_write_disk_secure-absolute_symlink_path.tmp"; +#endif + const char *pname = + "libarchive_test-test_write_disk_secure-absolute_path.tmp"; /* Start with a known umask. */ assertUmask(UMASK); @@ -86,12 +96,15 @@ DEFINE_TEST(test_write_disk_secure) assert(0 == archive_write_finish_entry(a)); #endif - /* Write an absolute symlink to /tmp. */ + /* Write an absolute symlink to $TMPDIR. */ archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_SYMLINKS); assert((ae = archive_entry_new()) != NULL); - archive_entry_copy_pathname(ae, "/tmp/libarchive_test-test_write_disk_secure-absolute_symlink"); + if ((tmpdir = getenv("TMPDIR")) == NULL) + tmpdir = "/tmp"; + snprintf(tmp, sizeof(tmp), "%s/%s", tmpdir, lname); + archive_entry_copy_pathname(ae, tmp); archive_entry_set_mode(ae, S_IFLNK | 0777); - archive_entry_set_symlink(ae, "/tmp"); + archive_entry_set_symlink(ae, tmpdir); archive_write_disk_set_options(a, 0); assert(0 == archive_write_header(a, ae)); assert(0 == archive_write_finish_entry(a)); @@ -99,15 +112,18 @@ DEFINE_TEST(test_write_disk_secure) #if 0 /* With security checks enabled, this should fail. */ assert(archive_entry_clear(ae) != NULL); - archive_entry_copy_pathname(ae, "/tmp/libarchive_test-test_write_disk_secure-absolute_symlink/libarchive_test-test_write_disk_secure-absolute_symlink_path.tmp"); + snprintf(tmp, sizeof(tmp), "%s/%s/%s", tmpdir, lname, fname); + archive_entry_copy_pathname(ae, tmp); archive_entry_set_mode(ae, S_IFREG | 0777); archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_SYMLINKS); failure("Extracting a file through an absolute symlink should fail here."); assertEqualInt(ARCHIVE_FAILED, archive_write_header(a, ae)); archive_entry_free(ae); - assertFileNotExists("/tmp/libarchive_test-test_write_disk_secure-absolute_symlink/libarchive_test-test_write_disk_secure-absolute_symlink_path.tmp"); - assert(0 == unlink("/tmp/libarchive_test-test_write_disk_secure-absolute_symlink")); - unlink("/tmp/libarchive_test-test_write_disk_secure-absolute_symlink_path.tmp"); + assertFileNotExists(tmp); + snprintf(tmp, sizeof(tmp), "%s/%s", tmpdir, lname); + assert(0 == unlink(tmp)); + snprintf(tmp, sizeof(tmp), "%s/%s", tmpdir, fname); + unlink(tmp); #endif /* Create another link. */ @@ -230,23 +246,24 @@ DEFINE_TEST(test_write_disk_secure) * extract an absolute path. */ assert((ae = archive_entry_new()) != NULL); - archive_entry_copy_pathname(ae, "/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp"); + snprintf(tmp, sizeof(tmp), "%s/%s", tmpdir, pname); + archive_entry_copy_pathname(ae, tmp); archive_entry_set_mode(ae, S_IFREG | 0777); assert(0 == archive_write_header(a, ae)); assert(0 == archive_write_finish_entry(a)); - assertFileExists("/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp"); - assert(0 == unlink("/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp")); + assertFileExists(tmp); + assert(0 == unlink(tmp)); /* But with security checks enabled, this should fail. */ assert(archive_entry_clear(ae) != NULL); - archive_entry_copy_pathname(ae, "/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp"); + archive_entry_copy_pathname(ae, tmp); archive_entry_set_mode(ae, S_IFREG | 0777); archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS); failure("Extracting an absolute path should fail here."); assertEqualInt(ARCHIVE_FAILED, archive_write_header(a, ae)); archive_entry_free(ae); assert(0 == archive_write_finish_entry(a)); - assertFileNotExists("/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp"); + assertFileNotExists(t
CVS commit: src/external/bsd/libarchive/dist/libarchive/test
Module Name:src Committed By: christos Date: Wed Apr 22 15:55:55 UTC 2020 Modified Files: src/external/bsd/libarchive/dist/libarchive/test: test_acl_platform_nfs4.c Log Message: Add missing break's To generate a diff of this commit: cvs rdiff -u -r1.1.1.2 -r1.2 \ src/external/bsd/libarchive/dist/libarchive/test/test_acl_platform_nfs4.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libarchive/dist/libarchive/test/test_acl_platform_nfs4.c diff -u src/external/bsd/libarchive/dist/libarchive/test/test_acl_platform_nfs4.c:1.1.1.2 src/external/bsd/libarchive/dist/libarchive/test/test_acl_platform_nfs4.c:1.2 --- src/external/bsd/libarchive/dist/libarchive/test/test_acl_platform_nfs4.c:1.1.1.2 Wed Jul 24 09:50:38 2019 +++ src/external/bsd/libarchive/dist/libarchive/test/test_acl_platform_nfs4.c Wed Apr 22 11:55:55 2020 @@ -634,9 +634,11 @@ acl_match(acl_entry_t aclent, struct mya 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); }
CVS commit: src/external/bsd/libarchive/dist/libarchive/test
Module Name:src Committed By: christos Date: Wed Apr 22 15:55:41 UTC 2020 Modified Files: src/external/bsd/libarchive/dist/libarchive/test: test_acl_platform_posix1e.c Log Message: make variable constant since it is assigned from a string literal To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 \ src/external/bsd/libarchive/dist/libarchive/test/test_acl_platform_posix1e.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libarchive/dist/libarchive/test/test_acl_platform_posix1e.c diff -u src/external/bsd/libarchive/dist/libarchive/test/test_acl_platform_posix1e.c:1.1.1.1 src/external/bsd/libarchive/dist/libarchive/test/test_acl_platform_posix1e.c:1.2 --- src/external/bsd/libarchive/dist/libarchive/test/test_acl_platform_posix1e.c:1.1.1.1 Thu Apr 20 08:55:53 2017 +++ src/external/bsd/libarchive/dist/libarchive/test/test_acl_platform_posix1e.c Wed Apr 22 11:55:41 2020 @@ -364,8 +364,8 @@ DEFINE_TEST(test_acl_platform_posix1e_re 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;
CVS commit: src/external/bsd/libarchive/dist/libarchive/test
Module Name:src Committed By: christos Date: Fri Jan 17 00:36:20 UTC 2020 Modified Files: src/external/bsd/libarchive/dist/libarchive/test: test_read_disk_directory_traversals.c Log Message: pull fix from head (O_EXEC means O_SEARCH only on FreeBSD) To generate a diff of this commit: cvs rdiff -u -r1.1.1.2 -r1.2 \ src/external/bsd/libarchive/dist/libarchive/test/test_read_disk_directory_traversals.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libarchive/dist/libarchive/test/test_read_disk_directory_traversals.c diff -u src/external/bsd/libarchive/dist/libarchive/test/test_read_disk_directory_traversals.c:1.1.1.2 src/external/bsd/libarchive/dist/libarchive/test/test_read_disk_directory_traversals.c:1.2 --- src/external/bsd/libarchive/dist/libarchive/test/test_read_disk_directory_traversals.c:1.1.1.2 Wed Jul 24 09:50:38 2019 +++ src/external/bsd/libarchive/dist/libarchive/test/test_read_disk_directory_traversals.c Thu Jan 16 19:36:20 2020 @@ -1775,7 +1775,8 @@ test_parent(void) archive_entry_clear(ae); r = archive_read_next_header2(a, ae); if (r == ARCHIVE_FAILED) { -#if defined(O_PATH) || defined(O_SEARCH) || defined(O_EXEC) +#if defined(O_PATH) || defined(O_SEARCH) || \ + (defined(__FreeBSD__) && defined(O_EXEC)) assertEqualIntA(a, ARCHIVE_OK, r); #endif /* Close the disk object. */
CVS commit: src/external/bsd/libarchive/dist/libarchive/test
Module Name:src Committed By: christos Date: Fri Jan 17 00:37:03 UTC 2020 Modified Files: src/external/bsd/libarchive/dist/libarchive/test: test_write_disk_secure.c Log Message: fix test I broke by commenting out flags. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/external/bsd/libarchive/dist/libarchive/test/test_write_disk_secure.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libarchive/dist/libarchive/test/test_write_disk_secure.c diff -u src/external/bsd/libarchive/dist/libarchive/test/test_write_disk_secure.c:1.2 src/external/bsd/libarchive/dist/libarchive/test/test_write_disk_secure.c:1.3 --- src/external/bsd/libarchive/dist/libarchive/test/test_write_disk_secure.c:1.2 Sun Jan 12 11:10:49 2020 +++ src/external/bsd/libarchive/dist/libarchive/test/test_write_disk_secure.c Thu Jan 16 19:37:03 2020 @@ -87,6 +87,7 @@ DEFINE_TEST(test_write_disk_secure) #endif /* Write an absolute symlink to /tmp. */ + archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_SYMLINKS); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, "/tmp/libarchive_test-test_write_disk_secure-absolute_symlink"); archive_entry_set_mode(ae, S_IFLNK | 0777);
CVS commit: src/external/bsd/libarchive/dist/libarchive/test
Module Name:src Committed By: christos Date: Fri Jan 17 00:37:26 UTC 2020 Modified Files: src/external/bsd/libarchive/dist/libarchive/test: test_archive_write_set_format_filter_by_ext.c test_read_format_7zip.c test_sparse_basic.c test_write_format_zip_file.c test_write_format_zip_file_zip64.c Log Message: make things compile (pullup merged) To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 \ src/external/bsd/libarchive/dist/libarchive/test/test_archive_write_set_format_filter_by_ext.c \ src/external/bsd/libarchive/dist/libarchive/test/test_read_format_7zip.c \ src/external/bsd/libarchive/dist/libarchive/test/test_write_format_zip_file.c \ src/external/bsd/libarchive/dist/libarchive/test/test_write_format_zip_file_zip64.c cvs rdiff -u -r1.1.1.2 -r1.2 \ src/external/bsd/libarchive/dist/libarchive/test/test_sparse_basic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libarchive/dist/libarchive/test/test_archive_write_set_format_filter_by_ext.c diff -u src/external/bsd/libarchive/dist/libarchive/test/test_archive_write_set_format_filter_by_ext.c:1.1.1.1 src/external/bsd/libarchive/dist/libarchive/test/test_archive_write_set_format_filter_by_ext.c:1.2 --- src/external/bsd/libarchive/dist/libarchive/test/test_archive_write_set_format_filter_by_ext.c:1.1.1.1 Thu Apr 20 08:55:56 2017 +++ src/external/bsd/libarchive/dist/libarchive/test/test_archive_write_set_format_filter_by_ext.c Thu Jan 16 19:37:26 2020 @@ -30,7 +30,7 @@ __FBSDID("$FreeBSD$"); static void test_format_filter_by_ext(const char *output_file, -int format_id, int filter_id, int dot_stored, char * def_ext) +int format_id, int filter_id, int dot_stored, const char * def_ext) { struct archive_entry *ae; struct archive *a; Index: src/external/bsd/libarchive/dist/libarchive/test/test_read_format_7zip.c diff -u src/external/bsd/libarchive/dist/libarchive/test/test_read_format_7zip.c:1.1.1.1 src/external/bsd/libarchive/dist/libarchive/test/test_read_format_7zip.c:1.2 --- src/external/bsd/libarchive/dist/libarchive/test/test_read_format_7zip.c:1.1.1.1 Thu Apr 20 08:55:53 2017 +++ src/external/bsd/libarchive/dist/libarchive/test/test_read_format_7zip.c Thu Jan 16 19:37:26 2020 @@ -87,7 +87,7 @@ test_copy(int use_open_fd) * An archive file has no entry. */ static void -test_empty_archive() +test_empty_archive(void) { const char *refname = "test_read_format_7zip_empty_archive.7z"; struct archive_entry *ae; @@ -119,7 +119,7 @@ test_empty_archive() * in the archive file except for a header. */ static void -test_empty_file() +test_empty_file(void) { const char *refname = "test_read_format_7zip_empty_file.7z"; struct archive_entry *ae; @@ -609,7 +609,7 @@ test_bcj(const char *refname) * Extract a file compressed with PPMd. */ static void -test_ppmd() +test_ppmd(void) { const char *refname = "test_read_format_7zip_ppmd.7z"; struct archive_entry *ae; @@ -663,7 +663,7 @@ test_ppmd() } static void -test_symname() +test_symname(void) { const char *refname = "test_read_format_7zip_symbolic_name.7z"; struct archive_entry *ae; Index: src/external/bsd/libarchive/dist/libarchive/test/test_write_format_zip_file.c diff -u src/external/bsd/libarchive/dist/libarchive/test/test_write_format_zip_file.c:1.1.1.1 src/external/bsd/libarchive/dist/libarchive/test/test_write_format_zip_file.c:1.2 --- src/external/bsd/libarchive/dist/libarchive/test/test_write_format_zip_file.c:1.1.1.1 Thu Apr 20 08:55:40 2017 +++ src/external/bsd/libarchive/dist/libarchive/test/test_write_format_zip_file.c Thu Jan 16 19:37:26 2020 @@ -84,7 +84,7 @@ DEFINE_TEST(test_write_format_zip_file) unsigned char *central_header, *local_header, *eocd, *eocd_record; unsigned char *extension_start, *extension_end; char file_data[] = {'1', '2', '3', '4', '5', '6', '7', '8'}; - char *file_name = "file"; + const char *file_name = "file"; #ifndef HAVE_ZLIB_H zip_version = 10; Index: src/external/bsd/libarchive/dist/libarchive/test/test_write_format_zip_file_zip64.c diff -u src/external/bsd/libarchive/dist/libarchive/test/test_write_format_zip_file_zip64.c:1.1.1.1 src/external/bsd/libarchive/dist/libarchive/test/test_write_format_zip_file_zip64.c:1.2 --- src/external/bsd/libarchive/dist/libarchive/test/test_write_format_zip_file_zip64.c:1.1.1.1 Thu Apr 20 08:55:49 2017 +++ src/external/bsd/libarchive/dist/libarchive/test/test_write_format_zip_file_zip64.c Thu Jan 16 19:37:26 2020 @@ -86,7 +86,7 @@ DEFINE_TEST(test_write_format_zip_file_z unsigned char *central_header, *local_header, *eocd, *eocd_record; unsigned char *extension_start, *extension_end; char file_data[] = {'1', '2', '3', '4', '5', '6', '7', '8'}; - char *file_name = "file"; + const char *file_name = "file"; #ifndef HAVE_ZLIB_H zip_compression = 0; Index: src/external/bsd/li