From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 146436DE115F for ; Mon, 28 Nov 2016 14:12:43 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.006 X-Spam-Level: X-Spam-Status: No, score=-0.006 tagged_above=-999 required=5 tests=[AWL=0.005, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pFkaU_5Yq4DV for ; Mon, 28 Nov 2016 14:12:42 -0800 (PST) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 2A0D36DE0B55 for ; Mon, 28 Nov 2016 14:12:41 -0800 (PST) Received: from remotemail by fethera.tethera.net with local (Exim 4.84_2) (envelope-from ) id 1cBU9q-0000gx-6F; Mon, 28 Nov 2016 17:12:18 -0500 Received: (nullmailer pid 25584 invoked by uid 1000); Mon, 28 Nov 2016 22:12:37 -0000 From: David Bremner To: David Bremner , Maarten Aertsen , Notmuch Mail Subject: v2 of insert tempfail series Date: Mon, 28 Nov 2016 18:12:28 -0400 Message-Id: <20161128221231.25528-1-david@tethera.net> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161128121641.4022-2-david@tethera.net> References: <20161128121641.4022-2-david@tethera.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 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: Mon, 28 Nov 2016 22:12:43 -0000 This incorporates Tomi's patch of id:1480367228-22183-1-git-send-email-tomi.ollila@iki.fi verbatim, to sort out conflicts. It fixes the issues I alread sent mail about, and puts back the --keep tests for various error codes. The interdiff follows; most of it is Tomi's fault :). diff --git a/notmuch-insert.c b/notmuch-insert.c index a152f15..bc96af0 100644 --- a/notmuch-insert.c +++ b/notmuch-insert.c @@ -541,7 +541,7 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[]) status = notmuch_database_open (notmuch_config_get_database_path (config), NOTMUCH_DATABASE_MODE_READ_WRITE, ¬much); if (status) - return status_to_exit(status); + return keep ? NOTMUCH_STATUS_SUCCESS : status_to_exit (status); notmuch_exit_if_unmatched_db_uuid (notmuch); @@ -578,5 +578,5 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[]) notmuch_run_hook (db_path, "post-insert"); } - return status ? status_to_exit(status) : EXIT_SUCCESS; + return status_to_exit (status); } diff --git a/test/T070-insert.sh b/test/T070-insert.sh index fd620e5..3e7d582 100755 --- a/test/T070-insert.sh +++ b/test/T070-insert.sh @@ -206,14 +206,24 @@ gen_insert_msg for code in FILE_NOT_EMAIL READ_ONLY_DATABASE UPGRADE_REQUIRED PATH_ERROR; do test_expect_code 1 "EXIT_FAILURE when add_message returns $code" \ - "gdb --batch-silent --return-child-result -x index-file-$code.gdb \ - --args notmuch insert < $gen_msg_filename" + "gdb --batch-silent --return-child-result \ + -ex \"set args insert < $gen_msg_filename\" \ + -x index-file-$code.gdb notmuch" + test_expect_code 0 "success exit with --keep when add_message returns $code" \ + "gdb --batch-silent --return-child-result \ + -ex \"set args insert --keep < $gen_msg_filename\" \ + -x index-file-$code.gdb notmuch" done for code in OUT_OF_MEMORY XAPIAN_EXCEPTION ; do test_expect_code 75 "EX_TEMPFAIL when add_message returns $code" \ - "gdb --batch-silent --return-child-result -x index-file-$code.gdb \ - --args notmuch insert < $gen_msg_filename" + "gdb --batch-silent --return-child-result \ + -ex \"set args insert < $gen_msg_filename\" \ + -x index-file-$code.gdb notmuch" + test_expect_code 0 "success exit with --keep when add_message returns $code" \ + "gdb --batch-silent --return-child-result \ + -ex \"set args insert --keep < $gen_msg_filename\" \ + -x index-file-$code.gdb notmuch" done test_done