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