[pacman-dev] [PATCH] Detect potental confict when symlink to directory is changing to directory

Allan McRae allan at archlinux.org
Thu Dec 3 21:41:59 UTC 2015


When a symlink to a directory is changing to a directory and takes a file with
it, pacman does not result the path of the file on the filesystem when checking
for conflicts.

Reported by Neofytos and Luca from Chakra.

Signed-off-by: Allan McRae <allan at archlinux.org>
---

This only works based on pacmans return failure. Why is the usr/include/bar being
detected as a directory and not a symlink?


 test/pacman/tests/TESTS         |  1 +
 test/pacman/tests/symlink021.py | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100644 test/pacman/tests/symlink021.py

diff --git a/test/pacman/tests/TESTS b/test/pacman/tests/TESTS
index e330896..bee7c8e 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 0000000..800094d
--- /dev/null
+++ b/test/pacman/tests/symlink021.py
@@ -0,0 +1,27 @@
+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/"]
+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|dir")
+self.addrule("FILE_EXIST=usr/include/foo/header.h")
+self.addrule("FILE_EXIST=usr/include/bar/header.h")
+
+self.expectfailure = True
-- 
2.6.3


More information about the pacman-dev mailing list