From: Jani Nikula <jani@nikula.org>
To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
Subject: Re: [PATCH 2/2] notmuch-new: block database upgrades in default configuration.
Date: Sun, 23 Mar 2014 16:17:38 +0200 [thread overview]
Message-ID: <87ppldrocd.fsf@nikula.org> (raw)
In-Reply-To: <1395541573-2417-3-git-send-email-david@tethera.net>
On Sun, 23 Mar 2014, David Bremner <david@tethera.net> wrote:
> People who prefer the current behaviour can set the configuration
> variable and forget it.
> ---
> notmuch-new.c | 9 +++++++++
> test/T530-upgrade.sh | 11 +++++++++++
> 2 files changed, 20 insertions(+)
>
> diff --git a/notmuch-new.c b/notmuch-new.c
> index 82acf69..c6a15b0 100644
> --- a/notmuch-new.c
> +++ b/notmuch-new.c
> @@ -989,6 +989,15 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
> return EXIT_FAILURE;
>
> if (notmuch_database_needs_upgrade (notmuch)) {
> + if (strcasecmp(notmuch_config_get_database_upgrades (config), "yes") != 0) {
> + fprintf (stderr,
> + "Database upgrade needed. Please enable with\n\n"
> + " notmuch config set database.upgrades yes\n\n"
> + "after taking appropriate precautions.\n");
"and if you're paranoid, please switch off the same option afterwards"?
We really have very few configuration options, and so far none of them
are such that we could make the decision for the user. I think in this
case pushing the responsibility to the user would be just *us* being
paranoid. What does that tell our users?
I also think the user should consider doing backups before upgrading
notmuch in the first place. I am generally more concerned about the user
doing a database dump of the old database version using the new notmuch
than doing the upgrade. (Although in this case I think we're fine unless
the user decides 'notmuch dump folder:important' is enough.)
BR,
Jani.
> +
> + return EXIT_FAILURE;
> + }
> +
> if (add_files_state.verbosity >= VERBOSITY_NORMAL)
> printf ("Welcome to a new version of notmuch! Your database will now be upgraded.\n");
> gettimeofday (&add_files_state.tv_start, NULL);
> diff --git a/test/T530-upgrade.sh b/test/T530-upgrade.sh
> index 67bbf31..00dcb1e 100755
> --- a/test/T530-upgrade.sh
> +++ b/test/T530-upgrade.sh
> @@ -25,8 +25,19 @@ test_begin_subtest "path: search does not work with old database version"
> output=$(notmuch search path:foo)
> test_expect_equal "$output" ""
>
> +test_begin_subtest "database upgrade blocked by default config"
> +output=$(notmuch new 2>&1)
> +test_expect_equal "$output" "\
> +Database upgrade needed. Please enable with
> +
> + notmuch config set database.upgrades yes
> +
> +after taking appropriate precautions."
> +
> test_begin_subtest "database upgrade from format version 1"
> +notmuch config set database.upgrades yes
> output=$(notmuch new)
> +
> test_expect_equal "$output" "\
> Welcome to a new version of notmuch! Your database will now be upgraded.
> Your notmuch database has now been upgraded to database format version 2.
> --
> 1.9.0
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
next prev parent reply other threads:[~2014-03-23 14:17 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-09 15:01 WARNING: database upgrade coming David Bremner
2014-03-12 11:25 ` David Bremner
2014-03-17 17:17 ` Jameson Graef Rollins
2014-03-17 19:12 ` Jani Nikula
2014-03-17 21:19 ` David Bremner
2014-03-17 21:29 ` Jameson Graef Rollins
2014-03-23 2:26 ` conservative database upgrade control David Bremner
2014-03-23 2:26 ` [PATCH 1/2] config: add key database.upgrades David Bremner
2014-03-23 13:12 ` Jani Nikula
2014-03-23 2:26 ` [PATCH 2/2] notmuch-new: block database upgrades in default configuration David Bremner
2014-03-23 14:17 ` Jani Nikula [this message]
2014-03-23 14:35 ` David Bremner
2014-03-23 14:39 ` David Bremner
2014-03-23 23:54 ` Jameson Graef Rollins
2014-03-17 21:31 ` WARNING: database upgrade coming Jani Nikula
2014-03-18 6:06 ` Rob Browning
2014-03-18 6:57 ` Tomi Ollila
2014-03-18 11:55 ` Stewart Smith
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=87ppldrocd.fsf@nikula.org \
--to=jani@nikula.org \
--cc=david@tethera.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).