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 9FEAC40BFDF for ; Mon, 20 Sep 2010 08:09:39 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2 X-Spam-Level: X-Spam-Status: No, score=-2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1] autolearn=ham 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 rdddLwoZg9mv for ; Mon, 20 Sep 2010 08:09:29 -0700 (PDT) Received: from homiemail-a22.g.dreamhost.com (caiajhbdcbbj.dreamhost.com [208.97.132.119]) by olra.theworths.org (Postfix) with ESMTP id E296C40BD85 for ; Mon, 20 Sep 2010 08:09:28 -0700 (PDT) Received: from homiemail-a22.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a22.g.dreamhost.com (Postfix) with ESMTP id 029C41A808E; Mon, 20 Sep 2010 08:09:29 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=SSpaeth.de; h=from:to:cc:subject :in-reply-to:references:date:message-id:mime-version: content-type; q=dns; s=sspaeth.de; b=kk2OLT3QowLvGKsoGd91GnOFESx LeuUyPna7qTgGxeKV7Z2PEof74Zec1Qd4IwUbTY8IHie4ovRTrvEf+9PwUy9+xCS NbGpuiGvpXaW/BMMN0mGjq3yjct8H8UTP0rOBRoBjCYw1AMzQYEe2o7hIybpSFmg CxgEGAv9y7rCJg/4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=SSpaeth.de; h=from:to:cc :subject:in-reply-to:references:date:message-id:mime-version: content-type; s=sspaeth.de; bh=0MDDKFHWHYKPb2mZTIWvlyeIdMM=; b=A fr5RS8hJPYCzTT5Tuo2GjdN+ZmhRObN/Z2KJ2b6u9sANi6mu+5632euHFmcmab7U wzi+uJy4EUZkZop+6I5vLrPw2irIVRvpOkhg4CdVZuMFjH09sptE4j43un+rM7qV kW24Z0MaieJJiaN/HM46jvGYcqMqTD0pE/6KDeeRAo= Received: from spaetzbook.sspaeth.de (mtec-hg-docking-2-dhcp-016.ethz.ch [82.130.121.16]) (Authenticated sender: fax@sspaeth.de) by homiemail-a22.g.dreamhost.com (Postfix) with ESMTPA id 7203C1A808D; Mon, 20 Sep 2010 08:09:27 -0700 (PDT) Received: by spaetzbook.sspaeth.de (sSMTP sendmail emulation); Mon, 20 Sep 2010 17:09:25 +0200 From: Sebastian Spaeth To: Rob Browning Subject: Re: notmuchsync: handling of the deleted tag In-Reply-To: <87bp7vewa5.fsf@raven.defaultvalue.org> References: <87bp7vewa5.fsf@raven.defaultvalue.org> User-Agent: Notmuch/0.3.1-43-g5d515b7 (http://notmuchmail.org) Emacs/23.1.50.1 (x86_64-pc-linux-gnu) Date: Mon, 20 Sep 2010 17:09:25 +0200 Message-ID: <87mxrcsb8a.fsf@SSpaeth.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Notmuch developer list 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: Mon, 20 Sep 2010 15:09:39 -0000 On 2010-09-18, Rob Browning wrote: > I've been trying notmuchsync, and it's quite helpful, but I just ran > across something that caused me a bit of concern. I noticed that some > messages were marked deleted that I'm fairly certain I didn't intend to > delete. > > My suspicion is that this is because I received two copies of the > message and I marked one of them for deletion (expiry) in Gnus, but not > the other one. Since notmuch doesn't normally distinguish between two > messages with the same id, I suspected that notmuchsync might not notice > either. Is that possible? Yes, that is certainly possible. notmuchsync checks if a file should be deleted ("pruning") like this: 1)Run notmuchsync --revsync (or -r) and it will examine your mail files. If a mail is trashed (expired) according to maildir flags in its filename, it will add the tag "deleted" to the mail's id in the notmuch database. If you have multiple copies with the same message that tag is now associated with the mail id, not the actual file. 2) Run notmuchsync --prune which runs the query: "tag:delete or tag:deleted or tag:maildir::trashed" by default. To which notmuch returns a list of messages and a corresponding filename for each id. If there are multiple messages with the same id, I think it will return the first filename that was associated with that mail id, so it is kind of random which file location gets returned. The returned file names are associated with the "deleted" tag - and thus - unlinked. I am unsure how to handle this in a better way. What should notmuchsync --prune do if it finds multiple mail files that are associated with a "deleted" tag? And what should --revsync do when it finds a mail file that is marked as expired. As long as notmuch only offers one data entry per mail id, there will remain some ambiguity as to how to handle these. If notmuch gave me at least all filenames that are associated with a mail id, I could introduce a command line option "--prune --safe" which would Sebastian P.S. CC'ing the notmuch list as this is potentially an issue that affects people.