[python] segfaults at Message.get_date
Hi all! First off: Thanks Sebastian for your recent work on the python bindings. It all makes a little bit more sense now without the __len__ and all. As some of you might have read on the IRC channel, I'm facing really strange behaviour with Message.get_date() which unfortunately, I cannot reproduce reliably: I get it on one machine, not on the other, despite using the same distribution (ubuntu natty - standard python install), and notmuch and bindings from master on both boxes: Unfortunately, as it segfaults, I don't get a stacktrace here. The line that seems to cause the segfault is this one: https://github.com/pazz/notmuch-gui/blob/master/alot/db.py#L181 To explain the circumstances in my code: I crete these alot.Message objects by recursively calling notmuch.Message.get_replies at line 153 in the same file. The error occurs only at recursion depth 1, so to reproduce one needs to open a thread with at least one reply. Did anyone experience something similar? It would help if someone could try and run my code and report if it works for him/her: git clone https://github.com/pazz/notmuch-gui python alot/init.py # to run directly open a large enough thread by hitting enter Just to be clear: I don't expect anybody to debug my broken code. I think it might help to report segfaults, as it looks like it is a problem with the C-lib or the bindings. Of course, I'd be grateful for any pointers (pun not intended *caught*) or helpful hints to debug this. thanks, /patrick -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20110616/5168512f/attachment.pgp>
Python updates
On Thu, 16 Jun 2011 12:59:47 +0200, Sebastian Spaeth wrote: > I just wanted to keep everyone updated on the python API changes that > are in the master branch. With one exception everything is backwards > compatible. Feel free to stuff this into the .6 release notes :). P.S. Once I get started I was teased on IRC, so I also implemented: Message().maildir_flags_to_tags and tags_to_maildir_flags, which are now by default invoked on Database().add_message and on any operation that modifies notmuch tags. See the updated API docs at: http://packages.python.org/notmuch/#notmuch.Message.tags_to_maildir_flags and the docs for freeze() as to how to use those efficiently. 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/20110616/d5d53d96/attachment.pgp>
[PATCH] Fix compilation warnings in test/smtp-dummy.c.
* Remove unused variables in main(): buf, bytes and greeting. * Replace return with no value in main() with exit(3). --- test/smtp-dummy.c |5 + 1 files changed, 1 insertions(+), 4 deletions(-) diff --git a/test/smtp-dummy.c b/test/smtp-dummy.c index e58d0ad..133d6c4 100644 --- a/test/smtp-dummy.c +++ b/test/smtp-dummy.c @@ -99,9 +99,6 @@ process_command (FILE *peer, FILE *output, const char *command) static void do_smtp_to_file (FILE *peer, FILE *output) { - char buf[4096]; - ssize_t bytes; - char greeting[] = "220 localhost smtp-dummy\r\n"; char *line = NULL; size_t line_size; ssize_t line_len; @@ -193,7 +190,7 @@ main (int argc, char *argv[]) if (peer_file == NULL) { fprintf (stderr, "Error: fdopen() failed: %s\n", strerror (errno)); - return; + exit (1); } do_smtp_to_file (peer_file, output); -- 1.7.5.4
Python updates
Hi all, I just wanted to keep everyone updated on the python API changes that are in the master branch. With one exception everything is backwards compatible. Feel free to stuff this into the .6 release notes :). - Messages() can now be "listified" with a simple: msglist = list(...) in case you plan to keep doing stuff with the contained messages. For this to work, the API had to be broken: __len__ function was implicitly invoked by list(), exhausting the iterator. By removing __len__ (and implementing __nonzero__ instead), the list() function works now fine on a Messages() instance. If you need the length of your Messages() object, you can use: - Query(...).count_messages() #for a pretty close approximation - len(list(Messages())) #for the precise count (exhausting the iterator) - bool(Messages()) to see if still at least one more Message() is contained in the iterator. - Message() now has a get_filenames() method which returns an iterator (generator function to be precise), pointing to all filenames that are recorded for that message ID. list(msg1.get_filenames()) will return all recorded names as a list. - Message() now implements _cmp_ and _hash_. This enables a) comparison of Messages: msgs1 == msgs2 is True if they both 1) contain a Message object with the same Message-ID and 2) if the list of contained file names is identical. Another implication is that set() arithmetic on Messages() is now possible: db= notmuch.Database() msgs1= set(notmuch.Query(db, 'from:Sebastian').search_messages()) msgs2= set(notmuch.Query(db, 'not to:notmuch').search_messages()) msgs3 = msgs1.union(msgs2) msgs3 = msgs1.difference(msgs2) etc... I don't need to mention that the performance of set arithmetic (being completely done in python) is going to be abysmal compared to redoing proper Querys, yet, it might come in handy here or there. It also means you can do things like: msgs1= list(notmuch.Query(db, 'from:Sebastian').search_messages()) msg= list(notmuch.Query(db, 'not to:notmuch').search_messages())[0] if msg in msgs1: #Yes!!! - Both Message() and Messages() implement now __nonzero__() which is used for boolean testing. To see whether a Message() actually contains a Message, you can now do: bool(msg) or if msg: ... More useful, for Messages() you can check if your iterator still contains at least one more Message(): msgs = notmuch.Query(db, 'from:Sebastian').search_messages() while msgs: msg = msgs.next() #yes, this will work we still had one! and also: msgs = notmuch.Query(db, 'from:quackydiquack').search_messages() if not msgs: print "Oh my, no search result for this weird query" Have fun 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/20110616/09f3a1d1/attachment.pgp>
[PATCH] Fix compilation warnings in test/smtp-dummy.c.
* Remove unused variables in main(): buf, bytes and greeting. * Replace return with no value in main() with exit(3). --- test/smtp-dummy.c |5 + 1 files changed, 1 insertions(+), 4 deletions(-) diff --git a/test/smtp-dummy.c b/test/smtp-dummy.c index e58d0ad..133d6c4 100644 --- a/test/smtp-dummy.c +++ b/test/smtp-dummy.c @@ -99,9 +99,6 @@ process_command (FILE *peer, FILE *output, const char *command) static void do_smtp_to_file (FILE *peer, FILE *output) { - char buf[4096]; - ssize_t bytes; - char greeting[] = 220 localhost smtp-dummy\r\n; char *line = NULL; size_t line_size; ssize_t line_len; @@ -193,7 +190,7 @@ main (int argc, char *argv[]) if (peer_file == NULL) { fprintf (stderr, Error: fdopen() failed: %s\n, strerror (errno)); - return; + exit (1); } do_smtp_to_file (peer_file, output); -- 1.7.5.4 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Python updates
Hi all, I just wanted to keep everyone updated on the python API changes that are in the master branch. With one exception everything is backwards compatible. Feel free to stuff this into the .6 release notes :). - Messages() can now be listified with a simple: msglist = list(...) in case you plan to keep doing stuff with the contained messages. For this to work, the API had to be broken: __len__ function was implicitly invoked by list(), exhausting the iterator. By removing __len__ (and implementing __nonzero__ instead), the list() function works now fine on a Messages() instance. If you need the length of your Messages() object, you can use: - Query(...).count_messages() #for a pretty close approximation - len(list(Messages())) #for the precise count (exhausting the iterator) - bool(Messages()) to see if still at least one more Message() is contained in the iterator. - Message() now has a get_filenames() method which returns an iterator (generator function to be precise), pointing to all filenames that are recorded for that message ID. list(msg1.get_filenames()) will return all recorded names as a list. - Message() now implements _cmp_ and _hash_. This enables a) comparison of Messages: msgs1 == msgs2 is True if they both 1) contain a Message object with the same Message-ID and 2) if the list of contained file names is identical. Another implication is that set() arithmetic on Messages() is now possible: db= notmuch.Database() msgs1= set(notmuch.Query(db, 'from:Sebastian').search_messages()) msgs2= set(notmuch.Query(db, 'not to:notmuch').search_messages()) msgs3 = msgs1.union(msgs2) msgs3 = msgs1.difference(msgs2) etc... I don't need to mention that the performance of set arithmetic (being completely done in python) is going to be abysmal compared to redoing proper Querys, yet, it might come in handy here or there. It also means you can do things like: msgs1= list(notmuch.Query(db, 'from:Sebastian').search_messages()) msg= list(notmuch.Query(db, 'not to:notmuch').search_messages())[0] if msg in msgs1: #Yes!!! - Both Message() and Messages() implement now __nonzero__() which is used for boolean testing. To see whether a Message() actually contains a Message, you can now do: bool(msg) or if msg: ... More useful, for Messages() you can check if your iterator still contains at least one more Message(): msgs = notmuch.Query(db, 'from:Sebastian').search_messages() while msgs: msg = msgs.next() #yes, this will work we still had one! and also: msgs = notmuch.Query(db, 'from:quackydiquack').search_messages() if not msgs: print Oh my, no search result for this weird query Have fun Sebastian pgptPhou8CjWB.pgp Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: Python updates
On Thu, 16 Jun 2011 12:59:47 +0200, Sebastian Spaeth wrote: I just wanted to keep everyone updated on the python API changes that are in the master branch. With one exception everything is backwards compatible. Feel free to stuff this into the .6 release notes :). P.S. Once I get started I was teased on IRC, so I also implemented: Message().maildir_flags_to_tags and tags_to_maildir_flags, which are now by default invoked on Database().add_message and on any operation that modifies notmuch tags. See the updated API docs at: http://packages.python.org/notmuch/#notmuch.Message.tags_to_maildir_flags and the docs for freeze() as to how to use those efficiently. Sebastian pgphwpJbj277E.pgp Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[python] segfaults at Message.get_date
Hi all! First off: Thanks Sebastian for your recent work on the python bindings. It all makes a little bit more sense now without the __len__ and all. As some of you might have read on the IRC channel, I'm facing really strange behaviour with Message.get_date() which unfortunately, I cannot reproduce reliably: I get it on one machine, not on the other, despite using the same distribution (ubuntu natty - standard python install), and notmuch and bindings from master on both boxes: Unfortunately, as it segfaults, I don't get a stacktrace here. The line that seems to cause the segfault is this one: https://github.com/pazz/notmuch-gui/blob/master/alot/db.py#L181 To explain the circumstances in my code: I crete these alot.Message objects by recursively calling notmuch.Message.get_replies at line 153 in the same file. The error occurs only at recursion depth 1, so to reproduce one needs to open a thread with at least one reply. Did anyone experience something similar? It would help if someone could try and run my code and report if it works for him/her: git clone https://github.com/pazz/notmuch-gui python alot/init.py # to run directly open a large enough thread by hitting enter Just to be clear: I don't expect anybody to debug my broken code. I think it might help to report segfaults, as it looks like it is a problem with the C-lib or the bindings. Of course, I'd be grateful for any pointers (pun not intended *caught*) or helpful hints to debug this. thanks, /patrick signature.asc Description: Digital signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch