From 5c1885b55eae870a10c91793d05a74d74a075e83 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 26 Oct 2011 16:43:36 -0500 Subject: Add some unowned symlink replacement tests These should all prevent installation, and yet two of the three tests currently fail. Not good. The best way to see what is going on here is to diff the three new tests side by side- there is only a small difference between the three tests, and that is in the destination of the symlink in question that should never be overwritten. symlink010.py: myprogsuffix -> myprog symlink011.py: myprogsuffix -> broken symlink012.py: myprogsuffix -> otherprog Signed-off-by: Dan McGee --- test/pacman/tests/symlink010.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/pacman/tests/symlink010.py (limited to 'test/pacman/tests/symlink010.py') diff --git a/test/pacman/tests/symlink010.py b/test/pacman/tests/symlink010.py new file mode 100644 index 00000000..8c80dbc9 --- /dev/null +++ b/test/pacman/tests/symlink010.py @@ -0,0 +1,26 @@ +self.description = "Unowned identical symlink pointing to file in package" + +lp = pmpkg("dummy") +lp.files = ["usr/bin/myprog"] +self.addpkg2db("local", lp) + +self.filesystem = ["usr/bin/otherprog", + "usr/bin/myprogsuffix -> myprog"] + +p = pmpkg("dummy", "1.0-2") +p.files = ["usr/bin/myprog", + "usr/bin/myprogsuffix -> myprog"] +self.addpkg(p) + +self.args = "-U %s" % p.filename() + +self.addrule("PACMAN_RETCODE=1") +self.addrule("PKG_VERSION=dummy|1.0-1") +self.addrule("FILE_EXIST=usr/bin/myprog") +self.addrule("LINK_EXIST=usr/bin/myprogsuffix") +self.addrule("FILE_EXIST=usr/bin/otherprog") +self.addrule("FILE_TYPE=usr/bin/myprog|file") +self.addrule("FILE_TYPE=usr/bin/myprogsuffix|link") +self.addrule("FILE_TYPE=usr/bin/otherprog|file") + +self.expectfailure = True -- cgit v1.2.3 From 8a9ce12a27970beb644952a83d27f54d1d7f751a Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 26 Oct 2011 17:32:46 -0500 Subject: Fix issues with replacing unowned symlinks There aretwo seperate issues in the same block of file conflict checking code here: 1) If realpath errored, such as when a symlink was broken, we would call 'continue' rather than simply exit this particular method of resolution. This was likely just a copy-paste mistake as the previous resolving steps all use loops where continue makes sense. Refactor the check so we only proceed if realpath is successful, and continue with the rest of the checks either way. 2) The real problem this code was trying to solve was canonicalizing path component (e.g., directory) symlinks. The final component, if not a directory, should not be handled at all in this loop. Add a !S_ISLNK() condition to the loop so we only call this for real files. There are few other small cleanups to the debug messages that I made while debugging this problem- we don't need to keep printing the file name, and ensure every block that sets resolved_conflict to true prints a debug message so we know how it was resolved. This fixes the expected failures from symlink010.py and symlink011.py, while still ensuring the fix for fileconflict007.py works. Signed-off-by: Dan McGee --- test/pacman/tests/symlink010.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'test/pacman/tests/symlink010.py') diff --git a/test/pacman/tests/symlink010.py b/test/pacman/tests/symlink010.py index 8c80dbc9..a1e562e1 100644 --- a/test/pacman/tests/symlink010.py +++ b/test/pacman/tests/symlink010.py @@ -22,5 +22,3 @@ self.addrule("FILE_EXIST=usr/bin/otherprog") self.addrule("FILE_TYPE=usr/bin/myprog|file") self.addrule("FILE_TYPE=usr/bin/myprogsuffix|link") self.addrule("FILE_TYPE=usr/bin/otherprog|file") - -self.expectfailure = True -- cgit v1.2.3