query: avoid false ownership matches for files in root
Check for an exact match when querying ownership of files in the root. Previously, our test was too simple and would match the the basename of package files against the query parameter, e.g. $ pacman -Qo config /config is owned by cower-git 20120614-1 Adds a new test to verify this behavior, query007.py. Fixes FS#30388. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
c6e47cb435
commit
da0dcc29cf
2 changed files with 15 additions and 2 deletions
|
@ -207,8 +207,10 @@ static int query_fileowner(alpm_list_t *targets)
|
||||||
|
|
||||||
/* for files in '/', there is no directory name to match */
|
/* for files in '/', there is no directory name to match */
|
||||||
if(!rpath) {
|
if(!rpath) {
|
||||||
|
if(strcmp(pkgfile, bname) == 0) {
|
||||||
print_query_fileowner(filename, info);
|
print_query_fileowner(filename, info);
|
||||||
found = 1;
|
found = 1;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
11
test/pacman/tests/query007.py
Normal file
11
test/pacman/tests/query007.py
Normal file
|
@ -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")
|
Loading…
Add table
Reference in a new issue