Re: v4 of DB_RETRY_LOCK patches
[notmuch-archives.git] / 39 / 0a99ac18b45d187c01a3a0b17b8336bfdd402e
1 Return-Path: <m.walters@qmul.ac.uk>\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 5CEC3431FBD\r
6         for <notmuch@notmuchmail.org>; Thu,  2 Feb 2012 14:34:04 -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: -1.098\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
12         tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
13         NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id SvmLn19NLiPK for <notmuch@notmuchmail.org>;\r
17         Thu,  2 Feb 2012 14:34:03 -0800 (PST)\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 0BFD2431FC3\r
22         for <notmuch@notmuchmail.org>; Thu,  2 Feb 2012 14:34:03 -0800 (PST)\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
24         by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
25         (envelope-from <m.walters@qmul.ac.uk>)\r
26         id 1Rt5E9-00016O-3Q; Thu, 02 Feb 2012 22:34:01 +0000\r
27 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]\r
28         helo=localhost)\r
29         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)\r
30         (envelope-from <m.walters@qmul.ac.uk>)\r
31         id 1Rt5E8-00028E-NB; Thu, 02 Feb 2012 22:34:00 +0000\r
32 From: Mark Walters <markwalters1009@gmail.com>\r
33 To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org, amdragon@MIT.EDU\r
34 Subject: Re: [PATCH v4 08/11] cli: Make notmuch-show respect excludes.\r
35 In-Reply-To: <87haz8yjkv.fsf@nikula.org>\r
36 References: <874nv9rv79.fsf@qmul.ac.uk>\r
37         <1328204619-25046-8-git-send-email-markwalters1009@gmail.com>\r
38         <87haz8yjkv.fsf@nikula.org>\r
39 User-Agent: Notmuch/0.11+140~gb5e1cf0 (http://notmuchmail.org) Emacs/23.2.1\r
40         (i486-pc-linux-gnu)\r
41 Date: Thu, 02 Feb 2012 22:35:10 +0000\r
42 Message-ID: <87y5skrhi9.fsf@qmul.ac.uk>\r
43 MIME-Version: 1.0\r
44 Content-Type: text/plain; charset=us-ascii\r
45 X-Sender-Host-Address: 94.192.233.223\r
46 X-QM-SPAM-Info: Sender has good ham record.  :)\r
47 X-QM-Body-MD5: 964dc5039b2910c564494d17395cc3b4 (of first 20000 bytes)\r
48 X-SpamAssassin-Score: -1.8\r
49 X-SpamAssassin-SpamBar: -\r
50 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
51         determine if it is\r
52         spam. We require at least 5.0 points to mark a message as spam.\r
53         This message scored -1.8 points.\r
54         Summary of the scoring: \r
55         * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
56         *      medium trust\r
57         *      [138.37.6.40 listed in list.dnswl.org]\r
58         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
59         provider *      (markwalters1009[at]gmail.com)\r
60         * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
61         *      domain\r
62         *  0.5 AWL AWL: From: address is in the auto white-list\r
63 X-QM-Scan-Virus: ClamAV says the message is clean\r
64 X-BeenThere: notmuch@notmuchmail.org\r
65 X-Mailman-Version: 2.1.13\r
66 Precedence: list\r
67 List-Id: "Use and development of the notmuch mail system."\r
68         <notmuch.notmuchmail.org>\r
69 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
71 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
72 List-Post: <mailto:notmuch@notmuchmail.org>\r
73 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
74 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
75         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
76 X-List-Received-Date: Thu, 02 Feb 2012 22:34:04 -0000\r
77 \r
78 \r
79 On Fri, 03 Feb 2012 00:08:32 +0200, Jani Nikula <jani@nikula.org> wrote:\r
80 > On Thu,  2 Feb 2012 17:43:36 +0000, Mark Walters <markwalters1009@gmail.com> wrote:\r
81 > > This adds the excludes to notmuch-show.c. We do not exclude when only\r
82 > > a single message (or part) is requested. notmuch-show will output the\r
83 > > exclude information when either text or json format is requested. As\r
84 > > this changes the output from notmuch-show it breaks many tests (in a\r
85 > > trivial and expected fashion).\r
86 > > ---\r
87 > >  notmuch-show.c |   24 ++++++++++++++++++++----\r
88 > >  1 files changed, 20 insertions(+), 4 deletions(-)\r
89 > > \r
90 > > diff --git a/notmuch-show.c b/notmuch-show.c\r
91 > > index dec799c..108f13b 100644\r
92 > > --- a/notmuch-show.c\r
93 > > +++ b/notmuch-show.c\r
94 > > @@ -193,10 +193,11 @@ _get_one_line_summary (const void *ctx, notmuch_message_t *message)\r
95 > >  static void\r
96 > >  format_message_text (unused (const void *ctx), notmuch_message_t *message, int indent)\r
97 > >  {\r
98 > > -    printf ("id:%s depth:%d match:%d filename:%s\n",\r
99 > > +    printf ("id:%s depth:%d match:%d excluded:%d filename:%s\n",\r
100 > >         notmuch_message_get_message_id (message),\r
101 > >         indent,\r
102 > > -       notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH),\r
103 > > +       notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH) ? 1 : 0,\r
104 > > +       notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED) ? 1 : 0,\r
105 > >         notmuch_message_get_filename (message));\r
106 > >  }\r
107 > >  \r
108 > > @@ -212,9 +213,10 @@ format_message_json (const void *ctx, notmuch_message_t *message, unused (int in\r
109 > >      date = notmuch_message_get_date (message);\r
110 > >      relative_date = notmuch_time_relative_date (ctx, date);\r
111 > >  \r
112 > > -    printf ("\"id\": %s, \"match\": %s, \"filename\": %s, \"timestamp\": %ld, \"date_relative\": \"%s\", \"tags\": [",\r
113 > > +    printf ("\"id\": %s, \"match\": %s, \"excluded\": %s, \"filename\": %s, \"timestamp\": %ld, \"date_relative\": \"%s\", \"tags\": [",\r
114 > >         json_quote_str (ctx_quote, notmuch_message_get_message_id (message)),\r
115 > >         notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH) ? "true" : "false",\r
116 > > +       notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED) ? "true" : "false",\r
117 > >         json_quote_str (ctx_quote, notmuch_message_get_filename (message)),\r
118 > >         date, relative_date);\r
119 > >  \r
120 > > @@ -1059,9 +1061,13 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
121 > >      char *opt;\r
122 > >      const notmuch_show_format_t *format = &format_text;\r
123 > >      notmuch_show_params_t params;\r
124 > > +    const char **search_exclude_tags;\r
125 > > +    size_t search_exclude_tags_length;\r
126\r
127 > Please move these within the if (!no_exclude) block.\r
128 \r
129 Will do. (I forgot to move them in notmuch-show when doing notmuch-count\r
130 and notmuch-search)\r
131 \r
132 > >      int mbox = 0;\r
133 > >      int format_specified = 0;\r
134 > >      int i;\r
135 > > +    notmuch_bool_t no_exclude = FALSE;\r
136 > > +    unsigned int j;\r
137\r
138 > Same. Or better yet, reuse i.\r
139 \r
140 Will do.\r
141 \r
142 > >      params.entire_thread = 0;\r
143 > >      params.raw = 0;\r
144 > > @@ -1098,6 +1104,8 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
145 > >         params.part = atoi(argv[i] + sizeof ("--part=") - 1);\r
146 > >     } else if (STRNCMP_LITERAL (argv[i], "--entire-thread") == 0) {\r
147 > >         params.entire_thread = 1;\r
148 > > +   } else if (STRNCMP_LITERAL (argv[i], "--no-exclude") == 0) {\r
149 > > +       no_exclude = TRUE;\r
150 > >     } else if ((STRNCMP_LITERAL (argv[i], "--verify") == 0) ||\r
151 > >                (STRNCMP_LITERAL (argv[i], "--decrypt") == 0)) {\r
152 > >         if (params.cryptoctx == NULL) {\r
153 > > @@ -1167,10 +1175,18 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
154 > >      if (params.raw && params.part < 0)\r
155 > >     params.part = 0;\r
156 > >  \r
157 > > +    /* If a single message is requested we do not use search_excludes. */\r
158 > >      if (params.part >= 0)\r
159 > >     return do_show_single (ctx, query, format, &params);\r
160 > > -    else\r
161 > > +    else {\r
162\r
163 > Nitpick: There's no rule about this, but I do like the style of using\r
164 > braces for both branches if either branch needs them.\r
165 \r
166 Will fix.\r
167 \r
168 > > +   if (!no_exclude) {\r
169 > > +       search_exclude_tags = notmuch_config_get_search_exclude_tags\r
170 > > +           (config, &search_exclude_tags_length);\r
171 > > +       for (j = 0; j < search_exclude_tags_length; j++)\r
172 > > +           notmuch_query_add_tag_exclude (query, search_exclude_tags[j]);\r
173 > > +   }\r
174 > >     return do_show (ctx, query, format, &params);\r
175 > > +    }\r
176\r
177 > Hmm, unreachable code below. Why doesn't the compiler complain?\r
178 \r
179 Yes I wondered about that (id:"20120120171801.GA16740@mit.edu"): but didn't think I should do anything about\r
180 that in this series.\r
181 \r
182 Thanks\r
183 \r
184 Mark\r
185 \r