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 61D386DE00BD for ; Sun, 4 Dec 2016 12:50:26 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.52 X-Spam-Level: X-Spam-Status: No, score=0.52 tagged_above=-999 required=5 tests=[AWL=-0.132, SPF_NEUTRAL=0.652] 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 pq9_uVsrI6ZN for ; Sun, 4 Dec 2016 12:50:25 -0800 (PST) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by arlo.cworth.org (Postfix) with ESMTP id 0A57B6DE00B8 for ; Sun, 4 Dec 2016 12:50:25 -0800 (PST) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id C86F910005A; Sun, 4 Dec 2016 22:51:05 +0200 (EET) From: Tomi Ollila To: David Bremner , Maarten Aertsen , Notmuch Mail Subject: Re: v2 of insert tempfail series In-Reply-To: <20161128221231.25528-1-david@tethera.net> References: <20161128121641.4022-2-david@tethera.net> <20161128221231.25528-1-david@tethera.net> User-Agent: Notmuch/0.23.1+52~ga6dbf3a (https://notmuchmail.org) Emacs/24.5.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain 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: Sun, 04 Dec 2016 20:50:26 -0000 On Tue, Nov 29 2016, David Bremner wrote: > 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 :). This series looks good to me -- also my part which I had a slight afterthought when I looked what brew install gdb printed out -- it suggested setting 'startup-with-shell off' which would have borken my version (on macOS), but http://apple.stackexchange.com/questions/246245/macos-sierra-gdb-not-codesigned informed that setting startup-with-shell has so far not been necessary (and it would be major pain everywhere if it were required; in addition to everything else using `exec-wrapper` also requires shell...) I.e. if it makes gdb use more robust in general that is good reason to use it. Last (and least) (i.e. I could not resist the templation): the code block below would be simpler in this format -- but perhaps what happends there is less understandable -- although now the where the expansion is done is more visible ;) + test_expect_code 75 "EX_TEMPFAIL when add_message returns $code" \ + "gdb --batch-silent --return-child-result \ + -ex 'set args insert < $gen_msg_filename' \ + -x index-file-$code.gdb notmuch" (all variable expansions are done here (in context of the outermost "gdb...") and not in the `eval` that is done by test_expect_code -- unless any of the variables expanded to yet another variable syntax ;) Tomi > > 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