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 2CFAB429E21 for ; Sat, 5 Nov 2011 10:26:06 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.699 X-Spam-Level: X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 YxDwd9dxHKuI for ; Sat, 5 Nov 2011 10:26:05 -0700 (PDT) Received: from mail-gx0-f181.google.com (mail-gx0-f181.google.com [209.85.161.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 755D1431FB6 for ; Sat, 5 Nov 2011 10:26:05 -0700 (PDT) Received: by ggdk6 with SMTP id k6so734362ggd.26 for ; Sat, 05 Nov 2011 10:26:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=7xCLuJCB3Ry9FYtSJElz5LFLySWriLHVVqNltD5+nsY=; b=gg0rSfFJNeNu6pI7o9P+QIzJ4SvXU83Oup0Dh2icV08ezIep31fxGZwNoCCn5EAmoO luFNTDGg94eN6Z6TDwJYvGUzuCKmn9piYS9tDeL+9phtg01g6AnMJU629CBnmCnxC5dS k2NU7nXltj4rQZ0F35hKb/V2mPVPyKbm62xpw= MIME-Version: 1.0 Received: by 10.50.156.230 with SMTP id wh6mr23689683igb.17.1320513963638; Sat, 05 Nov 2011 10:26:03 -0700 (PDT) Sender: amdragon@gmail.com Received: by 10.143.166.17 with HTTP; Sat, 5 Nov 2011 10:26:03 -0700 (PDT) In-Reply-To: <1317338806-7414-1-git-send-email-thomas@schwinge.name> References: <1317338806-7414-1-git-send-email-thomas@schwinge.name> Date: Sat, 5 Nov 2011 13:26:03 -0400 X-Google-Sender-Auth: 9IOARzWfc5xQOr6jmZXl-M1MfM0 Message-ID: Subject: Re: [PATCH] Repeatability when copying a whole directory into a new one. From: Austin Clements To: Thomas Schwinge Content-Type: text/plain; charset=ISO-8859-1 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: Sat, 05 Nov 2011 17:26:06 -0000 On Thu, Sep 29, 2011 at 7:26 PM, Thomas Schwinge wrote: > This new test currently fails -- but it shouldn't. > --- > > Hi! > > I found this while manually copying directories and running notmuch new. > > Am I just too sleepy at this time, or is it another DB vs. directory > mtime issue? Nice catch. I haven't verified this, but I believe the problem is that notmuch never deletes directory documents. In fact, there isn't even an API to do so. Even though it detects the deleted directory and deletes all messages under it, the directory document sticks around. When the directory comes back, notmuch finds the old directory document with the old directory mtime and thinks it doesn't have to rescan the directory because the cp -a reproduced the same mtime the directory used to have. So, I guess part of the answer is "don't cp -a" because that mucks with mtimes and mtimes are all notmuch has to go by. But that's no excuse for not removing the directory documents when the directory is removed. Fixing this is slightly tricky. I feel like there *shouldn't* be an API to simply remove a directory document because that would let you violate database consistency. Instead, I think the API should recursively remove everything under the removed directory, exactly like what notmuch-new.c:_remove_directory does right now (plus removing the directory documents). But _remove_directory depends on remove_filename, which currently has notmuch-new-specific logic in it. I feel like there must be a nice solution to this, and I'm just not thinking of it.