summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/pacman/query.c6
-rw-r--r--test/pacman/tests/query007.py11
2 files changed, 15 insertions, 2 deletions
diff --git a/src/pacman/query.c b/src/pacman/query.c
index a1cc1cf9..08974105 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -207,8 +207,10 @@ static int query_fileowner(alpm_list_t *targets)
/* for files in '/', there is no directory name to match */
if(!rpath) {
- print_query_fileowner(filename, info);
- found = 1;
+ if(strcmp(pkgfile, bname) == 0) {
+ print_query_fileowner(filename, info);
+ found = 1;
+ }
continue;
}
diff --git a/test/pacman/tests/query007.py b/test/pacman/tests/query007.py
new file mode 100644
index 00000000..35bb0ca6
--- /dev/null
+++ b/test/pacman/tests/query007.py
@@ -0,0 +1,11 @@
+self.description = "Query ownership of file in root"
+
+sp = pmpkg("dummy")
+sp.files = ["etc/config"]
+self.addpkg2db("local", sp)
+
+self.filesystem = ["config"]
+
+self.args = "-Qo /config"
+
+self.addrule("PACMAN_RETCODE=1")