From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1FAA3431FBF for ; Sun, 23 Mar 2014 07:17:47 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5gcCSDkpP1J0 for ; Sun, 23 Mar 2014 07:17:43 -0700 (PDT) Received: from mail-ee0-f45.google.com (mail-ee0-f45.google.com [74.125.83.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 8F7D6431FBD for ; Sun, 23 Mar 2014 07:17:43 -0700 (PDT) Received: by mail-ee0-f45.google.com with SMTP id d17so3474676eek.18 for ; Sun, 23 Mar 2014 07:17:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-type; bh=KnZKm16DrP/RszKRIa0TIsb/EsGVFTGIvMOYiK1YK/E=; b=av9eVIYDWJFUQfd0Ni/Zt5PF6+aEwqe7P3OGCGa8S3NBAGSFcoLDpQUiG6huS9YZdA CY9vMXOcAvqww1joH60IHgRGAXSi/DOKAZjDvQSlKWVk2t1kMwmFsNc0Bv5Jyys0J2Zo OY0yT12FDjpXoER8piBLvefbUBs+A3VoM1KsO1uM6x+yaBeAK+8/eyeOFUnIQ0ZZjoF/ i5eVcWzXRANJA8BUZRnnvq+mxzHCNi+x9HBfvWk1yXWicvIpyRyHGzZjEiSudIRVx/Np fDrrxPsrUnUm388v7o2V/7j6rS8g6CLkS53FtCkxKt1+iEEFQtmhyr8FpgwcWJC5nLNB pb3g== X-Gm-Message-State: ALoCoQlalXuI2qR4K3WxO72ET0FSoQrSSKFoBL0b5wEzuZaDXyQ1iHEUTEBA3xvNd7WKACuXjP8u X-Received: by 10.15.61.133 with SMTP id i5mr51592eex.80.1395584260708; Sun, 23 Mar 2014 07:17:40 -0700 (PDT) Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. [88.195.111.91]) by mx.google.com with ESMTPSA id 48sm26397239eee.2.2014.03.23.07.17.39 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 23 Mar 2014 07:17:40 -0700 (PDT) From: Jani Nikula To: David Bremner , notmuch@notmuchmail.org Subject: Re: [PATCH 2/2] notmuch-new: block database upgrades in default configuration. In-Reply-To: <1395541573-2417-3-git-send-email-david@tethera.net> References: <87bnx4jyyp.fsf@servo.finestructure.net> <1395541573-2417-1-git-send-email-david@tethera.net> <1395541573-2417-3-git-send-email-david@tethera.net> User-Agent: Notmuch/0.17+149~g6de65e9791bc (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Sun, 23 Mar 2014 16:17:38 +0200 Message-ID: <87ppldrocd.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Mar 2014 14:17:47 -0000 On Sun, 23 Mar 2014, David Bremner 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