unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] Skip dot files in `notmuch new`
@ 2011-08-24  0:11 James Vasile
  2011-08-24  6:30 ` Tomi Ollila
  2011-09-02  0:52 ` Tom Prince
  0 siblings, 2 replies; 4+ messages in thread
From: James Vasile @ 2011-08-24  0:11 UTC (permalink / raw)
  To: notmuch

No known mail client or fetch tool stores mail in dot files, because
files that start with '.' are usually used to store metadata
(i.e. state or configuration) as opposed to subject-matter data.

Some mail fetch tools (including mbsync) and clients use dot files in
maildirs to store metadata.  Notmuch should not warn that it is
ignoring these files, since it *should* ignore them.  Indeed, it
should ignore all dot files.
---
 notmuch-new.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/notmuch-new.c b/notmuch-new.c
index 7d17793..87ee07e 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -428,6 +428,10 @@ add_files_recursive (notmuch_database_t *notmuch,
 	    continue;
 	}
 
+	/* Don't add dot files. */
+	if (entry->d_name[0] == '.')
+	    continue;
+
 	/* We're now looking at a regular file that doesn't yet exist
 	 * in the database, so add it. */
 	next = talloc_asprintf (notmuch, "%s/%s", path, entry->d_name);
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Skip dot files in `notmuch new`
  2011-08-24  0:11 [PATCH] Skip dot files in `notmuch new` James Vasile
@ 2011-08-24  6:30 ` Tomi Ollila
  2011-09-02  0:52 ` Tom Prince
  1 sibling, 0 replies; 4+ messages in thread
From: Tomi Ollila @ 2011-08-24  6:30 UTC (permalink / raw)
  To: James Vasile; +Cc: notmuch

On Wed 24 Aug 2011 03:11, James Vasile <james@hackervisions.org> writes:

> No known mail client or fetch tool stores mail in dot files, because
> files that start with '.' are usually used to store metadata
> (i.e. state or configuration) as opposed to subject-matter data.
>
> Some mail fetch tools (including mbsync) and clients use dot files in
> maildirs to store metadata.  Notmuch should not warn that it is
> ignoring these files, since it *should* ignore them.  Indeed, it
> should ignore all dot files.
> ---
>  notmuch-new.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/notmuch-new.c b/notmuch-new.c
> index 7d17793..87ee07e 100644
> --- a/notmuch-new.c
> +++ b/notmuch-new.c
> @@ -428,6 +428,10 @@ add_files_recursive (notmuch_database_t *notmuch,
>  	    continue;
>  	}
>  
> +	/* Don't add dot files. */
> +	if (entry->d_name[0] == '.')
> +	    continue;
> +
>  	/* We're now looking at a regular file that doesn't yet exist
>  	 * in the database, so add it. */
>  	next = talloc_asprintf (notmuch, "%s/%s", path, entry->d_name);
> -- 
> 1.7.5.4

yesterday, when I was checking code for something else I was thinking
the same issue: Instead of the above the code sections:

        /* XXX: Eventually we'll want more sophistication to let the
         * user specify files to be ignored. */
        if (strcmp (entry->d_name, ".") == 0 ||
            strcmp (entry->d_name, "..") == 0 ||
            (is_maildir && strcmp (entry->d_name, "tmp") == 0) ||
            strcmp (entry->d_name, ".notmuch") ==0)
        {
            continue;
        }

and
        /* XXX: Eventually we'll want more sophistication to let the
         * user specify files to be ignored. */
        if (strcmp (entry->d_name, ".") == 0 ||
            strcmp (entry->d_name, "..") == 0 ||
            strcmp (entry->d_name, ".notmuch") == 0)
        {
            continue;
        }

Could be simplified to check just starting dot (.) (and tmp
in add_files_recursive() in case of is_maildir). Maybe
the count_files() function (the latter one above) should
also do the same check so that the numbers count_files()
and add_files() are (almost the) same, causing less confusion
to the user.

I personally don't want to *exclude* more -- I was planning
to hack in code that only include a list of directories under
top level 'db_path'. 


Tomi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Skip dot files in `notmuch new`
  2011-08-24  0:11 [PATCH] Skip dot files in `notmuch new` James Vasile
  2011-08-24  6:30 ` Tomi Ollila
@ 2011-09-02  0:52 ` Tom Prince
  2011-09-02  5:40   ` Tomi Ollila
  1 sibling, 1 reply; 4+ messages in thread
From: Tom Prince @ 2011-09-02  0:52 UTC (permalink / raw)
  To: James Vasile, notmuch

On Tue, 23 Aug 2011 20:11:53 -0400, James Vasile <james@hackervisions.org> wrote:
> No known mail client or fetch tool stores mail in dot files, because
> files that start with '.' are usually used to store metadata
> (i.e. state or configuration) as opposed to subject-matter data.

Dovecot stores folders in directories starting with . though.

  Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Skip dot files in `notmuch new`
  2011-09-02  0:52 ` Tom Prince
@ 2011-09-02  5:40   ` Tomi Ollila
  0 siblings, 0 replies; 4+ messages in thread
From: Tomi Ollila @ 2011-09-02  5:40 UTC (permalink / raw)
  To: Tom Prince; +Cc: notmuch

On Fri 02 Sep 2011 03:52, Tom Prince <tom.prince@ualberta.net> writes:

> On Tue, 23 Aug 2011 20:11:53 -0400, James Vasile <james@hackervisions.org> wrote:
>> No known mail client or fetch tool stores mail in dot files, because
>> files that start with '.' are usually used to store metadata
>> (i.e. state or configuration) as opposed to subject-matter data.
>
> Dovecot stores folders in directories starting with . though.

Just yesterday on irc I saw someone using ~/.mail/.sent/ though.

>   Tom

Tomi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-09-02  5:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-24  0:11 [PATCH] Skip dot files in `notmuch new` James Vasile
2011-08-24  6:30 ` Tomi Ollila
2011-09-02  0:52 ` Tom Prince
2011-09-02  5:40   ` Tomi Ollila

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).