From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id OFaMEr5A32KJOQAAbAwnHQ (envelope-from ) for ; Tue, 26 Jul 2022 03:17:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id cAdnEr5A32KuxgAAauVa8A (envelope-from ) for ; Tue, 26 Jul 2022 03:17:50 +0200 Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id AE26F39B64 for ; Tue, 26 Jul 2022 03:17:49 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id BDC685F3D0; Tue, 26 Jul 2022 01:17:46 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id 028B45F3CE for ; Tue, 26 Jul 2022 01:17:43 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id D38475FBD0; Mon, 25 Jul 2022 21:17:42 -0400 (EDT) Received: (nullmailer pid 1201214 invoked by uid 1000); Tue, 26 Jul 2022 01:17:41 -0000 From: David Bremner To: Sean Whitton , notmuch@notmuchmail.org Subject: Re: Database location bug when database does not already exist In-Reply-To: <87y1wqkw13.fsf@athena.silentflame.com> References: <87y1wqkw13.fsf@athena.silentflame.com> Date: Mon, 25 Jul 2022 21:17:41 -0400 Message-ID: <87fsio4qq2.fsf@tethera.net> MIME-Version: 1.0 Message-ID-Hash: U57QURDHEVPEJP2L5IXCCP5W7M7ILZFK X-Message-ID-Hash: U57QURDHEVPEJP2L5IXCCP5W7M7ILZFK X-MailFrom: david@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1658798269; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=2iZw8n6zprvDk5oeZbnX9la0WDPjiXoV6FK6ON+uCbk=; b=lIDyKg1ggMh6LAWexrWZ7cCrEVjE535DLHf8Nx/mjY6ayBTxuZ2Goc7cfBXIqrPO9lX8gJ CF3yNVB6WR7M8rJ6utZ6qX9l96tiMfws6y7qpqLos4/lrziSbh2lRliYyyqREM0MCN5zdM y5+L6YTRXBLBysmo+K4pMAPFr6CJPGAffp2MvfGokLCcfIZIJEcCVKV/D+vqjpHuhA8Dbu qmeZOYW2M9fQ1JXs30sptIO6GxDa6JWrZg1IMsd9Y5/aB/XE1mMN4fUzKrR3i/RDkq5odY DscOIq8y5VE98X9OCY9QOWlQbLv/pXk9BrkhI+l5vzFW02ztTCVPiiUtyMRy8w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1658798269; a=rsa-sha256; cv=none; b=ToLEo89wEr+9Zqq7QF3Xf0uNDva5VGO0YaSGOE/ssjfVlufteNXt8FZpxhTW2X/IKtUaUI 7YNHh4/JHRg7yQsZguL2FagaSM2Y93n754nz/CGA12XsujUnEkMNpnzuZWbnAgWmo1Nos/ /q86qYHk9R4BH67cD2sm8a8rSxmLhDPTPK+ZFMBUJDWvoeTXCZnWwUtLPAK0fpPlUlGeuQ zlYk0tPe8+cNZkHMmsVeZ8OGSgazUioueLbX8rrTrE9j178hBeOMNAWmPawrAL5RiP5m2Y JE5lxhzUAJZ7G7dlZzh20vompI0xsGU9Rh8pdUoMEy2A6SfVFvFYpoxkXTIHIA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -2.65 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: AE26F39B64 X-Spam-Score: -2.65 X-Migadu-Scanner: scn0.migadu.com X-TUID: YM8xk0bHmd6o 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