Bug 433 - exits after klicking on INBOX for a IMAP Account
Summary: exits after klicking on INBOX for a IMAP Account
Status: RESOLVED FIXED
Alias: None
Product: Sylpheed-Claws (GTK1)
Classification: Unclassified
Component: Folders/IMAP (show other bugs)
Version: 0.9.9
Hardware: PC Linux
: P3 major
Assignee: sylpheed-claws-users
URL:
: 563 728 (view as bug list)
Depends on:
Blocks: 704
  Show dependency tree
 
Reported: 2004-02-07 10:53 UTC by Stephan Sachse
Modified: 2005-06-02 11:05 UTC (History)
3 users (show)

See Also:


Attachments
bt of the crash (4.46 KB, text/plain)
2004-02-10 23:01 UTC, Stephan Sachse
no flags Details
valgrind output (2.57 KB, text/plain)
2004-03-13 00:07 UTC, Stephan Sachse
no flags Details
debug output after edit src/imap.c (4.51 KB, text/plain)
2004-07-25 16:56 UTC, Stephan Sachse
no flags Details
output from sylpheed --debug (36.21 KB, text/plain)
2004-08-01 23:49 UTC, Stephan Sachse
no flags Details
sypheed crashs when i move this mail (3.55 KB, text/plain)
2004-08-01 23:50 UTC, Stephan Sachse
no flags Details
etheral output when sc moves the bad mail (2.36 KB, text/plain)
2004-08-01 23:51 UTC, Stephan Sachse
no flags Details

Description Stephan Sachse 2004-02-07 10:53:11 UTC
Sylpheed-CRITICAL **: file imap.c: line 2244 (imap_get_header): assertion
`*cur_pos == '{'' failed.


Sylpheed version 0.9.9claws
GTK+ version 1.2.10
Features: gdk-pixbuf IPv6 libcompface GPGME OpenSSL LDAP GNU/aspell
Operating system: Linux 2.6.1-1.149 (i686)
C Library: GNU libc 2.3.2
--
Using host libthread_db library "/lib/tls/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread -150649664 (LWP 28321)]
0x00678c32 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#0  0x00678c32 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0x00522b03 in __waitpid_nocancel () from /lib/tls/libpthread.so.0
#2  0x080a4f1a in crash_handler (sig=0) at crash.c:536
#3  <signal handler called>
#4  string_getline (buf=0xfef0af40 "\r\n", len=8192, str=0xfef0cf80) at
procheader.c:78
#5  0x08137b84 in generic_get_one_field (buf=0xfef0af40 "\r\n", len=8192,
data=0xfef0cf80, hentry=0x81df1e0, 
    getline=0x8137ac0 <string_getline>, peekchar=0x8137b10 <string_peekchar>,
unfold=1) at procheader.c:112
#6  0x08137ab1 in string_get_one_field (buf=0x0, len=0, str=0x0, hentry=0x0) at
procheader.c:70
#7  0x08138289 in parse_stream (data=0xfef0cf80, isstring=1, flags={perm_flags =
0, tmp_flags = 524288}, full=0, decrypted=0)
    at procheader.c:729
#8  0x08138156 in procheader_parse_str (str=0x0, flags={perm_flags = 0,
tmp_flags = 136180192}, full=0, decrypted=0)
    at procheader.c:484
#9  0x080d2d67 in imap_parse_envelope (sock=0x99561e8, item=0x0,
line_str=0x9884180) at imap.c:2393
#10 0x080d1669 in imap_get_uncached_messages (session=0x9959c70, item=0x9956840,
numlist=0x0) at imap.c:1875
#11 0x080d648a in imap_get_msginfos (folder=0x99693c0, item=0x9956840,
msgnum_list=0x9b94c28) at imap.c:3905
#12 0x080bec9b in folder_item_scan_full (item=0x9956840, filtering=1) at
folder.c:1576
#13 0x080bf349 in folder_item_read_cache (item=0x9956840) at folder.c:1778
#14 0x080bf67d in folder_item_get_msg_list (item=0x9956840) at folder.c:1864
#15 0x080c1daa in folder_item_apply_processing (item=0x9956840) at folder.c:3002
#16 0x080e6e08 in initial_processing (item=0x9956840, data=0x989dac8) at main.c:578
Comment 1 Alfons Hoogervorst 2004-02-07 12:42:40 UTC
For the original poster: What IMAP server?

Christoph: syntax alright (compliant IMAP server)? 

It's a NULL pointer param deref:

#8  0x08138156 in procheader_parse_str (str=0x0, flags={perm_flags = 0,
tmp_flags = 136180192}, full=0, decrypted=0)
    at procheader.c:484

src/imap.c:
                        cur_pos = imap_get_header(sock, cur_pos, &headers,
                                                  line_str);
                        msginfo = procheader_parse_str(headers, flags, FALSE,
FALSE);

Extra check for cur_pos won't hurt too.
Comment 2 Stephan Sachse 2004-02-07 19:55:29 UTC
the problem exists since v0.9.7, v0.9.6 works fine with oure company imap server.
no problem with other IMAP server. Only the with the server @ works crashs SC.

$ nc 10.1.24.254 143
* OK liznt.nuhq.nunet IMAP4rev1 v12.250 server ready
Comment 3 Mitko Haralanov 2004-02-10 02:07:41 UTC
I got a related crash using 0.9.9 with UW IMAP. I am including the mail that I 
sent to the list with more details (unfortunately, I don't have the full bt 
since I did not get it the first time and now I can't reproduce the error):

From: Dimitar Haralanov <voidtrance@comcast.net>
To: Sylpheed-Claws List <sylpheed-claws-users@lists.sourceforge.net>
Subject: Crash with 0.9.9 went rebuilding folder trees
Date: Mon, 9 Feb 2004 15:50:10 -0800
Sender: sylpheed-claws-users-admin@lists.sourceforge.net
X-Mailer: Sylpheed version 0.9.9claws (GTK+ 1.2.10; i686-pc-linux-gnu)

	I downloaded, compiled, and installed sylpheed-claws 0.9.9 which
I use for personal and work email. The work email is an IMAP account
which gets accessed over an SSH tunel (which doesn't really have
anything to do with the problem, but...)
	 Today, I had to rebuild my folder tree of the IMAP work
account. While sylpheed was cranking along on it, it crashed. I re-ran
with with gdb and I got the following backtrace:

================================================================================
=================
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 13074)]
0x08116371 in string_getline (
    buf=0xbfffaab0 "58.GA1118@lazy.shackne20040206095058.GA1118@lazy.
shacknesage-ID: <20040206095058.GA1118@lazy.shackneD: <20040206095058.
GA1118@lazy.shackneri, 6 Feb 2004 10:50:58 +0100\r\nFrom: hungerburg 
<nospam@lazy.s"..., len=8192, str=0xbfffcb00) at procheader.c:78
78              if (!**str)
(gdb) p str
$1 = (char **) 0xbfffcb00
(gdb) p *str
$2 = 0x0
(gdb) bt
#0  0x08116371 in string_getline (
    buf=0xbfffaab0 "58.GA1118@lazy.shackne20040206095058.GA1118@lazy.
shacknesage-ID: <20040206095058.GA1118@lazy.shackneD: <20040206095058.
GA1118@lazy.shackneri, 6 Feb 2004 10:50:58 +0100\r\nFrom: hungerburg 
<nospam@lazy.s"..., len=8192, str=0xbfffcb00) at procheader.c:78
#1  0x08116419 in generic_get_one_field (
    buf=0xbfffaab0 "58.GA1118@lazy.shackne20040206095058.GA1118@lazy.
shacknesage-ID: <20040206095058.GA1118@lazy.shackneD: <20040206095058.
GA1118@lazy.shackneri, 6 Feb 2004 10:50:58 +0100\r\nFrom: hungerburg 
<nospam@lazy.s"..., len=8192, data=0xbfffcb00, hentry=0x81b2140, 
getline=0x8116360 <string_getline>, peekchar=0x81163b0 <string_peekchar>, 
    unfold=1) at procheader.c:112
#2  0x08116357 in string_get_one_field (
    buf=0xbfffaab0 "58.GA1118@lazy.shackne20040206095058.GA1118@lazy.
shacknesage-ID: <20040206095058.GA1118@lazy.shackneD: <20040206095058.
GA1118@lazy.shackneri, 6 Feb 2004 10:50:58 +0100\r\nFrom: hungerburg 
<nospam@lazy.s"..., len=8192, str=0xbfffcb00, hentry=0x81b2140) at procheader.c:
70
#3  0x08116a4c in parse_stream (data=0xbfffcb00, isstring=1, flags={perm_flags = 
0, tmp_flags = 3221195292}, full=0, decrypted=0) at procheader.c:729
#4  0x08116931 in procheader_parse_str (str=0x0, flags={perm_flags = 0, 
tmp_flags = 524288}, full=0, decrypted=0) at procheader.c:484
#5  0x080c1e38 in imap_parse_envelope (sock=0x8284c30, item=0x0, 
line_str=0x820d238) at imap.c:2393
#6  0x080c0b23 in imap_get_uncached_messages (session=0x8611728, item=0x860fb98, 
numlist=0x83cf690) at imap.c:1875
#7  0x080c4e25 in imap_get_msginfos (folder=0x82dcd38, item=0x860fb98, 
msgnum_list=0x83cf690) at imap.c:3905
#8  0x080b0dfa in folder_item_scan_full (item=0x860fb98, filtering=0) at folder.
c:1576
#9  0x080af7f0 in folder_scan_tree_func (node=0x0, data=0x8284c10) at folder.c:
731
#10 0x4042be7c in g_node_last_sibling () from /usr/lib/libglib-1.2.so.0
#11 0x4042a777 in g_node_traverse () from /usr/lib/libglib-1.2.so.0
#12 0x080af873 in folder_scan_tree (folder=0x82d40a4) at folder.c:758
#13 0x080b63c9 in folderview_rescan_tree (folder=0x82dcd38) at folderview.c:847
#14 0x4017f809 in gtk_item_factory_new () from /usr/lib/libgtk-1.2.so.0
(gdb) l
847             folder_scan_tree(folder);
848             folder_set_ui_func(folder, NULL, NULL);
849
850             folderview_set_all();
851
852             gtk_widget_destroy(window);
853             inc_unlock();
854     }
855
856     /** folderview_check_new()
(gdb)

================================================================================
=================

At that point, I changed procheader.c (line 78) to the following
Comment 4 Stephan Sachse 2004-02-10 22:58:40 UTC
ok, i dont now what i do, but here is output of gdb ;)
i try to attach this as file...

1.) add my account from work
2.) close sc (so i dont lost the account entry after segfault)
3.) restart and klick INBOX in the new account. Now sc crashs

see attachment

cya later
/stephan
Comment 5 Stephan Sachse 2004-02-10 23:01:07 UTC
Created attachment 127 [details]
bt of the crash

i can reproduce this crash every time since SC v0.9.7
Comment 6 Alfons Hoogervorst 2004-03-12 01:30:12 UTC
if this still happens, can any of you run sylpheed under valgrind? 
Comment 7 Alfons Hoogervorst 2004-03-12 01:45:00 UTC
In both BTs I see the following: 
 
#5  0x080d2d67 in imap_parse_envelope (sock=0x9c3e518, item=0x0, 
line_str=0x9b6d188) at imap.c:2393 
#6  0x080d1669 in imap_get_uncached_messages (session=0x9c61e78, 
item=0x9c58de0, numlist=0x0) at imap.c:1875 
#7  0x080d648a in imap_get_msginfos (folder=0x9c573a0, item=0x9c58de0, 
msgnum_list=0x9c25268) at imap.c:3905 
 
What strikes me is that numlist (#6) is NULL, though it should have the same 
value as msgnum_list. Here's the code that leads to the offending call, imap.c, 
imap_get_msginfos(), line 3904-3915: 
 
        session = imap_session_get(folder); 
        g_return_val_if_fail(session != NULL, NULL); 
 
        ok = imap_select(session, IMAP_FOLDER(folder), item->path, 
                         NULL, NULL, NULL, NULL); 
        if (ok != IMAP_SUCCESS) 
                return NULL; 
 
        if (!(item->stype == F_QUEUE || item->stype == F_DRAFT)) { 
                ret = g_slist_concat(ret, 
                        imap_get_uncached_messages( 
                        session, item, msgnum_list)); 
        } else { 
 
I strongly some stack badness is happening in imap_select(). 
 
Comment 8 Stephan Sachse 2004-03-12 22:49:46 UTC
$ valgrind sylpheed
[...]
==8511== discard syms in /usr/lib/gconv/ISO8859-1.so due to munmap()
--8506-- FATAL: unhandled syscall: 7
--8506-- Do not panic.  You may be able to fix this easily.
--8506-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
[...]
sched status:
 
Thread 1: status = Runnable, associated_mx = 0x0, associated_cv = 0x0
==8506==    at 0x8C4858: __GI___libc_waitpid (in /lib/libc-2.3.2.so)
==8506==    by 0x9B2BEF: _gpgme_ath_waitpid (in /usr/lib/libgpgme.so.6.3.6)
==8506==    by 0x9B366A: _gpgme_io_waitpid (in /usr/lib/libgpgme.so.6.3.6)
==8506==    by 0x9B3554: _gpgme_io_spawn (in /usr/lib/libgpgme.so.6.3.6)
==8511== discard syms in /lib/libnss_files-2.3.2.so due to munmap()
==8511==
==8511== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 18 from 2)
==8511== malloc/free: in use at exit: 641169 bytes in 31457 blocks.
==8511== malloc/free: 48963 allocs, 17506 frees, 1874981 bytes allocated.
==8511== For a detailed leak analysis,  rerun with: --leak-check=yes
==8511== For counts of detected errors, rerun with: -v
Comment 9 Alfons Hoogervorst 2004-03-12 23:37:03 UTC
That syscall thing is Valgrind saying that it did not implement something. 
Try running the thing with: 
 
% valgrind --num-callers=20 --log-file=SYLPHEED-LOG 
 
(This will result in a log file called SYLPHEED.LOG.<some pid>)  
If the resulting file is not too big, attach it to this report. 
 
Thanks. 
Comment 10 Alfons Hoogervorst 2004-03-12 23:38:00 UTC
Is this still with version 0.9.9? 
Comment 11 Stephan Sachse 2004-03-13 00:07:12 UTC
Created attachment 133 [details]
valgrind output

same as before imo

$ sylpheed --version
Sylpheed version 0.9.9claws11

its still version 0.9.9 because i cant compile 0.9.10

$ ./autogen.sh
[...]
Copying file m4/ulonglong.m4
aclocal: configure.ac: 236: macro `AM_PATH_OPENSSL' not found in library
aclocal: configure.ac: 283: macro `AM_PATH_ASPELL' not found in library

but this is another problem and offtopic in this place ;)
Comment 12 Alfons Hoogervorst 2004-04-10 15:18:18 UTC
what about latest CVS? 
Comment 13 Stephan Sachse 2004-04-10 22:51:00 UTC
same as before.
s-c crashs after clicking INBOX

Sylpheed-CRITICAL **: file imap.c: line 2249 (imap_get_header): assertion
`*cur_pos == '{'' failed.
Comment 14 Stephan Sachse 2004-07-25 11:21:30 UTC
with current cvs (gtk1||gtk2) i can read mails and change folders.
but when i try to delete one mail i get the same error as before

(sylpheed:22910): Sylpheed-CRITICAL **: file imap.c: line 2249
(imap_get_header): assertion `*cur_pos == '{'' failed
Speicherzugriffsfehler
Comment 15 Stephan Sachse 2004-07-25 16:55:48 UTC
i edit src/imap.c like this (line 2248)

  + debug_print("1: cur_pos = %d (%s)\n", cur_pos, cur_pos);
                                                                               
                           
    while (isspace(*(guchar *)cur_pos)) cur_pos++;
                                                                               
                           
  + debug_print("2: cur_pos = %d (%s)\n", cur_pos, cur_pos);


now i have a look at the --debug output and post the truncat stuff in a attachement.

i remove my Trashfolder (rm -fr) and create a new empty folder, and now it works
Comment 16 Stephan Sachse 2004-07-25 16:56:37 UTC
Created attachment 148 [details]
debug output after edit src/imap.c
Comment 17 Christoph Hohmann 2004-07-31 12:49:57 UTC
*** Bug 563 has been marked as a duplicate of this bug. ***
Comment 18 Christoph Hohmann 2004-07-31 13:05:25 UTC
I tried to reproduce the crash with a mail without any header that sylpheed
fetches and it does not crash here. Can you please add the log of the IMAP session.
Comment 19 Stephan Sachse 2004-07-31 17:14:33 UTC
what about ->
http://www.thewildbeast.co.uk/sylpheed-claws/bugzilla/attachment.cgi?id=148&action=view

i cant reproduce it since delete my Trashfolder on the server...
sorry :(
Comment 20 Christoph Hohmann 2004-07-31 23:28:42 UTC
Yes the debug output shows the problem too. It is a problem of the pretty lame
IMAP response parser of sylpheed.  I'll try to fix it.
Comment 21 Stephan Sachse 2004-08-01 23:49:22 UTC
Created attachment 155 [details]
output from sylpheed --debug

today a got another mail the force crashs sc
a can read this mail, but after delete them (C^d) sc crashs.
after crash the mail is in Trashfolder, and i can read this mail, but when i
move the mail in another folder sylpheed crashs again.

i will create another attachment with the mail an another with output of
etheral

PS: the same mail works fine on my IMAP Server at home
Comment 22 Stephan Sachse 2004-08-01 23:50:35 UTC
Created attachment 156 [details]
sypheed crashs when i move this mail
Comment 23 Stephan Sachse 2004-08-01 23:51:22 UTC
Created attachment 157 [details]
etheral output when sc moves the bad mail
Comment 24 Colin Leroy 2005-06-02 05:11:13 UTC
Should be fixed in 1.9.11cvs32
Comment 25 Colin Leroy 2005-06-02 05:13:43 UTC
*** Bug 728 has been marked as a duplicate of this bug. ***
Comment 26 Stephan Sachse 2005-06-02 11:05:59 UTC
works fine here

thanks!

Note You need to log in before you can comment on or make changes to this bug.