aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2016-06-21 16:50:16 -0400
committerMike Frysinger <vapier@gentoo.org>2016-06-21 16:50:16 -0400
commitbb2446132941352a1026e94df1cffcd664889fa6 (patch)
tree11ae983c78f8cb9bed61abd16e8d0bd9c528ad6f
parentREADME: update repo URLs (diff)
downloadportage-utils-bb2446132941352a1026e94df1cffcd664889fa6.tar.gz
portage-utils-bb2446132941352a1026e94df1cffcd664889fa6.tar.bz2
portage-utils-bb2446132941352a1026e94df1cffcd664889fa6.zip
qlist: fix subslot matching
If the user hasn't request matching against a subslot, make sure we ignore it when checking the package's SLOT value.
-rw-r--r--qlist.c7
-rwxr-xr-xtests/qlist/dotest3
-rw-r--r--tests/qlist/list16.good1
3 files changed, 9 insertions, 2 deletions
diff --git a/qlist.c b/qlist.c
index a5b17af..d238259 100644
--- a/qlist.c
+++ b/qlist.c
@@ -183,8 +183,11 @@ qlist_match(q_vdb_pkg_ctx *pkg_ctx, const char *name, depend_atom **name_atom, b
}
if (uslot) {
- /* require exact match on SLOTs */
- if (strncmp(pkg_ctx->slot, uslot, uslot_len) != 0 || pkg_ctx->slot[uslot_len] != '\0')
+ /* Require exact match on SLOTs. If the user didn't include a subslot,
+ * then ignore it when checking the package's value. */
+ if (strncmp(pkg_ctx->slot, uslot, uslot_len) != 0 ||
+ (pkg_ctx->slot[uslot_len] != '\0' &&
+ pkg_ctx->slot[uslot_len] != '/'))
return false;
}
diff --git a/tests/qlist/dotest b/tests/qlist/dotest
index ddcd761..317a282 100755
--- a/tests/qlist/dotest
+++ b/tests/qlist/dotest
@@ -67,6 +67,9 @@ test 14 0 "qlist -ICSS"
# no matches
test 15 1 "qlist -Iv lajsdflkjasdflkjasdfljasdf"
+# match test w/out sub-SLOT
+test 16 0 "qlist -ICSS cat/sub-2:1"
+
cleantmpdir
end
diff --git a/tests/qlist/list16.good b/tests/qlist/list16.good
new file mode 100644
index 0000000..9c27e9c
--- /dev/null
+++ b/tests/qlist/list16.good
@@ -0,0 +1 @@
+cat/sub:1/1234