From 91146b204ff7a47eb67d6fb18bbcad0e1d3bbecd Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 29 Jan 2023 13:44:13 +0300 Subject: feat(3p/public-inbox): always set list-id when ingesting in watch There is a code path in public-inbox that will (under certain conditions) set the expected list-id as derived from the recipient mail address (so in our case depot@tvl.su -> `List-ID: depot.tvl.su`). However, when/how this triggers seems to be particular to the code path taken based on certain config settings. I couldn't fully figure it out, and to be honest I don't really know Perl, and I don't think this warrants a super-high-effort investigation. For that reason, this patches the appropriate line in public-inbox-watch to always trigger this code path regardless of what is going on with the email. I tested this locally with a public-inbox config that does *not* have a `listid` setting set, as that just adds an additional filter which would be a no-op in this case. All emails are ingested correctly with List-ID set. There might be a better place to put this in (e.g. right before the actual mail ingestion), if a Perl expert is interested in figuring this out and considers it relevant, feel free to send a CL. Note that this will not update old emails. Probably. Change-Id: I4a8a42653aa2f408a85c9301a1ee3545f0e74eed Reviewed-on: https://cl.tvl.fyi/c/depot/+/7946 Tested-by: BuildkiteCI Autosubmit: tazjin Reviewed-by: flokli --- ...ways-set-the-List-ID-header-even-in-watch.patch | 30 ++++++++++++++++++++++ third_party/public-inbox/default.nix | 9 +++++++ 2 files changed, 39 insertions(+) create mode 100644 third_party/public-inbox/0001-feat-always-set-the-List-ID-header-even-in-watch.patch create mode 100644 third_party/public-inbox/default.nix (limited to 'third_party') diff --git a/third_party/public-inbox/0001-feat-always-set-the-List-ID-header-even-in-watch.patch b/third_party/public-inbox/0001-feat-always-set-the-List-ID-header-even-in-watch.patch new file mode 100644 index 000000000000..bff2d4c200e2 --- /dev/null +++ b/third_party/public-inbox/0001-feat-always-set-the-List-ID-header-even-in-watch.patch @@ -0,0 +1,30 @@ +From 1719e904acf19499209b16a8a008f55390a7b5e2 Mon Sep 17 00:00:00 2001 +From: Vincent Ambo +Date: Sun, 29 Jan 2023 13:36:12 +0300 +Subject: [PATCH] feat: always set the List-ID header even in -watch + +Without bothering to figure out exactly how this code path is usually +triggered, always set a list ID when ingesting new emails in +public-inbox-watch. +--- + lib/PublicInbox/Watch.pm | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/lib/PublicInbox/Watch.pm b/lib/PublicInbox/Watch.pm +index 3f6fe21..147971c 100644 +--- a/lib/PublicInbox/Watch.pm ++++ b/lib/PublicInbox/Watch.pm +@@ -188,6 +188,10 @@ sub _remove_spam { + sub import_eml ($$$) { + my ($self, $ibx, $eml) = @_; + ++ # TVL-specific: always set the list-id header, regardless of ++ # any of the other logic below. ++ PublicInbox::MDA->set_list_headers($eml, $ibx); ++ + # any header match means it's eligible for the inbox: + if (my $watch_hdrs = $ibx->{-watchheaders}) { + my $ok; +-- +2.39.0 + diff --git a/third_party/public-inbox/default.nix b/third_party/public-inbox/default.nix new file mode 100644 index 000000000000..1a4b196f94b5 --- /dev/null +++ b/third_party/public-inbox/default.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: + +pkgs.public-inbox.overrideAttrs (old: { + patches = (old.patches or [ ]) ++ [ + ./0001-feat-always-set-the-List-ID-header-even-in-watch.patch + ]; + + doCheck = false; # too slow, and nixpkgs already runs them +}) -- cgit 1.4.1