unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Change duplicate priority?
@ 2023-09-28 14:10 Jesse Rosenthal
  2023-09-30 12:20 ` David Bremner
  0 siblings, 1 reply; 2+ messages in thread
From: Jesse Rosenthal @ 2023-09-28 14:10 UTC (permalink / raw)
  To: notmuch

Dear All,

My work email comes through an Outlook server, which scans some
attachments. The process seems to be to first post an email with an
"Advanced Threat Protection" message and a link to a preview of the
attachment. Then, after the scan is complete, to delete that message and
post a second message, with the same Message ID, and the actual
attachment.

Depending on how long the scan takes, getmail might pull down both of
these emails. The second duplicate is available through the emacs change
index command, but the attachment is not available (since it tries to
pull the first attachment from the first version, which is just an html
part).

I can usually solve this by deleting the first one by hand, something
like:

    notmuch search --output=files id:<mid> | head -1 | xargs rm

This has a couple of problems, though. (1) It's relying on the Maildir file
name being a time stamp to get rid of the earlier file, and (2) it
doesn't actually reindex the file when I run notmuch new, just treating
it as a rename, so I still get the search results for the older deleted
file.

I guess I could do a bindings-based script that gives me a bit more
confidence, dump the tags, delete the messages, reindex, and reapply the
tags.

But I wonder if there is some way to change the priority of duplicates
so that later versions overwrite earlier versions. Alternately, could
there be a way to specify which file name notmuch commands pull
attachments from? This would allow me to get the attachment that is only
on the second dup from the emacs interface.

The other (classical) approach, I guess, would be to put an mda in there
which only lets the second one through. But I'm trying to avoid
/dev/null-ing emails non-interactively if I possible can.

Thanks,
Jesse

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Change duplicate priority?
  2023-09-28 14:10 Change duplicate priority? Jesse Rosenthal
@ 2023-09-30 12:20 ` David Bremner
  0 siblings, 0 replies; 2+ messages in thread
From: David Bremner @ 2023-09-30 12:20 UTC (permalink / raw)
  To: Jesse Rosenthal, notmuch

Jesse Rosenthal <jrosenthal@jhu.edu> writes:

>
> Depending on how long the scan takes, getmail might pull down both of
> these emails. The second duplicate is available through the emacs change
> index command, but the attachment is not available (since it tries to
> pull the first attachment from the first version, which is just an html
> part).

Hmm. That seems like a bug, the attachement should be drawn from the
"current" version. I will see if I can replicate this with a simple test
case.

> I can usually solve this by deleting the first one by hand, something
> like:
>
>     notmuch search --output=files id:<mid> | head -1 | xargs rm
>
> This has a couple of problems, though. (1) It's relying on the Maildir file
> name being a time stamp to get rid of the earlier file, and (2) it
> doesn't actually reindex the file when I run notmuch new, just treating
> it as a rename, so I still get the search results for the older deleted
> file.

What if you use notmuch-reindex instead of notmuch-new after the deletion?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-09-30 12:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-28 14:10 Change duplicate priority? Jesse Rosenthal
2023-09-30 12:20 ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).