~sircmpwn/aerc

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

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

Details
Message ID
<20191027135323.406381-1-matt.snider@protonmail.com>
DKIM signature
pass
Download raw message
Patch: +4 -0
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
Details
Message ID
<20191027140358.y43kdpw7zo7yknqn@feather.localdomain>
In-Reply-To
<20191027135323.406381-1-matt.snider@protonmail.com> (view parent)
DKIM signature
pass
Download raw message
Patch looks good to me

Thanks!
Details
Message ID
<BY4NGNRDPI5A.3IRHRJE7KTCRG@homura>
In-Reply-To
<20191027135323.406381-1-matt.snider@protonmail.com> (view parent)
DKIM signature
pass
Download raw message
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