Re: Hi all
[notmuch-archives.git] / 67 / eba2f0055881e2d9466aebeac92ae191f87126
1 Return-Path: <jani@nikula.org>\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 21B13431FC2\r
6         for <notmuch@notmuchmail.org>; Wed,  1 Jan 2014 04:53:37 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id SqWNCn65enow for <notmuch@notmuchmail.org>;\r
16         Wed,  1 Jan 2014 04:53:28 -0800 (PST)\r
17 Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com\r
18  [74.125.83.49])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
19  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
20  AF948431FC0    for <notmuch@notmuchmail.org>; Wed,  1 Jan 2014 04:53:28 -0800\r
21  (PST)\r
22 Received: by mail-ee0-f49.google.com with SMTP id c41so5834449eek.22\r
23         for <notmuch@notmuchmail.org>; Wed, 01 Jan 2014 04:53:27 -0800 (PST)\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
25         d=1e100.net; s=20130820;\r
26         h=x-gm-message-state:from:to:cc:subject:in-reply-to:references\r
27         :user-agent:date:message-id:mime-version:content-type;\r
28         bh=iGyyesHHTOrJIBO9Fade920ByurBe7hOvU44y0IJCww=;\r
29         b=dqFWssk5bpPZAwSgpqqmin1DZpHa2k/hdXVzNOdC7pywWt5Id1WeYx0fNlnXYBAwU4\r
30         6o3BhjK01DUhoHSPG3NsJTtyIXHrfE7qN00N4+MC0Zw+cqyOZ6YaxoiwemUkFr8seM/t\r
31         mfD+AHSGius3pWpdfLb6jvEMfOBWp2o8fxjKWLekclL8ZT/8u7/2InUl2sprtiE6e5jc\r
32         qCh/tKtwxRF26+bb3lGP29/vU47jYa0ujM5wlwVSRzP8/wY+7uWAwH1Da0WACmt4+iqx\r
33         bPXxV/sk9bzXblq5Hf9b7lT+1Z9/Qd277gsWRdioPw+me85PUcuHmYVl2j8sfMqXGjeZ\r
34         wSDA==\r
35 X-Gm-Message-State:\r
36  ALoCoQnu/f+BWKaYlvd4RP+0/Y3K2afcnV6isf3+FEOkEGwdE8BnKBk1BVdWbZqGMKiu1ZHamqfU\r
37 X-Received: by 10.15.44.4 with SMTP id y4mr10917893eev.71.1388580807384;\r
38         Wed, 01 Jan 2014 04:53:27 -0800 (PST)\r
39 Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
40         [88.195.111.91]) by mx.google.com with ESMTPSA id\r
41         a45sm126834149eem.6.2014.01.01.04.53.25 for <multiple recipients>\r
42         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
43         Wed, 01 Jan 2014 04:53:26 -0800 (PST)\r
44 From: Jani Nikula <jani@nikula.org>\r
45 To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
46 Subject: Re: [PATCH] new: Detect dirent.d_type support at configure time\r
47 In-Reply-To: <1385262952-29240-1-git-send-email-amdragon@mit.edu>\r
48 References: <1385262952-29240-1-git-send-email-amdragon@mit.edu>\r
49 User-Agent: Notmuch/0.17~rc2+18~g39a67a6 (http://notmuchmail.org) Emacs/24.3.1\r
50         (x86_64-pc-linux-gnu)\r
51 Date: Wed, 01 Jan 2014 14:53:24 +0200\r
52 Message-ID: <87txdn2797.fsf@nikula.org>\r
53 MIME-Version: 1.0\r
54 Content-Type: text/plain\r
55 Cc: pi-notmuch@pihost.us\r
56 X-BeenThere: notmuch@notmuchmail.org\r
57 X-Mailman-Version: 2.1.13\r
58 Precedence: list\r
59 List-Id: "Use and development of the notmuch mail system."\r
60         <notmuch.notmuchmail.org>\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
64 List-Post: <mailto:notmuch@notmuchmail.org>\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
68 X-List-Received-Date: Wed, 01 Jan 2014 12:53:37 -0000\r
69 \r
70 On Sun, 24 Nov 2013, Austin Clements <amdragon@MIT.EDU> wrote:\r
71 > Support for dirent.d_type is OS-specific.  Previously, we used\r
72 > _DIRENT_HAVE_D_TYPE to detect support for this, but this is apparently\r
73 > a glic-ism (FreeBSD, for example, supports d_type, but does not define\r
74 > this).  Since there's no cross-platform way to detect support for\r
75 > dirent.d_type, detect it using a test compile at configure time.\r
76 > ---\r
77 >  compat/have_d_type.c | 10 ++++++++++\r
78 >  configure            | 16 ++++++++++++++++\r
79 >  notmuch-new.c        |  2 +-\r
80 >  3 files changed, 27 insertions(+), 1 deletion(-)\r
81 >  create mode 100644 compat/have_d_type.c\r
82 >\r
83 > diff --git a/compat/have_d_type.c b/compat/have_d_type.c\r
84 > new file mode 100644\r
85 > index 0000000..9ca6c6e\r
86 > --- /dev/null\r
87 > +++ b/compat/have_d_type.c\r
88 > @@ -0,0 +1,10 @@\r
89 > +#include <dirent.h>\r
90 > +\r
91 > +int main()\r
92 > +{\r
93 > +    struct dirent ent;\r
94 > +\r
95 > +    (void) ent.d_type;\r
96 > +\r
97 > +    return 0;\r
98 > +}\r
99 > diff --git a/configure b/configure\r
100 > index 1a8e939..d2d193c 100755\r
101 > --- a/configure\r
102 > +++ b/configure\r
103 > @@ -557,6 +557,17 @@ else\r
104 >  fi\r
105 >  rm -f compat/have_timegm\r
106 >  \r
107 > +printf "Checking for dirent.d_type... "\r
108 > +if ${CC} -o compat/have_d_type "$srcdir"/compat/have_d_type.c > /dev/null 2>&1\r
109 > +then\r
110 > +    printf "Yes.\n"\r
111 > +    have_d_type="1"\r
112 > +else\r
113 > +    printf "No (will use stat instead).\n"\r
114 > +    have_d_type="0"\r
115 > +fi\r
116 > +rm -f compat/have_d_type\r
117 > +\r
118 >  printf "Checking for standard version of getpwuid_r... "\r
119 >  if ${CC} -o compat/check_getpwuid "$srcdir"/compat/check_getpwuid.c > /dev/null 2>&1\r
120 >  then\r
121 > @@ -745,6 +756,9 @@ HAVE_STRCASESTR = ${have_strcasestr}\r
122 >  # build its own version)\r
123 >  HAVE_STRSEP = ${have_strsep}\r
124 >  \r
125 > +# Whether struct dirent has d_type (if not, then notmuch will use stat)\r
126 > +HAVE_D_TYPE = ${have_d_type}\r
127 > +\r
128 >  # Whether the Xapian version in use supports compaction\r
129 >  HAVE_XAPIAN_COMPACT = ${have_xapian_compact}\r
130 >  \r
131 > @@ -805,6 +819,7 @@ CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)      \\\r
132 >                  \$(VALGRIND_CFLAGS)                                   \\\r
133 >                  -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)                 \\\r
134 >                  -DHAVE_STRSEP=\$(HAVE_STRSEP)                         \\\r
135 > +                -DHAVE_D_TYPE=\$(HAVE_D_TYPE)                         \\\r
136 >                  -DSTD_GETPWUID=\$(STD_GETPWUID)                       \\\r
137 >                  -DSTD_ASCTIME=\$(STD_ASCTIME)                         \\\r
138 >                  -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)\r
139 > @@ -813,6 +828,7 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)    \\\r
140 >                    \$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS)             \\\r
141 >                    -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)               \\\r
142 >                    -DHAVE_STRSEP=\$(HAVE_STRSEP)                       \\\r
143 > +                  -DHAVE_D_TYPE=\$(HAVE_D_TYPE)                       \\\r
144 >                    -DSTD_GETPWUID=\$(STD_GETPWUID)                     \\\r
145 >                    -DSTD_ASCTIME=\$(STD_ASCTIME)                       \\\r
146 >                    -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)\r
147 \r
148 The patch looks good, but the above two hunks no longer apply\r
149 cleanly. Please repost.\r
150 \r
151 BR,\r
152 Jani.\r
153 \r
154 \r
155 \r
156 > diff --git a/notmuch-new.c b/notmuch-new.c\r
157 > index ba05cb4..423e188 100644\r
158 > --- a/notmuch-new.c\r
159 > +++ b/notmuch-new.c\r
160 > @@ -167,7 +167,7 @@ dirent_type (const char *path, const struct dirent *entry)\r
161 >      char *abspath;\r
162 >      int err, saved_errno;\r
163 >  \r
164 > -#ifdef _DIRENT_HAVE_D_TYPE\r
165 > +#if HAVE_D_TYPE\r
166 >      /* Mapping from d_type to stat mode_t.  We omit DT_LNK so that\r
167 >       * we'll fall through to stat and get the real file type. */\r
168 >      static const mode_t modes[] = {\r
169 > -- \r
170 > 1.8.4.rc3\r
171 >\r
172 > _______________________________________________\r
173 > notmuch mailing list\r
174 > notmuch@notmuchmail.org\r
175 > http://notmuchmail.org/mailman/listinfo/notmuch\r