summaryrefslogtreecommitdiff
path: root/tar
diff options
context:
space:
mode:
authorMartin Matuska <martin@matuska.org>2019-04-03 23:13:35 +0200
committerMartin Matuska <martin@matuska.org>2019-04-04 00:11:32 +0200
commit7f7c83316849b5d24b93ace5c69ad39f539d26b1 (patch)
treee456db190d069ae5ed75b5ca1abd42a00f83df57 /tar
parentc1824937fddd931a82814cf51fb3308fa65bffaf (diff)
downloadlibarchive-7f7c83316849b5d24b93ace5c69ad39f539d26b1.tar.gz
Fix various symlink bugs with Windows symlinks
tests: extend assertMakeSymlink with targetIsDir
Diffstat (limited to 'tar')
-rw-r--r--tar/test/test_basic.c2
-rw-r--r--tar/test/test_copy.c2
-rw-r--r--tar/test/test_option_H_upper.c10
-rw-r--r--tar/test/test_option_L_upper.c10
-rw-r--r--tar/test/test_option_U_upper.c12
-rw-r--r--tar/test/test_option_s.c2
-rw-r--r--tar/test/test_strip_components.c4
-rw-r--r--tar/test/test_symlink_dir.c22
8 files changed, 32 insertions, 32 deletions
diff --git a/tar/test/test_basic.c b/tar/test/test_basic.c
index 0008e1cf..91282cde 100644
--- a/tar/test/test_basic.c
+++ b/tar/test/test_basic.c
@@ -42,7 +42,7 @@ make_files(void)
/* Symlink to above file. */
if (canSymlink())
- assertMakeSymlink("symlink", "file");
+ assertMakeSymlink("symlink", "file", 0);
/* Directory. */
assertMakeDir("dir", 0775);
diff --git a/tar/test/test_copy.c b/tar/test/test_copy.c
index e6e31f45..1e59e192 100644
--- a/tar/test/test_copy.c
+++ b/tar/test/test_copy.c
@@ -176,7 +176,7 @@ create_tree(void)
sprintf(buff, "s/%s", filenames[i]);
sprintf(buff2, "../f/%s", filenames[i]);
failure("buff=\"%s\" buff2=\"%s\"", buff, buff2);
- assertMakeSymlink(buff, buff2);
+ assertMakeSymlink(buff, buff2, 0);
}
/* Create a dir named "d/abcdef...". */
buff[0] = 'd';
diff --git a/tar/test/test_option_H_upper.c b/tar/test/test_option_H_upper.c
index adc294b5..7c201ce2 100644
--- a/tar/test/test_option_H_upper.c
+++ b/tar/test/test_option_H_upper.c
@@ -39,13 +39,13 @@ DEFINE_TEST(test_option_H_upper)
assertMakeDir("in", 0755);
assertChdir("in");
assertMakeDir("d1", 0755);
- assertMakeSymlink("ld1", "d1");
+ assertMakeSymlink("ld1", "d1", 1);
assertMakeFile("d1/file1", 0644, "d1/file1");
assertMakeFile("d1/file2", 0644, "d1/file2");
- assertMakeSymlink("d1/link1", "file1");
- assertMakeSymlink("d1/linkX", "fileX");
- assertMakeSymlink("link2", "d1/file2");
- assertMakeSymlink("linkY", "d1/fileY");
+ assertMakeSymlink("d1/link1", "file1", 0);
+ assertMakeSymlink("d1/linkX", "fileX", 0);
+ assertMakeSymlink("link2", "d1/file2", 0);
+ assertMakeSymlink("linkY", "d1/fileY", 0);
assertChdir("..");
/* Test 1: Without -H */
diff --git a/tar/test/test_option_L_upper.c b/tar/test/test_option_L_upper.c
index f5a3c5ab..83f69d08 100644
--- a/tar/test/test_option_L_upper.c
+++ b/tar/test/test_option_L_upper.c
@@ -39,13 +39,13 @@ DEFINE_TEST(test_option_L_upper)
assertMakeDir("in", 0755);
assertChdir("in");
assertMakeDir("d1", 0755);
- assertMakeSymlink("ld1", "d1");
+ assertMakeSymlink("ld1", "d1", 1);
assertMakeFile("d1/file1", 0644, "d1/file1");
assertMakeFile("d1/file2", 0644, "d1/file2");
- assertMakeSymlink("d1/link1", "file1");
- assertMakeSymlink("d1/linkX", "fileX");
- assertMakeSymlink("link2", "d1/file2");
- assertMakeSymlink("linkY", "d1/fileY");
+ assertMakeSymlink("d1/link1", "file1", 0);
+ assertMakeSymlink("d1/linkX", "fileX", 0);
+ assertMakeSymlink("link2", "d1/file2", 0);
+ assertMakeSymlink("linkY", "d1/fileY", 0);
assertChdir("..");
/* Test 1: Without -L */
diff --git a/tar/test/test_option_U_upper.c b/tar/test/test_option_U_upper.c
index 2c43e002..83205486 100644
--- a/tar/test/test_option_U_upper.c
+++ b/tar/test/test_option_U_upper.c
@@ -79,7 +79,7 @@ DEFINE_TEST(test_option_U_upper)
assertMakeDir("test3", 0755);
assertChdir("test3");
assertMakeDir("realDir", 0755);
- assertMakeSymlink("d1", "realDir");
+ assertMakeSymlink("d1", "realDir", 1);
r = systemf("%s -xf ../archive.tar d1/file1 >test.out 2>test.err", testprog);
assert(r != 0);
assertIsSymlink("d1", "realDir");
@@ -92,7 +92,7 @@ DEFINE_TEST(test_option_U_upper)
assertMakeDir("test4", 0755);
assertChdir("test4");
assertMakeDir("realDir", 0755);
- assertMakeSymlink("d1", "realDir");
+ assertMakeSymlink("d1", "realDir", 1);
assertEqualInt(0,
systemf("%s -xUf ../archive.tar >test.out 2>test.err", testprog));
assertIsDir("d1", -1);
@@ -105,7 +105,7 @@ DEFINE_TEST(test_option_U_upper)
assertMakeDir("test5", 0755);
assertChdir("test5");
assertMakeDir("realDir", 0755);
- assertMakeSymlink("d1", "realDir");
+ assertMakeSymlink("d1", "realDir", 1);
assertEqualInt(0,
systemf("%s -xPf ../archive.tar d1/file1 >test.out 2>test.err", testprog));
assertIsSymlink("d1", "realDir");
@@ -118,7 +118,7 @@ DEFINE_TEST(test_option_U_upper)
assertMakeDir("test6", 0755);
assertChdir("test6");
assertMakeDir("realDir", 0755);
- assertMakeSymlink("d1", "realDir");
+ assertMakeSymlink("d1", "realDir", 1);
assertEqualInt(0,
systemf("%s -xPUf ../archive.tar d1/file1 >test.out 2>test.err", testprog));
assertIsSymlink("d1", "realDir");
@@ -132,7 +132,7 @@ DEFINE_TEST(test_option_U_upper)
assertChdir("test7");
assertMakeDir("d1", 0755);
assertMakeFile("d1/realfile1", 0644, "realfile1");
- assertMakeSymlink("d1/file1", "d1/realfile1");
+ assertMakeSymlink("d1/file1", "d1/realfile1", 0);
assertEqualInt(0,
systemf("%s -xf ../archive.tar d1/file1 >test.out 2>test.err", testprog));
assertIsReg("d1/file1", umasked(0644));
@@ -147,7 +147,7 @@ DEFINE_TEST(test_option_U_upper)
assertChdir("test8");
assertMakeDir("d1", 0755);
assertMakeFile("d1/realfile1", 0644, "realfile1");
- assertMakeSymlink("d1/file1", "d1/realfile1");
+ assertMakeSymlink("d1/file1", "d1/realfile1", 0);
assertEqualInt(0,
systemf("%s -xPUf ../archive.tar d1/file1 >test.out 2>test.err", testprog));
assertIsReg("d1/file1", umasked(0644));
diff --git a/tar/test/test_option_s.c b/tar/test/test_option_s.c
index ee8332f3..a0896606 100644
--- a/tar/test/test_option_s.c
+++ b/tar/test/test_option_s.c
@@ -36,7 +36,7 @@ DEFINE_TEST(test_option_s)
assertMakeFile("in/d1/bar", 0644, "bar");
if (canSymlink()) {
assertMakeFile("in/d1/realfile", 0644, "realfile");
- assertMakeSymlink("in/d1/symlink", "realfile");
+ assertMakeSymlink("in/d1/symlink", "realfile", 0);
}
assertMakeFile("in/d1/hardlink1", 0644, "hardlinkedfile");
assertMakeHardlink("in/d1/hardlink2", "in/d1/hardlink1");
diff --git a/tar/test/test_strip_components.c b/tar/test/test_strip_components.c
index d195af1b..e1d71ddc 100644
--- a/tar/test/test_strip_components.c
+++ b/tar/test/test_strip_components.c
@@ -36,8 +36,8 @@ DEFINE_TEST(test_strip_components)
assertMakeHardlink("l1", "d1/d2/f1");
assertMakeHardlink("d1/l2", "d1/d2/f1");
if (canSymlink()) {
- assertMakeSymlink("s1", "d1/d2/f1");
- assertMakeSymlink("d1/s2", "d2/f1");
+ assertMakeSymlink("s1", "d1/d2/f1", 0);
+ assertMakeSymlink("d1/s2", "d2/f1", 0);
}
assertChdir("..");
diff --git a/tar/test/test_symlink_dir.c b/tar/test/test_symlink_dir.c
index 852e00b3..485ab32f 100644
--- a/tar/test/test_symlink_dir.c
+++ b/tar/test/test_symlink_dir.c
@@ -66,22 +66,22 @@ DEFINE_TEST(test_symlink_dir)
/* "dir" is a symlink to an existing "dest1/real_dir" */
assertMakeDir("dest1/real_dir", 0755);
if (canSymlink()) {
- assertMakeSymlink("dest1/dir", "real_dir");
+ assertMakeSymlink("dest1/dir", "real_dir", 1);
/* "dir2" is a symlink to a non-existing "real_dir2" */
- assertMakeSymlink("dest1/dir2", "real_dir2");
+ assertMakeSymlink("dest1/dir2", "real_dir2", 1);
} else {
skipping("Symlinks are not supported on this platform");
}
/* "dir3" is a symlink to an existing "non_dir3" */
assertMakeFile("dest1/non_dir3", 0755, "abcdef");
if (canSymlink())
- assertMakeSymlink("dest1/dir3", "non_dir3");
+ assertMakeSymlink("dest1/dir3", "non_dir3", 1);
/* "file" is a symlink to existing "real_file" */
assertMakeFile("dest1/real_file", 0755, "abcdefg");
if (canSymlink()) {
- assertMakeSymlink("dest1/file", "real_file");
+ assertMakeSymlink("dest1/file", "real_file", 0);
/* "file2" is a symlink to non-existing "real_file2" */
- assertMakeSymlink("dest1/file2", "real_file2");
+ assertMakeSymlink("dest1/file2", "real_file2", 0);
}
assertEqualInt(0, systemf("%s -xf test.tar -C dest1", testprog));
@@ -108,26 +108,26 @@ DEFINE_TEST(test_symlink_dir)
/* "dir" is a symlink to existing "real_dir" */
assertMakeDir("dest2/real_dir", 0755);
if (canSymlink())
- assertMakeSymlink("dest2/dir", "real_dir");
+ assertMakeSymlink("dest2/dir", "real_dir", 1);
/* "dir2" is a symlink to a non-existing "real_dir2" */
if (canSymlink())
- assertMakeSymlink("dest2/dir2", "real_dir2");
+ assertMakeSymlink("dest2/dir2", "real_dir2", 1);
/* "dir3" is a symlink to an existing "non_dir3" */
assertMakeFile("dest2/non_dir3", 0755, "abcdefgh");
if (canSymlink())
- assertMakeSymlink("dest2/dir3", "non_dir3");
+ assertMakeSymlink("dest2/dir3", "non_dir3", 1);
/* "file" is a symlink to existing "real_file" */
assertMakeFile("dest2/real_file", 0755, "abcdefghi");
if (canSymlink())
- assertMakeSymlink("dest2/file", "real_file");
+ assertMakeSymlink("dest2/file", "real_file", 0);
/* "file2" is a symlink to non-existing "real_file2" */
if (canSymlink())
- assertMakeSymlink("dest2/file2", "real_file2");
+ assertMakeSymlink("dest2/file2", "real_file2", 0);
assertEqualInt(0, systemf("%s -xPf test.tar -C dest2", testprog));
/* "dir4" is a symlink to existing "real_dir" */
if (canSymlink())
- assertMakeSymlink("dest2/dir4", "real_dir");
+ assertMakeSymlink("dest2/dir4", "real_dir", 1);
assertEqualInt(0, systemf("%s -xPf test2.tar -C dest2", testprog));
/* dest2/dir and dest2/dir4 symlinks should be followed */