[PATCH] avoid segfault when calling sanitize_string() on NULL
--- notmuch-search.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/notmuch-search.c b/notmuch-search.c index 794b145..26b24eb 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -116,6 +116,9 @@ sanitize_string (const void *ctx, const char *str) { char *out, *loop; +if (NULL == str) + return NULL; + loop = out = talloc_strdup (ctx, str); for (; *loop; loop++) { -- 1.7.4.4
[PATCH] test: use `princ' instead of `message' calls in emacs tests
The patch replaces all (message (buffer-string)) calls in emacs tests with (princ (buffer-string)). This avoids accidentally interpreting '%' as format specifiers and makes code simpler because we do not need to capture stderr. Also, the patch works around an Emacs (23.3+1-1 on current Debian Unstable) segfault in "Ensure that emacs doesn't drop results" test. Note: the segfault does not happen on every test run. Though, it seems to be consistently reproducible if the test uses 300 messages instead of 30. Hopefully, it is the crash described in Emacs bug #8545 [1] which is already fixed. [1] http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8545 --- The patch applies to the release-candidate/0.6 branch. This is a rewrite of id:"1305006007-26445-1-git-send-email-dmitry.kurochkin at gmail.com" following Austin's suggestion. Regards, Dmitry test/emacs | 18 +- test/emacs-large-search-buffer |5 +++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/test/emacs b/test/emacs index b376033..2e85b0c 100755 --- a/test/emacs +++ b/test/emacs @@ -7,38 +7,38 @@ EXPECTED=../emacs.expected-output add_email_corpus test_begin_subtest "Basic notmuch-hello view in emacs" -output=$(test_emacs '(notmuch-hello) (message (buffer-string))' 2>&1) +output=$(test_emacs '(notmuch-hello) (princ (buffer-string))') expected=$(cat $EXPECTED/notmuch-hello) test_expect_equal "$output" "$expected" test_begin_subtest "Saved search with 0 results" -output=$(test_emacs '(setq notmuch-show-empty-saved-searches t) (setq notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . "tag:unread") ("empty" . "tag:doesnotexist"))) (notmuch-hello) (message (buffer-string))' 2>&1) +output=$(test_emacs '(setq notmuch-show-empty-saved-searches t) (setq notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . "tag:unread") ("empty" . "tag:doesnotexist"))) (notmuch-hello) (princ (buffer-string))') expected=$(cat $EXPECTED/notmuch-hello-with-empty) test_expect_equal "$output" "$expected" test_begin_subtest "No saved searches displayed (all with 0 results)" -output=$(test_emacs '(setq notmuch-saved-searches '\''(("empty" . "tag:doesnotexist"))) (notmuch-hello) (message (buffer-string))' 2>&1) +output=$(test_emacs '(setq notmuch-saved-searches '\''(("empty" . "tag:doesnotexist"))) (notmuch-hello) (princ (buffer-string))') expected=$(cat $EXPECTED/notmuch-hello-no-saved-searches) test_expect_equal "$output" "$expected" test_begin_subtest "Basic notmuch-search view in emacs" -output=$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (message (buffer-string))' 2>&1) +output=$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (princ (buffer-string))') expected=$(cat $EXPECTED/notmuch-search-tag-inbox) test_expect_equal "$output" "$expected" test_begin_subtest "Navigation of notmuch-hello to search results" -output=$(test_emacs '(notmuch-hello) (goto-char (point-min)) (re-search-forward "inbox") (widget-button-press (point)) (notmuch-test-wait) (message (buffer-string))' 2>&1) +output=$(test_emacs '(notmuch-hello) (goto-char (point-min)) (re-search-forward "inbox") (widget-button-press (point)) (notmuch-test-wait) (princ (buffer-string))') expected=$(cat $EXPECTED/notmuch-hello-view-inbox) test_expect_equal "$output" "$expected" test_begin_subtest "Basic notmuch-show view in emacs" maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165 at dottiness.seas.harvard.edu) -output=$(test_emacs "(notmuch-show \"$maildir_storage_thread\") (message (buffer-string))" 2>&1) +output=$(test_emacs "(notmuch-show \"$maildir_storage_thread\") (princ (buffer-string))") expected=$(cat $EXPECTED/notmuch-show-thread-maildir-storage) test_expect_equal "$output" "$expected" test_begin_subtest "Navigation of notmuch-search to thread view" -output=$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (goto-char (point-min)) (re-search-forward "Working with Maildir") (notmuch-search-show-thread) (notmuch-test-wait) (message (buffer-string))' 2>&1) +output=$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (goto-char (point-min)) (re-search-forward "Working with Maildir") (notmuch-search-show-thread) (notmuch-test-wait) (princ (buffer-string))') test_expect_equal "$output" "$expected" test_begin_subtest "Add tag from search view" @@ -102,7 +102,7 @@ test_expect_equal "$output" "thread:XXX 1974-03-29 [1/1] Notmuch Test Suite; T test_begin_subtest "Reply within emacs" # We sed away everything before the ^From in the output to avoid getting # confused by messages such as "Parsing /home/cworth/.mailrc... done" -output=$(test_emacs '(notmuch-search "subject:\"testing message sent via SMTP\"") (notmuch-test-wait) (notmuch-search-reply-to-thread) (message (buffer-string))' 2>&1 | sed -ne '/^From/,$ p' | sed -e 's/^In-Reply-To: <.*>$/In-Reply-To: /') +output=$(test_emacs '(notmuch-search
[PATCH] test: add "%s" format string to all `message' calls in emacs tests
On Tue, 10 May 2011 01:47:17 -0400, Austin Clements wrote: > This looks good to me (and is certainly more correct), but seems > rather roundabout. Is there a reason this code doesn't simply (princ > (buffer-string))? > Thanks, Austin! I am, unfortunately, not an Emacs Lisp expert. I did not know about princ, so I improved what we had :) Princ seems to work fine. And certainly looks cleaner than using message and capturing stderr. It also fixes the segfault. I will send another patch that uses princ instead of message. Regards, Dmitry > On Tue, May 10, 2011 at 1:40 AM, Dmitry Kurochkin > wrote: > > The patch replaces all (message (buffer-string)) calls in emacs > > tests with (message "%s" (buffer-string)). ?This works around an > > Emacs (23.3+1-1 on current Debian Unstable) segfault in "Ensure > > that emacs doesn't drop results" test. ?Note: the segfault does > > not happen on every test run. ?Though, it seems to be > > consistently reproducible if the test uses 300 messages instead > > of 30. ?Hopefully, it is the crash described in Emacs bug #8545 > > [1] which is already fixed. > > > > Also, the patch makes the code more correct - we want to avoid > > accidentally interpreting '%' as format specifiers. > > > > [1] http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8545 > > --- > > > > The patch applies to the release-candidate/0.6 branch. > > > > Regards, > > ?Dmitry > > > > > > ?test/emacs ? ? ? ? ? ? ? ? ? ? | ? 18 +- > > ?test/emacs-large-search-buffer | ? ?5 +++-- > > ?2 files changed, 12 insertions(+), 11 deletions(-) > > > > diff --git a/test/emacs b/test/emacs > > index b376033..5b39423 100755 > > --- a/test/emacs > > +++ b/test/emacs > > @@ -7,38 +7,38 @@ EXPECTED=../emacs.expected-output > > ?add_email_corpus > > > > ?test_begin_subtest "Basic notmuch-hello view in emacs" > > -output=$(test_emacs '(notmuch-hello) (message (buffer-string))' 2>&1) > > +output=$(test_emacs '(notmuch-hello) (message "%s" (buffer-string))' 2>&1) > > ?expected=$(cat $EXPECTED/notmuch-hello) > > ?test_expect_equal "$output" "$expected" > > > > ?test_begin_subtest "Saved search with 0 results" > > -output=$(test_emacs '(setq notmuch-show-empty-saved-searches t) (setq > > notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . > > "tag:unread") ("empty" . "tag:doesnotexist"))) (notmuch-hello) (message > > (buffer-string))' 2>&1) > > +output=$(test_emacs '(setq notmuch-show-empty-saved-searches t) (setq > > notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . > > "tag:unread") ("empty" . "tag:doesnotexist"))) (notmuch-hello) (message > > "%s" (buffer-string))' 2>&1) > > ?expected=$(cat $EXPECTED/notmuch-hello-with-empty) > > ?test_expect_equal "$output" "$expected" > > > > ?test_begin_subtest "No saved searches displayed (all with 0 results)" > > -output=$(test_emacs '(setq notmuch-saved-searches '\''(("empty" . > > "tag:doesnotexist"))) (notmuch-hello) (message (buffer-string))' 2>&1) > > +output=$(test_emacs '(setq notmuch-saved-searches '\''(("empty" . > > "tag:doesnotexist"))) (notmuch-hello) (message "%s" (buffer-string))' 2>&1) > > ?expected=$(cat $EXPECTED/notmuch-hello-no-saved-searches) > > ?test_expect_equal "$output" "$expected" > > > > ?test_begin_subtest "Basic notmuch-search view in emacs" > > -output=$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) > > (message (buffer-string))' 2>&1) > > +output=$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) > > (message "%s" (buffer-string))' 2>&1) > > ?expected=$(cat $EXPECTED/notmuch-search-tag-inbox) > > ?test_expect_equal "$output" "$expected" > > > > ?test_begin_subtest "Navigation of notmuch-hello to search results" > > -output=$(test_emacs '(notmuch-hello) (goto-char (point-min)) > > (re-search-forward "inbox") (widget-button-press (point)) > > (notmuch-test-wait) (message (buffer-string))' 2>&1) > > +output=$(test_emacs '(notmuch-hello) (goto-char (point-min)) > > (re-search-forward "inbox") (widget-button-press (point)) > > (notmuch-test-wait) (message "%s" (buffer-string))' 2>&1) > > ?expected=$(cat $EXPECTED/notmuch-hello-view-inbox) > > ?test_expect_equal "$output" "$expected" > > > > ?test_begin_subtest "Basic notmuch-show view in emacs" > > ?maildir_storage_thread=$(notmuch search --output=threads > > id:20091117190054.GU3165 at dottiness.seas.harvard.edu) > > -output=$(test_emacs "(notmuch-show \"$maildir_storage_thread\") (message > > (buffer-string))" 2>&1) > > +output=$(test_emacs "(notmuch-show \"$maildir_storage_thread\") (message > > \"%s\" (buffer-string))" 2>&1) > > ?expected=$(cat $EXPECTED/notmuch-show-thread-maildir-storage) > > ?test_expect_equal "$output" "$expected" > > > > ?test_begin_subtest "Navigation of notmuch-search to thread view" > > -output=$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) > > (goto-char (point-min)) (re-search-forward "Working with Maildir") > > (notmuch-search-show-thread) (notmuch-test-wait) (message
release-candidate/0.6
Arg. One last bit of churn. dkg found a bug in the new sanitize_string function that was causing segfaults on messages with empty headers. This is obviously an imprtant thing to fix. After chatting with some folks on #notmuch, we decided that the debian build dependency on libgmime 2.4.24 is a bit too extreme, particularly since it will actually prevent the package from being uploaded to debian. I therefore rolled-back the stricter build dependency. A new version of release-candidate/0.6 is pushed. jamie. [0] git://finestructure.net/notmuch release-candidate/0.6 aac1936bc9f878bd9ad2e097c5a686e146b73143 -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 835 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20110510/d2eb6b6a/attachment.pgp>
[PATCH] test: add "%s" format string to all `message' calls in emacs tests
The patch replaces all (message (buffer-string)) calls in emacs tests with (message "%s" (buffer-string)). This works around an Emacs (23.3+1-1 on current Debian Unstable) segfault in "Ensure that emacs doesn't drop results" test. Note: the segfault does not happen on every test run. Though, it seems to be consistently reproducible if the test uses 300 messages instead of 30. Hopefully, it is the crash described in Emacs bug #8545 [1] which is already fixed. Also, the patch makes the code more correct - we want to avoid accidentally interpreting '%' as format specifiers. [1] http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8545 --- The patch applies to the release-candidate/0.6 branch. Regards, Dmitry test/emacs | 18 +- test/emacs-large-search-buffer |5 +++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/test/emacs b/test/emacs index b376033..5b39423 100755 --- a/test/emacs +++ b/test/emacs @@ -7,38 +7,38 @@ EXPECTED=../emacs.expected-output add_email_corpus test_begin_subtest "Basic notmuch-hello view in emacs" -output=$(test_emacs '(notmuch-hello) (message (buffer-string))' 2>&1) +output=$(test_emacs '(notmuch-hello) (message "%s" (buffer-string))' 2>&1) expected=$(cat $EXPECTED/notmuch-hello) test_expect_equal "$output" "$expected" test_begin_subtest "Saved search with 0 results" -output=$(test_emacs '(setq notmuch-show-empty-saved-searches t) (setq notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . "tag:unread") ("empty" . "tag:doesnotexist"))) (notmuch-hello) (message (buffer-string))' 2>&1) +output=$(test_emacs '(setq notmuch-show-empty-saved-searches t) (setq notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . "tag:unread") ("empty" . "tag:doesnotexist"))) (notmuch-hello) (message "%s" (buffer-string))' 2>&1) expected=$(cat $EXPECTED/notmuch-hello-with-empty) test_expect_equal "$output" "$expected" test_begin_subtest "No saved searches displayed (all with 0 results)" -output=$(test_emacs '(setq notmuch-saved-searches '\''(("empty" . "tag:doesnotexist"))) (notmuch-hello) (message (buffer-string))' 2>&1) +output=$(test_emacs '(setq notmuch-saved-searches '\''(("empty" . "tag:doesnotexist"))) (notmuch-hello) (message "%s" (buffer-string))' 2>&1) expected=$(cat $EXPECTED/notmuch-hello-no-saved-searches) test_expect_equal "$output" "$expected" test_begin_subtest "Basic notmuch-search view in emacs" -output=$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (message (buffer-string))' 2>&1) +output=$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (message "%s" (buffer-string))' 2>&1) expected=$(cat $EXPECTED/notmuch-search-tag-inbox) test_expect_equal "$output" "$expected" test_begin_subtest "Navigation of notmuch-hello to search results" -output=$(test_emacs '(notmuch-hello) (goto-char (point-min)) (re-search-forward "inbox") (widget-button-press (point)) (notmuch-test-wait) (message (buffer-string))' 2>&1) +output=$(test_emacs '(notmuch-hello) (goto-char (point-min)) (re-search-forward "inbox") (widget-button-press (point)) (notmuch-test-wait) (message "%s" (buffer-string))' 2>&1) expected=$(cat $EXPECTED/notmuch-hello-view-inbox) test_expect_equal "$output" "$expected" test_begin_subtest "Basic notmuch-show view in emacs" maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165 at dottiness.seas.harvard.edu) -output=$(test_emacs "(notmuch-show \"$maildir_storage_thread\") (message (buffer-string))" 2>&1) +output=$(test_emacs "(notmuch-show \"$maildir_storage_thread\") (message \"%s\" (buffer-string))" 2>&1) expected=$(cat $EXPECTED/notmuch-show-thread-maildir-storage) test_expect_equal "$output" "$expected" test_begin_subtest "Navigation of notmuch-search to thread view" -output=$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (goto-char (point-min)) (re-search-forward "Working with Maildir") (notmuch-search-show-thread) (notmuch-test-wait) (message (buffer-string))' 2>&1) +output=$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (goto-char (point-min)) (re-search-forward "Working with Maildir") (notmuch-search-show-thread) (notmuch-test-wait) (message "%s" (buffer-string))' 2>&1) test_expect_equal "$output" "$expected" test_begin_subtest "Add tag from search view" @@ -102,7 +102,7 @@ test_expect_equal "$output" "thread:XXX 1974-03-29 [1/1] Notmuch Test Suite; T test_begin_subtest "Reply within emacs" # We sed away everything before the ^From in the output to avoid getting # confused by messages such as "Parsing /home/cworth/.mailrc... done" -output=$(test_emacs '(notmuch-search "subject:\"testing message sent via SMTP\"") (notmuch-test-wait) (notmuch-search-reply-to-thread) (message (buffer-string))' 2>&1 | sed -ne '/^From/,$ p' | sed -e 's/^In-Reply-To: <.*>$/In-Reply-To: /') +output=$(test_emacs '(notmuch-search "subject:\"testing message sent via SMTP\"")
[PATCH] avoid segfault when calling sanitize_string() on NULL
Yikes! Thanks for finding this, dkg. I just pushed this to r-c/0.6. It looks like we need to expand the tests to test this corner case. jamie. -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 835 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20110510/d1439a9a/attachment.pgp>
[PATCH 2/2] test: add test for saving attachments using notmuch-show-save-part
Use .gz filenames for saved attachments in the tests to check that Emacs does not re-compress the file. Use test_expect_equal_file instead of test_expect_equal to avoid binary output on the console. --- test/emacs | 14 +- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/test/emacs b/test/emacs index 75dec89..b376033 100755 --- a/test/emacs +++ b/test/emacs @@ -112,11 +112,15 @@ Fcc: $(pwd)/mail/sent On Fri, 29 Mar 1974 10:00:00 -, Notmuch Test Suite wrote: > This is a test that messages are sent via SMTP" -test_begin_subtest "Save attachment from within emacs" -echo "./attachment" | test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at mail.gmail.com") (notmuch-show-save-attachments)' > /dev/null 2>&1 -output=$(cat attachment) -expected=$(cat $EXPECTED/attachment) -test_expect_equal "$output" "$expected" +test_begin_subtest "Save attachment from within emacs using notmuch-show-save-attachments" +# save as archive to test that Emacs does not re-compress .gz +echo ./attachment1.gz | test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at mail.gmail.com") (notmuch-show-save-attachments)' > /dev/null 2>&1 +test_expect_equal_file "$EXPECTED/attachment" attachment1.gz + +test_begin_subtest "Save attachment from within emacs using notmuch-show-save-part" +# save as archive to test that Emacs does not re-compress .gz +echo ./attachment2.gz | test_emacs '(notmuch-show-save-part "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at mail.gmail.com" 5)' > /dev/null 2>&1 +test_expect_equal_file "$EXPECTED/attachment" attachment2.gz test_begin_subtest "View raw message within emacs" expected=$(cat $EXPECTED/raw-message-cf0c4d-52ad0a) -- 1.7.5.1
[PATCH 1/2] test: copy files in test_expect_equal_file instead of moving them
Before the change, test_expect_equal_file moved files it compared in case of failure. The patch changes it to copy the files instead. This allows testing non-temporary files which are stored in git. Note: the change should not result in new temporary files left after the tests. Test_expect_equal_file used to move files only on failure, so callers had to cleanup them anyway. --- test/test-lib.sh |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test-lib.sh b/test/test-lib.sh index eaf5051..7cc43cd 100755 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -477,8 +477,8 @@ test_expect_equal_file () test_ok_ "$test_subtest_name" else testname=$this_test.$test_count - mv "$output" $testname.output - mv "$expected" $testname.expected + cp "$output" $testname.output + cp "$expected" $testname.expected test_failure_ "$test_subtest_name" "$(diff -u $testname.expected $testname.output)" fi fi -- 1.7.5.1
[PATCH v2 0/2] test: add test for saving attachments using notmuch-show-save-part
This is amended patch from id:"1304990689-10933-1-git-send-email-dmitry.kurochkin at gmail.com" to test saving attachments withing Emacs using notmuch-show-save-part. It uses test_expect_equal_file instead of test_expect_equal as suggested by Jameson. This patch is for the release-candidate/0.6 branch. Regards, Dmitry
[PATCH] test: saving attachments from within emacs using notmuch-show-save-part
--- Oops, the previos patch (id:"1304990327-8665-1-git-send-email-dmitry.kurochkin at gmail.com") has wrong title. s/notmuch-show-save-attachments/notmuch-show-save-part/ Regards, Dmitry test/emacs | 14 +++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/test/emacs b/test/emacs index 75dec89..675a887 100755 --- a/test/emacs +++ b/test/emacs @@ -112,9 +112,17 @@ Fcc: $(pwd)/mail/sent On Fri, 29 Mar 1974 10:00:00 -, Notmuch Test Suite wrote: > This is a test that messages are sent via SMTP" -test_begin_subtest "Save attachment from within emacs" -echo "./attachment" | test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at mail.gmail.com") (notmuch-show-save-attachments)' > /dev/null 2>&1 -output=$(cat attachment) +test_begin_subtest "Save attachment from within emacs using notmuch-show-save-attachments" +# save as archive to test that Emacs does not re-compress .gz +echo "./attachment1.gz" | test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at mail.gmail.com") (notmuch-show-save-attachments)' > /dev/null 2>&1 +output=$(cat attachment1.gz) +expected=$(cat $EXPECTED/attachment) +test_expect_equal "$output" "$expected" + +test_begin_subtest "Save attachment from within emacs using notmuch-show-save-part" +# save as archive to test that Emacs does not re-compress .gz +echo "./attachment2.gz" | test_emacs '(notmuch-show-save-part "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at mail.gmail.com" 5)' > /dev/null 2>&1 +output=$(cat attachment2.gz) expected=$(cat $EXPECTED/attachment) test_expect_equal "$output" "$expected" -- 1.7.5.1
[PATCH] test: saving attachments from within emacs using notmuch-show-save-attachments
--- test/emacs | 14 +++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/test/emacs b/test/emacs index 75dec89..675a887 100755 --- a/test/emacs +++ b/test/emacs @@ -112,9 +112,17 @@ Fcc: $(pwd)/mail/sent On Fri, 29 Mar 1974 10:00:00 -, Notmuch Test Suite wrote: > This is a test that messages are sent via SMTP" -test_begin_subtest "Save attachment from within emacs" -echo "./attachment" | test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at mail.gmail.com") (notmuch-show-save-attachments)' > /dev/null 2>&1 -output=$(cat attachment) +test_begin_subtest "Save attachment from within emacs using notmuch-show-save-attachments" +# save as archive to test that Emacs does not re-compress .gz +echo "./attachment1.gz" | test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at mail.gmail.com") (notmuch-show-save-attachments)' > /dev/null 2>&1 +output=$(cat attachment1.gz) +expected=$(cat $EXPECTED/attachment) +test_expect_equal "$output" "$expected" + +test_begin_subtest "Save attachment from within emacs using notmuch-show-save-part" +# save as archive to test that Emacs does not re-compress .gz +echo "./attachment2.gz" | test_emacs '(notmuch-show-save-part "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at mail.gmail.com" 5)' > /dev/null 2>&1 +output=$(cat attachment2.gz) expected=$(cat $EXPECTED/attachment) test_expect_equal "$output" "$expected" -- 1.7.5.1
[PATCH] Don't re-compress .gz & al. in notmuch-show-save-part.
Write-region handles some file names specially, see Emacs Lisp manual section 25.11 Making Certain File Names "Magic" [1]. This is a nice feature for normal text editing, but it is not desirable if we need to save raw file content (e.g. attachment). In particular, this affects archives and may result in corrupted attachments saved with notmuch-show-save-part (attachment button click handler). Turns out, smart GNUS folks encountered the same problem and implemented write-region wrapper which inhibits some file name handlers. In particular, this wrapper is used in mm-save-part, which is why notmuch-save-attachments that uses it works fine with archives. The patch replaces write-region with mm-write-region in notmuch-show-save-part. Also it removes coding-system-for-write and require-final-newline setting in notmuch-show-save-part. The former is set in mm-write-region. The latter seems to be unneeded because mm-save-part does not use it. [1] http://www.gnu.org/s/emacs/manual/html_node/elisp/Magic-File-Names.html --- This patch is for the release-candidate/0.6 branch. I know Jameson has declared it ready for release, but perhaps it is not too late for a small fix? Adding a test for this would be nice, but is a low priority for me. If anyone volunteers, that would be welcomed :) Regards, Dmitry emacs/notmuch-show.el |9 + 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 825988c..23291ce 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -306,10 +306,11 @@ message at DEPTH in the current thread." "Filename to save as: " (or mailcap-download-directory "~/") nil nil - filename)) - (require-final-newline nil) - (coding-system-for-write 'no-conversion)) - (write-region (point-min) (point-max) file) + filename))) + ;; Don't re-compress .gz & al. Arguably we should make + ;; `file-name-handler-alist' nil, but that would chop + ;; ange-ftp, which is reasonable to use here. + (mm-write-region (point-min) (point-max) file nil nil nil 'no-conversion t) (defun notmuch-show-mm-display-part-inline (msg part content-type content) "Use the mm-decode/mm-view functions to display a part in the -- 1.7.5.1
[PATCH] python/thread: always return a string in get_subject/authors
On Mon, 09 May 2011 09:20:41 -0300, David Bremner wrote: > On Mon, 9 May 2011 09:06:34 +0200, Anton Khirnov > wrote: > > Now None is returned when those don't exist, which is inconvenient to > > deal with. > > I'm not using the python bindings, but from a philosophical point of > view, this change makes me a bit uncomfortable since it apparently > merges two cases together, and makes an error (no Subject) > indistinguishable from an odd situation (Subject of empty string). > Or am I missing something here? Hi there, This change makes me a bit uncomfortable too. 3 Reasons: - I believe users should be able to distinguish the case when someone uses an empty subject, and when someone doesn't specify a subject at all. - People have been writing code and breaking backwards compatability for such a small gain doesn't really seem worth it. - Testing-wise this is easy. Just test for "if subject:" on the returned value and you'll get both cases (empty and non-existing). But if people really want it, I won't object. Sebastian -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20110510/ea8cf13e/attachment.pgp>
vim support improvements for 0.6
On Tue, 10 May 2011 01:30:11 +0300, Felipe Contreras wrote: > All right. Hopefully nobody will request further changes to these patches: > git://github.com/felipec/notmuch.git [fc-vim-next] > > It's not rebased on top of your branch, but there are no merge conflicts. Thanks, Felipe. Merged with r-c/0.6 at 0e57911dae0dc07ae567fa4467a9686a9d090ace. jamie. -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 835 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20110510/1dd37693/attachment.pgp>
[PATCH] test: use `princ' instead of `message' calls in emacs tests
On Tue, 10 May 2011 10:25:08 +0400, Dmitry Kurochkin wrote: > The patch replaces all (message (buffer-string)) calls in emacs > tests with (princ (buffer-string)). This avoids accidentally > interpreting '%' as format specifiers and makes code simpler > because we do not need to capture stderr. > > Also, the patch works around an Emacs (23.3+1-1 on current Debian > Unstable) segfault in "Ensure that emacs doesn't drop results" > test. Note: the segfault does not happen on every test run. > Though, it seems to be consistently reproducible if the test uses > 300 messages instead of 30. Hopefully, it is the crash described > in Emacs bug #8545 [1] which is already fixed. This is a great catch, Dmitry. Thank you. And I'm glad you and Austin figured out the best solution. jamie. -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 835 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20110510/3f91699d/attachment-0001.pgp>
release-candidate/0.6
On Mon, 09 May 2011 10:20:18 -0700, Jameson Graef Rollins wrote: > ***I hereby declare that release-candidate/0.6 is ready for release.*** After all of that pomp, I take it all back! Fully fearful of further delaying release of 0.6, I decided I wanted to slip in a couple last-minute patches, most of which are really bug fixes: I told Felipe I would include his vim patches, so I wanted to follow through on that. Dmitry submitted a patch to fix sporadic seg faults in one of the emacs tests. I built release-candidate/0.6 against the Ubuntu package of libgmime-2.4-dev, version 2.4.24-0ubuntu1 [0]. This fixed all but one of the failing crypto tests, and the delinquent test only needed to be updated to expect libgmime's improved error reporting. This means that all 184 tests now consistently cleanly pass (after 100 runs). This persuaded me to decide that 0.6 really should depend on this newly released 2.4.24 version of libgmime-2.4-2, and I updated the debian packaging accordingly. If people think this is not the way to go, I'm open to arguments. I think this /will/ create a bit of a snag for debian users. libgmime's dependency is not currently available in debian, so declaring notmuch 0.6 dependent on libgmime-2.4-2 2.4.24 will render the debian package of 0.6 uninstallable (and maybe even unbuildable). But I'm hoping we can use this to convince the debian maintainer of libgmime to release 2.4.24 concurrently with notmuch 0.6. If this sounds ridiculous, please let me know and we can look at a different solutions. Again, sorry for the last minute churn, but I think it's worth it [1]. jamie. [0] https://launchpad.net/ubuntu/+source/gmime2.4/2.4.24-0ubuntu1/ [1] git://finestructure.net/notmuch release-candidate/0.6 f357eafd3c315c7b59abe3088479a3b4e68a4d11 -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 835 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20110510/da69a3e9/attachment.pgp>
[PATCH] test: add "%s" format string to all `message' calls in emacs tests
This looks good to me (and is certainly more correct), but seems rather roundabout. Is there a reason this code doesn't simply (princ (buffer-string))? On Tue, May 10, 2011 at 1:40 AM, Dmitry Kurochkin wrote: > The patch replaces all (message (buffer-string)) calls in emacs > tests with (message "%s" (buffer-string)). ?This works around an > Emacs (23.3+1-1 on current Debian Unstable) segfault in "Ensure > that emacs doesn't drop results" test. ?Note: the segfault does > not happen on every test run. ?Though, it seems to be > consistently reproducible if the test uses 300 messages instead > of 30. ?Hopefully, it is the crash described in Emacs bug #8545 > [1] which is already fixed. > > Also, the patch makes the code more correct - we want to avoid > accidentally interpreting '%' as format specifiers. > > [1] http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8545 > --- > > The patch applies to the release-candidate/0.6 branch. > > Regards, > ?Dmitry > > > ?test/emacs ? ? ? ? ? ? ? ? ? ? | ? 18 +- > ?test/emacs-large-search-buffer | ? ?5 +++-- > ?2 files changed, 12 insertions(+), 11 deletions(-) > > diff --git a/test/emacs b/test/emacs > index b376033..5b39423 100755 > --- a/test/emacs > +++ b/test/emacs > @@ -7,38 +7,38 @@ EXPECTED=../emacs.expected-output > ?add_email_corpus > > ?test_begin_subtest "Basic notmuch-hello view in emacs" > -output=$(test_emacs '(notmuch-hello) (message (buffer-string))' 2>&1) > +output=$(test_emacs '(notmuch-hello) (message "%s" (buffer-string))' 2>&1) > ?expected=$(cat $EXPECTED/notmuch-hello) > ?test_expect_equal "$output" "$expected" > > ?test_begin_subtest "Saved search with 0 results" > -output=$(test_emacs '(setq notmuch-show-empty-saved-searches t) (setq > notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . "tag:unread") > ("empty" . "tag:doesnotexist"))) (notmuch-hello) (message (buffer-string))' > 2>&1) > +output=$(test_emacs '(setq notmuch-show-empty-saved-searches t) (setq > notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . "tag:unread") > ("empty" . "tag:doesnotexist"))) (notmuch-hello) (message "%s" > (buffer-string))' 2>&1) > ?expected=$(cat $EXPECTED/notmuch-hello-with-empty) > ?test_expect_equal "$output" "$expected" > > ?test_begin_subtest "No saved searches displayed (all with 0 results)" > -output=$(test_emacs '(setq notmuch-saved-searches '\''(("empty" . > "tag:doesnotexist"))) (notmuch-hello) (message (buffer-string))' 2>&1) > +output=$(test_emacs '(setq notmuch-saved-searches '\''(("empty" . > "tag:doesnotexist"))) (notmuch-hello) (message "%s" (buffer-string))' 2>&1) > ?expected=$(cat $EXPECTED/notmuch-hello-no-saved-searches) > ?test_expect_equal "$output" "$expected" > > ?test_begin_subtest "Basic notmuch-search view in emacs" > -output=$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) > (message (buffer-string))' 2>&1) > +output=$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) > (message "%s" (buffer-string))' 2>&1) > ?expected=$(cat $EXPECTED/notmuch-search-tag-inbox) > ?test_expect_equal "$output" "$expected" > > ?test_begin_subtest "Navigation of notmuch-hello to search results" > -output=$(test_emacs '(notmuch-hello) (goto-char (point-min)) > (re-search-forward "inbox") (widget-button-press (point)) (notmuch-test-wait) > (message (buffer-string))' 2>&1) > +output=$(test_emacs '(notmuch-hello) (goto-char (point-min)) > (re-search-forward "inbox") (widget-button-press (point)) (notmuch-test-wait) > (message "%s" (buffer-string))' 2>&1) > ?expected=$(cat $EXPECTED/notmuch-hello-view-inbox) > ?test_expect_equal "$output" "$expected" > > ?test_begin_subtest "Basic notmuch-show view in emacs" > ?maildir_storage_thread=$(notmuch search --output=threads > id:20091117190054.GU3165 at dottiness.seas.harvard.edu) > -output=$(test_emacs "(notmuch-show \"$maildir_storage_thread\") (message > (buffer-string))" 2>&1) > +output=$(test_emacs "(notmuch-show \"$maildir_storage_thread\") (message > \"%s\" (buffer-string))" 2>&1) > ?expected=$(cat $EXPECTED/notmuch-show-thread-maildir-storage) > ?test_expect_equal "$output" "$expected" > > ?test_begin_subtest "Navigation of notmuch-search to thread view" > -output=$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) > (goto-char (point-min)) (re-search-forward "Working with Maildir") > (notmuch-search-show-thread) (notmuch-test-wait) (message (buffer-string))' > 2>&1) > +output=$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) > (goto-char (point-min)) (re-search-forward "Working with Maildir") > (notmuch-search-show-thread) (notmuch-test-wait) (message "%s" > (buffer-string))' 2>&1) > ?test_expect_equal "$output" "$expected" > > ?test_begin_subtest "Add tag from search view" > @@ -102,7 +102,7 @@ test_expect_equal "$output" "thread:XXX ? 1974-03-29 > [1/1] Notmuch Test Suite; T > ?test_begin_subtest "Reply within emacs" > ?# We sed away everything before the ^From in the output to avoid getting > ?#
vim support improvements for 0.6
On Fri, May 6, 2011 at 10:51 PM, Jameson Graef Rollins wrote: > Hi, Filipe. ?I notice that you have been submitting a lot of patches for > vim support. ?As you may have seen, I'm trying to put together a release > candidate for notmuch 0.6. ?Since I know nothing about vim, would you be > willing to prepare a patch set that includes all of the patches to vim > support that you would like to see in the 0.6 release? > > I think the easiest way to do that would be for you to push a branch to > your public repo that includes all of the vim improvements rebased on > top of my release-candidate/0.6 branch. ?If you can then point me to > that branch, I can merge it with my release-candidate/0.6 branch and > push it out for others to test. > > Let me know what you think. All right. Hopefully nobody will request further changes to these patches: git://github.com/felipec/notmuch.git [fc-vim-next] It's not rebased on top of your branch, but there are no merge conflicts. Cheers. -- Felipe Contreras
Re: release-candidate/0.6
On Mon, 09 May 2011 10:20:18 -0700, Jameson Graef Rollins jroll...@finestructure.net wrote: ***I hereby declare that release-candidate/0.6 is ready for release.*** After all of that pomp, I take it all back! Fully fearful of further delaying release of 0.6, I decided I wanted to slip in a couple last-minute patches, most of which are really bug fixes: I told Felipe I would include his vim patches, so I wanted to follow through on that. Dmitry submitted a patch to fix sporadic seg faults in one of the emacs tests. I built release-candidate/0.6 against the Ubuntu package of libgmime-2.4-dev, version 2.4.24-0ubuntu1 [0]. This fixed all but one of the failing crypto tests, and the delinquent test only needed to be updated to expect libgmime's improved error reporting. This means that all 184 tests now consistently cleanly pass (after 100 runs). This persuaded me to decide that 0.6 really should depend on this newly released 2.4.24 version of libgmime-2.4-2, and I updated the debian packaging accordingly. If people think this is not the way to go, I'm open to arguments. I think this /will/ create a bit of a snag for debian users. libgmime's dependency is not currently available in debian, so declaring notmuch 0.6 dependent on libgmime-2.4-2 2.4.24 will render the debian package of 0.6 uninstallable (and maybe even unbuildable). But I'm hoping we can use this to convince the debian maintainer of libgmime to release 2.4.24 concurrently with notmuch 0.6. If this sounds ridiculous, please let me know and we can look at a different solutions. Again, sorry for the last minute churn, but I think it's worth it [1]. jamie. [0] https://launchpad.net/ubuntu/+source/gmime2.4/2.4.24-0ubuntu1/ [1] git://finestructure.net/notmuch release-candidate/0.6 f357eafd3c315c7b59abe3088479a3b4e68a4d11 pgpvwK5Y1KdPA.pgp Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] test: use `princ' instead of `message' calls in emacs tests
On Tue, 10 May 2011 10:25:08 +0400, Dmitry Kurochkin dmitry.kuroch...@gmail.com wrote: The patch replaces all (message (buffer-string)) calls in emacs tests with (princ (buffer-string)). This avoids accidentally interpreting '%' as format specifiers and makes code simpler because we do not need to capture stderr. Also, the patch works around an Emacs (23.3+1-1 on current Debian Unstable) segfault in Ensure that emacs doesn't drop results test. Note: the segfault does not happen on every test run. Though, it seems to be consistently reproducible if the test uses 300 messages instead of 30. Hopefully, it is the crash described in Emacs bug #8545 [1] which is already fixed. This is a great catch, Dmitry. Thank you. And I'm glad you and Austin figured out the best solution. jamie. pgpZihnI8cKYL.pgp Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: vim support improvements for 0.6
On Tue, 10 May 2011 01:30:11 +0300, Felipe Contreras felipe.contre...@gmail.com wrote: All right. Hopefully nobody will request further changes to these patches: git://github.com/felipec/notmuch.git [fc-vim-next] It's not rebased on top of your branch, but there are no merge conflicts. Thanks, Felipe. Merged with r-c/0.6 at 0e57911dae0dc07ae567fa4467a9686a9d090ace. jamie. pgpi3bP5fDbcP.pgp Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] avoid segfault when calling sanitize_string() on NULL
--- notmuch-search.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/notmuch-search.c b/notmuch-search.c index 794b145..26b24eb 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -116,6 +116,9 @@ sanitize_string (const void *ctx, const char *str) { char *out, *loop; +if (NULL == str) + return NULL; + loop = out = talloc_strdup (ctx, str); for (; *loop; loop++) { -- 1.7.4.4 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] avoid segfault when calling sanitize_string() on NULL
Yikes! Thanks for finding this, dkg. I just pushed this to r-c/0.6. It looks like we need to expand the tests to test this corner case. jamie. pgpdZpqR2ALSs.pgp Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: release-candidate/0.6
Arg. One last bit of churn. dkg found a bug in the new sanitize_string function that was causing segfaults on messages with empty headers. This is obviously an imprtant thing to fix. After chatting with some folks on #notmuch, we decided that the debian build dependency on libgmime 2.4.24 is a bit too extreme, particularly since it will actually prevent the package from being uploaded to debian. I therefore rolled-back the stricter build dependency. A new version of release-candidate/0.6 is pushed. jamie. [0] git://finestructure.net/notmuch release-candidate/0.6 aac1936bc9f878bd9ad2e097c5a686e146b73143 pgpIu7RYvVVfx.pgp Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: storing From and Subject in xapian
On Sun, 08 May 2011 22:24:37 -0700, Istvan Marko notm...@kismala.com wrote: Jameson Graef Rollins jroll...@finestructure.net writes: Unless I hear a strong positive response I'll hold off on considering it for 0.6, and suggest instead targeting it for 0.7. I would say wait until 0.7 at least. An important thing missing is fallback to the old method for messages where the Subject/From VALUE fields don't exist. Otherwise people will get blank results until they rebuild their database. Would it be possible to progressively fill the DB with the new data? i.e. if Subject/From not in db for message add Subject/From for this message to DB. ? That'd be awesome from my pov (having just rebuilt my database in chert format and that took FOREVER). -- Stewart Smith ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch