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 B0894431FD0 for ; Tue, 23 Aug 2011 23:30:39 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] 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 dZlsIRxGLwQZ for ; Tue, 23 Aug 2011 23:30:38 -0700 (PDT) Received: from taco2.nixu.fi (taco2.nixu.fi [194.197.118.31]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 64EF7431FB6 for ; Tue, 23 Aug 2011 23:30:38 -0700 (PDT) Received: from taco2.nixu.fi (localhost [127.0.0.1]) by taco2.nixu.fi (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p7O6UQBh001017 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 24 Aug 2011 09:30:26 +0300 Received: (from too@localhost) by taco2.nixu.fi (8.14.3/8.14.3/Submit) id p7O6UOLg001010; Wed, 24 Aug 2011 09:30:24 +0300 X-Authentication-Warning: taco2.nixu.fi: too set sender to tomi.ollila@nixu.com using -f From: Tomi Ollila To: James Vasile Subject: Re: [PATCH] Skip dot files in `notmuch new` References: <8762lnwtva.fsf@hackervisions.org> X-Face: HhBM'cA~ (James Vasile's message of "Tue, 23 Aug 2011 20:11:53 -0400") Message-ID: User-Agent: Gnus/5.110014 (No Gnus v0.14) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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: Wed, 24 Aug 2011 06:30:40 -0000 On Wed 24 Aug 2011 03:11, James Vasile 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