panic when quoting reply from unread mail

When attempting to reply to an mail by quoting ( rq / Rq ), aerc panics with a stack-trace :

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x5dcf04]
goroutine 32 [running]:
	/home/shine/dev/lang/go/src/bufio/bufio.go:100 +0xd4
bufio.(*Reader).Peek(0xc00066bf00, 0x1, 0x20, 0xc0000a0000, 0x409902, 0xc00066bcd0, 0x2)
	/home/shine/dev/lang/go/src/bufio/bufio.go:138 +0x4f
github.com/emersion/go-message/textproto.ReadHeader(0xc00066bf00, 0x1000, 0x1000, 0xc000361000, 0x0, 0x1, 0xc0002084b0)
	/home/shine/dev/go/pkg/mod/github.com/emersion/go-message@v0.13.1-0.20201112194930-f77964fe28bd/textproto/header.go:497 +0x7b
git.sr.ht/~sircmpwn/aerc/worker/imap.(*IMAPWorker).handleFetchMessageBodyPart.func1(0xc0000e8180, 0xc00066bf98, 0x1)
	/home/shine/dev/go/src/sr.ht/sircmpwn/aerc/worker/imap/fetch.go:92 +0xd8
git.sr.ht/~sircmpwn/aerc/worker/imap.(*IMAPWorker).handleFetchMessages.func1(0xc0000b5380, 0xc0000ba500, 0xc000592600, 0xc0000b53e0)
	/home/shine/dev/go/src/sr.ht/sircmpwn/aerc/worker/imap/fetch.go:169 +0xad
created by git.sr.ht/~sircmpwn/aerc/worker/imap.(*IMAPWorker).handleFetchMessages
	/home/shine/dev/go/src/sr.ht/sircmpwn/aerc/worker/imap/fetch.go:165 +0xb6

This occurs when the mail is marked as unread ( New / Old ) AND when the reply method is to quote the original mail.

Example Steps to Reproduce :

  1. :unread | Mark a mail as unread
  2. rq | reply to mail pre-filled with quoted version of mail This is reproducible with Rq as well.

This is not reproducible if the message is already marked read OR if the reply method is not set to quote the original mail ( rr or Rr ).

Another observation is that when aerc is re-opened after the crash, the mail that caused the crash is marked as read.

Assigned to
3 months ago
3 months ago
No labels applied.

~labrat 3 months ago

hm, I can't reproduce this I'm afraid.

shine 3 months ago · edit

On Sun, Apr 18, 2021 at 09:37:56AM -0000, ~labrat wrote:

hm, I can't reproduce this I'm afraid.

This has been annoying me for a long time now. I am able to reproduce this 100% of the time ( provided I use the quoted reply method on unread mails ). I was ignoring it until it got on my nerves.

If it helps, this is a build at commit 548faca from March 7, 2021. And that commit specifically fixed typo in quoted reply template. There have been 2 commits since then which does not seem to be related to quoting replies.

I am going to compile new builds at the latest HEAD tip and see if it fixes the issue. If it does not, I will go down a few commits because the last 3 commits on my tree is related to templates.

-- View on the web: https://todo.sr.ht/~sircmpwn/aerc2/508#event-80459

shine 3 months ago · edit

After compiling many versions all the way down to tag:0.5.0 and then attempting another few versions with the latest version of go1.16.3, I have concluded that it could be some issue with my setup. This situation is still reproducible for me.

But it is probably not a bug. Hence this todo can be closed.

~labrat 3 months ago

But it is probably not a bug

hold your horses :)

I didn't say that, clearly something is wrong else you wouldn't get a panic.

I just can't reproduce it with my imap server that I run.

Is it some really obscure provider? I mean if people wouldn't be able to quote reply they'd have complained and this issue is the first I think I've seen.

But this absolutely doesn't mean that this couldn't be a bug in aerc, in fact it panicking means that it fucked up big time. This should never happen

shine 3 months ago · edit

I just can't reproduce it with my imap server that I run.

Ah, I did not consider the IMAP part of the problem. Now that you mentioned it, I investigated further with my personal IMAP server that runs dovecot. And then I could not reproduce the bug.

Is it some really obscure provider?

If you want to call Google obscure, sure ( I would ). The IMAP server that I was reproducing the bug with was GMail.

~labrat 3 months ago

There we are, now I can reproduce. I observe the same issue on my gmail account.

Register here or Log in to comment, or comment via email.