Re: [PATCH v4 04/16] Provide _notmuch_crypto_{set,get}_gpg_path
[notmuch-archives.git] / c8 / 55c29e03fba2e2ab84c36bcaeb673fdce326f6
1 Return-Path: <olly@survex.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id EA81D431FBC\r
6         for <notmuch@notmuchmail.org>; Wed, 23 Dec 2009 00:29:58 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id dZrrw3LWiy6u for <notmuch@notmuchmail.org>;\r
11         Wed, 23 Dec 2009 00:29:58 -0800 (PST)\r
12 Received: from atreus.tartarus.org (atreus.tartarus.org [80.252.125.10])\r
13         by olra.theworths.org (Postfix) with ESMTP id 02ED5431FAE\r
14         for <notmuch@notmuchmail.org>; Wed, 23 Dec 2009 00:29:57 -0800 (PST)\r
15 Received: from olly by atreus.tartarus.org with local (Exim 4.69)\r
16         (envelope-from <olly@survex.com>)\r
17         id 1NNMbU-0001HH-5Q; Wed, 23 Dec 2009 08:29:56 +0000\r
18 Date: Wed, 23 Dec 2009 08:29:56 +0000\r
19 From: Olly Betts <olly@survex.com>\r
20 To: Tomas Carnecky <tom@dbservice.com>\r
21 Message-ID: <20091223082955.GV25129@survex.com>\r
22 References: <1261450617-24616-1-git-send-email-tom@dbservice.com>\r
23         <loom.20091223T000211-724@post.gmane.org>\r
24         <4B31BF51.9030508@dbservice.com>\r
25 MIME-Version: 1.0\r
26 Content-Type: text/plain; charset=us-ascii\r
27 Content-Disposition: inline\r
28 In-Reply-To: <4B31BF51.9030508@dbservice.com>\r
29 User-Agent: Mutt/1.5.18 (2008-05-17)\r
30 X-Mailman-Approved-At: Fri, 25 Dec 2009 12:28:41 -0800\r
31 Cc: notmuch@notmuchmail.org\r
32 Subject: Re: [notmuch] [PATCH] Add post-add and post-tag hooks\r
33 X-BeenThere: notmuch@notmuchmail.org\r
34 X-Mailman-Version: 2.1.12\r
35 Precedence: list\r
36 List-Id: "Use and development of the notmuch mail system."\r
37         <notmuch.notmuchmail.org>\r
38 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
39         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
40 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
41 List-Post: <mailto:notmuch@notmuchmail.org>\r
42 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
43 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
45 X-List-Received-Date: Wed, 23 Dec 2009 08:29:59 -0000\r
46 \r
47 [Sorry, I seemed to manage to attach my reply to the wrong thread...]\r
48 \r
49 On Wed, Dec 23, 2009 at 07:57:21AM +0100, Tomas Carnecky wrote:\r
50 > On 12/23/09 12:02 AM, Olly Betts wrote:\r
51 >> Rather than a platform-specific check, it would be better to check if DT_DIR\r
52 >> is defined.\r
53 >>\r
54 >> Beware that even on Linux (where the d_type field is present), it may always\r
55 >> contain DT_UNKNOWN for some filesystems, so you really should check for that\r
56 >> case and fall back to using stat() instead.\r
57 >\r
58 > Currently configure is a simple shell script and not some autoconf  \r
59 > magic. And I don't know how eager Carl is to use autoconf, scons, cmake  \r
60 > or similar.\r
61 \r
62 No autoconf magic required (or desirable here that I can see) - here's what\r
63 I'm suggesting (untested as written, but Xapian's omega indexer uses an\r
64 approach much like this):\r
65 \r
66 #ifdef DT_UNKNOWN\r
67     /* If d_type is available and supported by the FS, avoid a call to stat. */\r
68     if (entries[i]->d_type == DT_UNKNOWN) {\r
69         /* Fall back to calling stat. */\r
70 #endif\r
71     {\r
72         char pbuf[PATH_MAX];\r
73         snprintf(pbuf, PATH_MAX, "%s/%s", path, entries[i]->d_name);\r
74 \r
75         struct stat buf;\r
76         if (stat(pbuf, &buf) == -1 || !S_ISDIR(buf.st_mode))\r
77             continue;\r
78     }\r
79 #ifdef DT_UNKNOWN\r
80     } else if (entries[i]->d_type != DT_DIR) continue;\r
81 #endif\r
82 \r
83 \r
84 Cheers,\r
85     Olly\r