[PATCH 1/5] query: only strip leading local/ for db packages

Andrew Gregory andrew.gregory.8 at gmail.com
Sun Feb 6 18:30:37 UTC 2022


Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---
 src/pacman/query.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/pacman/query.c b/src/pacman/query.c
index 0208d5b6..afcbbd4f 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -468,11 +468,6 @@ int pacman_query(alpm_list_t *targets)
 	for(i = targets; i; i = alpm_list_next(i)) {
 		const char *strname = i->data;
 
-		/* strip leading part of "local/pkgname" */
-		if(strncmp(strname, LOCAL_PREFIX, strlen(LOCAL_PREFIX)) == 0) {
-			strname += strlen(LOCAL_PREFIX);
-		}
-
 		if(config->op_q_isfile) {
 			alpm_pkg_load(config->handle, strname, 1, 0, &pkg);
 
@@ -482,6 +477,11 @@ int pacman_query(alpm_list_t *targets)
 						alpm_strerror(alpm_errno(config->handle)));
 			}
 		} else {
+			/* strip leading part of "local/pkgname" */
+			if(strncmp(strname, LOCAL_PREFIX, strlen(LOCAL_PREFIX)) == 0) {
+				strname += strlen(LOCAL_PREFIX);
+			}
+
 			pkg = alpm_db_get_pkg(db_local, strname);
 			if(pkg == NULL) {
 				pkg = alpm_find_satisfier(alpm_db_get_pkgcache(db_local), strname);
-- 
2.35.0



More information about the pacman-dev mailing list