Re: [PATCH 2/2] notmuch-new: block database upgrades in default configuration.
[notmuch-archives.git] / 1d / 68c74466ebdaa86bfb8f1bb574bcffa2f40f00
1 Return-Path: <jani@nikula.org>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 1FAA3431FBF\r
6         for <notmuch@notmuchmail.org>; Sun, 23 Mar 2014 07:17:47 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id 5gcCSDkpP1J0 for <notmuch@notmuchmail.org>;\r
16         Sun, 23 Mar 2014 07:17:43 -0700 (PDT)\r
17 Received: from mail-ee0-f45.google.com (mail-ee0-f45.google.com\r
18  [74.125.83.45])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
19  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
20  8F7D6431FBD    for <notmuch@notmuchmail.org>; Sun, 23 Mar 2014 07:17:43 -0700\r
21  (PDT)\r
22 Received: by mail-ee0-f45.google.com with SMTP id d17so3474676eek.18\r
23         for <notmuch@notmuchmail.org>; Sun, 23 Mar 2014 07:17:40 -0700 (PDT)\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
25         d=1e100.net; s=20130820;\r
26         h=x-gm-message-state:from:to:subject:in-reply-to:references\r
27         :user-agent:date:message-id:mime-version:content-type;\r
28         bh=KnZKm16DrP/RszKRIa0TIsb/EsGVFTGIvMOYiK1YK/E=;\r
29         b=av9eVIYDWJFUQfd0Ni/Zt5PF6+aEwqe7P3OGCGa8S3NBAGSFcoLDpQUiG6huS9YZdA\r
30         CY9vMXOcAvqww1joH60IHgRGAXSi/DOKAZjDvQSlKWVk2t1kMwmFsNc0Bv5Jyys0J2Zo\r
31         OY0yT12FDjpXoER8piBLvefbUBs+A3VoM1KsO1uM6x+yaBeAK+8/eyeOFUnIQ0ZZjoF/\r
32         i5eVcWzXRANJA8BUZRnnvq+mxzHCNi+x9HBfvWk1yXWicvIpyRyHGzZjEiSudIRVx/Np\r
33         fDrrxPsrUnUm388v7o2V/7j6rS8g6CLkS53FtCkxKt1+iEEFQtmhyr8FpgwcWJC5nLNB\r
34         pb3g==\r
35 X-Gm-Message-State:\r
36  ALoCoQlalXuI2qR4K3WxO72ET0FSoQrSSKFoBL0b5wEzuZaDXyQ1iHEUTEBA3xvNd7WKACuXjP8u\r
37 X-Received: by 10.15.61.133 with SMTP id i5mr51592eex.80.1395584260708;\r
38         Sun, 23 Mar 2014 07:17:40 -0700 (PDT)\r
39 Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
40         [88.195.111.91])\r
41         by mx.google.com with ESMTPSA id 48sm26397239eee.2.2014.03.23.07.17.39\r
42         for <multiple recipients>\r
43         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
44         Sun, 23 Mar 2014 07:17:40 -0700 (PDT)\r
45 From: Jani Nikula <jani@nikula.org>\r
46 To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
47 Subject: Re: [PATCH 2/2] notmuch-new: block database upgrades in default\r
48         configuration.\r
49 In-Reply-To: <1395541573-2417-3-git-send-email-david@tethera.net>\r
50 References: <87bnx4jyyp.fsf@servo.finestructure.net>\r
51         <1395541573-2417-1-git-send-email-david@tethera.net>\r
52         <1395541573-2417-3-git-send-email-david@tethera.net>\r
53 User-Agent: Notmuch/0.17+149~g6de65e9791bc (http://notmuchmail.org)\r
54         Emacs/24.3.1 (x86_64-pc-linux-gnu)\r
55 Date: Sun, 23 Mar 2014 16:17:38 +0200\r
56 Message-ID: <87ppldrocd.fsf@nikula.org>\r
57 MIME-Version: 1.0\r
58 Content-Type: text/plain\r
59 X-BeenThere: notmuch@notmuchmail.org\r
60 X-Mailman-Version: 2.1.13\r
61 Precedence: list\r
62 List-Id: "Use and development of the notmuch mail system."\r
63         <notmuch.notmuchmail.org>\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
65         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
67 List-Post: <mailto:notmuch@notmuchmail.org>\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
71 X-List-Received-Date: Sun, 23 Mar 2014 14:17:47 -0000\r
72 \r
73 On Sun, 23 Mar 2014, David Bremner <david@tethera.net> wrote:\r
74 > People who prefer the current behaviour can set the configuration\r
75 > variable and forget it.\r
76 > ---\r
77 >  notmuch-new.c        |  9 +++++++++\r
78 >  test/T530-upgrade.sh | 11 +++++++++++\r
79 >  2 files changed, 20 insertions(+)\r
80 >\r
81 > diff --git a/notmuch-new.c b/notmuch-new.c\r
82 > index 82acf69..c6a15b0 100644\r
83 > --- a/notmuch-new.c\r
84 > +++ b/notmuch-new.c\r
85 > @@ -989,6 +989,15 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])\r
86 >           return EXIT_FAILURE;\r
87 >  \r
88 >       if (notmuch_database_needs_upgrade (notmuch)) {\r
89 > +         if (strcasecmp(notmuch_config_get_database_upgrades (config), "yes") != 0) {\r
90 > +             fprintf (stderr,\r
91 > +                      "Database upgrade needed. Please enable with\n\n"\r
92 > +                      "  notmuch config set database.upgrades yes\n\n"\r
93 > +                      "after taking appropriate precautions.\n");\r
94 \r
95 "and if you're paranoid, please switch off the same option afterwards"?\r
96 \r
97 We really have very few configuration options, and so far none of them\r
98 are such that we could make the decision for the user. I think in this\r
99 case pushing the responsibility to the user would be just *us* being\r
100 paranoid. What does that tell our users?\r
101 \r
102 I also think the user should consider doing backups before upgrading\r
103 notmuch in the first place. I am generally more concerned about the user\r
104 doing a database dump of the old database version using the new notmuch\r
105 than doing the upgrade. (Although in this case I think we're fine unless\r
106 the user decides 'notmuch dump folder:important' is enough.)\r
107 \r
108 BR,\r
109 Jani.\r
110 \r
111 \r
112 > +\r
113 > +             return EXIT_FAILURE;\r
114 > +         }\r
115 > +\r
116 >           if (add_files_state.verbosity >= VERBOSITY_NORMAL)\r
117 >               printf ("Welcome to a new version of notmuch! Your database will now be upgraded.\n");\r
118 >           gettimeofday (&add_files_state.tv_start, NULL);\r
119 > diff --git a/test/T530-upgrade.sh b/test/T530-upgrade.sh\r
120 > index 67bbf31..00dcb1e 100755\r
121 > --- a/test/T530-upgrade.sh\r
122 > +++ b/test/T530-upgrade.sh\r
123 > @@ -25,8 +25,19 @@ test_begin_subtest "path: search does not work with old database version"\r
124 >  output=$(notmuch search path:foo)\r
125 >  test_expect_equal "$output" ""\r
126 >  \r
127 > +test_begin_subtest "database upgrade blocked by default config"\r
128 > +output=$(notmuch new 2>&1)\r
129 > +test_expect_equal "$output" "\\r
130 > +Database upgrade needed. Please enable with\r
131 > +\r
132 > +  notmuch config set database.upgrades yes\r
133 > +\r
134 > +after taking appropriate precautions."\r
135 > +\r
136 >  test_begin_subtest "database upgrade from format version 1"\r
137 > +notmuch config set database.upgrades yes\r
138 >  output=$(notmuch new)\r
139 > +\r
140 >  test_expect_equal "$output" "\\r
141 >  Welcome to a new version of notmuch! Your database will now be upgraded.\r
142 >  Your notmuch database has now been upgraded to database format version 2.\r
143 > -- \r
144 > 1.9.0\r
145 >\r
146 > _______________________________________________\r
147 > notmuch mailing list\r
148 > notmuch@notmuchmail.org\r
149 > http://notmuchmail.org/mailman/listinfo/notmuch\r