--- /dev/null
+Return-Path: <bremner@tesseract.cs.unb.ca>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id CFFEF6DE025E\r
+ for <notmuch@notmuchmail.org>; Wed, 10 Jun 2015 00:19:08 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.207\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.207 tagged_above=-999 required=5 tests=[AWL=0.197, \r
+ T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id w8HF7pQd60sV for <notmuch@notmuchmail.org>;\r
+ Wed, 10 Jun 2015 00:19:05 -0700 (PDT)\r
+Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net\r
+ [87.98.215.224])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id CC8E46DE0244\r
+ for <notmuch@notmuchmail.org>; Wed, 10 Jun 2015 00:19:04 -0700 (PDT)\r
+Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim\r
+ 4.80) (envelope-from <bremner@tesseract.cs.unb.ca>)\r
+ id 1Z2aGM-0007U6-6x; Wed, 10 Jun 2015 07:17:26 +0000\r
+Received: (nullmailer pid 5324 invoked by uid 1000); Wed, 10 Jun 2015\r
+ 07:17:07 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: David Bremner <david@tethera.net>, Morgan Veyret\r
+ <morgan.veyret@gmail.com>, notmuch@notmuchmail.org\r
+Subject: [PATCH 1/2] lib: add NOTMUCH_STATUS_PATH_ERROR\r
+Date: Wed, 10 Jun 2015 09:17:00 +0200\r
+Message-Id: <1433920621-5279-1-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <87oakqj5rm.fsf@maritornes.cs.unb.ca>\r
+References: <87oakqj5rm.fsf@maritornes.cs.unb.ca>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 10 Jun 2015 07:19:08 -0000\r
+\r
+The difference with FILE_ERROR is that this is for things that are\r
+wrong with the path before looking at the disk.\r
+\r
+Add some 3 tests; two broken as a reminder to actually use this new\r
+code.\r
+---\r
+ lib/database.cc | 2 ++\r
+ lib/notmuch.h | 5 +++++\r
+ test/T070-insert.sh | 2 +-\r
+ test/T560-lib-error.sh | 42 ++++++++++++++++++++++++++++++++++++++++--\r
+ 4 files changed, 48 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/lib/database.cc b/lib/database.cc\r
+index 78a24f7..e726f62 100644\r
+--- a/lib/database.cc\r
++++ b/lib/database.cc\r
+@@ -342,6 +342,8 @@ notmuch_status_to_string (notmuch_status_t status)\r
+ return "Unsupported operation";\r
+ case NOTMUCH_STATUS_UPGRADE_REQUIRED:\r
+ return "Operation requires a database upgrade";\r
++ case NOTMUCH_STATUS_PATH_ERROR:\r
++ return "Path supplied is illegal for this function";\r
+ default:\r
+ case NOTMUCH_STATUS_LAST_STATUS:\r
+ return "Unknown error status value";\r
+diff --git a/lib/notmuch.h b/lib/notmuch.h\r
+index 20c4e01..aab0151 100644\r
+--- a/lib/notmuch.h\r
++++ b/lib/notmuch.h\r
+@@ -164,6 +164,11 @@ typedef enum _notmuch_status {\r
+ */\r
+ NOTMUCH_STATUS_UPGRADE_REQUIRED,\r
+ /**\r
++ * There is a problem with the proposed path, a relative path\r
++ * passed to a function expecting an absolute path.\r
++ */\r
++ NOTMUCH_STATUS_PATH_ERROR,\r
++ /**\r
+ * Not an actual status value. Just a way to find out how many\r
+ * valid status values there are.\r
+ */\r
+diff --git a/test/T070-insert.sh b/test/T070-insert.sh\r
+index 74f1955..7e71c3b 100755\r
+--- a/test/T070-insert.sh\r
++++ b/test/T070-insert.sh\r
+@@ -188,7 +188,7 @@ notmuch config set new.tags $OLDCONFIG\r
+ # DUPLICATE_MESSAGE_ID is not tested here, because it should actually pass.\r
+ \r
+ for code in OUT_OF_MEMORY XAPIAN_EXCEPTION FILE_NOT_EMAIL \\r
+- READ_ONLY_DATABASE UPGRADE_REQUIRED; do\r
++ READ_ONLY_DATABASE UPGRADE_REQUIRED PATH_ERROR; do\r
+ gen_insert_msg\r
+ cat <<EOF > index-file-$code.gdb\r
+ set breakpoint pending on\r
+diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh\r
+index c99b17e..9f5f7ae 100755\r
+--- a/test/T560-lib-error.sh\r
++++ b/test/T560-lib-error.sh\r
+@@ -35,7 +35,8 @@ Error: Cannot open a database for a NULL path.\r
+ EOF\r
+ test_expect_equal_file EXPECTED OUTPUT\r
+ \r
+-test_begin_subtest "Open nonexistent database"\r
++test_begin_subtest "Open relative path"\r
++test_subtest_known_broken\r
+ test_C <<'EOF'\r
+ #include <stdio.h>\r
+ #include <notmuch.h>\r
+@@ -49,7 +50,44 @@ EOF\r
+ cat <<'EOF' >EXPECTED\r
+ == stdout ==\r
+ == stderr ==\r
+-Error opening database at ./nonexistent/foo/.notmuch: No such file or directory\r
++Error: Database path must be absolute.\r
++EOF\r
++test_expect_equal_file EXPECTED OUTPUT\r
++\r
++test_begin_subtest "Create database in relative path"\r
++test_subtest_known_broken\r
++test_C <<'EOF'\r
++#include <stdio.h>\r
++#include <notmuch.h>\r
++int main (int argc, char** argv)\r
++{\r
++ notmuch_database_t *db;\r
++ notmuch_status_t stat;\r
++ stat = notmuch_database_create ("./nonexistent/foo", &db);\r
++}\r
++EOF\r
++cat <<'EOF' >EXPECTED\r
++== stdout ==\r
++== stderr ==\r
++Error: Database path must be absolute.\r
++EOF\r
++test_expect_equal_file EXPECTED OUTPUT\r
++\r
++test_begin_subtest "Open nonexistent database"\r
++test_C ${PWD}/nonexistent/foo <<'EOF'\r
++#include <stdio.h>\r
++#include <notmuch.h>\r
++int main (int argc, char** argv)\r
++{\r
++ notmuch_database_t *db;\r
++ notmuch_status_t stat;\r
++ stat = notmuch_database_open (argv[1], 0, 0);\r
++}\r
++EOF\r
++cat <<'EOF' >EXPECTED\r
++== stdout ==\r
++== stderr ==\r
++Error opening database at CWD/nonexistent/foo/.notmuch: No such file or directory\r
+ EOF\r
+ test_expect_equal_file EXPECTED OUTPUT\r
+ \r
+-- \r
+2.1.4\r
+\r