From: Tomi Ollila Date: Sun, 6 Sep 2015 10:00:42 +0000 (+0300) Subject: Re: [PATCH 2/2] cli: reset db directory mtime upon directory removal X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fd5a6930c699dd4fb51756707c80c2b84e1ea681;p=notmuch-archives.git Re: [PATCH 2/2] cli: reset db directory mtime upon directory removal --- diff --git a/07/3e2cbc3f93f4e43bb5c2f651526c9493ba4329 b/07/3e2cbc3f93f4e43bb5c2f651526c9493ba4329 new file mode 100644 index 000000000..9aba2b741 --- /dev/null +++ b/07/3e2cbc3f93f4e43bb5c2f651526c9493ba4329 @@ -0,0 +1,106 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id B38856DE1AD8 + for ; Sun, 6 Sep 2015 03:02:10 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: 0.804 +X-Spam-Level: +X-Spam-Status: No, score=0.804 tagged_above=-999 required=5 tests=[AWL=0.152, + SPF_NEUTRAL=0.652] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id R0OPeyntgZSa for ; + Sun, 6 Sep 2015 03:02:08 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by arlo.cworth.org (Postfix) with ESMTP id 667CB6DE143A + for ; Sun, 6 Sep 2015 03:02:08 -0700 (PDT) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id 1718E100033; + Sun, 6 Sep 2015 13:00:42 +0300 (EEST) +From: Tomi Ollila +To: Jani Nikula , Mark Walters , + notmuch@notmuchmail.org +Subject: Re: [PATCH 2/2] cli: reset db directory mtime upon directory removal +In-Reply-To: <1441445731-4362-2-git-send-email-jani@nikula.org> +References: <87siray6th.fsf@qmul.ac.uk> + <1441445731-4362-1-git-send-email-jani@nikula.org> + <1441445731-4362-2-git-send-email-jani@nikula.org> +User-Agent: Notmuch/0.20.2+68~g0c35549 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.18 +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: Sun, 06 Sep 2015 10:02:10 -0000 + +On Sat, Sep 05 2015, Jani Nikula wrote: + +> The library does not have a function to remove a directory document +> for a path. Usually this doesn't matter except for a slight waste of +> space. However, if the same directory gets added to the filesystem +> again, the old directory document is found with the old mtime. Reset +> the directory mtime on removal to avoid problems. +> +> The corner case that can hit this problem is renaming directories back +> and forth. Renaming does not change the mtime of the directory in the +> filesystem, and thus the old db directory document mtime may match the +> fs mtime of the directory. +> +> The long term fix might be to add a library function to remove a +> directory document, however this is a much simpler and faster fix for +> the time being. +> --- + +LGTM. + +Tomi + + +> notmuch-new.c | 9 +++++++++ +> 1 file changed, 9 insertions(+) +> +> diff --git a/notmuch-new.c b/notmuch-new.c +> index 514e06a4d1f3..33645349cd5f 100644 +> --- a/notmuch-new.c +> +++ b/notmuch-new.c +> @@ -878,6 +878,15 @@ _remove_directory (void *ctx, +> goto DONE; +> } +> +> + /* +> + * XXX: The library does not have a function to remove a directory +> + * document for a path. Usually this doesn't matter except for a +> + * slight waste of space. However, if the directory gets added to +> + * the filesystem again, the old directory document is found with +> + * the old mtime. Reset the directory mtime to avoid problems. +> + */ +> + notmuch_directory_set_mtime (directory, 0); +> + +> DONE: +> notmuch_directory_destroy (directory); +> return status; +> -- +> 2.1.4 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch