1 Return-Path: <ethan.glasser.camp@gmail.com>
\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 olra.theworths.org (Postfix) with ESMTP id 3D9C5431FB6
\r
6 for <notmuch@notmuchmail.org>; Mon, 25 Jun 2012 13:52:27 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=1.061 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_BL_SPAMCOP_NET=1.246,
\r
14 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_SORBS_WEB=0.614] autolearn=disabled
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id AIR-5bzUUieL for <notmuch@notmuchmail.org>;
\r
18 Mon, 25 Jun 2012 13:52:25 -0700 (PDT)
\r
19 Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com
\r
20 [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
21 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
22 5396F431FAF for <notmuch@notmuchmail.org>; Mon, 25 Jun 2012 13:52:25 -0700
\r
24 Received: by wgbdt14 with SMTP id dt14so3709395wgb.2
\r
25 for <notmuch@notmuchmail.org>; Mon, 25 Jun 2012 13:52:24 -0700 (PDT)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
27 h=from:to:cc:subject:date:message-id:x-mailer;
\r
28 bh=YqK8BU9axMj+Rr5tO1sFHtUxlwDAX28vQ9xpC//GUDw=;
\r
29 b=CGevjzK+6x+1hcxjFEcIbktSvOK62V5PAqbXTAPDZippKuVfUj2vA6sLFhvHDsywMo
\r
30 4xBcKCcuGVuZFwhwpGNZx+kRVu53CswPa9rjhD8YmWjqZpTPjTDZG2cWY5Cvg+BVBVuY
\r
31 lNgrEijURGjSDWoQ/RBMj7wPhsyGcluvVyOvA65UsTMhTkTpaCzqkBJR72QfxTQJCfza
\r
32 pSLVeqO1saQJBx9kzKE/012sG6vr5DMDyMuZk3nu10QUMOr/2NzVhRmlZs/iSHd9bvXW
\r
33 CtCTX8JHInzrLVZRqV5G5ro5FqTXV0a3qHcFdreGAxL0mrtqqkW7Bq9OTfYl+03MP1Uh
\r
35 Received: by 10.180.83.197 with SMTP id s5mr27227608wiy.9.1340657544059;
\r
36 Mon, 25 Jun 2012 13:52:24 -0700 (PDT)
\r
37 Received: from localhost ([195.24.209.21])
\r
38 by mx.google.com with ESMTPS id f7sm77266wiv.2.2012.06.25.13.52.18
\r
39 (version=TLSv1/SSLv3 cipher=OTHER);
\r
40 Mon, 25 Jun 2012 13:52:23 -0700 (PDT)
\r
41 From: Ethan Glasser-Camp <ethan.glasser.camp@gmail.com>
\r
42 To: notmuch@notmuchmail.org
\r
43 Subject: [RFC PATCH 05/14] new: use new URL-based filenames for messages
\r
44 Date: Mon, 25 Jun 2012 16:51:48 -0400
\r
45 Message-Id: <1340657517-6539-1-git-send-email-ethan@betacantrips.com>
\r
46 X-Mailer: git-send-email 1.7.9.5
\r
47 X-Mailman-Approved-At: Tue, 26 Jun 2012 03:51:54 -0700
\r
48 X-BeenThere: notmuch@notmuchmail.org
\r
49 X-Mailman-Version: 2.1.13
\r
51 List-Id: "Use and development of the notmuch mail system."
\r
52 <notmuch.notmuchmail.org>
\r
53 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
54 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
55 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
56 List-Post: <mailto:notmuch@notmuchmail.org>
\r
57 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
58 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
59 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
60 X-List-Received-Date: Mon, 25 Jun 2012 20:52:27 -0000
\r
62 This commit breaks a bunch of tests; fixes follow.
\r
64 Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
\r
66 notmuch-new.c | 27 +++++++++++++++++++--------
\r
67 1 file changed, 19 insertions(+), 8 deletions(-)
\r
69 diff --git a/notmuch-new.c b/notmuch-new.c
\r
70 index 938ae29..1f11b2c 100644
\r
73 @@ -287,7 +287,7 @@ add_files (notmuch_database_t *notmuch,
\r
76 struct dirent *entry = NULL;
\r
77 - char *next = NULL;
\r
78 + char *next = NULL, *path_uri = NULL;
\r
79 time_t fs_mtime, db_mtime;
\r
80 notmuch_status_t status, ret = NOTMUCH_STATUS_SUCCESS;
\r
81 notmuch_message_t *message = NULL;
\r
82 @@ -315,7 +315,16 @@ add_files (notmuch_database_t *notmuch,
\r
84 fs_mtime = st.st_mtime;
\r
86 - status = notmuch_database_get_directory (notmuch, path, &directory);
\r
87 + /* maildir URIs should never have a hostname component, but
\r
88 + * uriparser doesn't parse paths correctly if they start with //,
\r
89 + * as in scheme://host//path.
\r
91 + if (path[0] == '/')
\r
92 + path_uri = talloc_asprintf (notmuch, "maildir://%s", path);
\r
94 + path_uri = talloc_asprintf (notmuch, "maildir:///%s", path);
\r
96 + status = notmuch_database_get_directory (notmuch, path_uri, &directory);
\r
100 @@ -423,7 +432,7 @@ add_files (notmuch_database_t *notmuch,
\r
101 strcmp (notmuch_filenames_get (db_files), entry->d_name) < 0)
\r
103 char *absolute = talloc_asprintf (state->removed_files,
\r
105 + "%s/%s", path_uri,
\r
106 notmuch_filenames_get (db_files));
\r
108 _filename_list_add (state->removed_files, absolute);
\r
109 @@ -439,7 +448,7 @@ add_files (notmuch_database_t *notmuch,
\r
110 if (strcmp (filename, entry->d_name) < 0)
\r
112 char *absolute = talloc_asprintf (state->removed_directories,
\r
113 - "%s/%s", path, filename);
\r
114 + "%s/%s", path_uri, filename);
\r
116 _filename_list_add (state->removed_directories, absolute);
\r
118 @@ -467,7 +476,7 @@ add_files (notmuch_database_t *notmuch,
\r
120 /* We're now looking at a regular file that doesn't yet exist
\r
121 * in the database, so add it. */
\r
122 - next = talloc_asprintf (notmuch, "%s/%s", path, entry->d_name);
\r
123 + next = talloc_asprintf (notmuch, "%s/%s", path_uri, entry->d_name);
\r
125 state->processed_files++;
\r
127 @@ -559,7 +568,7 @@ add_files (notmuch_database_t *notmuch,
\r
128 while (notmuch_filenames_valid (db_files))
\r
130 char *absolute = talloc_asprintf (state->removed_files,
\r
132 + "%s/%s", path_uri,
\r
133 notmuch_filenames_get (db_files));
\r
135 _filename_list_add (state->removed_files, absolute);
\r
136 @@ -570,7 +579,7 @@ add_files (notmuch_database_t *notmuch,
\r
137 while (notmuch_filenames_valid (db_subdirs))
\r
139 char *absolute = talloc_asprintf (state->removed_directories,
\r
141 + "%s/%s", path_uri,
\r
142 notmuch_filenames_get (db_subdirs));
\r
144 _filename_list_add (state->removed_directories, absolute);
\r
145 @@ -584,9 +593,11 @@ add_files (notmuch_database_t *notmuch,
\r
146 * same second. This may lead to unnecessary re-scans, but it
\r
147 * avoids overlooking messages. */
\r
148 if (fs_mtime != stat_time)
\r
149 - _filename_list_add (state->directory_mtimes, path)->mtime = fs_mtime;
\r
150 + _filename_list_add (state->directory_mtimes, path_uri)->mtime = fs_mtime;
\r
154 + talloc_free (path_uri);
\r
156 talloc_free (next);
\r