questions about post-new/insert hooks
authorJameson Graef Rollins <jrollins@finestructure.net>
Tue, 23 Dec 2014 21:48:02 +0000 (13:48 +1600)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:47:02 +0000 (14:47 -0700)
52/fc0390855433f0999faea8f19438299d3a9c57 [new file with mode: 0644]

diff --git a/52/fc0390855433f0999faea8f19438299d3a9c57 b/52/fc0390855433f0999faea8f19438299d3a9c57
new file mode 100644 (file)
index 0000000..f7e2d5f
--- /dev/null
@@ -0,0 +1,112 @@
+Return-Path: <jrollins@finestructure.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 4DA21431FC2\r
+       for <notmuch@notmuchmail.org>; Tue, 23 Dec 2014 13:48:11 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id awc6dy1+vZiE for <notmuch@notmuchmail.org>;\r
+       Tue, 23 Dec 2014 13:48:08 -0800 (PST)\r
+Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
+       [131.215.239.19])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 1D908431FBF\r
+       for <notmuch@notmuchmail.org>; Tue, 23 Dec 2014 13:48:08 -0800 (PST)\r
+Received: from smtp01.caltech.edu (localhost [127.0.0.1])\r
+       by filter-return (Postfix) with ESMTP id 65208A0737\r
+       for <notmuch@notmuchmail.org>; Tue, 23 Dec 2014 13:48:07 -0800 (PST)\r
+X-Spam-Scanned: at Caltech-IMSS on smtp01.caltech.edu by amavisd-new\r
+Received: from finestructure.net (user-38o13sb.cable.mindspring.com\r
+       [209.128.143.139])\r
+       (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits))\r
+       (No client certificate requested) (Authenticated sender: jrollins)\r
+       by smtp-server.its.caltech.edu (Postfix) with ESMTPSA id 8BEACA062E\r
+       for <notmuch@notmuchmail.org>; Tue, 23 Dec 2014 13:48:06 -0800 (PST)\r
+Received: by finestructure.net (Postfix, from userid 1000)\r
+       id 1561060132; Tue, 23 Dec 2014 13:48:05 -0800 (PST)\r
+From: Jameson Graef Rollins <jrollins@finestructure.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: questions about post-new/insert hooks\r
+User-Agent: Notmuch/0.19+9~gdca38d0 (http://notmuchmail.org) Emacs/24.4.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Tue, 23 Dec 2014 13:48:02 -0800\r
+Message-ID: <87k31im419.fsf@servo.finestructure.net>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; boundary="=-=-=";\r
+       micalg=pgp-sha256; protocol="application/pgp-signature"\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 23 Dec 2014 21:48:11 -0000\r
+\r
+--=-=-=\r
+Content-Type: text/plain\r
+\r
+Hi, folks.  I was wondering about possible race conditions in the\r
+post-new hook.  Given that the database does not remain locked during\r
+execution of the post-new hook, isn't there a possibility that more new\r
+messages will be added to the database before the post-new hook has\r
+finished processing?  If so, I can imagine multiple ways that might\r
+break typical logic in post-new hooks.  I wonder if this race condition\r
+could be avoided by e.g. sending the post-new hook the message ids of\r
+all newly-added messages on stdin.  The hook could then use the message\r
+ids to process just the new messages, without worrying that other\r
+messages could have been added in the middle of processing.  Has anyone\r
+thought about this?\r
+\r
+I was also wondering about per-message insertion hooks.  The new(ish)\r
+insert command has a post-insert hook which is run on a per-message\r
+insertion basis.  What about adding a hook that would run on each\r
+message being added with new?  This would also be a way to get rid of\r
+the above mentioned race condition, and might allow for simpler message\r
+content filtering for those of us using notmuch-new instead of\r
+notmuch-insert.  Maybe in this the per-message hook could get the full\r
+text of the message on stdin, and the message id as argument.\r
+\r
+I haven't fully thought the implications of this stuff through, so I\r
+would love to hear what others think.\r
+\r
+The reason I bring all this up is that I'm trying to figure out the best\r
+way to integrate spam classification into my notmuch setup, which for\r
+some reason is currently proving exceedingly difficult.\r
+\r
+jamie.\r
+\r
+--=-=-=\r
+Content-Type: application/pgp-signature; name="signature.asc"\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1\r
+\r
+iQIcBAEBCAAGBQJUmeMSAAoJEO00zqvie6q8Ax8P/2It5iz5Zo2C4S1Agp06jiZC\r
+HdEJiAy5TQCoslofytzhPj3SgK6Px90qLKyTiJ9Luu7yH551GlSt91T6jxL6r67t\r
+5S2lISOFJFWS43cOPE1C0vi+Qyp+VGpHT3b0rxDYOMTwE3zPM3labfGrz51EFyxK\r
+LQnu2UkV0MF/GZsJHkOheDEKUQp53dd/4ON4udR/9qoW+EP2XaMlnT10aIi0lSBw\r
+ljinFMd00v7jCJrNmTdwk3+hNCRGM6o+mlVKGU8zzNWulvi1TJsFjAPm5e60h8jO\r
+WGkHak4rhleiiO3FKhgbzRoJITPLd9LDavAmJ55RsXXa0wWTqeQwxJdjxa5+vH3o\r
+GWk0aoshFxWof/tGChaUGsTh6sj2rvl+W+SSL6RMVm+eTis4XQ+BdQrjnDVCsXzi\r
+P7vxoOE4/0/bCh6y93GHsIhWQgdTHkiSjOuah5U9fcTzE3aMTLil9fyJR4WkOiJP\r
+1+UOJHKRvgAKt8RTOWArAyZG+HIA+Zq8Ix30eVnf0chtGjPA+275bVbl8N6Nf7yd\r
+bM3PrI73PvJvnpuuvALy0dklgrTQr2humqPIFivKWruWTq2GQb8QJHF3qye5Rt78\r
+4dxckg/lgyDKP7y8xZO86a+lqiseLulh8CC6Zcmvusnl7a5SVVzd2/hlvL01Hncy\r
+w/3PA7EXWXmW/wyAAyX1\r
+=3QK9\r
+-----END PGP SIGNATURE-----\r
+--=-=-=--\r