Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 47 / 7b60a6e989d6a1c87be8986c53c38064d96f91
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 0BEFC431FC3\r
6         for <notmuch@notmuchmail.org>; Sat,  8 Jun 2013 21:46:13 -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 6IXH3G8+abBO for <notmuch@notmuchmail.org>;\r
16         Sat,  8 Jun 2013 21:46:07 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-6.mit.edu (dmz-mailsec-scanner-6.mit.edu\r
18         [18.7.68.35])\r
19         by olra.theworths.org (Postfix) with ESMTP id B83A0431FB6\r
20         for <notmuch@notmuchmail.org>; Sat,  8 Jun 2013 21:46:01 -0700 (PDT)\r
21 X-AuditID: 12074423-b7f546d0000040c3-59-51b408899ae5\r
22 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
23         by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id F7.EE.16579.98804B15; Sun,  9 Jun 2013 00:46:01 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
26         by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id r594joEU004331; \r
27         Sun, 9 Jun 2013 00:45:50 -0400\r
28 Received: from drake.dyndns.org\r
29         (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
30         [216.15.114.40]) (authenticated bits=0)\r
31         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
32         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r594jmcS009514\r
33         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
34         Sun, 9 Jun 2013 00:45:50 -0400\r
35 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
36         (envelope-from <amdragon@mit.edu>)\r
37         id 1UlXVk-0003wW-Ie; Sun, 09 Jun 2013 00:45:48 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH 2/2] emacs: Fix "no such file or directory" error\r
41 Date: Sun,  9 Jun 2013 00:45:38 -0400\r
42 Message-Id: <1370753138-15021-3-git-send-email-amdragon@mit.edu>\r
43 X-Mailer: git-send-email 1.7.10.4\r
44 In-Reply-To: <1370753138-15021-1-git-send-email-amdragon@mit.edu>\r
45 References: <1370753138-15021-1-git-send-email-amdragon@mit.edu>\r
46 X-Brightmail-Tracker:\r
47  H4sIAAAAAAAAA+NgFjrMIsWRmVeSWpSXmKPExsUixCmqrdvJsSXQ4NVGcYs9+7wsrt+cyezA\r
48         5HH3NJfHs1W3mAOYorhsUlJzMstSi/TtErgy3nRNZCpYJFaxcfo8pgbGyUJdjJwcEgImEl2L\r
49         GtkhbDGJC/fWs3UxcnEICexjlPi3ZzsrSEJIYAOjxM/nWhD2bSaJk3esIIrmMkrMPPcTrJtN\r
50         QENi2/7ljCC2iIC0xM67s4GaOTiYBZwk2tq8QMLCAo4SC2edBAuzCKhK9HytAQnzCjhIXDv4\r
51         E+oGRYnuZxPYQGxOoPK270+YQcqFgGr6u9wnMPIvYGRYxSibklulm5uYmVOcmqxbnJyYl5da\r
52         pGuml5tZopeaUrqJERQ+7C7KOxj/HFQ6xCjAwajEwyuwbnOgEGtiWXFl7iFGSQ4mJVHeFQxb\r
53         AoX4kvJTKjMSizPii0pzUosPMUpwMCuJ8F46D1TOm5JYWZValA+TkuZgURLnvZZy019IID2x\r
54         JDU7NbUgtQgmK8PBoSTB28gONFSwKDU9tSItM6cEIc3EwQkynAdo+GSQGt7igsTc4sx0iPwp\r
55         Rl2Ozecnv2MUYsnLz0uVEuctAikSACnKKM2DmwOL+1eM4kBvCUOM4gGmDLhJr4CWMAEtmf5q\r
56         A8iSkkSElFQD41ljaZOrjRy1xhc/f6jiv9Z9zWxaP+O9m+8nXHpl1tJydG+45SNH0cNXnqYU\r
57         Hdrqu+9FWKjvsR/36r/EJMvLBp8IujpFKX/5gsAPqTKBO1vnBcved2aarvL54k+vRc7P8zZX\r
58         K3yc8eLimm/+LRtFHwtppvAsf5BR9G7Jj+SFFySuHtmn4thbukqJpTgj0VCLuag4EQCjJdc+\r
59         1gIAAA==\r
60 X-BeenThere: notmuch@notmuchmail.org\r
61 X-Mailman-Version: 2.1.13\r
62 Precedence: list\r
63 List-Id: "Use and development of the notmuch mail system."\r
64         <notmuch.notmuchmail.org>\r
65 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
66         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
67 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
68 List-Post: <mailto:notmuch@notmuchmail.org>\r
69 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
70 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
71         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
72 X-List-Received-Date: Sun, 09 Jun 2013 04:46:13 -0000\r
73 \r
74 Occasionally, when the user killed the search buffer when the CLI\r
75 process was still running, Emacs would run the\r
76 notmuch-start-notmuch-sentinel sentinel twice.  The first call would\r
77 process and delete the error output file and the second would fail\r
78 with an "Opening input file: no such file or directory, ..." error\r
79 when attempting to access the error file.\r
80 \r
81 Emacs isn't supposed to run the sentinel twice.  The reason it does is\r
82 rather subtle (and probably a bug in Emacs):\r
83 \r
84 1) When the user kills the search buffer, Emacs invokes\r
85 kill_buffer_processes, which sends a SIGHUP to notmuch, but doesn't do\r
86 anything else.  Meanwhile, suppose the notmuch search process has\r
87 printed some more output, but Emacs hasn't consumed it yet (this is\r
88 critical and is why this error only happens sometimes).\r
89 \r
90 2) Emacs gets a SIGCHLD from the dying notmuch process, which invokes\r
91 handle_child_signal, which sets the new process status, but can't do\r
92 anything else because it's a signal handler.\r
93 \r
94 3) Emacs returns to its idle loop, which calls status_notify, which\r
95 sees that the notmuch process has a new status.  This is where things\r
96 get interesting.\r
97 \r
98 3.1) Emacs guarantees that it will run process filters on any\r
99 unconsumed output before running the process sentinel, so\r
100 status_notify calls read_process_output, which consumes the final\r
101 output and calls notmuch-search-process-filter.\r
102 \r
103 3.1.1) notmuch-search-process-filter checks if the search buffer is\r
104 still alive and, since it's not, it calls delete-process.\r
105 \r
106 3.1.1.1) delete-process correctly sees that the process is already\r
107 dead and doesn't try to send another signal, *but* it still modifies\r
108 the status to "killed".  To deal with the new status, it calls\r
109 status_notify.  Dun dun dun.  We've seen this function before.\r
110 \r
111 3.1.1.1.1) The *recursive* status_notify invocation sees that the\r
112 process has a new status and doesn't have any more output to consume,\r
113 so it invokes our sentinel and returns.\r
114 \r
115 3.2) The outer status_notify call (which we're still in) is now done\r
116 flushing pending process output, so it *also* invokes our sentinel.\r
117 \r
118 This patch addresses this problem at step 3.1.1, where the filter\r
119 calls delete-process, since this is a strange and redundant thing to\r
120 do anyway.\r
121 ---\r
122  emacs/notmuch.el |    3 +--\r
123  1 file changed, 1 insertion(+), 2 deletions(-)\r
124 \r
125 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
126 index 7994d74..a9949a1 100644\r
127 --- a/emacs/notmuch.el\r
128 +++ b/emacs/notmuch.el\r
129 @@ -821,8 +821,7 @@ non-authors is found, assume that all of the authors match."\r
130         (parse-buf (process-get proc 'parse-buf))\r
131         (inhibit-read-only t)\r
132         done)\r
133 -    (if (not (buffer-live-p results-buf))\r
134 -       (delete-process proc)\r
135 +    (when (buffer-live-p results-buf)\r
136        (with-current-buffer parse-buf\r
137         ;; Insert new data\r
138         (save-excursion\r
139 -- \r
140 1.7.10.4\r
141 \r