From: Tomi Ollila <tomi.ollila@iki.fi>
To: Jani Nikula <jani@nikula.org>,
Mark Walters <markwalters1009@gmail.com>,
notmuch@notmuchmail.org
Subject: Re: [PATCH 2/2] cli: reset db directory mtime upon directory removal
Date: Sun, 06 Sep 2015 13:00:42 +0300 [thread overview]
Message-ID: <m2egib27g5.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <1441445731-4362-2-git-send-email-jani@nikula.org>
On Sat, Sep 05 2015, Jani Nikula <jani@nikula.org> 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
next prev parent reply other threads:[~2015-09-06 10:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-23 1:08 Weird behaviour in notmuch new Mark Walters
2014-02-23 21:40 ` [PATCH] test: test folder renames Jani Nikula
2014-02-23 23:28 ` Tomi Ollila
2015-09-05 9:35 ` [PATCH 1/2] HACK: " Jani Nikula
2015-09-05 9:35 ` [PATCH 2/2] cli: reset db directory mtime upon directory removal Jani Nikula
2015-09-06 10:00 ` Tomi Ollila [this message]
2015-09-07 12:51 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2egib27g5.fsf@guru.guru-group.fi \
--to=tomi.ollila@iki.fi \
--cc=jani@nikula.org \
--cc=markwalters1009@gmail.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).