[PATCH 2/3] ruby: allow build with RUNPATH
[notmuch-archives.git] / 45 / 73997aa1a9e8fedd7d9c04d7b2d1d18e525d13
1 Return-Path: <amthrax@drake.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 CAD5842119B\r
6         for <notmuch@notmuchmail.org>; Wed, 29 Jun 2011 16:00:07 -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 pGclJv+-x8O4 for <notmuch@notmuchmail.org>;\r
16         Wed, 29 Jun 2011 16:00:07 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU\r
18         [18.9.25.15])\r
19         by olra.theworths.org (Postfix) with ESMTP id 380E2421192\r
20         for <notmuch@notmuchmail.org>; Wed, 29 Jun 2011 16:00:07 -0700 (PDT)\r
21 X-AuditID: 1209190f-b7c82ae000000a20-ac-4e0bae7bb60e\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
23         by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id ED.54.02592.B7EAB0E4; Wed, 29 Jun 2011 19:00:11 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id p5TN06Eo015086; \r
27         Wed, 29 Jun 2011 19:00:06 -0400\r
28 Received: from drake.mit.edu (26-4-166.dynamic.csail.mit.edu [18.26.4.166])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id p5TN05DV000582\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Wed, 29 Jun 2011 19:00:06 -0400 (EDT)\r
34 Received: from amthrax by drake.mit.edu with local (Exim 4.76)\r
35         (envelope-from <amthrax@drake.mit.edu>)\r
36         id 1Qc3jp-0004I0-2h; Wed, 29 Jun 2011 19:00:05 -0400\r
37 From: Austin Clements <amdragon@MIT.EDU>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH] new: Improved workaround for mistaken new directories\r
40 Date: Wed, 29 Jun 2011 19:00:01 -0400\r
41 Message-Id: <1309388401-16437-1-git-send-email-amdragon@mit.edu>\r
42 X-Mailer: git-send-email 1.7.5.1\r
43 X-Brightmail-Tracker:\r
44  H4sIAAAAAAAAA+NgFlrOIsWRmVeSWpSXmKPExsUixCmqrFu9jtvPYP13AYvrN2cyOzB6PFt1\r
45         izmAMYrLJiU1J7MstUjfLoErY8/lNsaCGxIVbdeXszcw/hTqYuTkkBAwkTi2+xA7hC0mceHe\r
46         erYuRi4OIYF9jBKPp89jhHA2MErMnnwDKnOcSeL9y2VMEM58RolDDxvA+tkENCS27V/OCGKL\r
47         CEhL7Lw7m7WLkYODWUBE4t1MJpCwsICbxNJNS9hAbBYBVYk5Oz6AlfMKOEjM/DQZ6gwFiStX\r
48         5rFMYORdwMiwilE2JbdKNzcxM6c4NVm3ODkxLy+1SNdELzezRC81pXQTIzgMJPl3MH47qHSI\r
49         UYCDUYmHd6ETt58Qa2JZcWXuIUZJDiYlUV6vtUAhvqT8lMqMxOKM+KLSnNTiQ4wSHMxKIrwV\r
50         rkA53pTEyqrUonyYlDQHi5I4b7n3f18hgfTEktTs1NSC1CKYrAwHh5IErw/IUMGi1PTUirTM\r
51         nBKENBMHJ8hwHqDhNSA1vMUFibnFmekQ+VOMuhwLNj49zCjEkpeflyolzjsVpEgApCijNA9u\r
52         Dix+XzGKA70lzFsLUsUDjH24Sa+AljABLbkQxQWypCQRISXVwCh3pvQpz90SBR4xjfB/+Yz9\r
53         L+y1WGeeX3+7/ovP36Tpn2RO6K0vrMn+EiJquefYA4GXPm8aPm2aJri9U42l9pn74pkL88w8\r
54         Ygr/JB4/EJzkt7px32r9Be8uzZsmls066/PdpGQG+8j4/UJ3og7OfZb+XH+73EVtfz7V5tqc\r
55         EpEWrR8N/w667VViKc5INNRiLipOBADdFo8rugIAAA==\r
56 Cc: amdragon@mit.edu\r
57 X-BeenThere: notmuch@notmuchmail.org\r
58 X-Mailman-Version: 2.1.13\r
59 Precedence: list\r
60 List-Id: "Use and development of the notmuch mail system."\r
61         <notmuch.notmuchmail.org>\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
65 List-Post: <mailto:notmuch@notmuchmail.org>\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
68         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
69 X-List-Received-Date: Wed, 29 Jun 2011 23:00:07 -0000\r
70 \r
71 Currently, notmuch new assumes any directory with a database mtime of\r
72 0 is new, but we don't set the mtime until after processing messages\r
73 and subdirectories in that directory.  Hence, anything that prevents\r
74 the mtime update (such as an interruption or the wall-clock logic\r
75 introduced in 8c39e8d6) will cause the next notmuch new to think the\r
76 directory is still new.\r
77 \r
78 We work around this by setting the new directory's database mtime to\r
79 -1 before scanning anything in the new directory.  This also obviates\r
80 the need for the workaround used in 8c39e8d6.\r
81 ---\r
82  notmuch-new.c |   31 ++++++++++++++++++++-----------\r
83  1 files changed, 20 insertions(+), 11 deletions(-)\r
84 \r
85 diff --git a/notmuch-new.c b/notmuch-new.c\r
86 index c180591..7d17793 100644\r
87 --- a/notmuch-new.c\r
88 +++ b/notmuch-new.c\r
89 @@ -256,6 +256,25 @@ add_files_recursive (notmuch_database_t *notmuch,\r
90  \r
91      new_directory = db_mtime ? FALSE : TRUE;\r
92  \r
93 +    /* XXX This is a temporary workaround.  If we don't update the\r
94 +     * database mtime until after processing messages in this\r
95 +     * directory, then a 0 mtime is *not* sufficient to indicate that\r
96 +     * this directory has no messages or subdirs in the database (for\r
97 +     * example, if an earlier run skipped the mtime update because\r
98 +     * fs_mtime == stat_time, or was interrupted before updating the\r
99 +     * mtime at the end).  To address this, we record a (bogus)\r
100 +     * non-zero value before processing any child messages so that a\r
101 +     * later run won't mistake this for a new directory (and, for\r
102 +     * example, fail to detect removed files and subdirs).\r
103 +     *\r
104 +     * A better solution would be for notmuch_database_get_directory\r
105 +     * to indicate if it really created a new directory or not, either\r
106 +     * by a new out-argument, or by recording this information and\r
107 +     * providing an accessor.\r
108 +     */\r
109 +    if (new_directory)\r
110 +       notmuch_directory_set_mtime (directory, -1);\r
111 +\r
112      /* If the database knows about this directory, then we sort based\r
113       * on strcmp to match the database sorting. Otherwise, we can do\r
114       * inode-based sorting for faster filesystem operation. */\r
115 @@ -516,17 +535,7 @@ add_files_recursive (notmuch_database_t *notmuch,\r
116       * when we stat'ed the directory, we skip updating the mtime in\r
117       * the database because a message could be delivered later in this\r
118       * same second.  This may lead to unnecessary re-scans, but it\r
119 -     * avoids overlooking messages.\r
120 -     *\r
121 -     * XXX Bug workaround: If this is a new directory, we *must*\r
122 -     * update the mtime; otherwise the next run will see the 0 mtime\r
123 -     * and think this is still a new directory containing no files or\r
124 -     * subdirs (which is unsound in general).  If fs_mtime ==\r
125 -     * stat_time, we set the database mtime to a bogus (but non-zero!)\r
126 -     * value to force a rescan.\r
127 -     */\r
128 -    if (new_directory && fs_mtime == stat_time)\r
129 -       fs_mtime = 1;\r
130 +     * avoids overlooking messages. */\r
131      if (! interrupted && fs_mtime != stat_time) {\r
132         status = notmuch_directory_set_mtime (directory, fs_mtime);\r
133         if (status && ret == NOTMUCH_STATUS_SUCCESS)\r
134 -- \r
135 1.7.5.1\r
136 \r