summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2015-12-04 07:36:01 +1000
committerAllan McRae <allan@archlinux.org>2015-12-05 17:46:11 +1000
commit8a373096f590925465f624d7b0bf466b02143ce1 (patch)
tree1d49bc64918731027a662316a90ce6cea4503107
parent088649534e7fd493cab4fce335f50a68108a48a6 (diff)
Detect potential conflict when symlink to directory is changing to directory
When a symlink to a directory is changing to a directory, any package file inside the new directory can create an unexpected conflict with the filesystem. Reported by Neofytos and Luca from Chakra. Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--test/pacman/tests/TESTS1
-rw-r--r--test/pacman/tests/symlink021.py28
2 files changed, 29 insertions, 0 deletions
diff --git a/test/pacman/tests/TESTS b/test/pacman/tests/TESTS
index e330896b..bee7c8ec 100644
--- a/test/pacman/tests/TESTS
+++ b/test/pacman/tests/TESTS
@@ -150,6 +150,7 @@ TESTS += test/pacman/tests/symlink010.py
TESTS += test/pacman/tests/symlink011.py
TESTS += test/pacman/tests/symlink012.py
TESTS += test/pacman/tests/symlink020.py
+TESTS += test/pacman/tests/symlink021.py
TESTS += test/pacman/tests/sync-install-assumeinstalled.py
TESTS += test/pacman/tests/sync-nodepversion01.py
TESTS += test/pacman/tests/sync-nodepversion02.py
diff --git a/test/pacman/tests/symlink021.py b/test/pacman/tests/symlink021.py
new file mode 100644
index 00000000..19a7f099
--- /dev/null
+++ b/test/pacman/tests/symlink021.py
@@ -0,0 +1,28 @@
+self.description = "symlink -> dir replacment with file move"
+
+lp1 = pmpkg("pkg1")
+lp1.files = ["usr/include/foo/",
+ "usr/include/bar -> foo",
+ "usr/include/foo/header.h"]
+self.addpkg2db("local", lp1)
+
+sp1 = pmpkg("pkg1", "1.0-2")
+sp1.files = ["usr/include/foo/",
+ "usr/include/foo/header.h"]
+self.addpkg2db("sync", sp1)
+
+sp2 = pmpkg("pkg2", "1.0-2")
+sp2.files = ["usr/include/bar/",
+ "usr/include/bar/header.h"]
+self.addpkg2db("sync", sp2)
+
+
+self.args = "-S %s %s" % (sp1.name, sp2.name)
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("FILE_TYPE=usr/include/foo|dir")
+self.addrule("!FILE_TYPE=usr/include/bar|link")
+self.addrule("FILE_EXIST=usr/include/foo/header.h")
+self.addrule("FILE_EXIST=usr/include/bar/header.h")
+
+self.expectfailure = True