Re: BUG: bad notmuch shared library install_name on Mac OS X
[notmuch-archives.git] / a8 / 445bc22d263fda9bdb60d28d775655516df88f
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 2F5A4429E40\r
6         for <notmuch@notmuchmail.org>; Fri, 31 May 2013 17:40:30 -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 du3bUaL87RbX for <notmuch@notmuchmail.org>;\r
16         Fri, 31 May 2013 17:40:23 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-8.mit.edu (dmz-mailsec-scanner-8.mit.edu\r
18         [18.7.68.37])\r
19         by olra.theworths.org (Postfix) with ESMTP id 47DF4429E27\r
20         for <notmuch@notmuchmail.org>; Fri, 31 May 2013 17:40:17 -0700 (PDT)\r
21 X-AuditID: 12074425-b7f986d00000082c-e9-51a942ee8c97\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
23         by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id D4.F3.02092.EE249A15; Fri, 31 May 2013 20:40:14 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
26         by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id r510eDCU008172; \r
27         Fri, 31 May 2013 20:40:13 -0400\r
28 Received: from drake.dyndns.org (c-76-21-105-205.hsd1.ca.comcast.net\r
29         [76.21.105.205]) (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r510eAIl020943\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Fri, 31 May 2013 20:40:12 -0400\r
34 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1UiZrd-0003QT-FN; Fri, 31 May 2013 20:40:09 -0400\r
37 From: Austin Clements <amdragon@MIT.EDU>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH v3 3/6] emacs: Use async process helper for search\r
40 Date: Fri, 31 May 2013 20:40:05 -0400\r
41 Message-Id: <1370047208-12785-4-git-send-email-amdragon@mit.edu>\r
42 X-Mailer: git-send-email 1.7.10.4\r
43 In-Reply-To: <1370047208-12785-1-git-send-email-amdragon@mit.edu>\r
44 References: <1370047208-12785-1-git-send-email-amdragon@mit.edu>\r
45 X-Brightmail-Tracker:\r
46  H4sIAAAAAAAAA+NgFjrGIsWRmVeSWpSXmKPExsUixCmqrPvOaWWgwfEX1har5/JYXL85k9ni\r
47         zcp5rA7MHjtn3WX3OPx1IYvHs1W3mAOYo7hsUlJzMstSi/TtErgy7v5YzF4wW7niwreHrA2M\r
48         t6W7GDk5JARMJL5+7mKHsMUkLtxbz9bFyMUhJLCPUeLPtCdgCSGBjYwSr2Y4QCROM0ksuviJ\r
49         CcKZyyhxYvMXJpAqNgENiW37lzOC2CIC0hI7785mBbGZBeIktkz5DxYXFnCSuLBvIjOIzSKg\r
50         KnGquwXM5hVwkHg0ZTorxBmKEt3PJrCB2JwCjhLnr/5jhrjCQeLxiZPMExj5FzAyrGKUTcmt\r
51         0s1NzMwpTk3WLU5OzMtLLdK10MvNLNFLTSndxAgKLnYX1R2MEw4pHWIU4GBU4uE1WLEiUIg1\r
52         say4MvcQoyQHk5Io72zHlYFCfEn5KZUZicUZ8UWlOanFhxglOJiVRHjz5wCV86YkVlalFuXD\r
53         pKQ5WJTEeW+k3PQXEkhPLEnNTk0tSC2CycpwcChJ8L4EGSpYlJqeWpGWmVOCkGbi4AQZzgM0\r
54         /BxIDW9xQWJucWY6RP4Uo6KUOC8/MH6FBEASGaV5cL2w6H/FKA70ijDvBZB2HmDigOt+BTSY\r
55         CWjwE+vlIINLEhFSUg2MzoJHK5TtNb88WJkzY8fduVyaKXtWJIjuYFqQkMfnNjFSboOWpd2B\r
56         6mmWDv0umy++WHz7uHe71w+bgldMtcvZC26yi7BeP3lv+r47Xabvf6Ru7VZ9/sT1zKLJqdMf\r
57         bQi03bmpb8nLwF0VCxP93rUmuZje2212tSetPaCtS9WeKW3RwwWZ6YcVlViKMxINtZiLihMB\r
58         ZQWsL9kCAAA=\r
59 Cc: tomi.ollila@iki.fi\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: Sat, 01 Jun 2013 00:40:30 -0000\r
73 \r
74 Previously, search started the async notmuch process directly.  Now,\r
75 it uses `notmuch-start-notmuch'.  This simplifies the process sentinel\r
76 a bit and means that we no longer have to worry about errors\r
77 interleaved with the JSON output.\r
78 \r
79 We also update the tests of Emacs error handling, since the error\r
80 output is now separated from the search results buffer.\r
81 ---\r
82  emacs/notmuch.el |   19 +++++--------------\r
83  test/emacs       |   36 ++++++++++++++++++++++++++++++++----\r
84  2 files changed, 37 insertions(+), 18 deletions(-)\r
85 \r
86 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
87 index 4c1a6ca..b8d9c44 100644\r
88 --- a/emacs/notmuch.el\r
89 +++ b/emacs/notmuch.el\r
90 @@ -653,15 +653,8 @@ of the result."\r
91                     ;; For version mismatch, there's no point in\r
92                     ;; showing the search buffer\r
93                     (when (or (= exit-status 20) (= exit-status 21))\r
94 -                     (kill-buffer))\r
95 -                   (condition-case err\r
96 -                       (notmuch-check-async-exit-status proc msg)\r
97 -                     ;; Suppress the error signal since strange\r
98 -                     ;; things happen if a sentinel signals.  Mimic\r
99 -                     ;; the top-level's handling of error messages.\r
100 -                     (error\r
101 -                      (message "%s" (error-message-string err))\r
102 -                      (throw 'return nil)))\r
103 +                     (kill-buffer)\r
104 +                     (throw 'return nil))\r
105                     (if (and atbob\r
106                              (not (string= notmuch-search-target-thread "found")))\r
107                         (set 'never-found-target-thread t)))))\r
108 @@ -938,10 +931,9 @@ Other optional parameters are used as follows:\r
109        (erase-buffer)\r
110        (goto-char (point-min))\r
111        (save-excursion\r
112 -       (let ((proc (start-process\r
113 -                    "notmuch-search" buffer\r
114 -                    notmuch-command "search"\r
115 -                    "--format=json" "--format-version=1"\r
116 +       (let ((proc (notmuch-start-notmuch\r
117 +                    "notmuch-search" buffer #'notmuch-search-process-sentinel\r
118 +                    "search" "--format=json" "--format-version=1"\r
119                      (if oldest-first\r
120                          "--sort=oldest-first"\r
121                        "--sort=newest-first")\r
122 @@ -951,7 +943,6 @@ Other optional parameters are used as follows:\r
123               ;; should be called no matter how the process dies.\r
124               (parse-buf (generate-new-buffer " *notmuch search parse*")))\r
125           (process-put proc 'parse-buf parse-buf)\r
126 -         (set-process-sentinel proc 'notmuch-search-process-sentinel)\r
127           (set-process-filter proc 'notmuch-search-process-filter)\r
128           (set-process-query-on-exit-flag proc nil))))\r
129      (run-hooks 'notmuch-search-hook)))\r
130 diff --git a/test/emacs b/test/emacs\r
131 index f033bdf..d38ae8c 100755\r
132 --- a/test/emacs\r
133 +++ b/test/emacs\r
134 @@ -853,11 +853,10 @@ test_expect_success "Rendering HTML mail with images" \\r
135      'cat OUTPUT && grep -q smiley OUTPUT'\r
136  \r
137  \r
138 -test_begin_subtest "Search handles subprocess errors"\r
139 +test_begin_subtest "Search handles subprocess error exit codes"\r
140  cat > notmuch_fail <<EOF\r
141  #!/bin/sh\r
142  echo This is output\r
143 -echo This is an error >&2\r
144  exit 1\r
145  EOF\r
146  chmod a+x notmuch_fail\r
147 @@ -874,8 +873,6 @@ sed -i -e 's/^\[.*\]$/[XXX]/' ERROR\r
148  test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\\r
149  Error: Unexpected output from notmuch search:\r
150  This is output\r
151 -Error: Unexpected output from notmuch search:\r
152 -This is an error\r
153  End of search results.\r
154  ---\r
155  $PWD/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)\r
156 @@ -885,4 +882,35 @@ $PWD/notmuch_fail exited with status 1\r
157  command: $PWD/notmuch_fail search --format\=json --format-version\=1 --sort\=newest-first tag\:inbox\r
158  exit status: 1"\r
159  \r
160 +test_begin_subtest "Search handles subprocess warnings"\r
161 +cat > notmuch_fail <<EOF\r
162 +#!/bin/sh\r
163 +echo This is output\r
164 +echo This is a warning >&2\r
165 +echo This is another warning >&2\r
166 +exit 0\r
167 +EOF\r
168 +chmod a+x notmuch_fail\r
169 +test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))\r
170 +              (with-current-buffer \"*Messages*\" (erase-buffer))\r
171 +              (with-current-buffer \"*Notmuch errors*\" (erase-buffer))\r
172 +              (notmuch-search \"tag:inbox\")\r
173 +              (notmuch-test-wait)\r
174 +              (with-current-buffer \"*Messages*\"\r
175 +                 (test-output \"MESSAGES\"))\r
176 +              (with-current-buffer \"*Notmuch errors*\"\r
177 +                 (test-output \"ERROR\"))\r
178 +              (test-output))"\r
179 +sed -i -e 's/^\[.*\]$/[XXX]/' ERROR\r
180 +test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\\r
181 +Error: Unexpected output from notmuch search:\r
182 +This is output\r
183 +End of search results.\r
184 +---\r
185 +This is a warning (see *Notmuch errors* for more details)\r
186 +---\r
187 +[XXX]\r
188 +This is a warning\r
189 +This is another warning"\r
190 +\r
191  test_done\r
192 -- \r
193 1.7.10.4\r
194 \r