unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* notmuch segfault
@ 2010-04-23  8:01 Sebastian Spaeth
  2010-04-23 13:26 ` Sebastian Spaeth
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Spaeth @ 2010-04-23  8:01 UTC (permalink / raw)
  To: Notmuch development list

Sorry, I won't be able to offer much debug info, but the current stock
cworth/master segfaulted for me with only the "tag:inbox" search.

Output:
/home/spaetz/mail/INBOX/new/...2c57e:2,: No such file or directory
Segmentation fault (core dumped)

A "notmuch new" fixed the segfault, something is not as robust as it
should be (or used to be), it seems. I'll dig deeper if it occurs again.

Sebastian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: notmuch segfault
  2010-04-23  8:01 notmuch segfault Sebastian Spaeth
@ 2010-04-23 13:26 ` Sebastian Spaeth
  2010-04-23 13:37   ` Michal Sojka
  2010-04-24 13:52   ` Carl Worth
  0 siblings, 2 replies; 4+ messages in thread
From: Sebastian Spaeth @ 2010-04-23 13:26 UTC (permalink / raw)
  To: Notmuch development list

It happened again. Both times I had pressed "G" which calls offlineimap
and which removed messages that the notmuch database still thought are there.

----------------------------------------------------------------
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff602bb14 in strncasecmp () from /lib/libc.so.6
(gdb) bt
#0  0x00007ffff602bb14 in strncasecmp () from /lib/libc.so.6
#1  0x0000000000418521 in _thread_add_matched_message(_notmuch_thread*, _notmuch_message*, notmuch_sort_t) ()
#2  0x0000000000418b17 in _notmuch_thread_create ()
#3  0x000000000040e33c in notmuch_show_command ()
#4  0x0000000000408436 in main ()

-------------------------------------------------------------
spaetz@spaetz-macbook:~/src/notmuch$ notmuch show tag:inbox
Error opening /home/spaetz/mail/INBOX.Junk/new/1272025029_0.17175.spaetz-macbook,U=3608,FMD5=22888fa7f8daa670f25d806e9b4ae4df:2,: No such file or directory
Error opening /home/spaetz/mail/INBOX.Junk/new/1272025029_0.17175.spaetz-macbook,U=3608,FMD5=22888fa7f8daa670f25d806e9b4ae4df:2,: No such file or directory
Error opening /home/spaetz/mail/INBOX.Junk/new/1272025029_0.17175.spaetz-macbook,U=3608,FMD5=22888fa7f8daa670f25d806e9b4ae4df:2,: No such file or directory
Segmentation fault (core dumped)

----------------------------------------------------------
Coredump is here:
http://sspaeth.de/uploads/tmp/core.bin
-------------------------------------------------------------


Can it be that in thread.cc in _thread_add_matched_message ()
...
    subject = notmuch_message_get_header (message, "subject");

    if ((strncasecmp (subject, "Re: ", 4) == 0) ||
...

If the underlying message disappeared, get_header will return NULL and
we pass strncasecmp NULL as first parameter. Could that be?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: notmuch segfault
  2010-04-23 13:26 ` Sebastian Spaeth
@ 2010-04-23 13:37   ` Michal Sojka
  2010-04-24 13:52   ` Carl Worth
  1 sibling, 0 replies; 4+ messages in thread
From: Michal Sojka @ 2010-04-23 13:37 UTC (permalink / raw)
  To: Sebastian Spaeth, Notmuch development list

On Fri, 23 Apr 2010, Sebastian Spaeth wrote:
> Can it be that in thread.cc in _thread_add_matched_message ()
> ...
>     subject = notmuch_message_get_header (message, "subject");
> 
>     if ((strncasecmp (subject, "Re: ", 4) == 0) ||
> ...
> 
> If the underlying message disappeared, get_header will return NULL and
> we pass strncasecmp NULL as first parameter. Could that be?

Yes, it is very likely the problem. The fix is obvious (see bellow), but
the question is how will be this "missing message" presented to the user
e.g. in notmuch show. It may be that we will need some other checks to
not break other things.

diff --git a/lib/thread.cc b/lib/thread.cc
index 5bf8354..29b8336 100644
--- a/lib/thread.cc
+++ b/lib/thread.cc
@@ -148,6 +148,9 @@ _thread_add_matched_message (notmuch_thread_t *thread,
 
     subject = notmuch_message_get_header (message, "subject");
 
+    if (!subject)
+       return;
+
     if ((strncasecmp (subject, "Re: ", 4) == 0) ||
        (strncasecmp (subject, "Aw: ", 4) == 0) ||
        (strncasecmp (subject, "Vs: ", 4) == 0) ||

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: notmuch segfault
  2010-04-23 13:26 ` Sebastian Spaeth
  2010-04-23 13:37   ` Michal Sojka
@ 2010-04-24 13:52   ` Carl Worth
  1 sibling, 0 replies; 4+ messages in thread
From: Carl Worth @ 2010-04-24 13:52 UTC (permalink / raw)
  To: Sebastian Spaeth, Notmuch development list

[-- Attachment #1: Type: text/plain, Size: 588 bytes --]

On Fri, 23 Apr 2010 15:26:51 +0200, "Sebastian Spaeth" <Sebastian@SSpaeth.de> wrote:
> It happened again. Both times I had pressed "G" which calls offlineimap
> and which removed messages that the notmuch database still thought are there.

Thanks for the report, Sebastian.

I've just audited all calls to notmuch_message_get_header and tried to
handle NULL in all cases.

Of course, I haven't tested this thoroughly, but we'll hope that things
are better at least.

And perhaps someday someone will hook up some exhaustive
fault-injection-based testing to catch things like this.

-Carl

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-04-24 13:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-23  8:01 notmuch segfault Sebastian Spaeth
2010-04-23 13:26 ` Sebastian Spaeth
2010-04-23 13:37   ` Michal Sojka
2010-04-24 13:52   ` Carl Worth

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).