From: Bart Trojanowski <bart@jukie.net>
To: notmuch@notmuchmail.org
Subject: [PATCH] fix notmuch-new bug when database path ends with a trailing /
Date: Sun, 22 Nov 2009 11:19:31 -0500 [thread overview]
Message-ID: <1258906771-6869-1-git-send-email-bart@jukie.net> (raw)
I configured my database.path with a trailing /, and after running notmuch
new every notmuch search would fail with error messages like this:
Error opening /inbox/cur/1258565257.000211.mbox:2,S: No such file or directory
The actual bug was in the filename normalization for storage in the
database. The database.path was removed from the full filename, but if
the database.path from the config file contained a trailing /, the
relative file name would retain an extra leading /... which made it look
like an absolute path after it was read out from the DB.
Signed-off-by: Bart Trojanowski <bart@jukie.net>
---
lib/message.cc | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/lib/message.cc b/lib/message.cc
index 017c47b..1e325e2 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -411,10 +411,14 @@ _notmuch_message_set_filename (notmuch_message_t *message,
db_path = notmuch_database_get_path (message->notmuch);
db_path_len = strlen (db_path);
- if (*s == '/' && strncmp (s, db_path, db_path_len) == 0
- && strlen (s) > db_path_len)
+ if (*s == '/' && strlen (s) > db_path_len
+ && strncmp (s, db_path, db_path_len) == 0)
{
- s += db_path_len + 1;
+ s += db_path_len;
+ while (*s == '/') s++;
+
+ if (!*s)
+ INTERNAL_ERROR ("Message filename was same as db prefix.");
}
message->doc.set_data (s);
--
1.6.4.4.2.gc2f148
next reply other threads:[~2009-11-22 16:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-22 16:19 Bart Trojanowski [this message]
2009-11-23 3:38 ` [PATCH] fix notmuch-new bug when database path ends with a trailing / Carl Worth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1258906771-6869-1-git-send-email-bart@jukie.net \
--to=bart@jukie.net \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).