[PATCH 0/4] emacs: make message indentation width customisable (was: Re: [PATCH 2a/2] emacs: test notmuch-indent-messages-width default)

2011-11-25 Thread David Bremner
On Thu, 24 Nov 2011 23:03:20 +0100, Gregor Zattler  wrote:
> Dear David, notmuch developers,
> 
> * David Bremner  [24. Nov. 2011]:
> > On Sun, 23 Oct 2011 21:38:43 +0200, Gregor Zattler  
> > wrote:
> > The extra copy of the patch header messes up the log messages with the 3
> > test related patches in this series are applied. Can you resend with
> > git-send-email?
> 
> Sure.
> 

Pushed to master

d


compile error of current git on F15

2011-11-25 Thread Darren McGuicken
On Fri, 25 Nov 2011 13:43:35 -0500, David Bremner  wrote:
> Just confirm, all the crypto tests pass with this patch? In that case,
> can we have the patch (preferably as generated by git-send-email)? Or
> did I miss it somewhere in this thread?

I don't believe the patch ever made it to the list, I can't find it in
my own archive.  From the changelog here:

  http://koji.fedoraproject.org/koji/buildinfo?buildID=269819

  it looks like Karel Kl?? of Red Hat created it back in July, I assume
that's when Fedora moved to the later GMime version.

The patch itself looks like it's a straight re-mapping of the 2.4
GMimeSignatureValidity to the 2.5+ equivalent along with some
deprecation of GMimeSession, so just applying the patch will break
compilation for anyone < 2.5.

Also, three of the crypto tests relating to signature validation /do/
fail, although it looks like that may simply be down to changes in the
output format and so just need updated test cases.

I've attached the patch as-is to this mail for reference purposes, but
based on the above it'll need a bit of tweaking before it's useful to
the wider group.

-- next part --
A non-text attachment was scrubbed...
Name: notmuch-0.6.1-gmime.patch
Type: text/x-patch
Size: 9862 bytes
Desc: Fedora GMime Patch
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/2025/6acb206f/attachment.bin>
-- 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/2025/6acb206f/attachment.pgp>


[PATCH 3/3] Whitespaces cleanup.

2011-11-25 Thread Amadeusz Żołnowski
---
 test/symbol-test.cc |   13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/test/symbol-test.cc b/test/symbol-test.cc
index ec250b2..1548ca4 100644
--- a/test/symbol-test.cc
+++ b/test/symbol-test.cc
@@ -1,16 +1,17 @@
 #include 
 #include 
 #include 
-int main (){

-  (void)notmuch_database_open ("fakedb",
-NOTMUCH_DATABASE_MODE_READ_ONLY);

-  try{
-(void)new Xapian::WritableDatabase ("./nonexistant",   
Xapian::DB_OPEN);
+int main() {
+  (void) notmuch_database_open("fakedb", NOTMUCH_DATABASE_MODE_READ_ONLY);
+
+  try {
+(void) new Xapian::WritableDatabase("./nonexistant", Xapian::DB_OPEN);
   } catch (const Xapian::Error ) {
-printf("caught %s\n",error.get_msg().c_str());
+printf("caught %s\n", error.get_msg().c_str());
 return 0;
   }
+
   return 1;
 }
-- 
1.7.8.rc3



[PATCH 2/3] Fix warnings for test/symbol-test.cc.

2011-11-25 Thread Amadeusz Żołnowski
---
 test/symbol-test.cc |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/test/symbol-test.cc b/test/symbol-test.cc
index 1de06ea..ec250b2 100644
--- a/test/symbol-test.cc
+++ b/test/symbol-test.cc
@@ -1,10 +1,9 @@
 #include 
 #include 
 #include 
-main (int argc, char **argv){
+int main (){

-notmuch_database_t *notmuch
-  = notmuch_database_open ("fakedb",
+  (void)notmuch_database_open ("fakedb",
 NOTMUCH_DATABASE_MODE_READ_ONLY);

   try{
-- 
1.7.8.rc3



[PATCH 1/2] Build symbol-test with make instead of hardcoding in symbol-hiding.

2011-11-25 Thread Amadeusz Żołnowski
Excerpts from David Bremner's message of 2011-11-25 14:04:44 +0100:
> On Fri, 25 Nov 2011 11:54:51 +0100, Amadeusz ?o?nowski  aidecoe.name> wrote:
> >  
> > +$(dir)/symbol-test: $(dir)/symbol-test.o
> > +$(call quiet,CC) $^ -o $@ -Llib -lnotmuch -lxapian
> 
> I'm a bit surprised no -I is neaded here. Is that taken care in the CC
> call?

-I is for headers which are not used when linking.  symbol-test.o is
compiled according to rule defined earlier in some parent Makefile.


> >  .PHONY: test check
> > -test:all $(dir)/smtp-dummy
> > +test:all $(dir)/smtp-dummy $(dir)/symbol-test
> >  @${dir}/notmuch-test $(OPTIONS)
> 
> The instructions were already wrong, but maybe they should be updated to
> point out that calling the test scripts directly requires smtp-dummy and
> symbol-test already be built. Or maybe the tests should check for these
> binaries as pre-reqs along with emacs, gpg, etc... 
> 
> > +   -e 
> > "/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose|symbol-test.cc|symbol-test|symbol-test.o)/d"
> >  \
> 
> I wonder if this should be shortened (and made a bit sloppier) with the
> use of regexes.

Thanks it's so straightforward.  I found this line quickly without deep
analysis of all test-framework. :-)  It could only be made more flexible
- put list of this files into some separate text file.  But that's
subject for another patch.  Purpose of this one is to make building out
of tree working.


--
Amadeusz ?o?nowski
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/2025/b3af8dc4/attachment.pgp>


compile error of current git on F15

2011-11-25 Thread David Bremner
On Thu, 24 Nov 2011 21:45:20 +, Darren McGuicken  wrote:
> Hi guys, I assume this is old news, although I haven't seen anything
> else mentioned on list since the chain Dirk started - there's a koji
> build of 0.9 for rawhide, the source rpm of which contains a gmime 2.6
> patch.  I recently moved from Ubuntu to Fedora 16 on the netbook so I
> grabbed the patch and spec file, updated it to point to the 0.10 tarball
> and can confirm that the patch still applies cleanly and the notmuch
> build appears fine (crypto et al).

Just confirm, all the crypto tests pass with this patch? In that case,
can we have the patch (preferably as generated by git-send-email)? Or
did I miss it somewhere in this thread?

d


[PATCH] test: add simple tests for online help

2011-11-25 Thread David Bremner
From: David Bremner 

Nothing fancy, but we can at least detect segmentation faults.
---
I think Jani was just making fun of me when he suggested tests for notmuch 
--help, but I thought, why not.

 test/help-test|   12 
 test/notmuch-test |1 +
 2 files changed, 13 insertions(+), 0 deletions(-)
 create mode 100755 test/help-test

diff --git a/test/help-test b/test/help-test
new file mode 100755
index 000..9f4b9c7
--- /dev/null
+++ b/test/help-test
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+test_description="online help"
+. test-lib.sh
+
+test_expect_success 'notmuch --help' 'notmuch --help'
+test_expect_success 'notmuch --help tag' 'notmuch --help tag'
+test_expect_success 'notmuch help' 'notmuch help'
+test_expect_success 'notmuch help tag' 'notmuch help tag'
+test_expect_success 'notmuch --version' 'notmuch --version'
+
+test_done
diff --git a/test/notmuch-test b/test/notmuch-test
index adfd589..5aced5c 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -18,6 +18,7 @@ cd $(dirname "$0")

 TESTS="
   basic
+  help-test
   new
   count
   search
-- 
1.7.5.4



[PATCH 2/2] Fixed warnings for test/symbol-test.cc.

2011-11-25 Thread David Bremner
On Fri, 25 Nov 2011 11:54:52 +0100, Amadeusz ?o?nowski  wrote:
> ---
> +  //notmuch_database_t *notmuch =
> +  notmuch_database_open ("fakedb", NOTMUCH_DATABASE_MODE_READ_ONLY);

Leaving commented out code in is for people without version control ;).

Shouldn't this cast to void?

>  
>try{
> -(void)new Xapian::WritableDatabase ("./nonexistant", 
> Xapian::DB_OPEN);
> +(void)new Xapian::WritableDatabase ("./nonexistant", Xapian::DB_OPEN);

This seems to be whitespace only?  I'm not against whitespace cleanup,
but please put it in seperate commits. Or am I staring past a real
change here?

d



[PATCH 1/2] Build symbol-test with make instead of hardcoding in symbol-hiding.

2011-11-25 Thread David Bremner
On Fri, 25 Nov 2011 11:54:51 +0100, Amadeusz ?o?nowski  wrote:
>  
> +$(dir)/symbol-test: $(dir)/symbol-test.o
> + $(call quiet,CC) $^ -o $@ -Llib -lnotmuch -lxapian

I'm a bit surprised no -I is neaded here. Is that taken care in the CC call?

>  .PHONY: test check
> -test:all $(dir)/smtp-dummy
> +test:all $(dir)/smtp-dummy $(dir)/symbol-test
>   @${dir}/notmuch-test $(OPTIONS)

The instructions were already wrong, but maybe they should be updated to
point out that calling the test scripts directly requires smtp-dummy and
symbol-test already be built. Or maybe the tests should check for these
binaries as pre-reqs along with emacs, gpg, etc... 

> +-e 
> "/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose|symbol-test.cc|symbol-test|symbol-test.o)/d"
>  \

I wonder if this should be shortened (and made a bit sloppier) with the
use of regexes.



python-notmuch decoding error on a message

2011-11-25 Thread David Bremner
On Fri, 25 Nov 2011 09:04:06 +, Patrick Totzke  wrote:

> Silly question: how do i get Antoine's msg stup into notmuch? i tried
> using pythons mailbox lib to add this string to one of my mailboxes,
> which works fine.  but upon `notmuch new` I get something along the
> lines of "skipped non-mail file $myfile"..

I saved the attachement using notmuch-emacs, and then ran notmuch-new.

d


Incorrect parsing of email addresses (MIME with quotes)

2011-11-25 Thread Petter Reinholdtsen

[David Bremner]
> Notmuch is accepting the input, it just isn't displaying it the way
> you want.

Well, I guess that is mostly a question of semantics and definitions.
To me it isn't really accepting the input when I try to reply to an
email with the problem in question and end up with

  On Mon, 20 Jun 2011 11:12:00 +0200, "=?iso-8859-1?q?=D8yvind_Normann?=" 
 wrote:

One thing is not seeing the name properly in my client, but
broadcasting to my contacts my tools inability to process the From:
field is not something I can stand for.  So I really hope this can be
solved.  I hope Austin is right that this bug is fixed in later
versions of gmime.  I will try to upgrade and see if it solve the
issue.
-- 
Happy hacking
Petter Reinholdtsen


Re: python-notmuch decoding error on a message

2011-11-25 Thread Patrick Totzke
Silly question: how do i get Antoine's msg stup into notmuch? i tried
using pythons mailbox lib to add this string to one of my mailboxes, which 
works fine.
but upon `notmuch new` I get something along the lines of skipped non-mail 
file $myfile..

back to the topic:
I find it hichgly suprising that this decode fails because one can easily do 
sth like:

```
'=?utf-8?B?M+ht?= =?utf-8?Q?e?='.decode('UTF-8')
u'=?utf-8?B?M+ht?= =?utf-8?Q?e?='
```
So the actual string should not be the problem. Apparently,
the string as its stored in the index is not plain ascii anymore, which it was 
in the msg.
I thought notmuch stores exacctly what it gets?

Apart from this, I'd recommend replacing all decodes to unicode objects
by a subroutine that does the following:
If a global property notmuch.DEBUG is set to true: decode as is,
which will raise these exceptions upon errors
else: use .decode('UTF-8', errors='ignore').

In case the mail is not malformed, it will not contain any non-ascii symbols 
whatsoever,
so both ways should work. If you happen to deal with a malformed mail, you'd get
the problematic symbols omitted (beware of this when doing cryptostuff).

what do you think?
/p


Quoting David Bremner (2011-11-24 16:13:22)
On Sun, 6 Nov 2011 23:15:54 +0100, Antoine Amarilli antoine.amari...@ens.fr 
wrote:
 Hello,
 
 The attached message makes python-notmuch crash when trying to access it (see
 attached log).
 
 I don't know if the encoding of Subject is valid or not, but it would 
 probably
 be better anyway to ignore decoding errors and return some approximation of
 Subject instead of failing like this.
 

I get a set of critical errors about forgetting to call g_type_init.

We actually call g_type_init in the CLI now, thanks to 
   
   id:1311625989-97755-1-git-send-email-aarone...@gmail.com

but it sounds like this probably needs to be called either in libnotmuch
or in the bindings. 

For what it is worth this message decodes fine in the CLI

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] Build symbol-test with make a not manually in symbol-hiding.

2011-11-25 Thread Amadeusz Żołnowski
Fixed warnings in symbol-test.cc, btw.
---
 test/.gitignore |1 +
 test/Makefile.local |5 -
 test/basic  |2 +-
 test/symbol-hiding  |3 +--
 test/symbol-test.cc |9 -
 5 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/test/.gitignore b/test/.gitignore
index 9e97052..7e30e8d 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -1,4 +1,5 @@
 test-results
 corpus.mail
 smtp-dummy
+symbol-test
 tmp.*
diff --git a/test/Makefile.local b/test/Makefile.local
index 8eb0433..a672fd3 100644
--- a/test/Makefile.local
+++ b/test/Makefile.local
@@ -11,8 +11,11 @@ smtp_dummy_modules = $(smtp_dummy_srcs:.c=.o)
 $(dir)/smtp-dummy: $(smtp_dummy_modules)
$(call quiet,CC) $^ -o $@
 
+$(dir)/symbol-test: $(dir)/symbol-test.o
+   $(call quiet,CC) $^ -o $@ -Llib -lnotmuch -lxapian
+
 .PHONY: test check
-test:  all $(dir)/smtp-dummy
+test:  all $(dir)/smtp-dummy $(dir)/symbol-test
@${dir}/notmuch-test $(OPTIONS)
 
 check: test
diff --git a/test/basic b/test/basic
index 38db2ba..5463bf8 100755
--- a/test/basic
+++ b/test/basic
@@ -56,7 +56,7 @@ tests_in_suite=$(for i in $TESTS; do echo $i; done | sort)
 available=$(ls -1 $TEST_DIRECTORY/ | \
 sed -r -e 
/^(aggregate-results.sh|Makefile|Makefile.local|notmuch-test)/d \
   -e 
/^(README|test-lib.sh|test-lib.el|test-results|tmp.*|valgrind|corpus*)/d \
-  -e 
/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose|symbol-test.cc)/d
 \
+  -e 
/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose|symbol-test.cc|symbol-test|symbol-test.o)/d
 \
   -e /^(test.expected-output|.*~)/d \
   -e /^(gnupg-secret-key.asc)/d \
   -e /^(gnupg-secret-key.NOTE)/d \
diff --git a/test/symbol-hiding b/test/symbol-hiding
index d0b31ae..f67b653 100755
--- a/test/symbol-hiding
+++ b/test/symbol-hiding
@@ -12,13 +12,12 @@ test_description='exception symbol hiding'
 . ./test-lib.sh
 
 run_test(){
-result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib ./symbol-test 21)
+result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib 
$TEST_DIRECTORY/symbol-test 21)
 }
 
 output=A Xapian exception occurred opening database: Couldn't stat 
'fakedb/.notmuch/xapian'
 caught No chert database found at path \`./nonexistant'
 
-g++ -o symbol-test -I$TEST_DIRECTORY/../lib $TEST_DIRECTORY/symbol-test.cc 
-L$TEST_DIRECTORY/../lib -lnotmuch -lxapian
 mkdir -p fakedb/.notmuch
 test_expect_success 'running test' run_test
 test_begin_subtest 'checking output'
diff --git a/test/symbol-test.cc b/test/symbol-test.cc
index 1de06ea..bfbe38f 100644
--- a/test/symbol-test.cc
+++ b/test/symbol-test.cc
@@ -1,14 +1,13 @@
 #include stdio.h
 #include xapian.h
 #include notmuch.h
-main (int argc, char **argv){
+int main (){
 
-notmuch_database_t *notmuch
-  = notmuch_database_open (fakedb,
-NOTMUCH_DATABASE_MODE_READ_ONLY);
+  //notmuch_database_t *notmuch =
+  notmuch_database_open (fakedb, NOTMUCH_DATABASE_MODE_READ_ONLY);
 
   try{
-(void)new Xapian::WritableDatabase (./nonexistant,   
Xapian::DB_OPEN);
+(void)new Xapian::WritableDatabase (./nonexistant, Xapian::DB_OPEN);
   } catch (const Xapian::Error error) {
 printf(caught %s\n,error.get_msg().c_str());
 return 0;
-- 
1.7.8.rc3

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] Build symbol-test with make instead of hardcoding in symbol-hiding.

2011-11-25 Thread Amadeusz Żołnowski
If symbol-test is built in symbol-hiding with hardcoded g++ invokation, it's
not so easy to pass $(srcdir) which is required to find notmuch.h when srcdir
and builddir are separate directories.

Fixed warnings in symbol-test.cc, btw.
---
 test/.gitignore |1 +
 test/Makefile.local |5 -
 test/basic  |2 +-
 test/symbol-hiding  |3 +--
 test/symbol-test.cc |9 -
 5 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/test/.gitignore b/test/.gitignore
index 9e97052..7e30e8d 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -1,4 +1,5 @@
 test-results
 corpus.mail
 smtp-dummy
+symbol-test
 tmp.*
diff --git a/test/Makefile.local b/test/Makefile.local
index 8eb0433..a672fd3 100644
--- a/test/Makefile.local
+++ b/test/Makefile.local
@@ -11,8 +11,11 @@ smtp_dummy_modules = $(smtp_dummy_srcs:.c=.o)
 $(dir)/smtp-dummy: $(smtp_dummy_modules)
$(call quiet,CC) $^ -o $@
 
+$(dir)/symbol-test: $(dir)/symbol-test.o
+   $(call quiet,CC) $^ -o $@ -Llib -lnotmuch -lxapian
+
 .PHONY: test check
-test:  all $(dir)/smtp-dummy
+test:  all $(dir)/smtp-dummy $(dir)/symbol-test
@${dir}/notmuch-test $(OPTIONS)
 
 check: test
diff --git a/test/basic b/test/basic
index 38db2ba..5463bf8 100755
--- a/test/basic
+++ b/test/basic
@@ -56,7 +56,7 @@ tests_in_suite=$(for i in $TESTS; do echo $i; done | sort)
 available=$(ls -1 $TEST_DIRECTORY/ | \
 sed -r -e 
/^(aggregate-results.sh|Makefile|Makefile.local|notmuch-test)/d \
   -e 
/^(README|test-lib.sh|test-lib.el|test-results|tmp.*|valgrind|corpus*)/d \
-  -e 
/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose|symbol-test.cc)/d
 \
+  -e 
/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose|symbol-test.cc|symbol-test|symbol-test.o)/d
 \
   -e /^(test.expected-output|.*~)/d \
   -e /^(gnupg-secret-key.asc)/d \
   -e /^(gnupg-secret-key.NOTE)/d \
diff --git a/test/symbol-hiding b/test/symbol-hiding
index d0b31ae..f67b653 100755
--- a/test/symbol-hiding
+++ b/test/symbol-hiding
@@ -12,13 +12,12 @@ test_description='exception symbol hiding'
 . ./test-lib.sh
 
 run_test(){
-result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib ./symbol-test 21)
+result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib 
$TEST_DIRECTORY/symbol-test 21)
 }
 
 output=A Xapian exception occurred opening database: Couldn't stat 
'fakedb/.notmuch/xapian'
 caught No chert database found at path \`./nonexistant'
 
-g++ -o symbol-test -I$TEST_DIRECTORY/../lib $TEST_DIRECTORY/symbol-test.cc 
-L$TEST_DIRECTORY/../lib -lnotmuch -lxapian
 mkdir -p fakedb/.notmuch
 test_expect_success 'running test' run_test
 test_begin_subtest 'checking output'
diff --git a/test/symbol-test.cc b/test/symbol-test.cc
index 1de06ea..bfbe38f 100644
--- a/test/symbol-test.cc
+++ b/test/symbol-test.cc
@@ -1,14 +1,13 @@
 #include stdio.h
 #include xapian.h
 #include notmuch.h
-main (int argc, char **argv){
+int main (){
 
-notmuch_database_t *notmuch
-  = notmuch_database_open (fakedb,
-NOTMUCH_DATABASE_MODE_READ_ONLY);
+  //notmuch_database_t *notmuch =
+  notmuch_database_open (fakedb, NOTMUCH_DATABASE_MODE_READ_ONLY);
 
   try{
-(void)new Xapian::WritableDatabase (./nonexistant,   
Xapian::DB_OPEN);
+(void)new Xapian::WritableDatabase (./nonexistant, Xapian::DB_OPEN);
   } catch (const Xapian::Error error) {
 printf(caught %s\n,error.get_msg().c_str());
 return 0;
-- 
1.7.8.rc3

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 1/2] Build symbol-test with make instead of hardcoding in symbol-hiding.

2011-11-25 Thread Amadeusz Żołnowski
If symbol-test is built in symbol-hiding with hardcoded g++ invokation,
it's not so easy to pass $(srcdir) which is required to find notmuch.h
when srcdir and builddir are separate directories.
---
 test/.gitignore |1 +
 test/Makefile.local |5 -
 test/basic  |2 +-
 test/symbol-hiding  |3 +--
 4 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/test/.gitignore b/test/.gitignore
index 9e97052..7e30e8d 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -1,4 +1,5 @@
 test-results
 corpus.mail
 smtp-dummy
+symbol-test
 tmp.*
diff --git a/test/Makefile.local b/test/Makefile.local
index 8eb0433..a672fd3 100644
--- a/test/Makefile.local
+++ b/test/Makefile.local
@@ -11,8 +11,11 @@ smtp_dummy_modules = $(smtp_dummy_srcs:.c=.o)
 $(dir)/smtp-dummy: $(smtp_dummy_modules)
$(call quiet,CC) $^ -o $@
 
+$(dir)/symbol-test: $(dir)/symbol-test.o
+   $(call quiet,CC) $^ -o $@ -Llib -lnotmuch -lxapian
+
 .PHONY: test check
-test:  all $(dir)/smtp-dummy
+test:  all $(dir)/smtp-dummy $(dir)/symbol-test
@${dir}/notmuch-test $(OPTIONS)
 
 check: test
diff --git a/test/basic b/test/basic
index 38db2ba..5463bf8 100755
--- a/test/basic
+++ b/test/basic
@@ -56,7 +56,7 @@ tests_in_suite=$(for i in $TESTS; do echo $i; done | sort)
 available=$(ls -1 $TEST_DIRECTORY/ | \
 sed -r -e 
/^(aggregate-results.sh|Makefile|Makefile.local|notmuch-test)/d \
   -e 
/^(README|test-lib.sh|test-lib.el|test-results|tmp.*|valgrind|corpus*)/d \
-  -e 
/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose|symbol-test.cc)/d
 \
+  -e 
/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose|symbol-test.cc|symbol-test|symbol-test.o)/d
 \
   -e /^(test.expected-output|.*~)/d \
   -e /^(gnupg-secret-key.asc)/d \
   -e /^(gnupg-secret-key.NOTE)/d \
diff --git a/test/symbol-hiding b/test/symbol-hiding
index d0b31ae..f67b653 100755
--- a/test/symbol-hiding
+++ b/test/symbol-hiding
@@ -12,13 +12,12 @@ test_description='exception symbol hiding'
 . ./test-lib.sh
 
 run_test(){
-result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib ./symbol-test 21)
+result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib 
$TEST_DIRECTORY/symbol-test 21)
 }
 
 output=A Xapian exception occurred opening database: Couldn't stat 
'fakedb/.notmuch/xapian'
 caught No chert database found at path \`./nonexistant'
 
-g++ -o symbol-test -I$TEST_DIRECTORY/../lib $TEST_DIRECTORY/symbol-test.cc 
-L$TEST_DIRECTORY/../lib -lnotmuch -lxapian
 mkdir -p fakedb/.notmuch
 test_expect_success 'running test' run_test
 test_begin_subtest 'checking output'
-- 
1.7.8.rc3

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: python-notmuch decoding error on a message

2011-11-25 Thread David Bremner
On Fri, 25 Nov 2011 09:04:06 +, Patrick Totzke 
patricktot...@googlemail.com wrote:

 Silly question: how do i get Antoine's msg stup into notmuch? i tried
 using pythons mailbox lib to add this string to one of my mailboxes,
 which works fine.  but upon `notmuch new` I get something along the
 lines of skipped non-mail file $myfile..

I saved the attachement using notmuch-emacs, and then ran notmuch-new.

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 1/2] Build symbol-test with make instead of hardcoding in symbol-hiding.

2011-11-25 Thread David Bremner
On Fri, 25 Nov 2011 11:54:51 +0100, Amadeusz Żołnowski aide...@aidecoe.name 
wrote:
  
 +$(dir)/symbol-test: $(dir)/symbol-test.o
 + $(call quiet,CC) $^ -o $@ -Llib -lnotmuch -lxapian

I'm a bit surprised no -I is neaded here. Is that taken care in the CC call?

  .PHONY: test check
 -test:all $(dir)/smtp-dummy
 +test:all $(dir)/smtp-dummy $(dir)/symbol-test
   @${dir}/notmuch-test $(OPTIONS)

The instructions were already wrong, but maybe they should be updated to
point out that calling the test scripts directly requires smtp-dummy and
symbol-test already be built. Or maybe the tests should check for these
binaries as pre-reqs along with emacs, gpg, etc... 

 +-e 
 /^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose|symbol-test.cc|symbol-test|symbol-test.o)/d
  \

I wonder if this should be shortened (and made a bit sloppier) with the
use of regexes.

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/2] Fixed warnings for test/symbol-test.cc.

2011-11-25 Thread David Bremner
On Fri, 25 Nov 2011 11:54:52 +0100, Amadeusz Żołnowski aide...@aidecoe.name 
wrote:
 ---
 +  //notmuch_database_t *notmuch =
 +  notmuch_database_open (fakedb, NOTMUCH_DATABASE_MODE_READ_ONLY);

Leaving commented out code in is for people without version control ;).

Shouldn't this cast to void?

  
try{
 -(void)new Xapian::WritableDatabase (./nonexistant, 
 Xapian::DB_OPEN);
 +(void)new Xapian::WritableDatabase (./nonexistant, Xapian::DB_OPEN);

This seems to be whitespace only?  I'm not against whitespace cleanup,
but please put it in seperate commits. Or am I staring past a real
change here?

d

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 1/2] Build symbol-test with make instead of hardcoding in symbol-hiding.

2011-11-25 Thread Amadeusz Żołnowski
Excerpts from David Bremner's message of 2011-11-25 14:04:44 +0100:
 On Fri, 25 Nov 2011 11:54:51 +0100, Amadeusz Żołnowski aide...@aidecoe.name 
 wrote:
   
  +$(dir)/symbol-test: $(dir)/symbol-test.o
  +$(call quiet,CC) $^ -o $@ -Llib -lnotmuch -lxapian
 
 I'm a bit surprised no -I is neaded here. Is that taken care in the CC
 call?

-I is for headers which are not used when linking.  symbol-test.o is
compiled according to rule defined earlier in some parent Makefile.


   .PHONY: test check
  -test:all $(dir)/smtp-dummy
  +test:all $(dir)/smtp-dummy $(dir)/symbol-test
   @${dir}/notmuch-test $(OPTIONS)
 
 The instructions were already wrong, but maybe they should be updated to
 point out that calling the test scripts directly requires smtp-dummy and
 symbol-test already be built. Or maybe the tests should check for these
 binaries as pre-reqs along with emacs, gpg, etc... 
 
  +   -e 
  /^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose|symbol-test.cc|symbol-test|symbol-test.o)/d
   \
 
 I wonder if this should be shortened (and made a bit sloppier) with the
 use of regexes.

Thanks it's so straightforward.  I found this line quickly without deep
analysis of all test-framework. :-)  It could only be made more flexible
- put list of this files into some separate text file.  But that's
subject for another patch.  Purpose of this one is to make building out
of tree working.


--
Amadeusz Żołnowski


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/3] Fix warnings for test/symbol-test.cc.

2011-11-25 Thread Amadeusz Żołnowski
---
 test/symbol-test.cc |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/test/symbol-test.cc b/test/symbol-test.cc
index 1de06ea..ec250b2 100644
--- a/test/symbol-test.cc
+++ b/test/symbol-test.cc
@@ -1,10 +1,9 @@
 #include stdio.h
 #include xapian.h
 #include notmuch.h
-main (int argc, char **argv){
+int main (){
 
-notmuch_database_t *notmuch
-  = notmuch_database_open (fakedb,
+  (void)notmuch_database_open (fakedb,
 NOTMUCH_DATABASE_MODE_READ_ONLY);
 
   try{
-- 
1.7.8.rc3

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 3/3] Whitespaces cleanup.

2011-11-25 Thread Amadeusz Żołnowski
---
 test/symbol-test.cc |   13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/test/symbol-test.cc b/test/symbol-test.cc
index ec250b2..1548ca4 100644
--- a/test/symbol-test.cc
+++ b/test/symbol-test.cc
@@ -1,16 +1,17 @@
 #include stdio.h
 #include xapian.h
 #include notmuch.h
-int main (){
 
-  (void)notmuch_database_open (fakedb,
-NOTMUCH_DATABASE_MODE_READ_ONLY);
 
-  try{
-(void)new Xapian::WritableDatabase (./nonexistant,   
Xapian::DB_OPEN);
+int main() {
+  (void) notmuch_database_open(fakedb, NOTMUCH_DATABASE_MODE_READ_ONLY);
+
+  try {
+(void) new Xapian::WritableDatabase(./nonexistant, Xapian::DB_OPEN);
   } catch (const Xapian::Error error) {
-printf(caught %s\n,error.get_msg().c_str());
+printf(caught %s\n, error.get_msg().c_str());
 return 0;
   }
+
   return 1;
 }
-- 
1.7.8.rc3

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] test: add simple tests for online help

2011-11-25 Thread David Bremner
From: David Bremner brem...@debian.org

Nothing fancy, but we can at least detect segmentation faults.
---
I think Jani was just making fun of me when he suggested tests for notmuch 
--help, but I thought, why not.

 test/help-test|   12 
 test/notmuch-test |1 +
 2 files changed, 13 insertions(+), 0 deletions(-)
 create mode 100755 test/help-test

diff --git a/test/help-test b/test/help-test
new file mode 100755
index 000..9f4b9c7
--- /dev/null
+++ b/test/help-test
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+test_description=online help
+. test-lib.sh
+
+test_expect_success 'notmuch --help' 'notmuch --help'
+test_expect_success 'notmuch --help tag' 'notmuch --help tag'
+test_expect_success 'notmuch help' 'notmuch help'
+test_expect_success 'notmuch help tag' 'notmuch help tag'
+test_expect_success 'notmuch --version' 'notmuch --version'
+
+test_done
diff --git a/test/notmuch-test b/test/notmuch-test
index adfd589..5aced5c 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -18,6 +18,7 @@ cd $(dirname $0)
 
 TESTS=
   basic
+  help-test
   new
   count
   search
-- 
1.7.5.4

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: compile error of current git on F15

2011-11-25 Thread David Bremner
On Thu, 24 Nov 2011 21:45:20 +, Darren McGuicken 
mailing-notm...@fernseed.info wrote:
 Hi guys, I assume this is old news, although I haven't seen anything
 else mentioned on list since the chain Dirk started - there's a koji
 build of 0.9 for rawhide, the source rpm of which contains a gmime 2.6
 patch.  I recently moved from Ubuntu to Fedora 16 on the netbook so I
 grabbed the patch and spec file, updated it to point to the 0.10 tarball
 and can confirm that the patch still applies cleanly and the notmuch
 build appears fine (crypto et al).

Just confirm, all the crypto tests pass with this patch? In that case,
can we have the patch (preferably as generated by git-send-email)? Or
did I miss it somewhere in this thread?

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 1/2] emacs: remove some code duplication in notmuch-show

2011-11-25 Thread Dmitry Kurochkin
Add optional props argument to `notmuch-show-get-header'.  Use it to
get headers in `notmuch-show-insert-part-multipart/signed' and
`notmuch-show-insert-part-multipart/encrypted'.
---
 emacs/notmuch-show.el |   10 --
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 7be88f8..bcc436f 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -450,8 +450,7 @@ current buffer, if possible.
 (button-put button 'face '(:foreground blue))
 ;; add signature status button if sigstatus provided
 (if (plist-member part :sigstatus)
-   (let* ((headers (plist-get msg :headers))
-  (from (plist-get headers :From))
+   (let* ((from (notmuch-show-get-header :From msg))
   (sigstatus (car (plist-get part :sigstatus
  (notmuch-crypto-insert-sigstatus-button sigstatus from))
   ;; if we're not adding sigstatus, tell the user how they can get it
@@ -477,8 +476,7 @@ current buffer, if possible.
  (notmuch-crypto-insert-encstatus-button encstatus)
  ;; add signature status button if sigstatus specified
  (if (plist-member part :sigstatus)
- (let* ((headers (plist-get msg :headers))
-(from (plist-get headers :From))
+ (let* ((from (notmuch-show-get-header :From msg))
 (sigstatus (car (plist-get part :sigstatus
(notmuch-crypto-insert-sigstatus-button sigstatus from
   ;; if we're not adding encstatus, tell the user how they can get it
@@ -1079,9 +1077,9 @@ All currently available key bindings:
   Return the filename of the current message.
   (notmuch-show-get-prop :filename))
 
-(defun notmuch-show-get-header (header)
+(defun notmuch-show-get-header (header optional props)
   Return the named header of the current message, if any.
-  (plist-get (notmuch-show-get-prop :headers) header))
+  (plist-get (notmuch-show-get-prop :headers props) header))
 
 (defun notmuch-show-get-cc ()
   (notmuch-show-get-header :Cc))
-- 
1.7.7.3

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/2] emacs: remove unused variable in `notmuch-show-insert-part-message/rfc822'

2011-11-25 Thread Dmitry Kurochkin
An obvious cleanup.  I wonder why there was no warning about this
during compilation.
---
 emacs/notmuch-show.el |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index bcc436f..66c08cc 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -509,7 +509,6 @@ current buffer, if possible.
 (defun notmuch-show-insert-part-message/rfc822 (msg part content-type nth 
depth declared-type)
   (notmuch-show-insert-part-header nth declared-type content-type nil)
   (let* ((message (car (plist-get part :content)))
-(headers (plist-get message :headers))
 (body (car (plist-get message :body)))
 (start (point)))
 
-- 
1.7.7.3

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 1/3] test: add functions to count how much times notmuch was called

2011-11-25 Thread Dmitry Kurochkin
The patch adds two auxiliary functions and a variable:

  notmuch_counter_reset
  $notmuch_counter
  notmuch_counter

They allow to count how many times notmuch binary is called.
notmuch_counter_reset() function generates a script that counts how
many times it is called and resets the counter to zero.  The function
sets $notmuch_counter variable to the path to the generated script
that should be called instead of notmuch to do the counting.  The
notmuch_counter() function returns the current counter value.
---
 test/README  |   16 ++--
 test/test-lib.sh |   32 
 2 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/test/README b/test/README
index 2481f16..1570f7c 100644
--- a/test/README
+++ b/test/README
@@ -187,8 +187,8 @@ library for your script to use.
is to summarize successes and failures in the test script and
exit with an appropriate error code.
 
-There are also a number of mail-specific functions which are useful in
-writing tests:
+There are also a number of notmuch-specific auxiliary functions and
+variables which are useful in writing tests:
 
   generate_message
 
@@ -212,3 +212,15 @@ writing tests:
 will initialize the mail database to a known state of 50 sample
 messages, (culled from the early history of the notmuch mailing
 list).
+
+  notmuch_counter_reset
+  $notmuch_counter
+  notmuch_counter
+
+These allow to count how many times notmuch binary is called.
+notmuch_counter_reset() function generates a script that counts
+how many times it is called and resets the counter to zero.  The
+function sets $notmuch_counter variable to the path to the
+generated script that should be called instead of notmuch to do
+the counting.  The notmuch_counter() function returns the current
+counter value.
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 93867b0..e3b85d0 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -864,6 +864,38 @@ test_emacs () {
emacsclient --socket-name=$EMACS_SERVER --eval (progn $@)
 }
 
+# Creates a script that counts how much time it is executed and calls
+# notmuch.  $notmuch_counter is set to the path to the generated
+# script.  Use notmuch_counter() function to get the current counter
+# value.
+notmuch_counter_reset () {
+   notmuch_counter=$TMP_DIRECTORY/notmuch_counter
+   if [ ! -x $notmuch_counter ]; then
+   
notmuch_counter_state_path=$TMP_DIRECTORY/notmuch_counter.state
+   cat EOF $notmuch_counter
+#!/bin/sh
+
+count=\$(cat $notmuch_counter_state_path)
+echo -n \$(expr \$count + 1)  $notmuch_counter_state_path
+
+exec notmuch \$@
+EOF
+   chmod +x $notmuch_counter || return
+   fi
+
+   echo -n 0  $notmuch_counter_state_path || return
+}
+
+# Returns the current notmuch counter value.
+notmuch_counter () {
+   if [ -r $notmuch_counter_state_path ]; then
+   count=$(cat $notmuch_counter_state_path)
+   else
+   count=0
+   fi
+   echo -n $count
+}
+
 
 find_notmuch_path ()
 {
-- 
1.7.7.3

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 3/3] emacs: do not call notmuch show for non-inlinable parts

2011-11-25 Thread Dmitry Kurochkin
Before the change, there was a workaround to avoid notmuch show calls
for parts with application/* Content-Type.  But non-inlinable parts
are not limited to this Content-Type (e.g. mp3 files have audio/mpeg
Content-Type and are not inlinable).  For such parts
`notmuch-show-insert-part-*/*' handler is called which unconditionally
fetches contents for all parts.

The patch moves content fetching from `notmuch-show-insert-part-*/*'
to `notmuch-show-mm-display-part-inline' function after MIME inlinable
checks are done to avoid useless notmuch show calls.  The
application/* hack is no longer needed and removed.
---
 emacs/notmuch-show.el |   17 +
 test/emacs|1 -
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 7be88f8..2b0820e 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -310,17 +310,17 @@ message at DEPTH in the current thread.
;; 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)
+(defun notmuch-show-mm-display-part-inline (msg part nth content-type)
   Use the mm-decode/mm-view functions to display a part in the
 current buffer, if possible.
   (let ((display-buffer (current-buffer)))
 (with-temp-buffer
-  (insert content)
   (let ((handle (mm-make-handle (current-buffer) (list content-type
-   (set-buffer display-buffer)
(if (and (mm-inlinable-p handle)
 (mm-inlined-p handle))
-   (progn
+   (let ((content (notmuch-show-get-bodypart-content msg part nth)))
+ (insert content)
+ (set-buffer display-buffer)
  (mm-display-part handle)
  t)
  nil)
@@ -578,17 +578,10 @@ current buffer, if possible.
nil))
  nil
 
-(defun notmuch-show-insert-part-application/* (msg part content-type nth depth 
declared-type
-)
-  ;; do not render random application parts
-  (notmuch-show-insert-part-header nth content-type declared-type (plist-get 
part :filename)))
-
 (defun notmuch-show-insert-part-*/* (msg part content-type nth depth 
declared-type)
   ;; This handler _must_ succeed - it is the handler of last resort.
   (notmuch-show-insert-part-header nth content-type declared-type (plist-get 
part :filename))
-  (let ((content (notmuch-show-get-bodypart-content msg part nth)))
-(if content
-   (notmuch-show-mm-display-part-inline msg part content-type content)))
+  (notmuch-show-mm-display-part-inline msg part nth content-type)
   t)
 
 ;; Functions for determining how to handle MIME parts.
diff --git a/test/emacs b/test/emacs
index 38efe26..e2b438b 100755
--- a/test/emacs
+++ b/test/emacs
@@ -467,7 +467,6 @@ test_emacs (let ((notmuch-command \$notmuch_counter\))
 test_expect_equal $(notmuch_counter) 1
 
 test_begin_subtest Do not call notmuch for non-inlinable audio/mpeg parts
-test_subtest_known_broken
 id='message-with-audio/mpeg-attachm...@notmuchmail.org'
 emacs_deliver_message \
 'Message with audio/mpeg attachment' \
-- 
1.7.7.3

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: fix sed error in basic tests

2011-11-25 Thread Dmitry Kurochkin
Ping.  Perhaps this is trivial enought to be pushed?

Regards,
  Dmitry
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/2] test: cleanup basic tests

2011-11-25 Thread Dmitry Kurochkin
Basic test 'Ensure that all available tests will be run by
notmuch-test' compares all tests that are run with listing of test/
directory.  There is a growing list of exceptions for files and
directories which located in the test/ directory but are not tests.
Moreover some (probably buggy) tests do create files in the the test/
directory which may be left behind in case of failure.  This makes the
basic test fail.

The patch changes the test to look only for regular executable files.
This makes the exception list much smaller.  And since no tests should
create executables in the test/ directory (if there are, they should
be fixed), the basic test should not be affected by failed or
interrupted tests.
---
 test/basic |   12 +++-
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/test/basic b/test/basic
index 032c9f7..f258d1f 100755
--- a/test/basic
+++ b/test/basic
@@ -53,15 +53,9 @@ test_expect_code 2 'failure to clean up causes the test to 
fail' '
 test_begin_subtest 'Ensure that all available tests will be run by 
notmuch-test'
 eval $(sed -n -e '/^TESTS=$/,/^$/p' $TEST_DIRECTORY/notmuch-test)
 tests_in_suite=$(for i in $TESTS; do echo $i; done | sort)
-available=$(ls -1 $TEST_DIRECTORY/ | \
-sed -r -e 
/^(aggregate-results.sh|Makefile|Makefile.local|notmuch-test)/d \
-  -e 
/^(README|test-lib.sh|test-lib.el|test-results|tmp.*|valgrind|corpus*)/d \
-  -e 
/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose|symbol-test.cc)/d
 \
-  -e /^(test.expected-output|.*~)/d \
-  -e /^(gnupg-secret-key.asc)/d \
-  -e /^(gnupg-secret-key.NOTE)/d \
-  -e /^(atomicity.gdb)/d \
-  | sort)
+available=$(find $TEST_DIRECTORY -maxdepth 1 -type f -executable -printf 
'%f\n' | \
+sed -r -e 
/^(aggregate-results.sh|notmuch-test|smtp-dummy|test-verbose)$/d | \
+sort)
 test_expect_equal $tests_in_suite $available
 
 EXPECTED=$TEST_DIRECTORY/test.expected-output
-- 
1.7.7.3

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch