1 Return-Path: <tomi.ollila@iki.fi>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by arlo.cworth.org (Postfix) with ESMTP id 6F4546DE0B29
\r
6 for <notmuch@notmuchmail.org>; Thu, 11 Jun 2015 13:22:00 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=1 tagged_above=-999 required=5 tests=[AWL=0.348,
\r
12 SPF_NEUTRAL=0.652] autolearn=disabled
\r
13 Received: from arlo.cworth.org ([127.0.0.1])
\r
14 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id MAsKa3X6PHFt for <notmuch@notmuchmail.org>;
\r
16 Thu, 11 Jun 2015 13:21:57 -0700 (PDT)
\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])
\r
18 by arlo.cworth.org (Postfix) with ESMTP id 118056DE0948
\r
19 for <notmuch@notmuchmail.org>; Thu, 11 Jun 2015 13:21:56 -0700 (PDT)
\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])
\r
21 by guru.guru-group.fi (Postfix) with ESMTP id 47C0510005A;
\r
22 Thu, 11 Jun 2015 23:21:31 +0300 (EEST)
\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
24 To: David Bremner <david@tethera.net>, David Bremner <david@tethera.net>,
\r
25 Morgan Veyret <morgan.veyret@gmail.com>, notmuch@notmuchmail.org
\r
26 Subject: Re: [PATCH 1/2] lib: add NOTMUCH_STATUS_PATH_ERROR
\r
27 In-Reply-To: <1433920621-5279-1-git-send-email-david@tethera.net>
\r
28 References: <87oakqj5rm.fsf@maritornes.cs.unb.ca>
\r
29 <1433920621-5279-1-git-send-email-david@tethera.net>
\r
30 User-Agent: Notmuch/0.20+12~gf3d9440 (http://notmuchmail.org) Emacs/24.3.1
\r
31 (x86_64-unknown-linux-gnu)
\r
32 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL
\r
33 $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F
\r
34 !)g;OY^,BjTbr)Np:%c_o'jj,Z
\r
35 Date: Thu, 11 Jun 2015 23:21:30 +0300
\r
36 Message-ID: <m2k2vam1x1.fsf@guru.guru-group.fi>
\r
38 Content-Type: text/plain
\r
39 X-BeenThere: notmuch@notmuchmail.org
\r
40 X-Mailman-Version: 2.1.18
\r
42 List-Id: "Use and development of the notmuch mail system."
\r
43 <notmuch.notmuchmail.org>
\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
47 List-Post: <mailto:notmuch@notmuchmail.org>
\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
51 X-List-Received-Date: Thu, 11 Jun 2015 20:22:00 -0000
\r
53 On Wed, Jun 10 2015, David Bremner <david@tethera.net> wrote:
\r
55 > The difference with FILE_ERROR is that this is for things that are
\r
56 > wrong with the path before looking at the disk.
\r
58 > Add some 3 tests; two broken as a reminder to actually use this new
\r
62 Series looks good, tests pass.
\r
67 > lib/database.cc | 2 ++
\r
68 > lib/notmuch.h | 5 +++++
\r
69 > test/T070-insert.sh | 2 +-
\r
70 > test/T560-lib-error.sh | 42 ++++++++++++++++++++++++++++++++++++++++--
\r
71 > 4 files changed, 48 insertions(+), 3 deletions(-)
\r
73 > diff --git a/lib/database.cc b/lib/database.cc
\r
74 > index 78a24f7..e726f62 100644
\r
75 > --- a/lib/database.cc
\r
76 > +++ b/lib/database.cc
\r
77 > @@ -342,6 +342,8 @@ notmuch_status_to_string (notmuch_status_t status)
\r
78 > return "Unsupported operation";
\r
79 > case NOTMUCH_STATUS_UPGRADE_REQUIRED:
\r
80 > return "Operation requires a database upgrade";
\r
81 > + case NOTMUCH_STATUS_PATH_ERROR:
\r
82 > + return "Path supplied is illegal for this function";
\r
84 > case NOTMUCH_STATUS_LAST_STATUS:
\r
85 > return "Unknown error status value";
\r
86 > diff --git a/lib/notmuch.h b/lib/notmuch.h
\r
87 > index 20c4e01..aab0151 100644
\r
88 > --- a/lib/notmuch.h
\r
89 > +++ b/lib/notmuch.h
\r
90 > @@ -164,6 +164,11 @@ typedef enum _notmuch_status {
\r
92 > NOTMUCH_STATUS_UPGRADE_REQUIRED,
\r
94 > + * There is a problem with the proposed path, a relative path
\r
95 > + * passed to a function expecting an absolute path.
\r
97 > + NOTMUCH_STATUS_PATH_ERROR,
\r
99 > * Not an actual status value. Just a way to find out how many
\r
100 > * valid status values there are.
\r
102 > diff --git a/test/T070-insert.sh b/test/T070-insert.sh
\r
103 > index 74f1955..7e71c3b 100755
\r
104 > --- a/test/T070-insert.sh
\r
105 > +++ b/test/T070-insert.sh
\r
106 > @@ -188,7 +188,7 @@ notmuch config set new.tags $OLDCONFIG
\r
107 > # DUPLICATE_MESSAGE_ID is not tested here, because it should actually pass.
\r
109 > for code in OUT_OF_MEMORY XAPIAN_EXCEPTION FILE_NOT_EMAIL \
\r
110 > - READ_ONLY_DATABASE UPGRADE_REQUIRED; do
\r
111 > + READ_ONLY_DATABASE UPGRADE_REQUIRED PATH_ERROR; do
\r
113 > cat <<EOF > index-file-$code.gdb
\r
114 > set breakpoint pending on
\r
115 > diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh
\r
116 > index c99b17e..9f5f7ae 100755
\r
117 > --- a/test/T560-lib-error.sh
\r
118 > +++ b/test/T560-lib-error.sh
\r
119 > @@ -35,7 +35,8 @@ Error: Cannot open a database for a NULL path.
\r
121 > test_expect_equal_file EXPECTED OUTPUT
\r
123 > -test_begin_subtest "Open nonexistent database"
\r
124 > +test_begin_subtest "Open relative path"
\r
125 > +test_subtest_known_broken
\r
127 > #include <stdio.h>
\r
128 > #include <notmuch.h>
\r
129 > @@ -49,7 +50,44 @@ EOF
\r
130 > cat <<'EOF' >EXPECTED
\r
133 > -Error opening database at ./nonexistent/foo/.notmuch: No such file or directory
\r
134 > +Error: Database path must be absolute.
\r
136 > +test_expect_equal_file EXPECTED OUTPUT
\r
138 > +test_begin_subtest "Create database in relative path"
\r
139 > +test_subtest_known_broken
\r
141 > +#include <stdio.h>
\r
142 > +#include <notmuch.h>
\r
143 > +int main (int argc, char** argv)
\r
145 > + notmuch_database_t *db;
\r
146 > + notmuch_status_t stat;
\r
147 > + stat = notmuch_database_create ("./nonexistent/foo", &db);
\r
150 > +cat <<'EOF' >EXPECTED
\r
153 > +Error: Database path must be absolute.
\r
155 > +test_expect_equal_file EXPECTED OUTPUT
\r
157 > +test_begin_subtest "Open nonexistent database"
\r
158 > +test_C ${PWD}/nonexistent/foo <<'EOF'
\r
159 > +#include <stdio.h>
\r
160 > +#include <notmuch.h>
\r
161 > +int main (int argc, char** argv)
\r
163 > + notmuch_database_t *db;
\r
164 > + notmuch_status_t stat;
\r
165 > + stat = notmuch_database_open (argv[1], 0, 0);
\r
168 > +cat <<'EOF' >EXPECTED
\r
171 > +Error opening database at CWD/nonexistent/foo/.notmuch: No such file or directory
\r
173 > test_expect_equal_file EXPECTED OUTPUT
\r
178 > _______________________________________________
\r
179 > notmuch mailing list
\r
180 > notmuch@notmuchmail.org
\r
181 > http://notmuchmail.org/mailman/listinfo/notmuch
\r