~sircmpwn/aerc

notmuch: ignore comments and blank lines when processing query-map file v2 PROPOSED

Thanks! I had to run gofmt on this, please make sure that you're running
it yourself before submitting patches.

To git.sr.ht:~sircmpwn/aerc
   310bec2..331b915  master -> master
Patch looks good to me

Thanks!
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/aerc/patches/8852/mbox | git am -3
Learn more about email & git

[PATCH v2] notmuch: ignore comments and blank lines when processing query-map file Export this patch

A segmentation fault occurs when using the notmuch backend and a `query-map`
file that contains blank lines or comments.
---
This patch additionally ignores lines beginning with comment char ('#')

Thank reto@labrat.space for the feedback! :-)

 worker/notmuch/worker.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go
index 96adc29..fb6a594 100644
--- a/worker/notmuch/worker.go
+++ b/worker/notmuch/worker.go
@@ -387,6 +387,10 @@ func (w *worker) loadQueryMap(acctConfig *config.AccountConfig) error {
 	scanner := bufio.NewScanner(f)
 	for scanner.Scan() {
 		line := scanner.Text()
+		if line == ""  || line[0] == '#' {
+			continue
+		}
+
 		split := strings.SplitN(line, "=", 2)
 		if len(split) != 2 {
 			return fmt.Errorf("invalid line %q, want name=query", line)
-- 
2.23.0
Thanks! I had to run gofmt on this, please make sure that you're running
it yourself before submitting patches.

To git.sr.ht:~sircmpwn/aerc
   310bec2..331b915  master -> master
Patch looks good to me

Thanks!
View this thread in the archives