unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Arvid Picciani <aep@exys.org>
To: notmuch@notmuchmail.org
Subject: Re: indexing mail?
Date: Fri, 15 Jan 2010 08:27:50 +0100	[thread overview]
Message-ID: <87my0frfnt.fsf@exys.org> (raw)
In-Reply-To: <878wbzx3td.wl%djcb@djcbsoftware.nl>

[-- Attachment #1: Type: text/plain, Size: 452 bytes --]

On Fri, 15 Jan 2010 08:47:10 +0200, Dirk-Jan C. Binnema <djcb.bulk@gmail.com> wrote:

> I take a slighly different approach in mu:


works for me, thanks Dirk.  patch against HEAD is attached ( i hope. i'm
new to emacs mail :D )


It takes around half an hour for my 60K mail on reiserfs, but it did take 10 minutes
already on ext4. I suggest having a different approach to feed new mail
in, such as:

for i in (fetchmail)
do
    notmuch new < $i
done

[-- Attachment #2: notmuch_scandir_stat.patch --]
[-- Type: application/octet-stream, Size: 1440 bytes --]

diff --git a/notmuch-new.c b/notmuch-new.c
index 490101d..d8ac4ba 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -119,6 +119,37 @@ is_maildir (struct dirent **entries, int count)
     return 0;
 }
 
+/*
+  add entry->d_type
+ */
+
+ static gboolean
+ _set_dtype (const char* path, struct dirent *entry)
+ {
+     struct stat statbuf;
+     char fullpath[4096];
+
+     snprintf (fullpath, sizeof(fullpath), "%s%c%s",
+           path, G_DIR_SEPARATOR, entry->d_name);
+
+     if (stat (fullpath, &statbuf) != 0) {
+         g_warning ("stat failed on %s: %s", fullpath,
+                strerror(errno));
+         return FALSE;
+     }
+
+     /* we only care about dirs, regular files and links */
+     if (S_ISREG (statbuf.st_mode))
+         entry->d_type = DT_REG;
+     else if (S_ISDIR (statbuf.st_mode))
+         entry->d_type = DT_DIR;
+     else if (S_ISLNK (statbuf.st_mode))
+         entry->d_type = DT_LNK;
+
+     return TRUE;
+ }
+
+
 /* Examine 'path' recursively as follows:
  *
  *   o Ask the filesystem for the mtime of 'path' (fs_mtime)
@@ -186,6 +217,11 @@ add_files_recursive (notmuch_database_t *notmuch,
 	    break;
 
         entry= namelist[i++];
+        /* handle FSs that don't support entry->d_type */
+        if (entry->d_type == DT_UNKNOWN)
+            _set_dtype (path, entry);
+
+
 
 	/* If this directory hasn't been modified since the last
 	 * add_files, then we only need to look further for

  reply	other threads:[~2010-01-15  7:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-14  8:38 indexing mail? Arvid Picciani
2010-01-14 17:13 ` Arvid Picciani
2010-01-14 17:38   ` Adrian Perez de Castro
2010-01-14 22:42     ` Carl Worth
2010-01-15  3:28       ` Olly Betts
2010-01-15  6:47         ` Dirk-Jan C. Binnema
2010-01-15  7:27           ` Arvid Picciani [this message]
2010-01-23  6:09             ` Carl Worth
2010-01-23  6:28               ` Jesse Rosenthal
2010-01-23  9:47                 ` Carl Worth
2010-01-23 14:29               ` Arvid Picciani
2010-01-23 14:34                 ` Arvid Picciani
2010-01-15  7:30           ` Olly Betts
2010-01-15 19:57             ` Dirk-Jan C. Binnema
2010-01-15 20:15               ` Carl Worth
2010-01-15 21:41               ` Olly Betts
2010-01-16 15:20                 ` Dirk-Jan C. Binnema

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=87my0frfnt.fsf@exys.org \
    --to=aep@exys.org \
    --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).