Re: [PATCH 2/2] notmuch-new: block database upgrades in default configuration.
authorJani Nikula <jani@nikula.org>
Sun, 23 Mar 2014 14:17:38 +0000 (16:17 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:00:56 +0000 (10:00 -0800)
1d/68c74466ebdaa86bfb8f1bb574bcffa2f40f00 [new file with mode: 0644]

diff --git a/1d/68c74466ebdaa86bfb8f1bb574bcffa2f40f00 b/1d/68c74466ebdaa86bfb8f1bb574bcffa2f40f00
new file mode 100644 (file)
index 0000000..350fa36
--- /dev/null
@@ -0,0 +1,149 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 1FAA3431FBF\r
+       for <notmuch@notmuchmail.org>; Sun, 23 Mar 2014 07:17:47 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 5gcCSDkpP1J0 for <notmuch@notmuchmail.org>;\r
+       Sun, 23 Mar 2014 07:17:43 -0700 (PDT)\r
+Received: from mail-ee0-f45.google.com (mail-ee0-f45.google.com\r
+ [74.125.83.45])       (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
+ certificate requested)        by olra.theworths.org (Postfix) with ESMTPS id\r
+ 8F7D6431FBD   for <notmuch@notmuchmail.org>; Sun, 23 Mar 2014 07:17:43 -0700\r
+ (PDT)\r
+Received: by mail-ee0-f45.google.com with SMTP id d17so3474676eek.18\r
+       for <notmuch@notmuchmail.org>; Sun, 23 Mar 2014 07:17:40 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=1e100.net; s=20130820;\r
+       h=x-gm-message-state:from:to:subject:in-reply-to:references\r
+       :user-agent:date:message-id:mime-version:content-type;\r
+       bh=KnZKm16DrP/RszKRIa0TIsb/EsGVFTGIvMOYiK1YK/E=;\r
+       b=av9eVIYDWJFUQfd0Ni/Zt5PF6+aEwqe7P3OGCGa8S3NBAGSFcoLDpQUiG6huS9YZdA\r
+       CY9vMXOcAvqww1joH60IHgRGAXSi/DOKAZjDvQSlKWVk2t1kMwmFsNc0Bv5Jyys0J2Zo\r
+       OY0yT12FDjpXoER8piBLvefbUBs+A3VoM1KsO1uM6x+yaBeAK+8/eyeOFUnIQ0ZZjoF/\r
+       i5eVcWzXRANJA8BUZRnnvq+mxzHCNi+x9HBfvWk1yXWicvIpyRyHGzZjEiSudIRVx/Np\r
+       fDrrxPsrUnUm388v7o2V/7j6rS8g6CLkS53FtCkxKt1+iEEFQtmhyr8FpgwcWJC5nLNB\r
+       pb3g==\r
+X-Gm-Message-State:\r
+ ALoCoQlalXuI2qR4K3WxO72ET0FSoQrSSKFoBL0b5wEzuZaDXyQ1iHEUTEBA3xvNd7WKACuXjP8u\r
+X-Received: by 10.15.61.133 with SMTP id i5mr51592eex.80.1395584260708;\r
+       Sun, 23 Mar 2014 07:17:40 -0700 (PDT)\r
+Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
+       [88.195.111.91])\r
+       by mx.google.com with ESMTPSA id 48sm26397239eee.2.2014.03.23.07.17.39\r
+       for <multiple recipients>\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Sun, 23 Mar 2014 07:17:40 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 2/2] notmuch-new: block database upgrades in default\r
+       configuration.\r
+In-Reply-To: <1395541573-2417-3-git-send-email-david@tethera.net>\r
+References: <87bnx4jyyp.fsf@servo.finestructure.net>\r
+       <1395541573-2417-1-git-send-email-david@tethera.net>\r
+       <1395541573-2417-3-git-send-email-david@tethera.net>\r
+User-Agent: Notmuch/0.17+149~g6de65e9791bc (http://notmuchmail.org)\r
+       Emacs/24.3.1 (x86_64-pc-linux-gnu)\r
+Date: Sun, 23 Mar 2014 16:17:38 +0200\r
+Message-ID: <87ppldrocd.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 23 Mar 2014 14:17:47 -0000\r
+\r
+On Sun, 23 Mar 2014, David Bremner <david@tethera.net> wrote:\r
+> People who prefer the current behaviour can set the configuration\r
+> variable and forget it.\r
+> ---\r
+>  notmuch-new.c        |  9 +++++++++\r
+>  test/T530-upgrade.sh | 11 +++++++++++\r
+>  2 files changed, 20 insertions(+)\r
+>\r
+> diff --git a/notmuch-new.c b/notmuch-new.c\r
+> index 82acf69..c6a15b0 100644\r
+> --- a/notmuch-new.c\r
+> +++ b/notmuch-new.c\r
+> @@ -989,6 +989,15 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])\r
+>          return EXIT_FAILURE;\r
+>  \r
+>      if (notmuch_database_needs_upgrade (notmuch)) {\r
+> +        if (strcasecmp(notmuch_config_get_database_upgrades (config), "yes") != 0) {\r
+> +            fprintf (stderr,\r
+> +                     "Database upgrade needed. Please enable with\n\n"\r
+> +                     "  notmuch config set database.upgrades yes\n\n"\r
+> +                     "after taking appropriate precautions.\n");\r
+\r
+"and if you're paranoid, please switch off the same option afterwards"?\r
+\r
+We really have very few configuration options, and so far none of them\r
+are such that we could make the decision for the user. I think in this\r
+case pushing the responsibility to the user would be just *us* being\r
+paranoid. What does that tell our users?\r
+\r
+I also think the user should consider doing backups before upgrading\r
+notmuch in the first place. I am generally more concerned about the user\r
+doing a database dump of the old database version using the new notmuch\r
+than doing the upgrade. (Although in this case I think we're fine unless\r
+the user decides 'notmuch dump folder:important' is enough.)\r
+\r
+BR,\r
+Jani.\r
+\r
+\r
+> +\r
+> +            return EXIT_FAILURE;\r
+> +        }\r
+> +\r
+>          if (add_files_state.verbosity >= VERBOSITY_NORMAL)\r
+>              printf ("Welcome to a new version of notmuch! Your database will now be upgraded.\n");\r
+>          gettimeofday (&add_files_state.tv_start, NULL);\r
+> diff --git a/test/T530-upgrade.sh b/test/T530-upgrade.sh\r
+> index 67bbf31..00dcb1e 100755\r
+> --- a/test/T530-upgrade.sh\r
+> +++ b/test/T530-upgrade.sh\r
+> @@ -25,8 +25,19 @@ test_begin_subtest "path: search does not work with old database version"\r
+>  output=$(notmuch search path:foo)\r
+>  test_expect_equal "$output" ""\r
+>  \r
+> +test_begin_subtest "database upgrade blocked by default config"\r
+> +output=$(notmuch new 2>&1)\r
+> +test_expect_equal "$output" "\\r
+> +Database upgrade needed. Please enable with\r
+> +\r
+> +  notmuch config set database.upgrades yes\r
+> +\r
+> +after taking appropriate precautions."\r
+> +\r
+>  test_begin_subtest "database upgrade from format version 1"\r
+> +notmuch config set database.upgrades yes\r
+>  output=$(notmuch new)\r
+> +\r
+>  test_expect_equal "$output" "\\r
+>  Welcome to a new version of notmuch! Your database will now be upgraded.\r
+>  Your notmuch database has now been upgraded to database format version 2.\r
+> -- \r
+> 1.9.0\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r