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 9B573431FAF
\r
6 for <notmuch@notmuchmail.org>; Sat, 8 Dec 2012 11:35:49 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 vIiosUdeA9g2 for <notmuch@notmuchmail.org>;
\r
16 Sat, 8 Dec 2012 11:35:48 -0800 (PST)
\r
17 Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com
\r
18 [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 1221A431FAE
\r
21 for <notmuch@notmuchmail.org>; Sat, 8 Dec 2012 11:35:47 -0800 (PST)
\r
22 Received: by mail-lb0-f181.google.com with SMTP id ge1so1241914lbb.26
\r
23 for <notmuch@notmuchmail.org>; Sat, 08 Dec 2012 11:35:46 -0800 (PST)
\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
25 d=google.com; s=20120113;
\r
26 h=from:to:subject:in-reply-to:references:user-agent:date:message-id
\r
27 :mime-version:content-type:x-gm-message-state;
\r
28 bh=HR+sczVi1lq6vUSy8foHcQys7b+NBNhuMZxMC8b/wqs=;
\r
29 b=QfdGh8/lMnS7TAOe54uOnIO0iH+AEdZUniLHyyzEWQMA19cES7unwvTEpTd7j62yf4
\r
30 UGPFrmCmew7eFku8jR3UpzTje5XbRY969rrD17rPGSv9Z9553WNv0mxipa50AXSox9wn
\r
31 SrtPGjtQTARs7C+xsZMO1OBp9aYCys3s3hyiISmYxo5cdowDQ+DD5ZKyB0kHuorIQXAt
\r
32 MeTJLsMTzkMPQeHbH+d/alKVRPrP7zYhW1OIaszEbVYOXtkFkbnIhhx917TDAWtq8dMh
\r
33 tnMeJ3IM/BJ61EgtOauUjKUM6ZRdaMrkHveo04bvytXUqM2xsKo7t3R6O0LIrs2MtKpG
\r
35 Received: by 10.152.125.237 with SMTP id mt13mr9003084lab.45.1354995346438;
\r
36 Sat, 08 Dec 2012 11:35:46 -0800 (PST)
\r
37 Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi.
\r
39 by mx.google.com with ESMTPS id ps11sm5935164lab.12.2012.12.08.11.35.44
\r
40 (version=SSLv3 cipher=OTHER); Sat, 08 Dec 2012 11:35:45 -0800 (PST)
\r
41 From: Jani Nikula <jani@nikula.org>
\r
42 To: david@tethera.net, notmuch@notmuchmail.org
\r
43 Subject: Re: v4 of Hex Dump/Restore patches
\r
44 In-Reply-To: <1354979276-20099-1-git-send-email-david@tethera.net>
\r
45 References: <1354979276-20099-1-git-send-email-david@tethera.net>
\r
46 User-Agent: Notmuch/0.14+138~g7041c56 (http://notmuchmail.org) Emacs/23.4.1
\r
48 Date: Sat, 08 Dec 2012 21:35:43 +0200
\r
49 Message-ID: <87y5h8pca8.fsf@nikula.org>
\r
51 Content-Type: text/plain; charset=us-ascii
\r
53 ALoCoQmK4hBrrlKGO7eUDs2mXN7elrVXQ0DmoXl262pYY3zx2npg8s8uHQkMHWfYDQDFZehmtI2g
\r
54 X-BeenThere: notmuch@notmuchmail.org
\r
55 X-Mailman-Version: 2.1.13
\r
57 List-Id: "Use and development of the notmuch mail system."
\r
58 <notmuch.notmuchmail.org>
\r
59 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
61 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
62 List-Post: <mailto:notmuch@notmuchmail.org>
\r
63 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
64 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
65 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
66 X-List-Received-Date: Sat, 08 Dec 2012 19:35:49 -0000
\r
69 Hi David, some minor bikeshedding in patch 4 (can be fixed later too),
\r
70 and did not look at patches 7, 8, or 9, but otherwise the series LGTM.
\r
76 On Sat, 08 Dec 2012, david@tethera.net wrote:
\r
77 > This obsoletes the series at
\r
79 > id:1354843607-17980-1-git-send-email-david@tethera.net
\r
83 > [Patch v4 08/10] test/dump-restore: add test for warning/error
\r
85 > Other changes since the last series are as follows:
\r
87 > commit 16ca0f8126fafd49266ffa02534f2e9b73c03027
\r
88 > Author: David Bremner <bremner@debian.org>
\r
89 > Date: Fri Dec 7 20:19:21 2012 -0400
\r
91 > fixup for test/dump-restore
\r
93 > diff --git a/test/dump-restore b/test/dump-restore
\r
94 > index 2532cbb..b267792 100755
\r
95 > --- a/test/dump-restore
\r
96 > +++ b/test/dump-restore
\r
97 > @@ -212,7 +212,7 @@ test_expect_equal_file EXPECTED OUTPUT
\r
99 > test_begin_subtest 'roundtripping random message-ids and tags'
\r
101 > - ${TEST_DIRECTORY}/random-corpus --config-path=${NOTMUCH_CONFIG}
\r
102 > + ${TEST_DIRECTORY}/random-corpus --config-path=${NOTMUCH_CONFIG} \
\r
103 > --num-messages=100
\r
105 > notmuch dump --format=batch-tag| \
\r
107 > commit 9d864bd724bd2d2b26b5d52e3e2f28b4fff2046f
\r
108 > Author: David Bremner <bremner@debian.org>
\r
109 > Date: Fri Dec 7 20:32:50 2012 -0400
\r
111 > fixup for tag-util.c: put * in right palce
\r
113 > diff --git a/tag-util.h b/tag-util.h
\r
114 > index df05d72..6674674 100644
\r
117 > @@ -62,8 +62,8 @@ parse_tag_line (void *ctx, char *line,
\r
118 > * ctx is passed to talloc
\r
122 > -*tag_op_list_create (void *ctx);
\r
124 > +tag_op_list_create (void *ctx);
\r
127 > * Add a tag operation (delete iff remove == TRUE) to a list.
\r
129 > commit d2cead797981e8992849e1d96ad95177b42290e2
\r
130 > Author: David Bremner <bremner@debian.org>
\r
131 > Date: Fri Dec 7 20:57:52 2012 -0400
\r
133 > fixup for id:87txrxxyzp.fsf@nikula.org
\r
135 > diff --git a/tag-util.c b/tag-util.c
\r
136 > index 3d54e9e..a927363 100644
\r
139 > @@ -24,9 +24,15 @@ parse_tag_line (void *ctx, char *line,
\r
141 > char *tok = line;
\r
142 > size_t tok_len = 0;
\r
143 > - char *line_for_error = talloc_strdup (ctx, line);
\r
144 > + char *line_for_error;
\r
147 > + line_for_error = talloc_strdup (ctx, line);
\r
148 > + if (line_for_error == NULL) {
\r
149 > + fprintf (stderr, "Error: out of memory\n");
\r
153 > chomp_newline (line);
\r
155 > /* remove leading space */
\r
156 > @@ -58,7 +64,7 @@ parse_tag_line (void *ctx, char *line,
\r
158 > /* If tag is terminated by NUL, there's no query string. */
\r
159 > if (*(tok + tok_len) == '\0') {
\r
160 > - fprintf (stderr, "no query string: %s\n", line_for_error);
\r
161 > + fprintf (stderr, "Warning: no query string: %s\n", line_for_error);
\r
165 > @@ -71,19 +77,21 @@ parse_tag_line (void *ctx, char *line,
\r
167 > /* Maybe refuse empty tags. */
\r
168 > if (! (flags & TAG_FLAG_BE_GENEROUS) && *tag == '\0') {
\r
169 > - fprintf (stderr, "Error: empty tag: %s\n", line_for_error);
\r
170 > + fprintf (stderr, "Warning: empty tag: %s\n", line_for_error);
\r
175 > /* Decode tag. */
\r
176 > if (hex_decode_inplace (tag) != HEX_SUCCESS) {
\r
177 > - fprintf (stderr, "Hex decoding of tag %s failed\n",
\r
178 > + fprintf (stderr, "Warning: Hex decoding of tag %s failed\n",
\r
184 > if (tag_op_list_append (ctx, tag_ops, tag, remove)) {
\r
185 > + /* diagnostics already printed */
\r
189 > @@ -98,7 +106,7 @@ parse_tag_line (void *ctx, char *line,
\r
191 > /* tok now points to the query string */
\r
192 > if (hex_decode_inplace (tok) != HEX_SUCCESS) {
\r
193 > - fprintf (stderr, "Hex decoding of query %s failed\n",
\r
194 > + fprintf (stderr, "Warning: Hex decoding of query %s failed\n",
\r
199 > commit 162c20ab6d9b9eef56cb2b966a7144a61557eade
\r
200 > Author: David Bremner <bremner@debian.org>
\r
201 > Date: Sat Dec 8 07:29:56 2012 -0400
\r
203 > fixup for id:87624chmfw.fsf@qmul.ac.uk
\r
207 > diff --git a/util/string-util.h b/util/string-util.h
\r
208 > index 696da40..ac7676c 100644
\r
209 > --- a/util/string-util.h
\r
210 > +++ b/util/string-util.h
\r
213 > #include <string.h>
\r
215 > -/* like strtok(3), but without state, and doesn't modify s. usage pattern:
\r
216 > +/* like strtok(3), but without state, and doesn't modify s. Return
\r
217 > + * value is indicated by pointer and length, not null terminator.
\r
219 > + * Usage pattern:
\r
221 > * const char *tok = input;
\r
222 > * const char *delim = " \t";
\r
224 > commit 590adeec072f235861154b930bfb10bedbe37e8a
\r
225 > Author: David Bremner <bremner@debian.org>
\r
226 > Date: Sat Dec 8 07:42:44 2012 -0400
\r
228 > fixup for id:8738zghl6d.fsf@qmul.ac.uk
\r
230 > diff --git a/tag-util.c b/tag-util.c
\r
231 > index a927363..c97d240 100644
\r
234 > @@ -98,8 +98,6 @@ parse_tag_line (void *ctx, char *line,
\r
237 > if (tok == NULL) {
\r
238 > - fprintf (stderr, "Warning: Ignoring invalid input line: %s\n",
\r
239 > - line_for_error);
\r
243 > @@ -113,7 +111,13 @@ parse_tag_line (void *ctx, char *line,
\r
246 > *query_string = tok;
\r
250 > + fprintf (stderr, "% invalid input line %s\n",
\r
251 > + ret == 1 ? "Warning: Ignoring" : "Error: Failing at",
\r
252 > + line_for_error);
\r
254 > talloc_free (line_for_error);
\r
258 > commit 6002e08eb048612f5ef4eab3205a2887e1ab3f02
\r
259 > Author: David Bremner <bremner@debian.org>
\r
260 > Date: Sat Dec 8 07:46:39 2012 -0400
\r
262 > fixup: chomp line before copy
\r
264 > diff --git a/tag-util.c b/tag-util.c
\r
265 > index c97d240..8e6b1ef 100644
\r
268 > @@ -27,14 +27,14 @@ parse_tag_line (void *ctx, char *line,
\r
269 > char *line_for_error;
\r
272 > + chomp_newline (line);
\r
274 > line_for_error = talloc_strdup (ctx, line);
\r
275 > if (line_for_error == NULL) {
\r
276 > fprintf (stderr, "Error: out of memory\n");
\r
280 > - chomp_newline (line);
\r
282 > /* remove leading space */
\r
283 > while (*tok == ' ' || *tok == '\t')
\r
286 > commit 9c4878bf0ad0e1f60a45c963998a20635fc234af
\r
287 > Author: David Bremner <bremner@debian.org>
\r
288 > Date: Sat Dec 8 08:36:48 2012 -0400
\r
290 > further fixup for error messages
\r
292 > diff --git a/tag-util.c b/tag-util.c
\r
293 > index 8e6b1ef..6018d49 100644
\r
296 > @@ -41,7 +41,7 @@ parse_tag_line (void *ctx, char *line,
\r
298 > /* Skip empty and comment lines. */
\r
299 > if (*tok == '\0' || *tok == '#') {
\r
305 > @@ -55,6 +55,8 @@ parse_tag_line (void *ctx, char *line,
\r
306 > /* Optional explicit end of tags marker. */
\r
307 > if (tok_len == 2 && strncmp (tok, "--", tok_len) == 0) {
\r
308 > tok = strtok_len (tok + tok_len, " ", &tok_len);
\r
309 > + if (tok == NULL)
\r
310 > + fprintf (stderr, "Warning: no query string: %s\n", line_for_error);
\r
314 > @@ -113,8 +115,8 @@ parse_tag_line (void *ctx, char *line,
\r
315 > *query_string = tok;
\r
319 > - fprintf (stderr, "% invalid input line %s\n",
\r
320 > + if ((ret % 2) != 0)
\r
321 > + fprintf (stderr, "%s invalid input line %s\n",
\r
322 > ret == 1 ? "Warning: Ignoring" : "Error: Failing at",
\r
325 > diff --git a/tag-util.h b/tag-util.h
\r
326 > index 6674674..1d564f0 100644
\r
329 > @@ -45,7 +45,10 @@ typedef enum {
\r
330 > * Leading and trailing space ' ' is ignored. Empty lines and lines
\r
331 > * beginning with '#' are ignored.
\r
333 > - * Returns: 0 for OK, 1 for skipped line, -1 for fatal(ish) error.
\r
334 > + * Returns: 0 OK,
\r
335 > + * 1 skipped (invalid) line
\r
336 > + * 2 skipped (valid)
\r
337 > + * -1 fatal(ish) error.
\r
339 > * Output Parameters:
\r
340 > * ops contains a list of tag operations
\r
342 > commit 6e8a7b30e3980f77724d6005292265d49ad5241a
\r
343 > Author: David Bremner <bremner@debian.org>
\r
344 > Date: Sat Dec 8 08:41:01 2012 -0400
\r
346 > fixup for id:87wqwsg46p.fsf@qmul.ac.uk
\r
348 > diff --git a/notmuch-restore.c b/notmuch-restore.c
\r
349 > index ceec2d3..44bf88d 100644
\r
350 > --- a/notmuch-restore.c
\r
351 > +++ b/notmuch-restore.c
\r
352 > @@ -56,6 +56,11 @@ tag_message (unused (void *ctx),
\r
356 > +/* Sup dump output is one line per message. We match a sequence of
\r
357 > + * non-space characters for the message-id, then one or more
\r
358 > + * spaces, then a list of space-separated tags as a sequence of
\r
359 > + * characters within literal '(' and ')'. */
\r
362 > parse_sup_line (void *ctx, char *line,
\r
363 > char **query_str, tag_op_list_t *tag_ops)
\r
364 > @@ -172,11 +177,6 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[])
\r
365 > argv[opt_index]);
\r
369 > - /* Dump output is one line per message. We match a sequence of
\r
370 > - * non-space characters for the message-id, then one or more
\r
371 > - * spaces, then a list of space-separated tags as a sequence of
\r
372 > - * characters within literal '(' and ')'. */
\r
375 > line_len = getline (&line, &line_size, input);
\r
377 > commit ee198b0d388243f0f43fab1d7ef7acbea5bdb3e6
\r
378 > Author: David Bremner <bremner@debian.org>
\r
379 > Date: Sat Dec 8 08:52:51 2012 -0400
\r
381 > fixup: rewrite confusing for loop as while.
\r
383 > diff --git a/tag-util.c b/tag-util.c
\r
384 > index 6018d49..b68ea50 100644
\r
387 > @@ -157,8 +157,10 @@ makes_changes (notmuch_message_t *message,
\r
388 > const char *cur_tag = notmuch_tags_get (tags);
\r
389 > int last_op = (flags & TAG_FLAG_REMOVE_ALL) ? -1 : 0;
\r
391 > - /* slight contortions to count down with an unsigned index */
\r
392 > - for (i = list->count; i-- > 0; /*nothing*/) {
\r
393 > + /* scan backwards to get last operation */
\r
394 > + i = list->count;
\r
395 > + while (i > 0) {
\r
397 > if (strcmp (cur_tag, list->ops[i].tag) == 0) {
\r
398 > last_op = list->ops[i].remove ? -1 : 1;
\r
400 > _______________________________________________
\r
401 > notmuch mailing list
\r
402 > notmuch@notmuchmail.org
\r
403 > http://notmuchmail.org/mailman/listinfo/notmuch
\r