~rjarry/aerc-devel

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

[PATCH aerc v2] parse: remove trailing whitespace from rfc1123z regex

Details
Message ID
<20220820074624.2228822-1-tom@tjf.sh>
DKIM signature
missing
Download raw message
Patch: +1 -1
When there is no Date header in a message, aerc falls back to the
Received header and tries to extract an rfc1123z date from it
(introduced in commit d1600e46). The current regex for extracting the
date incorrectly allows for trailing whitespace, causing time.Parse() to
fail inside of parseReceivedHeader(). As a result, the message's date is
shown as "???????????????????" in the message list and as
"0000-12-31 07:03 PM" in the message view (the latter is likely related
to the zero value of time.Time).

Steps to reproduce:
1) Send yourself a message with no Date header, e.g. with msmtp:
printf 'Subject: foo bar\n\nbody text\n' | msmtp --set-date-header=off me@example.com
2) Note the message's displayed date in aerc's message list and message
   view.

Signed-off-by: Thomas Faughnan <tom@tjf.sh>
---
There is no change from v1, other than fixing my git-send-email
configuration.  The v1 build failed on alpine because of something with
my message's encoding.

 worker/lib/parse.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/worker/lib/parse.go b/worker/lib/parse.go
index 7f6eb20..30d06a9 100644
--- a/worker/lib/parse.go
+++ b/worker/lib/parse.go
@@ -19,7 +19,7 @@ import (
// RFC 1123Z regexp
var dateRe = regexp.MustCompile(`(((Mon|Tue|Wed|Thu|Fri|Sat|Sun))[,]?\s[0-9]{1,2})\s` +
	`(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s` +
	`([0-9]{4})\s([0-9]{2}):([0-9]{2})(:([0-9]{2}))?\s([\+|\-][0-9]{4})\s?`)
	`([0-9]{4})\s([0-9]{2}):([0-9]{2})(:([0-9]{2}))?\s([\+|\-][0-9]{4})`)

func FetchEntityPartReader(e *message.Entity, index []int) (io.Reader, error) {
	if len(index) == 0 {
-- 
2.37.2

[aerc/patches] build failed

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CMAOW2N535OF.166G201Z7OPRQ@cirno2>
In-Reply-To
<20220820074624.2228822-1-tom@tjf.sh> (view parent)
DKIM signature
missing
Download raw message
aerc/patches: FAILED in 2m20s

[parse: remove trailing whitespace from rfc1123z regex][0] v2 from [Thomas Faughnan][1]

[0]: https://lists.sr.ht/~rjarry/aerc-devel/patches/34802
[1]: tom@tjf.sh

✓ #827248 SUCCESS aerc/patches/openbsd.yml     https://builds.sr.ht/~rjarry/job/827248
✗ #827247 FAILED  aerc/patches/alpine-edge.yml https://builds.sr.ht/~rjarry/job/827247

Re: [aerc/patches] build failed

Details
Message ID
<CMAP5MDUXH0B.3RKKPZWZA9MTL@Archetype>
In-Reply-To
<CMAOW2N535OF.166G201Z7OPRQ@cirno2> (view parent)
DKIM signature
missing
Download raw message
On Sat Aug 20, 2022 at 9:49 AM CEST, builds.sr.ht wrote:
> ✗ #827247 FAILED  aerc/patches/alpine-edge.yml https://builds.sr.ht/~rjarry/job/827247
Disregard this. Lint was successful.
Details
Message ID
<CMAP7DF4PPXE.3R4CQZXZ5SXSA@Archetype>
In-Reply-To
<20220820074624.2228822-1-tom@tjf.sh> (view parent)
DKIM signature
missing
Download raw message
On Sat Aug 20, 2022 at 9:46 AM CEST, Thomas Faughnan wrote:
> When there is no Date header in a message, aerc falls back to the
> Received header and tries to extract an rfc1123z date from it
> (introduced in commit d1600e46). The current regex for extracting the
> date incorrectly allows for trailing whitespace, causing time.Parse() to
> fail inside of parseReceivedHeader(). As a result, the message's date is
> shown as "???????????????????" in the message list and as
> "0000-12-31 07:03 PM" in the message view (the latter is likely related
> to the zero value of time.Time).
>
> Steps to reproduce:
> 1) Send yourself a message with no Date header, e.g. with msmtp:
> printf 'Subject: foo bar\n\nbody text\n' | msmtp --set-date-header=off me@example.com
I would love to try, but my mailserver told me:

	BAD HEADER SECTION, Missing required header field: "Date"

and rejected the mail

> 2) Note the message's displayed date in aerc's message list and message
>    view.
>
> Signed-off-by: Thomas Faughnan <tom@tjf.sh>
> ---
> There is no change from v1, other than fixing my git-send-email
> configuration.  The v1 build failed on alpine because of something with
> my message's encoding.
>
>  worker/lib/parse.go | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
Details
Message ID
<CMAPED3VQHDU.2HTZBX6U81468@deepthought>
In-Reply-To
<CMAP7DF4PPXE.3R4CQZXZ5SXSA@Archetype> (view parent)
DKIM signature
missing
Download raw message
If you use maildir you could also simply edit a message file directly,
deleting the line with the Date header.

Admittedly, it is rare that emails arrive in my inbox with no Date
header, but I did actually receive one the other day (from GitHub
Actions of all places)  which is how I stumbled across this bug.
Details
Message ID
<CMCLTY50BA8Q.31IVLXX6PQ14I@marty>
In-Reply-To
<20220820074624.2228822-1-tom@tjf.sh> (view parent)
DKIM signature
missing
Download raw message
Thomas Faughnan, Aug 20, 2022 at 09:46:
> When there is no Date header in a message, aerc falls back to the
> Received header and tries to extract an rfc1123z date from it
> (introduced in commit d1600e46). The current regex for extracting the
> date incorrectly allows for trailing whitespace, causing time.Parse() to
> fail inside of parseReceivedHeader(). As a result, the message's date is
> shown as "???????????????????" in the message list and as
> "0000-12-31 07:03 PM" in the message view (the latter is likely related
> to the zero value of time.Time).
>
> Steps to reproduce:
> 1) Send yourself a message with no Date header, e.g. with msmtp:
> printf 'Subject: foo bar\n\nbody text\n' | msmtp --set-date-header=off me@example.com
> 2) Note the message's displayed date in aerc's message list and message
>    view.
>
> Signed-off-by: Thomas Faughnan <tom@tjf.sh>

Acked-by: Robin-Jarry <robin@jarry.cc>

Applied. Thanks!
Reply to thread Export thread (mbox)