Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 99 / de4b9c98ca72e03fe4c9d6924eda8940a991dd
1 Return-Path: <amdragon@mit.edu>\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 AB503431FBC\r
6         for <notmuch@notmuchmail.org>; Sat, 23 Aug 2014 17:59:00 -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: -2.3\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_MED=-2.3] 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 2Hr1+1xpMa5l for <notmuch@notmuchmail.org>;\r
16         Sat, 23 Aug 2014 17:58:53 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-1.mit.edu (dmz-mailsec-scanner-1.mit.edu\r
18         [18.9.25.12])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 84C23431FB6\r
22         for <notmuch@notmuchmail.org>; Sat, 23 Aug 2014 17:58:53 -0700 (PDT)\r
23 X-AuditID: 1209190c-f795e6d000006c66-ef-53f938cc5799\r
24 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
25         (using TLS with cipher AES256-SHA (256/256 bits))\r
26         (Client did not present a certificate)\r
27         by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
28         id 94.84.27750.CC839F35; Sat, 23 Aug 2014 20:58:52 -0400 (EDT)\r
29 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
30         by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id s7O0wqZq009560; \r
31         Sat, 23 Aug 2014 20:58:52 -0400\r
32 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
33         (authenticated bits=0)\r
34         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
35         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s7O0woqS027618\r
36         (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
37         Sat, 23 Aug 2014 20:58:51 -0400\r
38 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
39         (envelope-from <amdragon@mit.edu>)\r
40         id 1XLM8w-0001tA-HW; Sat, 23 Aug 2014 20:58:50 -0400\r
41 From: Austin Clements <amdragon@mit.edu>\r
42 To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
43 Subject: Re: [PATCH v3 04/13] lib: Database version 3: Introduce fine-grained\r
44         "features"\r
45 In-Reply-To: <87ppfqsv8s.fsf@maritornes.cs.unb.ca>\r
46 References: <1406859003-11561-1-git-send-email-amdragon@mit.edu>\r
47         <1406859003-11561-5-git-send-email-amdragon@mit.edu>\r
48         <87ppfqsv8s.fsf@maritornes.cs.unb.ca>\r
49 User-Agent: Notmuch/0.18.1+76~g58c9570 (http://notmuchmail.org) Emacs/23.4.1\r
50         (i486-pc-linux-gnu)\r
51 Date: Sat, 23 Aug 2014 20:58:50 -0400\r
52 Message-ID: <87fvgmg0tx.fsf@awakening.csail.mit.edu>\r
53 MIME-Version: 1.0\r
54 Content-Type: text/plain; charset=us-ascii\r
55 X-Brightmail-Tracker:\r
56  H4sIAAAAAAAAA+NgFnrAIsWRmVeSWpSXmKPExsUixG6nonvG4mewwdJflhY3WrsZLa7fnMns\r
57         wOTxbNUtZo8th94zBzBFcdmkpOZklqUW6dslcGXMnfybueC3cMX0Ca8ZGxif83cxcnJICJhI\r
58         LPv7gQXCFpO4cG89WxcjF4eQwGwmiU0r1rBAOBsZJZbfvscOUiUkcJpJ4sQKLojEEkaJ3lMN\r
59         YAk2AQ2J37cWM4HYIgJ2Ej0XzoPFhQUiJOZ83wO2glPASOLOsmmsEINmM0q07UoFsUUFEiRO\r
60         9h9g7GLk4GARUJXo/c4FEuYFuu7t0jZ2CFtQ4uTMJ2BjmAW0JG78e8k0gVFgFpLULCSpBYxM\r
61         qxhlU3KrdHMTM3OKU5N1i5MT8/JSi3QN9XIzS/RSU0o3MYICklOSZwfjm4NKhxgFOBiVeHg/\r
62         XPwRLMSaWFZcmXuIUZKDSUmU95XGz2AhvqT8lMqMxOKM+KLSnNTiQ4wSHMxKIrzFZkA53pTE\r
63         yqrUonyYlDQHi5I471trq2AhgfTEktTs1NSC1CKYrAwHh5IE70xzoEbBotT01Iq0zJwShDQT\r
64         ByfIcB6g4Y9BaniLCxJzizPTIfKnGBWlxHk3giQEQBIZpXlwvbCE8YpRHOgVYd6VIFU8wGQD\r
65         1/0KaDAT0ODpM76CDC5JREhJNTDanjqs9WKrRoZorE7+kmNHBfintS9/HbN3Ildo5raZlzfI\r
66         PmJT75z0fhOz8QXu9PJ3N2oVF5bNOrCoW0zs0uTpKz/sFZKZ0N/0T9Hi2/pXy1NyjB7/W7Ri\r
67         /vfpC9bcrPr46+aXP5win9bsZTWPTLvy6tER6Zt3XzfcWVraFSF48cuxTde/nPc+ZaHEUpyR\r
68         aKjFXFScCAB2WsD38wIAAA==\r
69 X-BeenThere: notmuch@notmuchmail.org\r
70 X-Mailman-Version: 2.1.13\r
71 Precedence: list\r
72 List-Id: "Use and development of the notmuch mail system."\r
73         <notmuch.notmuchmail.org>\r
74 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
75         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
76 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
77 List-Post: <mailto:notmuch@notmuchmail.org>\r
78 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
79 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
80         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
81 X-List-Received-Date: Sun, 24 Aug 2014 00:59:00 -0000\r
82 \r
83 On Sat, 23 Aug 2014, David Bremner <david@tethera.net> wrote:\r
84 > Austin Clements <amdragon@MIT.EDU> writes:\r
85 >>  \r
86 >> +    /* Bit mask of features used by this database.  Features are\r
87 >> +     * named, independent aspects of the database schema.  This is a\r
88 >> +     * bitwise-OR of NOTMUCH_FEATURE_* values (below). */\r
89 >> +    unsigned int features;\r
90 >\r
91 > Should we be using a fixed size integer (uint_32t or whatever) for\r
92 > features? iirc the metadata in the database is actually a string, so I\r
93 > guess arbitrary precision there.\r
94 \r
95 Right; this doesn't matter for the on-disk format because these don't\r
96 appear on disk.  But you're right that in principle we could overflow\r
97 this, leading to subtle bugs.  I moved the enum above struct\r
98 _notmuch_database, gave it a name and bitwise operators for C++, and\r
99 used that enum name everywhere, so precision should never be a problem.\r
100 \r
101 >> +/* Bit masks for _notmuch_database::features. */\r
102 >> +enum {\r
103 >> +    /* If set, file names are stored in "file-direntry" terms.  If\r
104 >> +     * unset, file names are stored in document data.\r
105 >> +     *\r
106 >> +     * Introduced: version 1.  Implementation support: both for read;\r
107 >> +     * required for write. */\r
108 >> +    NOTMUCH_FEATURE_FILE_TERMS = 1 << 0,\r
109 >\r
110 > I agree with Jani that the Implementation support: part is a bit\r
111 > mystifying without the commit message. Maybe part of the commit message\r
112 > could migrate here? Or maybe just add a pointer to the comment in database.cc.\r
113 \r
114 I stripped these out because I don't think they're maintainable.  See my\r
115 reply to Jani.\r
116 \r
117 >> +            if (! *incompat_out)\r
118 >\r
119 > Should we support passing NULL for incompat_out? or at least check for\r
120 > it?\r
121 \r
122 Added a guard so it's safe to pass NULL.\r
123 \r
124 >> @@ -1048,7 +1164,8 @@ notmuch_database_get_version (notmuch_database_t *notmuch)\r
125 >>  notmuch_bool_t\r
126 >>  notmuch_database_needs_upgrade (notmuch_database_t *notmuch)\r
127 >>  {\r
128 >> -    return notmuch->needs_upgrade;\r
129 >> +    return notmuch->mode == NOTMUCH_DATABASE_MODE_READ_WRITE &&\r
130 >> +    (NOTMUCH_FEATURES_CURRENT & ~notmuch->features);\r
131 >>  }\r
132 >\r
133 > Maybe I'm not thinking hard enough here, but how does this deal with a\r
134 > feature that is needed to open a database in read only mode? Maybe it\r
135 > needs a comment for people not as clever as Austin ;).\r
136 \r
137 I'm not quite sure what you mean.  notmuch_database_needs_upgrade\r
138 returns false for read-only databases because you can't upgrade a\r
139 read-only database.  This was true before this patch, too, though it was\r
140 less obvious.  (Maybe that's not what you're asking?)\r