Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 8DEDF431FD0 for ; Wed, 26 Jan 2011 01:15:23 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.99 X-Spam-Level: X-Spam-Status: No, score=-0.99 tagged_above=-999 required=5 tests=[ALL_TRUSTED=-1, T_MIME_NO_TEXT=0.01] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MfRH1clNTlEl; Wed, 26 Jan 2011 01:15:22 -0800 (PST) Received: from yoom.home.cworth.org (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id F0502431FB5; Wed, 26 Jan 2011 01:15:21 -0800 (PST) Received: by yoom.home.cworth.org (Postfix, from userid 1000) id 349372540E0; Wed, 26 Jan 2011 19:15:21 +1000 (EST) From: Carl Worth To: Austin Clements , Michal Sojka Subject: Re: [PATCH 1/3] new: Do not defer maildir flag synchronization during the first run In-Reply-To: References: <1295603977-14326-1-git-send-email-sojkam1@fel.cvut.cz> <1295603977-14326-3-git-send-email-sojkam1@fel.cvut.cz> User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.2.1 (i486-pc-linux-gnu) Date: Wed, 26 Jan 2011 19:15:21 +1000 Message-ID: <87pqrk10wm.fsf@yoom.home.cworth.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Cc: notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jan 2011 09:15:23 -0000 --=-=-= On Tue, 25 Jan 2011 17:42:30 -0500, Austin Clements wrote: > Wouldn't this be simpler and more general? ... > case NOTMUCH_STATUS_SUCCESS: .. > if (state->synchronize_flags == TRUE) > - _filename_list_add (state->message_ids_to_sync, > - notmuch_message_get_message_id (message)); > + notmuch_message_maildir_flags_to_tags (message); Yes, that is much simpler and should work equally well as the original patch. But there's perhaps a problem with both of these patches. Besides rename, (which obviously can't happen with a new message), we also need to take care when a message is added with multiple filenames (and with different flags on the files). We've got a plan for adding flags-to-tags mappings which only apply if every file for the message has the corresponding flag. For example, this is the semantic we want for the 'D' flag mapping to the "deleted" tag. So we'll want to make sure these cases do the right thing. Consider two new files with the same Message-Id both appearing in a run of "notmuch new", one with the D flag and one without. If the file with the D flag is seen first, and the maildir_flags_to_tags processing happens without being deferred, then the "deleted" tag will be applied to the message. This is different than would happen if both messages were seen, but I think it's just fine. It's still in a state that's consistent, nothing bad would happen if you interrupted this and then acted on the "deleted" tag, and if you restarted "notmuch new" and the second message were seen, then the tag would be correctly removed. So, I think I've convinced myself that the change is actually OK. But then I'm also wondering if perhaps we could do the processing undeferred in all cases? I haven't thought that through, but I'd be glad to hear your ideas. -Carl --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iD8DBQFNP+Yp6JDdNq8qSWgRAub7AJ9hO3Yi5LZdB+M6YVIG/FnUF0Vt/QCeLMar qknMTSgX/oBrZWRT2lXgZP8= =Yxg1 -----END PGP SIGNATURE----- --=-=-=--