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 1589D431FD8
\r
6 for <notmuch@notmuchmail.org>; Sun, 23 Feb 2014 08:55:40 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"
\r
12 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
13 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 g0qgZNhmr3CF for <notmuch@notmuchmail.org>;
\r
17 Sun, 23 Feb 2014 08:55:36 -0800 (PST)
\r
18 Received: from mail-ea0-f178.google.com (mail-ea0-f178.google.com
\r
19 [209.85.215.178]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id A35BB431FCF
\r
22 for <notmuch@notmuchmail.org>; Sun, 23 Feb 2014 08:55:34 -0800 (PST)
\r
23 Received: by mail-ea0-f178.google.com with SMTP id a15so2666338eae.9
\r
24 for <notmuch@notmuchmail.org>; Sun, 23 Feb 2014 08:55:33 -0800 (PST)
\r
25 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
26 d=1e100.net; s=20130820;
\r
27 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
\r
28 :references:in-reply-to:references;
\r
29 bh=OB8U3rnc4byZ/F8Qgg13Ryn/sMPT1BP5kACnOYLMxmo=;
\r
30 b=TcQBP6voiX/8XUj2cEofd4qpnuUF0apy+qYI2yx5gH++zh6kaWMYpznqjBtmsxcdeg
\r
31 JbpBLCcpnx9TzlLwORi8hs1JJuamrTRzaFtuswgaeEkvO//n0hVwUfRNFt73FzjPYLQU
\r
32 4nq2jDEJMr+BtiUugd5S0RRB/4TXruwx3Nf5bsKETU+8vf9ylNFLTKZWvThhHdJpd1fr
\r
33 JcJbiq9NM4ueEQxJ0pBpnXIm00PEcgrJUIeQs8seIz1sQDU2Tqd6NxD+cZGwIQil/SXr
\r
34 xzigiAH1SzBcGgXTwG3G/NDoEN5x+IRnbtauAkHbgdfG/t9rNXjo9xO0VgrPZhIX48F/
\r
37 ALoCoQmwRBpooXm2DaU7ugFfRyTD7KhyNrQhJ5VcuVn8VYGrU5yg+4ZrqjtOmU/Oktjk2UaO0bJw
\r
38 X-Received: by 10.14.193.193 with SMTP id k41mr19874863een.112.1393174532253;
\r
39 Sun, 23 Feb 2014 08:55:32 -0800 (PST)
\r
40 Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.
\r
41 [88.195.111.91]) by mx.google.com with ESMTPSA id
\r
42 j41sm53050533eey.15.2014.02.23.08.55.30 for <multiple recipients>
\r
43 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
44 Sun, 23 Feb 2014 08:55:31 -0800 (PST)
\r
45 From: Jani Nikula <jani@nikula.org>
\r
46 To: notmuch@notmuchmail.org,
\r
47 Rob Browning <rlb@defaultvalue.org>
\r
48 Subject: [PATCH 2/3] cli: make sure notmuch new and insert don't add invalid
\r
50 Date: Sun, 23 Feb 2014 18:55:22 +0200
\r
52 <edc2bc900f75bb2e72be2037e2df9105be7f0273.1393174108.git.jani@nikula.org>
\r
53 X-Mailer: git-send-email 1.8.5.3
\r
54 In-Reply-To: <cover.1393174108.git.jani@nikula.org>
\r
55 References: <87ha7qfto7.fsf@trouble.defaultvalue.org>
\r
56 <cover.1393174108.git.jani@nikula.org>
\r
57 In-Reply-To: <cover.1393174108.git.jani@nikula.org>
\r
58 References: <cover.1393174108.git.jani@nikula.org>
\r
59 X-BeenThere: notmuch@notmuchmail.org
\r
60 X-Mailman-Version: 2.1.13
\r
62 List-Id: "Use and development of the notmuch mail system."
\r
63 <notmuch.notmuchmail.org>
\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
65 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
67 List-Post: <mailto:notmuch@notmuchmail.org>
\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
70 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
71 X-List-Received-Date: Sun, 23 Feb 2014 16:55:40 -0000
\r
73 Check new.tags configuration values before doing anything, and bail
\r
74 out on invalid values.
\r
76 notmuch-insert.c | 9 +++++++++
\r
77 notmuch-new.c | 14 +++++++++++++-
\r
78 2 files changed, 22 insertions(+), 1 deletion(-)
\r
80 diff --git a/notmuch-insert.c b/notmuch-insert.c
\r
81 index cd6de88f6891..6752fc8de255 100644
\r
82 --- a/notmuch-insert.c
\r
83 +++ b/notmuch-insert.c
\r
84 @@ -431,6 +431,15 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
\r
85 return EXIT_FAILURE;
\r
87 for (i = 0; i < new_tags_length; i++) {
\r
88 + const char *error_msg;
\r
90 + error_msg = illegal_tag (new_tags[i], FALSE);
\r
92 + fprintf (stderr, "Error: tag '%s' in new.tags: %s\n",
\r
93 + new_tags[i], error_msg);
\r
94 + return EXIT_FAILURE;
\r
97 if (tag_op_list_append (tag_ops, new_tags[i], FALSE))
\r
98 return EXIT_FAILURE;
\r
100 diff --git a/notmuch-new.c b/notmuch-new.c
\r
101 index 8529fdd3eac7..82acf695353e 100644
\r
102 --- a/notmuch-new.c
\r
103 +++ b/notmuch-new.c
\r
107 #include "notmuch-client.h"
\r
108 +#include "tag-util.h"
\r
110 #include <unistd.h>
\r
112 @@ -918,7 +919,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
\r
113 struct sigaction action;
\r
114 _filename_node_t *f;
\r
118 notmuch_bool_t timer_is_active = FALSE;
\r
119 notmuch_bool_t no_hooks = FALSE;
\r
120 notmuch_bool_t quiet = FALSE, verbose = FALSE;
\r
121 @@ -950,6 +951,17 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
\r
122 add_files_state.synchronize_flags = notmuch_config_get_maildir_synchronize_flags (config);
\r
123 db_path = notmuch_config_get_database_path (config);
\r
125 + for (i = 0; i < add_files_state.new_tags_length; i++) {
\r
126 + const char *error_msg;
\r
128 + error_msg = illegal_tag (add_files_state.new_tags[i], FALSE);
\r
130 + fprintf (stderr, "Error: tag '%s' in new.tags: %s\n",
\r
131 + add_files_state.new_tags[i], error_msg);
\r
132 + return EXIT_FAILURE;
\r
137 ret = notmuch_run_hook (db_path, "pre-new");
\r