Subject: [alpine-devel] [PATCH] Fix apk search --description

From: Bobby Bingham <[email-masked]>
Date: Tue, 9 Jun 2015 22:29:17 -0500

`apk search --description` doesn't work correctly, because the needle
and haystack arguments are swapped in a couple calls to strstr.  The
attached patch fixes this.
--
Bobby Bingham
commit 2d168068969cecbe65c722673fb9a9ffe2cdf6f3
Author: Bobby Bingham <[email-masked]>
Date:   Tue Jun 9 22:03:27 2015 -0500

    search: fix swapped needle and haystack

diff --git a/src/search.c b/src/search.c
index 47339fd..5833325 100644
--- a/src/search.c
+++ b/src/search.c
@@ -122,8 +122,8 @@ static void print_result_pkg(struct search_ctx *ctx, struct apk_package *pkg)
 
 	if (ctx->search_description) {
 		foreach_array_item(pmatch, ctx->filter) {
-			if (strstr(*pmatch, pkg->description) != NULL ||
-			    strstr(*pmatch, pkg->name->name) != NULL)
+			if (strstr(pkg->description, *pmatch) != NULL ||
+			    strstr(pkg->name->name, *pmatch) != NULL)
 				goto match;
 		}
 		return;

---

From: Timo Teras <[email-masked]>
Date: Wed, 10 Jun 2015 08:10:04 +0300

On Tue, 9 Jun 2015 22:29:17 -0500

> attached patch fixes this.

Applied thanks.

But I noticed the attachment for "git show" format. It did not apply
as-is. Next time use "git format-patch" to generate them, and
potentially "git send-email" to email the patch inline in the email.

Thanks.

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---