Re: [notmuch] indexing mail?
authorDirk-Jan C. Binnema <djcb.bulk@gmail.com>
Fri, 15 Jan 2010 06:47:10 +0000 (08:47 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:35:59 +0000 (09:35 -0800)
3d/91600ae081bb93c3b6fc66287dd27eefa5891b [new file with mode: 0644]

diff --git a/3d/91600ae081bb93c3b6fc66287dd27eefa5891b b/3d/91600ae081bb93c3b6fc66287dd27eefa5891b
new file mode 100644 (file)
index 0000000..bc3b227
--- /dev/null
@@ -0,0 +1,131 @@
+Return-Path: <djcb@djcbsoftware.nl>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 77669431FBC\r
+       for <notmuch@notmuchmail.org>; Thu, 14 Jan 2010 22:47:18 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 1.595\r
+X-Spam-Level: *\r
+X-Spam-Status: No, score=1.595 tagged_above=-999 required=5 tests=[AWL=1.594, \r
+       BAYES_50=0.001] autolearn=ham\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id czkBgf612ibv for <notmuch@notmuchmail.org>;\r
+       Thu, 14 Jan 2010 22:47:15 -0800 (PST)\r
+Received: from gw01.mail.saunalahti.fi (gw01.mail.saunalahti.fi\r
+       [195.197.172.115])\r
+       by olra.theworths.org (Postfix) with ESMTP id 7CEFF431FAE\r
+       for <notmuch@notmuchmail.org>; Thu, 14 Jan 2010 22:47:15 -0800 (PST)\r
+Received: from djcbsoftware.nl (a88-114-93-212.elisa-laajakaista.fi\r
+       [88.114.93.212])\r
+       (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by gw01.mail.saunalahti.fi (Postfix) with ESMTP id 30069151707;\r
+       Fri, 15 Jan 2010 08:47:11 +0200 (EET)\r
+Received: from cthulhu.mindcrime.djcbsoftware.nl (localhost [127.0.0.1])\r
+       by djcbsoftware.nl (Postfix) with ESMTP id 81841456098;\r
+       Fri, 15 Jan 2010 08:47:10 +0200 (EET)\r
+Date: Fri, 15 Jan 2010 08:47:10 +0200\r
+Message-ID: <878wbzx3td.wl%djcb@djcbsoftware.nl>\r
+From: Dirk-Jan C. Binnema <djcb.bulk@gmail.com>\r
+To: Olly Betts <olly@survex.com>\r
+In-Reply-To: <slrnhkvo6d.2rf.olly@msgid.survex.com>\r
+References: <4B4ED7E8.20501@exys.org> <878wc0623y.fsf@exys.org>\r
+       <20100114183854.1d04f111@hikari>\r
+       <87fx68e2am.fsf@yoom.home.cworth.org>\r
+       <slrnhkvo6d.2rf.olly@msgid.survex.com>\r
+Mail-Reply-To: djcb@djcbsoftware.nl\r
+User-Agent: Wanderlust/2.15.6 (Almost Unreal) Emacs/23.1 Mule/6.0\r
+       (HANACHIRUSATO)\r
+Organization: DJCBSoftware\r
+MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka")\r
+Content-Type: text/plain; charset=US-ASCII\r
+Cc: notmuch@notmuchmail.org\r
+Subject: Re: [notmuch] indexing mail?\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+Reply-To: djcb@djcbsoftware.nl\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 15 Jan 2010 06:47:18 -0000\r
+\r
+>>>>> "Olly" == Olly Betts <olly@survex.com> writes:\r
+\r
+    Olly> On 2010-01-14, Carl Worth wrote:\r
+    >> On Thu, 14 Jan 2010 18:38:54 +0100, Adrian Perez de Castro <aperez@igalia.com> wrote:\r
+    >>> I am using XFS, which always returns DT_UNKNOWN. Taking into account that\r
+    >>> there is a good deal of people using filesystems other than the ones you\r
+    >>> mention, and that other non-linux filesystems may also return DT_UNKNOWN,\r
+    >>> in my opinion there should be a fall-back. I will try to post a patch\r
+    >>> Anytime Soon=E2=84=A2.\r
+    >> \r
+    >> We definitely want the fallback. I can attempt to code it, but I don't\r
+    >> have ready access to an afflicted filesystem, so I'd need help testing\r
+    >> anyway.\r
+    >> \r
+    >> I'd love to see a patch for this bug soon. Be sure to CC me when the\r
+    >> patch is sent and that will help me commit it sooner.\r
+\r
+    Olly> Not a full patch, but I already posted what this code should look like\r
+    Olly> to handle both systems without d_type, and those which return DT_UNKNOWN:\r
+\r
+    Olly> http://article.gmane.org/gmane.mail.notmuch.general/1044\r
+\r
+I take a slighly different approach in mu:\r
+\r
+/* if the file system does not support entry->d_type, we add it ourselves\r
+ * this is slower (extra stat) but at least it works\r
+ */\r
+static gboolean\r
+_set_dtype (const char* path, struct dirent *entry)\r
+{\r
+       struct stat statbuf;\r
+       char fullpath[4096];\r
+       \r
+       snprintf (fullpath, sizeof(fullpath), "%s%c%s",\r
+                 path, G_DIR_SEPARATOR, entry->d_name);\r
+\r
+       if (stat (fullpath, &statbuf) != 0) {\r
+               g_warning ("stat failed on %s: %s", fullpath,\r
+                          strerror(errno));\r
+               return FALSE;\r
+       }\r
+\r
+       /* we only care about dirs, regular files and links */\r
+       if (S_ISREG (statbuf.st_mode))\r
+               entry->d_type = DT_REG;\r
+       else if (S_ISDIR (statbuf.st_mode))\r
+               entry->d_type = DT_DIR;\r
+       else if (S_ISLNK (statbuf.st_mode))\r
+               entry->d_type = DT_LNK;\r
+       \r
+       return TRUE;\r
+}\r
+\r
+\r
+and then in some other places:\r
+\r
+/* handle FSs that don't support entry->d_type */\r
+if (entry->d_type == DT_UNKNOWN) \r
+       _set_dtype (dirname, entry);\r
+\r
+       \r
+Note, that is untested as of yet.\r
+\r
+Best wishes,\r
+Dirk.\r
+\r
+-- \r
+Dirk-Jan C. Binnema                  Helsinki, Finland\r
+e:djcb@djcbsoftware.nl           w:www.djcbsoftware.nl\r
+pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C\r