--- /dev/null
+Return-Path: <olly@survex.com>\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 EA81D431FBC\r
+ for <notmuch@notmuchmail.org>; Wed, 23 Dec 2009 00:29:58 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\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 dZrrw3LWiy6u for <notmuch@notmuchmail.org>;\r
+ Wed, 23 Dec 2009 00:29:58 -0800 (PST)\r
+Received: from atreus.tartarus.org (atreus.tartarus.org [80.252.125.10])\r
+ by olra.theworths.org (Postfix) with ESMTP id 02ED5431FAE\r
+ for <notmuch@notmuchmail.org>; Wed, 23 Dec 2009 00:29:57 -0800 (PST)\r
+Received: from olly by atreus.tartarus.org with local (Exim 4.69)\r
+ (envelope-from <olly@survex.com>)\r
+ id 1NNMbU-0001HH-5Q; Wed, 23 Dec 2009 08:29:56 +0000\r
+Date: Wed, 23 Dec 2009 08:29:56 +0000\r
+From: Olly Betts <olly@survex.com>\r
+To: Tomas Carnecky <tom@dbservice.com>\r
+Message-ID: <20091223082955.GV25129@survex.com>\r
+References: <1261450617-24616-1-git-send-email-tom@dbservice.com>\r
+ <loom.20091223T000211-724@post.gmane.org>\r
+ <4B31BF51.9030508@dbservice.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <4B31BF51.9030508@dbservice.com>\r
+User-Agent: Mutt/1.5.18 (2008-05-17)\r
+X-Mailman-Approved-At: Fri, 25 Dec 2009 12:28:41 -0800\r
+Cc: notmuch@notmuchmail.org\r
+Subject: Re: [notmuch] [PATCH] Add post-add and post-tag hooks\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.12\r
+Precedence: list\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: Wed, 23 Dec 2009 08:29:59 -0000\r
+\r
+[Sorry, I seemed to manage to attach my reply to the wrong thread...]\r
+\r
+On Wed, Dec 23, 2009 at 07:57:21AM +0100, Tomas Carnecky wrote:\r
+> On 12/23/09 12:02 AM, Olly Betts wrote:\r
+>> Rather than a platform-specific check, it would be better to check if DT_DIR\r
+>> is defined.\r
+>>\r
+>> Beware that even on Linux (where the d_type field is present), it may always\r
+>> contain DT_UNKNOWN for some filesystems, so you really should check for that\r
+>> case and fall back to using stat() instead.\r
+>\r
+> Currently configure is a simple shell script and not some autoconf \r
+> magic. And I don't know how eager Carl is to use autoconf, scons, cmake \r
+> or similar.\r
+\r
+No autoconf magic required (or desirable here that I can see) - here's what\r
+I'm suggesting (untested as written, but Xapian's omega indexer uses an\r
+approach much like this):\r
+\r
+#ifdef DT_UNKNOWN\r
+ /* If d_type is available and supported by the FS, avoid a call to stat. */\r
+ if (entries[i]->d_type == DT_UNKNOWN) {\r
+ /* Fall back to calling stat. */\r
+#endif\r
+ {\r
+ char pbuf[PATH_MAX];\r
+ snprintf(pbuf, PATH_MAX, "%s/%s", path, entries[i]->d_name);\r
+\r
+ struct stat buf;\r
+ if (stat(pbuf, &buf) == -1 || !S_ISDIR(buf.st_mode))\r
+ continue;\r
+ }\r
+#ifdef DT_UNKNOWN\r
+ } else if (entries[i]->d_type != DT_DIR) continue;\r
+#endif\r
+\r
+\r
+Cheers,\r
+ Olly\r