From: David Bremner <david@tethera.net>
To: Sean Whitton <spwhitton@spwhitton.name>, notmuch@notmuchmail.org
Subject: Re: Database location bug when database does not already exist
Date: Mon, 25 Jul 2022 21:17:41 -0400 [thread overview]
Message-ID: <87fsio4qq2.fsf@tethera.net> (raw)
In-Reply-To: <87y1wqkw13.fsf@athena.silentflame.com>
Sean Whitton <spwhitton@spwhitton.name> writes:
> Hello,
>
> In the following situation:
>
> - only notmuch config is ~/.notmuch-config
> - database.mail_root is set
> - database.path is not set
> - notmuch database does not yet exist
>
> then notmuch wants to create its db under mail_root/.notmuch, contrary
> to notmuch-config(1).
>
Thanks for the report. It looks like the case database.mail_root being
set when database.path is not set is not as well tested as it should
be. I have updated T055-path-config.sh to remedy this [1]. Most things
seem to work, but database creating (and upgrading) seem broken.
[1]:
diff --git a/test/T055-path-config.sh b/test/T055-path-config.sh
index 63dd90fd..7bd3f219 100755
--- a/test/T055-path-config.sh
+++ b/test/T055-path-config.sh
@@ -92,7 +92,19 @@ xdg_config () {
notmuch --config=${CONFIG_PATH} config set database.path
}
-for config in traditional split XDG XDG+profile symlink home_mail maildir_env; do
+mailroot_only_config () {
+ local dir
+
+ backup_config
+ notmuch config set database.mail_root ${TMP_DIRECTORY}/mail
+ notmuch --config=${CONFIG_PATH} config set database.path
+ DATABASE_PATH="${HOME}/.local/share/notmuch/default"
+ rm -rf $DATABASE_PATH
+ mkdir -p $DATABASE_PATH
+ XAPIAN_PATH="${DATABASE_PATH}/xapian"
+}
+
+for config in traditional split XDG XDG+profile symlink home_mail maildir_env mailroot_only; do
#start each set of tests with an known set of messages
add_email_corpus
@@ -122,6 +134,9 @@ for config in traditional split XDG XDG+profile symlink home_mail maildir_env; d
maildir_env)
maildir_env_config
;;
+ mailroot_only)
+ mailroot_only_config
+ ;;
esac
test_begin_subtest "count ($config)"
@@ -224,6 +239,9 @@ EOF
test_expect_equal_file_nonempty EXPECTED OUTPUT
test_begin_subtest "upgrade backup ($config)"
+ if [[ $config = mailroot_only ]]; then
+ test_subtest_known_broken
+ fi
features=$(xapian-metadata get $XAPIAN_PATH features | grep -v "^relative directory paths")
xapian-metadata set $XAPIAN_PATH features "$features"
output=$(notmuch new | grep Welcome)
@@ -232,6 +250,9 @@ EOF
"Welcome to a new version of notmuch! Your database will now be upgraded."
test_begin_subtest "notmuch +config -database suggests notmuch new ($config)"
+ if [[ $config = mailroot_only ]]; then
+ test_subtest_known_broken
+ fi
mv "$XAPIAN_PATH" "${XAPIAN_PATH}.bak"
notmuch > OUTPUT
cat <<EOF > EXPECTED
@@ -313,6 +334,15 @@ user.other_email
user.primary_email
EOF
test_expect_equal_file EXPECTED OUTPUT
+
+ test_begin_subtest "create database ($config)"
+ if [[ $config = mailroot_only ]]; then
+ test_subtest_known_broken
+ fi
+ rm -r ${XAPIAN_PATH}
+ notmuch new
+ test_expect_equal "$(xapian-metadata get ${XAPIAN_PATH} version)" 3
+
case $config in
XDG*)
test_begin_subtest "Set shadowed config value in database ($config)"
@@ -359,9 +389,6 @@ EOF
;;
esac
- case $config in
- split|XDG*)
- esac
restore_config
rm -rf home/.local
rm -rf home/.config
next prev parent reply other threads:[~2022-07-26 1:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-18 20:26 Database location bug when database does not already exist Sean Whitton
2022-07-26 1:17 ` David Bremner [this message]
2022-07-27 12:02 ` David Bremner
2022-09-03 11:34 ` David Bremner
2022-09-04 0:58 ` Sean Whitton
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=87fsio4qq2.fsf@tethera.net \
--to=david@tethera.net \
--cc=notmuch@notmuchmail.org \
--cc=spwhitton@spwhitton.name \
/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).