Re: Database location bug when database does not already exist

2022-09-03 Thread Sean Whitton
Hello,

On Sat 03 Sep 2022 at 08:34AM -03, David Bremner wrote:

> Sean Whitton  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).
>>
>
> This bug should be fixed as of commit 84e4e130e2c920b3dee91901582c4ab6276e2630

Nice, thanks!

-- 
Sean Whitton
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Database location bug when database does not already exist

2022-09-03 Thread David Bremner
Sean Whitton  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).
>

This bug should be fixed as of commit 84e4e130e2c920b3dee91901582c4ab6276e2630
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Database location bug when database does not already exist

2022-07-27 Thread David Bremner
David Bremner  writes:

> Sean Whitton  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.
>

Looking at this a bit more (and fixing a few bugs in those test changes)
I realized the underlying issue is related to what the library
internally callse the "database path" (parent of /xapian) exists. In
particular if .local/share/notmuch/default (or replace default with your
profile name) does not exist, notmuch does not create it. As a
workaround for now you could try creating that directory first.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Database location bug when database does not already exist

2022-07-25 Thread David Bremner
Sean Whitton  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 < 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


___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Database location bug when database does not already exist

2022-07-18 Thread Sean Whitton
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).

-- 
Sean Whitton
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org