1 Return-Path: <bremner@tethera.net>
\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 01AC3431FBF
\r
6 for <notmuch@notmuchmail.org>; Sat, 8 Dec 2012 07:08:13 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 sR+Ca-s+JqAZ for <notmuch@notmuchmail.org>;
\r
16 Sat, 8 Dec 2012 07:08:11 -0800 (PST)
\r
17 Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238])
\r
18 (using TLSv1 with cipher AES256-SHA (256/256 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 2117F431FAE
\r
21 for <notmuch@notmuchmail.org>; Sat, 8 Dec 2012 07:08:11 -0800 (PST)
\r
22 Received: from fctnnbsc30w-142167090129.dhcp-dynamic.fibreop.nb.bellaliant.net
\r
23 ([142.167.90.129] helo=zancas.localnet)
\r
24 by tesseract.cs.unb.ca with esmtpsa
\r
25 (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72)
\r
26 (envelope-from <bremner@tethera.net>) id 1ThM0f-0005dJ-AC
\r
27 for notmuch@notmuchmail.org; Sat, 08 Dec 2012 11:08:10 -0400
\r
28 Received: from bremner by zancas.localnet with local (Exim 4.80)
\r
29 (envelope-from <bremner@tethera.net>) id 1ThM0Z-0005GY-Nn
\r
30 for notmuch@notmuchmail.org; Sat, 08 Dec 2012 11:08:03 -0400
\r
31 From: david@tethera.net
\r
32 To: notmuch@notmuchmail.org
\r
33 Subject: v4 of Hex Dump/Restore patches
\r
34 Date: Sat, 8 Dec 2012 11:07:46 -0400
\r
35 Message-Id: <1354979276-20099-1-git-send-email-david@tethera.net>
\r
36 X-Mailer: git-send-email 1.7.10.4
\r
38 X-BeenThere: notmuch@notmuchmail.org
\r
39 X-Mailman-Version: 2.1.13
\r
41 List-Id: "Use and development of the notmuch mail system."
\r
42 <notmuch.notmuchmail.org>
\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
46 List-Post: <mailto:notmuch@notmuchmail.org>
\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
49 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
50 X-List-Received-Date: Sat, 08 Dec 2012 15:08:13 -0000
\r
52 This obsoletes the series at
\r
54 id:1354843607-17980-1-git-send-email-david@tethera.net
\r
58 [Patch v4 08/10] test/dump-restore: add test for warning/error
\r
60 Other changes since the last series are as follows:
\r
62 commit 16ca0f8126fafd49266ffa02534f2e9b73c03027
\r
63 Author: David Bremner <bremner@debian.org>
\r
64 Date: Fri Dec 7 20:19:21 2012 -0400
\r
66 fixup for test/dump-restore
\r
68 diff --git a/test/dump-restore b/test/dump-restore
\r
69 index 2532cbb..b267792 100755
\r
70 --- a/test/dump-restore
\r
71 +++ b/test/dump-restore
\r
72 @@ -212,7 +212,7 @@ test_expect_equal_file EXPECTED OUTPUT
\r
74 test_begin_subtest 'roundtripping random message-ids and tags'
\r
76 - ${TEST_DIRECTORY}/random-corpus --config-path=${NOTMUCH_CONFIG}
\r
77 + ${TEST_DIRECTORY}/random-corpus --config-path=${NOTMUCH_CONFIG} \
\r
80 notmuch dump --format=batch-tag| \
\r
82 commit 9d864bd724bd2d2b26b5d52e3e2f28b4fff2046f
\r
83 Author: David Bremner <bremner@debian.org>
\r
84 Date: Fri Dec 7 20:32:50 2012 -0400
\r
86 fixup for tag-util.c: put * in right palce
\r
88 diff --git a/tag-util.h b/tag-util.h
\r
89 index df05d72..6674674 100644
\r
92 @@ -62,8 +62,8 @@ parse_tag_line (void *ctx, char *line,
\r
93 * ctx is passed to talloc
\r
97 -*tag_op_list_create (void *ctx);
\r
99 +tag_op_list_create (void *ctx);
\r
102 * Add a tag operation (delete iff remove == TRUE) to a list.
\r
104 commit d2cead797981e8992849e1d96ad95177b42290e2
\r
105 Author: David Bremner <bremner@debian.org>
\r
106 Date: Fri Dec 7 20:57:52 2012 -0400
\r
108 fixup for id:87txrxxyzp.fsf@nikula.org
\r
110 diff --git a/tag-util.c b/tag-util.c
\r
111 index 3d54e9e..a927363 100644
\r
114 @@ -24,9 +24,15 @@ parse_tag_line (void *ctx, char *line,
\r
117 size_t tok_len = 0;
\r
118 - char *line_for_error = talloc_strdup (ctx, line);
\r
119 + char *line_for_error;
\r
122 + line_for_error = talloc_strdup (ctx, line);
\r
123 + if (line_for_error == NULL) {
\r
124 + fprintf (stderr, "Error: out of memory\n");
\r
128 chomp_newline (line);
\r
130 /* remove leading space */
\r
131 @@ -58,7 +64,7 @@ parse_tag_line (void *ctx, char *line,
\r
133 /* If tag is terminated by NUL, there's no query string. */
\r
134 if (*(tok + tok_len) == '\0') {
\r
135 - fprintf (stderr, "no query string: %s\n", line_for_error);
\r
136 + fprintf (stderr, "Warning: no query string: %s\n", line_for_error);
\r
140 @@ -71,19 +77,21 @@ parse_tag_line (void *ctx, char *line,
\r
142 /* Maybe refuse empty tags. */
\r
143 if (! (flags & TAG_FLAG_BE_GENEROUS) && *tag == '\0') {
\r
144 - fprintf (stderr, "Error: empty tag: %s\n", line_for_error);
\r
145 + fprintf (stderr, "Warning: empty tag: %s\n", line_for_error);
\r
151 if (hex_decode_inplace (tag) != HEX_SUCCESS) {
\r
152 - fprintf (stderr, "Hex decoding of tag %s failed\n",
\r
153 + fprintf (stderr, "Warning: Hex decoding of tag %s failed\n",
\r
159 if (tag_op_list_append (ctx, tag_ops, tag, remove)) {
\r
160 + /* diagnostics already printed */
\r
164 @@ -98,7 +106,7 @@ parse_tag_line (void *ctx, char *line,
\r
166 /* tok now points to the query string */
\r
167 if (hex_decode_inplace (tok) != HEX_SUCCESS) {
\r
168 - fprintf (stderr, "Hex decoding of query %s failed\n",
\r
169 + fprintf (stderr, "Warning: Hex decoding of query %s failed\n",
\r
174 commit 162c20ab6d9b9eef56cb2b966a7144a61557eade
\r
175 Author: David Bremner <bremner@debian.org>
\r
176 Date: Sat Dec 8 07:29:56 2012 -0400
\r
178 fixup for id:87624chmfw.fsf@qmul.ac.uk
\r
182 diff --git a/util/string-util.h b/util/string-util.h
\r
183 index 696da40..ac7676c 100644
\r
184 --- a/util/string-util.h
\r
185 +++ b/util/string-util.h
\r
188 #include <string.h>
\r
190 -/* like strtok(3), but without state, and doesn't modify s. usage pattern:
\r
191 +/* like strtok(3), but without state, and doesn't modify s. Return
\r
192 + * value is indicated by pointer and length, not null terminator.
\r
196 * const char *tok = input;
\r
197 * const char *delim = " \t";
\r
199 commit 590adeec072f235861154b930bfb10bedbe37e8a
\r
200 Author: David Bremner <bremner@debian.org>
\r
201 Date: Sat Dec 8 07:42:44 2012 -0400
\r
203 fixup for id:8738zghl6d.fsf@qmul.ac.uk
\r
205 diff --git a/tag-util.c b/tag-util.c
\r
206 index a927363..c97d240 100644
\r
209 @@ -98,8 +98,6 @@ parse_tag_line (void *ctx, char *line,
\r
213 - fprintf (stderr, "Warning: Ignoring invalid input line: %s\n",
\r
218 @@ -113,7 +111,13 @@ parse_tag_line (void *ctx, char *line,
\r
221 *query_string = tok;
\r
225 + fprintf (stderr, "% invalid input line %s\n",
\r
226 + ret == 1 ? "Warning: Ignoring" : "Error: Failing at",
\r
229 talloc_free (line_for_error);
\r
233 commit 6002e08eb048612f5ef4eab3205a2887e1ab3f02
\r
234 Author: David Bremner <bremner@debian.org>
\r
235 Date: Sat Dec 8 07:46:39 2012 -0400
\r
237 fixup: chomp line before copy
\r
239 diff --git a/tag-util.c b/tag-util.c
\r
240 index c97d240..8e6b1ef 100644
\r
243 @@ -27,14 +27,14 @@ parse_tag_line (void *ctx, char *line,
\r
244 char *line_for_error;
\r
247 + chomp_newline (line);
\r
249 line_for_error = talloc_strdup (ctx, line);
\r
250 if (line_for_error == NULL) {
\r
251 fprintf (stderr, "Error: out of memory\n");
\r
255 - chomp_newline (line);
\r
257 /* remove leading space */
\r
258 while (*tok == ' ' || *tok == '\t')
\r
261 commit 9c4878bf0ad0e1f60a45c963998a20635fc234af
\r
262 Author: David Bremner <bremner@debian.org>
\r
263 Date: Sat Dec 8 08:36:48 2012 -0400
\r
265 further fixup for error messages
\r
267 diff --git a/tag-util.c b/tag-util.c
\r
268 index 8e6b1ef..6018d49 100644
\r
271 @@ -41,7 +41,7 @@ parse_tag_line (void *ctx, char *line,
\r
273 /* Skip empty and comment lines. */
\r
274 if (*tok == '\0' || *tok == '#') {
\r
280 @@ -55,6 +55,8 @@ parse_tag_line (void *ctx, char *line,
\r
281 /* Optional explicit end of tags marker. */
\r
282 if (tok_len == 2 && strncmp (tok, "--", tok_len) == 0) {
\r
283 tok = strtok_len (tok + tok_len, " ", &tok_len);
\r
285 + fprintf (stderr, "Warning: no query string: %s\n", line_for_error);
\r
289 @@ -113,8 +115,8 @@ parse_tag_line (void *ctx, char *line,
\r
290 *query_string = tok;
\r
294 - fprintf (stderr, "% invalid input line %s\n",
\r
295 + if ((ret % 2) != 0)
\r
296 + fprintf (stderr, "%s invalid input line %s\n",
\r
297 ret == 1 ? "Warning: Ignoring" : "Error: Failing at",
\r
300 diff --git a/tag-util.h b/tag-util.h
\r
301 index 6674674..1d564f0 100644
\r
304 @@ -45,7 +45,10 @@ typedef enum {
\r
305 * Leading and trailing space ' ' is ignored. Empty lines and lines
\r
306 * beginning with '#' are ignored.
\r
308 - * Returns: 0 for OK, 1 for skipped line, -1 for fatal(ish) error.
\r
310 + * 1 skipped (invalid) line
\r
311 + * 2 skipped (valid)
\r
312 + * -1 fatal(ish) error.
\r
314 * Output Parameters:
\r
315 * ops contains a list of tag operations
\r
317 commit 6e8a7b30e3980f77724d6005292265d49ad5241a
\r
318 Author: David Bremner <bremner@debian.org>
\r
319 Date: Sat Dec 8 08:41:01 2012 -0400
\r
321 fixup for id:87wqwsg46p.fsf@qmul.ac.uk
\r
323 diff --git a/notmuch-restore.c b/notmuch-restore.c
\r
324 index ceec2d3..44bf88d 100644
\r
325 --- a/notmuch-restore.c
\r
326 +++ b/notmuch-restore.c
\r
327 @@ -56,6 +56,11 @@ tag_message (unused (void *ctx),
\r
331 +/* Sup dump output is one line per message. We match a sequence of
\r
332 + * non-space characters for the message-id, then one or more
\r
333 + * spaces, then a list of space-separated tags as a sequence of
\r
334 + * characters within literal '(' and ')'. */
\r
337 parse_sup_line (void *ctx, char *line,
\r
338 char **query_str, tag_op_list_t *tag_ops)
\r
339 @@ -172,11 +177,6 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[])
\r
344 - /* Dump output is one line per message. We match a sequence of
\r
345 - * non-space characters for the message-id, then one or more
\r
346 - * spaces, then a list of space-separated tags as a sequence of
\r
347 - * characters within literal '(' and ')'. */
\r
350 line_len = getline (&line, &line_size, input);
\r
352 commit ee198b0d388243f0f43fab1d7ef7acbea5bdb3e6
\r
353 Author: David Bremner <bremner@debian.org>
\r
354 Date: Sat Dec 8 08:52:51 2012 -0400
\r
356 fixup: rewrite confusing for loop as while.
\r
358 diff --git a/tag-util.c b/tag-util.c
\r
359 index 6018d49..b68ea50 100644
\r
362 @@ -157,8 +157,10 @@ makes_changes (notmuch_message_t *message,
\r
363 const char *cur_tag = notmuch_tags_get (tags);
\r
364 int last_op = (flags & TAG_FLAG_REMOVE_ALL) ? -1 : 0;
\r
366 - /* slight contortions to count down with an unsigned index */
\r
367 - for (i = list->count; i-- > 0; /*nothing*/) {
\r
368 + /* scan backwards to get last operation */
\r
372 if (strcmp (cur_tag, list->ops[i].tag) == 0) {
\r
373 last_op = list->ops[i].remove ? -1 : 1;
\r