From 3ea52cb3b51e01a3571f83690b64e8b2ebc3c0ce Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Tue, 22 Jan 2013 19:41:06 +0200 Subject: [PATCH] [PATCH 1/4] cli: make caller check tag count in parse_tag_command_line --- 65/2fd292d52f6d22e66b4c6890c1574658519068 | 105 ++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 65/2fd292d52f6d22e66b4c6890c1574658519068 diff --git a/65/2fd292d52f6d22e66b4c6890c1574658519068 b/65/2fd292d52f6d22e66b4c6890c1574658519068 new file mode 100644 index 000000000..533bd959a --- /dev/null +++ b/65/2fd292d52f6d22e66b4c6890c1574658519068 @@ -0,0 +1,105 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id C3C87431FAF + for ; Tue, 22 Jan 2013 09:41:15 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id zYb9MZRYWXQZ for ; + Tue, 22 Jan 2013 09:41:15 -0800 (PST) +Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com + [209.85.217.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 199D1431FAE + for ; Tue, 22 Jan 2013 09:41:14 -0800 (PST) +Received: by mail-lb0-f173.google.com with SMTP id gf7so4544241lbb.4 + for ; Tue, 22 Jan 2013 09:41:12 -0800 (PST) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20120113; + h=x-received:from:to:cc:subject:date:message-id:x-mailer + :x-gm-message-state; + bh=Yf60HqK5H68IYpMF2TIm3/fMp1CjveJOez2AATppMII=; + b=BzV3un0UJe3/V0iwKk//0bKDOvtdPJmaJxXoqfxc5i8DST4Ucf7BUHR+OMlXKAU264 + gCUWNZuq+2f5apAlREFy7Ge1aPxxNb2qU1/RYFWME1aCxyacjcesF0lSxi765bI/a3N8 + URLUYGP0wVJoo9R+l8vgJmih5Y3r1cv3wiyuji0L1l8str+fNAhbfKc+nt0uewX36QCC + SGvsRc/E7t2PnPO1597o3S2q3wjt0K+WYViUJm1qJ3viAKUvTKqzv6Wjv9szi87zAusB + QUgMuW9OWJ0cGoZk0fxyvEeIo++0EIB+z7uu1tsmmHyz+RrCTtsD4XY0cC2v75xwsrMb + FcCA== +X-Received: by 10.112.32.100 with SMTP id h4mr9668588lbi.53.1358876471897; + Tue, 22 Jan 2013 09:41:11 -0800 (PST) +Received: from localhost (dsl-hkibrasgw4-50df51-27.dhcp.inet.fi. + [80.223.81.27]) + by mx.google.com with ESMTPS id er8sm7340723lbb.9.2013.01.22.09.41.09 + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Tue, 22 Jan 2013 09:41:10 -0800 (PST) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH 1/4] cli: make caller check tag count in + parse_tag_command_line +Date: Tue, 22 Jan 2013 19:41:06 +0200 +Message-Id: + <1a2c09adc1c963f1aa209c09143f85dca7634e11.1358876448.git.jani@nikula.org> +X-Mailer: git-send-email 1.7.10.4 +X-Gm-Message-State: + ALoCoQnlk8s0N05sjM2Fr+SL2Al0Ao3DClxSP44fXjkM75eSc5+ifCfjlO3Cko1qUsM+jm4iXpHq +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Tue, 22 Jan 2013 17:41:15 -0000 + +--- + notmuch-tag.c | 5 +++++ + tag-util.c | 5 ----- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/notmuch-tag.c b/notmuch-tag.c +index d9daf8f..b2b22f7 100644 +--- a/notmuch-tag.c ++++ b/notmuch-tag.c +@@ -234,6 +234,11 @@ notmuch_tag_command (void *ctx, int argc, char *argv[]) + if (parse_tag_command_line (ctx, argc - opt_index, argv + opt_index, + &query_string, tag_ops)) + return 1; ++ ++ if (tag_op_list_size (tag_ops) == 0) { ++ fprintf (stderr, "Error: 'notmuch tag' requires at least one tag to add or remove.\n"); ++ return 1; ++ } + } + + config = notmuch_config_open (ctx, NULL, NULL); +diff --git a/tag-util.c b/tag-util.c +index 701d329..c5f5859 100644 +--- a/tag-util.c ++++ b/tag-util.c +@@ -188,11 +188,6 @@ parse_tag_command_line (void *ctx, int argc, char **argv, + tag_op_list_append (tag_ops, argv[i] + 1, is_remove); + } + +- if (tag_op_list_size (tag_ops) == 0) { +- fprintf (stderr, "Error: 'notmuch tag' requires at least one tag to add or remove.\n"); +- return TAG_PARSE_INVALID; +- } +- + *query_str = query_string_from_args (ctx, argc - i, &argv[i]); + + if (*query_str == NULL || **query_str == '\0') { +-- +1.7.10.4 + -- 2.26.2