From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id C9956431FB6 for ; Fri, 21 Oct 2011 12:48:12 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.3 X-Spam-Level: X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_MED=-2.3] 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 v8icIaW+a5nd for ; Fri, 21 Oct 2011 12:48:12 -0700 (PDT) Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 5CB74429E27 for ; Fri, 21 Oct 2011 12:48:11 -0700 (PDT) Received: from convex-new.cs.unb.ca ([131.202.13.154]) by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id p9LJm40i002205; Fri, 21 Oct 2011 16:48:07 -0300 Received: from bremner by convex-new.cs.unb.ca with local (Exim 4.72) (envelope-from ) id 1RHL4W-00016c-TN; Fri, 21 Oct 2011 16:48:04 -0300 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 6/6] notmuch-restore: check for extra arguments. Date: Fri, 21 Oct 2011 16:47:57 -0300 Message-Id: <1319226477-4181-7-git-send-email-david@tethera.net> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1319226477-4181-1-git-send-email-david@tethera.net> References: <1317317857-29636-1-git-send-email-thomas@schwinge.name> <1319226477-4181-1-git-send-email-david@tethera.net> Cc: David Bremner 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: Fri, 21 Oct 2011 19:48:13 -0000 From: David Bremner We consider it an error to pass more than one file to restore, since extra ones are ignored. --- notmuch-restore.c | 7 +++++++ test/dump-restore | 1 - 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/notmuch-restore.c b/notmuch-restore.c index 097ca4b..c388c23 100644 --- a/notmuch-restore.c +++ b/notmuch-restore.c @@ -76,6 +76,13 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[]) optind++; } + if (optind < argc) { + fprintf (stderr, + "Cannot read dump from more than one file: %s\n", + argv[optind]); + return 1; + } + /* Dump output is one line per message. We match a sequence of * non-space characters for the message-id, then one or more * spaces, then a list of space-separated tags as a sequence of diff --git a/test/dump-restore b/test/dump-restore index a6d6d65..d4b424e 100755 --- a/test/dump-restore +++ b/test/dump-restore @@ -50,7 +50,6 @@ test_expect_success 'Restore with nothing to do, III' \ test_cmp dump.expected dump.actual' # notmuch restore currently only considers the first argument. -test_subtest_known_broken test_expect_success 'Invalid restore invocation' \ 'test_must_fail notmuch restore dump.expected another_one' -- 1.7.5.4