]> git.cworth.org Git - notmuch/commitdiff
Merge branch 'release'
authorDavid Bremner <david@tethera.net>
Wed, 7 Dec 2016 11:28:46 +0000 (07:28 -0400)
committerDavid Bremner <david@tethera.net>
Wed, 7 Dec 2016 11:30:12 +0000 (07:30 -0400)
Merge changes for notmuch-insert error handling, debian bugfix release

debian/changelog
debian/control
notmuch-client.h
notmuch-insert.c
status.c
test/T070-insert.sh

index 7c1a53033fad247c0ba6ea944d162ef550daaf59..9c2ebf7525c4dd39b8ce3aeeedef5e7d1428ee8c 100644 (file)
@@ -1,3 +1,9 @@
+notmuch (0.23.3-3) unstable; urgency=medium
+
+  * Disable gdb using tests on kfreebsd-*, due to apparent gdb breakage
+
+ -- David Bremner <bremner@debian.org>  Mon, 05 Dec 2016 08:25:32 -0400
+
 notmuch (0.23.3-2) unstable; urgency=medium
 
   * Add missing depends to notmuch-emacs. Thanks to micah for the
index ba8642b49373554f73009c07835a3e94743d20e8..e71a67161dd6c840631c4362f5713852e45a5cb1 100644 (file)
@@ -22,7 +22,7 @@ Build-Depends:
  ruby, ruby-dev (>>1:1.9.3~),
  emacs24-nox | emacs24 (>=24~) | emacs24-lucid (>=24~) |
  emacs23-nox | emacs23 (>=23~) | emacs23-lucid (>=23~),
- gdb [!s390x !ia64 !armel !ppc64el !mips !mipsel !mips64el],
+ gdb [!s390x !ia64 !armel !ppc64el !mips !mipsel !mips64el !kfreebsd-any],
  dtach (>= 0.8),
  gpgsm <!nocheck>,
  gnupg <!nocheck>,
index 793f32ecc55a36d5b08d57a7ce99ebc5d4d72e80..d026e6004239a1868dd44dde4b16de58fc0351a6 100644 (file)
@@ -489,6 +489,9 @@ print_status_database (const char *loc,
                       const notmuch_database_t *database,
                       notmuch_status_t status);
 
+int
+status_to_exit (notmuch_status_t status);
+
 #include "command-line-arguments.h"
 
 extern char *notmuch_requested_db_uuid;
index 131f09e2c6cf61139319296a28d8d8d0df566167..bc96af0e881c4ec2b2dac8130bf9aea22588fb81 100644 (file)
@@ -532,19 +532,20 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
     action.sa_flags = 0;
     sigaction (SIGINT, &action, NULL);
 
-    if (notmuch_database_open (notmuch_config_get_database_path (config),
-                              NOTMUCH_DATABASE_MODE_READ_WRITE, &notmuch))
-       return EXIT_FAILURE;
-
-    notmuch_exit_if_unmatched_db_uuid (notmuch);
-
     /* Write the message to the Maildir new directory. */
     newpath = maildir_write_new (config, STDIN_FILENO, maildir);
     if (! newpath) {
-       notmuch_database_destroy (notmuch);
        return EXIT_FAILURE;
     }
 
+    status = notmuch_database_open (notmuch_config_get_database_path (config),
+                                   NOTMUCH_DATABASE_MODE_READ_WRITE, &notmuch);
+    if (status)
+       return keep ? NOTMUCH_STATUS_SUCCESS : status_to_exit (status);
+
+    notmuch_exit_if_unmatched_db_uuid (notmuch);
+
+
     /* Index the message. */
     status = add_file (notmuch, newpath, tag_ops, synchronize_flags, keep);
 
@@ -577,5 +578,5 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
        notmuch_run_hook (db_path, "post-insert");
     }
 
-    return status ? EXIT_FAILURE : EXIT_SUCCESS;
+    return status_to_exit (status);
 }
index 45d3fb4e230e9426a194e045421aaaa6dcba684b..8bc2fe4b47ecba8af5246f8389f9e62f2e33f88c 100644 (file)
--- a/status.c
+++ b/status.c
@@ -36,3 +36,19 @@ print_status_database (const char *loc,
     }
     return status;
 }
+
+int
+status_to_exit (notmuch_status_t status)
+{
+    switch (status) {
+    case NOTMUCH_STATUS_SUCCESS:
+       return EXIT_SUCCESS;
+    case NOTMUCH_STATUS_OUT_OF_MEMORY:
+    case NOTMUCH_STATUS_XAPIAN_EXCEPTION:
+    case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID:
+    case NOTMUCH_STATUS_FILE_ERROR:
+       return EX_TEMPFAIL;
+    default:
+       return EXIT_FAILURE;
+    }
+}
index c2485bb2c2bd71bf0e1a51db5b9f833d03e018c6..57472b913964e4ca0200de2cc5ccea5bb98253f5 100755 (executable)
@@ -189,7 +189,6 @@ notmuch config set new.tags $OLDCONFIG
 
 for code in OUT_OF_MEMORY XAPIAN_EXCEPTION FILE_NOT_EMAIL \
     READ_ONLY_DATABASE UPGRADE_REQUIRED PATH_ERROR; do
-gen_insert_msg
 cat <<EOF > index-file-$code.gdb
 set breakpoint pending on
 set logging file index-file-$code.log
@@ -201,15 +200,30 @@ continue
 end
 run
 EOF
-test_begin_subtest "error exit when add_message returns $code"
-gdb --batch-silent --return-child-result -x index-file-$code.gdb \
-    --args notmuch insert  < $gen_msg_filename
-test_expect_equal $? 1
-
-test_begin_subtest "success exit with --keep when add_message returns $code"
-gdb --batch-silent --return-child-result -x index-file-$code.gdb \
-    --args notmuch insert --keep  < $gen_msg_filename
-test_expect_equal $? 0
+done
+
+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 \
+            -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 \
+            -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