Bug 174112 - KFileDebugStream crashes if multiple endl are inserted in the debug message
Summary: KFileDebugStream crashes if multiple endl are inserted in the debug message
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: kdecore (show other bugs)
Version: 4.1
Platform: Ubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2008-11-02 17:08 UTC by Stefano Franchi
Modified: 2010-02-23 22:48 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefano Franchi 2008-11-02 17:08:16 UTC
Version:           1.10.1 (using KDE 4.1.2)
OS:                Linux
Installed from:    Ubuntu Packages

Kmail (v.1.10.1) running in KDE 4.1.2 crashes, reliably, with signal SIGABRT
when trying to attach a document to composed message. This behavior happens reliably every time, and makes in fact Kmail unusable.

I attach the backtrace below:

The application KMail (kmail) crashed and caused the signal 6 (SIGABRT).
Please help us improve the software you use by filing a report at http://bugs.kde.org. Useful details include how to reproduce the error, documents that were loaded, etc.

Application: KMail (kmail), signal SIGABRT
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread 0x7f1190d6f6f0 (LWP 8234)]
[New Thread 0x40c0c950 (LWP 8712)]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[KCrash handler]
#5  0x00007f118dc7dfd5 in raise () from /lib/libc.so.6
#6  0x00007f118dc7fb43 in abort () from /lib/libc.so.6
#7  0x00007f118f09a6b5 in qt_message_output () from /usr/lib/libQtCore.so.4
#8  0x00007f118f09a7fd in qFatal () from /usr/lib/libQtCore.so.4
#9  0x00007f118f5538d8 in ?? () from /usr/lib/libkdecore.so.5
#10 0x00007f118f122cc1 in QIODevice::write () from /usr/lib/libQtCore.so.4
#11 0x00007f118f12effc in ?? () from /usr/lib/libQtCore.so.4
#12 0x00007f118f12f119 in flush () from /usr/lib/libQtCore.so.4
#13 0x00007f119044d297 in ?? () from /usr/lib/libkmailprivate.so.4
#14 0x00007f11903f7095 in ?? () from /usr/lib/libkmailprivate.so.4
#15 0x00007f119040087c in ?? () from /usr/lib/libkmailprivate.so.4
#16 0x00007f118f19f134 in QMetaObject::activate ()
   from /usr/lib/libQtCore.so.4
#17 0x00007f118f568b72 in KJob::result () from /usr/lib/libkdecore.so.5
#18 0x00007f118f568f37 in KJob::emitResult () from /usr/lib/libkdecore.so.5
#19 0x00007f1189e550f0 in KIO::SimpleJob::slotFinished ()
   from /usr/lib/libkio.so.5
#20 0x00007f1189e58543 in KIO::TransferJob::slotFinished ()
   from /usr/lib/libkio.so.5
#21 0x00007f1189e592a5 in KIO::TransferJob::qt_metacall ()
   from /usr/lib/libkio.so.5
#22 0x00007f118f19f134 in QMetaObject::activate ()
   from /usr/lib/libQtCore.so.4
#23 0x00007f1189f100a1 in KIO::SlaveInterface::dispatch ()
   from /usr/lib/libkio.so.5
#24 0x00007f1189f0cf02 in KIO::SlaveInterface::dispatch ()
   from /usr/lib/libkio.so.5
#25 0x00007f1189efdf53 in KIO::Slave::gotInput () from /usr/lib/libkio.so.5
#26 0x00007f1189f00678 in KIO::Slave::qt_metacall () from /usr/lib/libkio.so.5
#27 0x00007f118f19f134 in QMetaObject::activate ()
   from /usr/lib/libQtCore.so.4
#28 0x00007f1189e22830 in ?? () from /usr/lib/libkio.so.5
#29 0x00007f1189e2296a in KIO::Connection::qt_metacall ()
   from /usr/lib/libkio.so.5
#30 0x00007f118f199da5 in QObject::event () from /usr/lib/libQtCore.so.4
#31 0x00007f118e6acc3d in QApplicationPrivate::notify_helper ()
   from /usr/lib/libQtGui.so.4
#32 0x00007f118e6b49ea in QApplication::notify () from /usr/lib/libQtGui.so.4
#33 0x00007f118fae6b8b in KApplication::notify () from /usr/lib/libkdeui.so.5
#34 0x00007f118f18ad61 in QCoreApplication::notifyInternal ()
   from /usr/lib/libQtCore.so.4
#35 0x00007f118f18b9fa in QCoreApplicationPrivate::sendPostedEvents ()
   from /usr/lib/libQtCore.so.4
#36 0x00007f118f1b34d3 in ?? () from /usr/lib/libQtCore.so.4
#37 0x00007f11866a1d3b in g_main_context_dispatch ()
   from /usr/lib/libglib-2.0.so.0
#38 0x00007f11866a550d in ?? () from /usr/lib/libglib-2.0.so.0
#39 0x00007f11866a56cb in g_main_context_iteration ()
   from /usr/lib/libglib-2.0.so.0
#40 0x00007f118f1b315f in QEventDispatcherGlib::processEvents ()
   from /usr/lib/libQtCore.so.4
#41 0x00007f118e73ea9f in ?? () from /usr/lib/libQtGui.so.4
#42 0x00007f118f189682 in QEventLoop::processEvents ()
   from /usr/lib/libQtCore.so.4
#43 0x00007f118f18980d in QEventLoop::exec () from /usr/lib/libQtCore.so.4
#44 0x00007f118f18bcbd in QCoreApplication::exec ()
   from /usr/lib/libQtCore.so.4
#45 0x0000000000402fcb in _start ()
#0  0x00007f118dcf3621 in nanosleep () from /lib/libc.so.6
Comment 1 Stefano Franchi 2008-11-02 17:14:32 UTC
After additional testing, it seems to crash, reliably, only when trying to attach a non-text file. pdf, .jpg. .mp3 cause the crash. .txt, .lyx, and .bib do not
Comment 2 Oliver Putz 2008-11-02 17:35:39 UTC
Hello,

Thanks for your report. Regrettably I cannot reproduce the crash. Can have a look at http://techbase.kde.org/Development/Tutorials/Debugging/How_to_create_useful_crash_reports, try to install the debugging packages for your distribution and post a more detailed backtrace for the crash? Also giving a step-by-step instruction what exactly you do in order to make it crash could help.
Comment 3 Stefano Franchi 2008-11-02 18:25:46 UTC
Additional info:

1. how I can reliably produce the crash:
   a. - Click "new message" or type CTRL-N to open up a new message composer window
   b. - Click the attachment icon to open up a file browser 
   c. - Navigate to a .pdf, .ps, .mp3, or .jpg file (I haven't tied other file types)
   d. - click on the file--KMAIL CRASHES

Notice that I do NOT get a crash if I select a text-based file at (d) above (I tried with .txt, .lyx, .bib, i.e. all pure ASCII files)

As per Oliver's suggestion, I installed the -dbg packages and I attach a new backtrace below. Hopefully it'll be more informative.

Application: KMail (kmail), signal SIGABRT
[Thread debugging using libthread_db enabled]
[New Thread 0x7f17cc6866f0 (LWP 15132)]
[KCrash handler]
#5  0x00007f17c9594fd5 in raise () from /lib/libc.so.6
#6  0x00007f17c9596b43 in abort () from /lib/libc.so.6
#7  0x00007f17ca9b16b5 in qt_message_output () from /usr/lib/libQtCore.so.4
#8  0x00007f17ca9b17fd in qFatal () from /usr/lib/libQtCore.so.4
#9  0x00007f17cae6a8d8 in KFileDebugStream::writeData (
    this=<value optimized out>, data=0x2806038 "Fix this caller: \n", len=18)
    at /build/buildd/kde4libs-4.1.2/kdecore/io/kdebug.cpp:132
#10 0x00007f17caa39cc1 in QIODevice::write () from /usr/lib/libQtCore.so.4
#11 0x00007f17caa45ffc in ?? () from /usr/lib/libQtCore.so.4
#12 0x00007f17caa46119 in flush () from /usr/lib/libQtCore.so.4
#13 0x00007f17cbd64297 in KMMessagePart::setCharset (this=0x28067f0, 
    c=@0x7fffd46d8600) at /usr/include/qt4/QtCore/qtextstream.h:282
#14 0x00007f17cbd0e095 in KMComposeWin::slotAttachFileResult (this=0x1e3cfc0, 
    job=0x280f7e0) at /build/buildd/kdepim-4.1.2/kmail/kmcomposewin.cpp:2406
#15 0x00007f17cbd1787c in KMComposeWin::qt_metacall (this=0x1e3cfc0, 
    _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, 
    _a=0x7fffd46d8800)
    at /build/buildd/kdepim-4.1.2/obj-x86_64-linux-gnu/kmail/kmcomposewin.moc:309
#16 0x00007f17caab6134 in QMetaObject::activate ()
   from /usr/lib/libQtCore.so.4
#17 0x00007f17cae7fb72 in KJob::result (this=0x3b1c, _t1=0x280f7e0)
    at /build/buildd/kde4libs-4.1.2/obj-x86_64-linux-gnu/kdecore/kjob.moc:186
#18 0x00007f17cae7ff37 in KJob::emitResult (this=0x280f7e0)
    at /build/buildd/kde4libs-4.1.2/kdecore/jobs/kjob.cpp:290
#19 0x00007f17c576c0f0 in KIO::SimpleJob::slotFinished (this=0x280f7e0)
    at /build/buildd/kde4libs-4.1.2/kio/kio/job.cpp:498
#20 0x00007f17c576f543 in KIO::TransferJob::slotFinished (this=0x280f7e0)
    at /build/buildd/kde4libs-4.1.2/kio/kio/job.cpp:967
#21 0x00007f17c57702a5 in KIO::TransferJob::qt_metacall (this=0x280f7e0, 
    _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, 
    _a=0x7fffd46d8c00)
    at /build/buildd/kde4libs-4.1.2/obj-x86_64-linux-gnu/kio/jobclasses.moc:336
#22 0x00007f17caab6134 in QMetaObject::activate ()
   from /usr/lib/libQtCore.so.4
#23 0x00007f17c58270a1 in KIO::SlaveInterface::dispatch (this=0x1b49430, 
    _cmd=104, rawdata=<value optimized out>)
    at /build/buildd/kde4libs-4.1.2/kio/kio/slaveinterface.cpp:175
#24 0x00007f17c5823f02 in KIO::SlaveInterface::dispatch (this=0x1b49430)
    at /build/buildd/kde4libs-4.1.2/kio/kio/slaveinterface.cpp:90
#25 0x00007f17c5814f53 in KIO::Slave::gotInput (this=0x1b49430)
    at /build/buildd/kde4libs-4.1.2/kio/kio/slave.cpp:322
#26 0x00007f17c5817678 in KIO::Slave::qt_metacall (this=0x1b49430, 
    _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fffd46d9020)
    at /build/buildd/kde4libs-4.1.2/obj-x86_64-linux-gnu/kio/slave.moc:75
#27 0x00007f17caab6134 in QMetaObject::activate ()
   from /usr/lib/libQtCore.so.4
#28 0x00007f17c5739830 in KIO::ConnectionPrivate::dequeue (this=0x1c9d720)
    at /build/buildd/kde4libs-4.1.2/kio/kio/connection.cpp:82
#29 0x00007f17c573996a in KIO::Connection::qt_metacall (this=0x19e4100, 
    _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x2723090)
    at /build/buildd/kde4libs-4.1.2/obj-x86_64-linux-gnu/kio/connection.moc:72
#30 0x00007f17caab0da5 in QObject::event () from /usr/lib/libQtCore.so.4
#31 0x00007f17c9fc3c3d in QApplicationPrivate::notify_helper ()
   from /usr/lib/libQtGui.so.4
#32 0x00007f17c9fcb9ea in QApplication::notify () from /usr/lib/libQtGui.so.4
#33 0x00007f17cb3fdb8b in KApplication::notify (this=0x7fffd46d9b90, 
    receiver=0x19e4100, event=0x27de360)
    at /build/buildd/kde4libs-4.1.2/kdeui/kernel/kapplication.cpp:311
#34 0x00007f17caaa1d61 in QCoreApplication::notifyInternal ()
   from /usr/lib/libQtCore.so.4
#35 0x00007f17caaa29fa in QCoreApplicationPrivate::sendPostedEvents ()
   from /usr/lib/libQtCore.so.4
#36 0x00007f17caaca4d3 in ?? () from /usr/lib/libQtCore.so.4
#37 0x00007f17c1fb8d3b in g_main_context_dispatch ()
   from /usr/lib/libglib-2.0.so.0
#38 0x00007f17c1fbc50d in ?? () from /usr/lib/libglib-2.0.so.0
#39 0x00007f17c1fbc6cb in g_main_context_iteration ()
   from /usr/lib/libglib-2.0.so.0
#40 0x00007f17caaca15f in QEventDispatcherGlib::processEvents ()
   from /usr/lib/libQtCore.so.4
#41 0x00007f17ca055a9f in ?? () from /usr/lib/libQtGui.so.4
#42 0x00007f17caaa0682 in QEventLoop::processEvents ()
   from /usr/lib/libQtCore.so.4
#43 0x00007f17caaa080d in QEventLoop::exec () from /usr/lib/libQtCore.so.4
#44 0x00007f17caaa2cbd in QCoreApplication::exec ()
   from /usr/lib/libQtCore.so.4
#45 0x0000000000402fcb in main (argc=<value optimized out>, 
    argv=<value optimized out>)
    at /build/buildd/kdepim-4.1.2/kmail/main.cpp:146
#0  0x00007f17c960a5f0 in __nanosleep_nocancel () from /lib/libc.so.6




Application: KMail (kmail), signal SIGABRT
[Thread debugging using libthread_db enabled]
[New Thread 0x7f2e92ea66f0 (LWP 14687)]
[KCrash handler]
#5  0x00007f2e8fdb4fd5 in raise () from /lib/libc.so.6
#6  0x00007f2e8fdb6b43 in abort () from /lib/libc.so.6
#7  0x00007f2e911d16b5 in qt_message_output () from /usr/lib/libQtCore.so.4
#8  0x00007f2e911d17fd in qFatal () from /usr/lib/libQtCore.so.4
#9  0x00007f2e9168a8d8 in KFileDebugStream::writeData (
    this=<value optimized out>, data=0x27302d8 "Fix this caller: \n", len=18)
    at /build/buildd/kde4libs-4.1.2/kdecore/io/kdebug.cpp:132
#10 0x00007f2e91259cc1 in QIODevice::write () from /usr/lib/libQtCore.so.4
#11 0x00007f2e91265ffc in ?? () from /usr/lib/libQtCore.so.4
#12 0x00007f2e91266119 in flush () from /usr/lib/libQtCore.so.4
#13 0x00007f2e92584297 in KMMessagePart::setCharset (this=0x276ca00, 
    c=@0x7fff9aef8e20) at /usr/include/qt4/QtCore/qtextstream.h:282
#14 0x00007f2e9252e095 in KMComposeWin::slotAttachFileResult (this=0x1d510b0, 
    job=0x2741de0) at /build/buildd/kdepim-4.1.2/kmail/kmcomposewin.cpp:2406
#15 0x00007f2e9253787c in KMComposeWin::qt_metacall (this=0x1d510b0, 
    _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, 
    _a=0x7fff9aef9020)
    at /build/buildd/kdepim-4.1.2/obj-x86_64-linux-gnu/kmail/kmcomposewin.moc:309
#16 0x00007f2e912d6134 in QMetaObject::activate ()
   from /usr/lib/libQtCore.so.4
#17 0x00007f2e9169fb72 in KJob::result (this=0x395f, _t1=0x2741de0)
    at /build/buildd/kde4libs-4.1.2/obj-x86_64-linux-gnu/kdecore/kjob.moc:186
#18 0x00007f2e9169ff37 in KJob::emitResult (this=0x2741de0)
    at /build/buildd/kde4libs-4.1.2/kdecore/jobs/kjob.cpp:290
#19 0x00007f2e8bf8c0f0 in KIO::SimpleJob::slotFinished (this=0x2741de0)
    at /build/buildd/kde4libs-4.1.2/kio/kio/job.cpp:498
#20 0x00007f2e8bf8f543 in KIO::TransferJob::slotFinished (this=0x2741de0)
    at /build/buildd/kde4libs-4.1.2/kio/kio/job.cpp:967
#21 0x00007f2e8bf902a5 in KIO::TransferJob::qt_metacall (this=0x2741de0, 
    _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, 
    _a=0x7fff9aef9420)
    at /build/buildd/kde4libs-4.1.2/obj-x86_64-linux-gnu/kio/jobclasses.moc:336
#22 0x00007f2e912d6134 in QMetaObject::activate ()
   from /usr/lib/libQtCore.so.4
#23 0x00007f2e8c0470a1 in KIO::SlaveInterface::dispatch (this=0x1c57e60, 
    _cmd=104, rawdata=<value optimized out>)
    at /build/buildd/kde4libs-4.1.2/kio/kio/slaveinterface.cpp:175
#24 0x00007f2e8c043f02 in KIO::SlaveInterface::dispatch (this=0x1c57e60)
    at /build/buildd/kde4libs-4.1.2/kio/kio/slaveinterface.cpp:90
#25 0x00007f2e8c034f53 in KIO::Slave::gotInput (this=0x1c57e60)
    at /build/buildd/kde4libs-4.1.2/kio/kio/slave.cpp:322
#26 0x00007f2e8c037678 in KIO::Slave::qt_metacall (this=0x1c57e60, 
    _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fff9aef9840)
    at /build/buildd/kde4libs-4.1.2/obj-x86_64-linux-gnu/kio/slave.moc:75
#27 0x00007f2e912d6134 in QMetaObject::activate ()
   from /usr/lib/libQtCore.so.4
#28 0x00007f2e8bf59830 in KIO::ConnectionPrivate::dequeue (this=0x1c57d40)
    at /build/buildd/kde4libs-4.1.2/kio/kio/connection.cpp:82
#29 0x00007f2e8bf5996a in KIO::Connection::qt_metacall (this=0x1ccfc80, 
    _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x2717480)
    at /build/buildd/kde4libs-4.1.2/obj-x86_64-linux-gnu/kio/connection.moc:72
#30 0x00007f2e912d0da5 in QObject::event () from /usr/lib/libQtCore.so.4
#31 0x00007f2e907e3c3d in QApplicationPrivate::notify_helper ()
   from /usr/lib/libQtGui.so.4
#32 0x00007f2e907eb9ea in QApplication::notify () from /usr/lib/libQtGui.so.4
#33 0x00007f2e91c1db8b in KApplication::notify (this=0x7fff9aefa3b0, 
    receiver=0x1ccfc80, event=0x27bda90)
    at /build/buildd/kde4libs-4.1.2/kdeui/kernel/kapplication.cpp:311
#34 0x00007f2e912c1d61 in QCoreApplication::notifyInternal ()
   from /usr/lib/libQtCore.so.4
#35 0x00007f2e912c29fa in QCoreApplicationPrivate::sendPostedEvents ()
   from /usr/lib/libQtCore.so.4
#36 0x00007f2e912ea4d3 in ?? () from /usr/lib/libQtCore.so.4
#37 0x00007f2e887d8d3b in g_main_context_dispatch ()
   from /usr/lib/libglib-2.0.so.0
#38 0x00007f2e887dc50d in ?? () from /usr/lib/libglib-2.0.so.0
#39 0x00007f2e887dc6cb in g_main_context_iteration ()
   from /usr/lib/libglib-2.0.so.0
#40 0x00007f2e912ea15f in QEventDispatcherGlib::processEvents ()
   from /usr/lib/libQtCore.so.4
#41 0x00007f2e90875a9f in ?? () from /usr/lib/libQtGui.so.4
#42 0x00007f2e912c0682 in QEventLoop::processEvents ()
   from /usr/lib/libQtCore.so.4
#43 0x00007f2e912c080d in QEventLoop::exec () from /usr/lib/libQtCore.so.4
#44 0x00007f2e912c2cbd in QCoreApplication::exec ()
   from /usr/lib/libQtCore.so.4
#45 0x0000000000402fcb in main (argc=<value optimized out>, 
    argv=<value optimized out>)
    at /build/buildd/kdepim-4.1.2/kmail/main.cpp:146
#0  0x00007f2e8fe2a5f0 in __nanosleep_nocancel () from /lib/libc.so.6
Comment 4 George Kiagiadakis 2008-11-08 00:30:40 UTC
Interesting backtrace.... I can't reproduce it, but it's reasonable, as this is a configuration-dependent feature that crashes.

The problem probably is in kdelibs (kdecore, kdebug.cpp). In this case, kdebug is configured to write its output to a file instead of stdout, so the KFileDebugStream is connected to the QDebug object that is returned by kDebug() and friends. KFileDebugStream expects to get a filename from somewhere and this is passed to it in the string that it writes (the filename is prepended with a \0 character to the debug message). That is defined in kdebug.cpp line 375:
    QDebug setupFileWriter(const QString &fileName)
    {
        QDebug result(&filewriter);
        result.nospace() << qPrintable(fileName) << '\0';
        return result;
    }

When KFileDebugStream::writeData() is called, it gets the filename from the string and writes the rest of the string to that file. However, in this case we have this warning in kmmsgpart.cpp line 151:
    kWarning(5006)
      << "KMMessagePart::setCharset(): trying to set a charset for a non-textual mimetype." << endl
      << "Fix this caller:" << endl
      << "====================================================================" << endl
      << kBacktrace( 5 ) << endl
      << "====================================================================";

The problem with this is that it puts "endl" many times in the stream and endl by default causes a flush, which in turn calls KFileDebugStream::writeData() many times, but the filename is only prepended once, in the first string only! That makes it unable to get the filename the second time and thus cause assertion failure.

PS: quick solution: disable logging kdebug to a file! (don't ask me how, I don't know :P)

PS2: That is also a kmail bug, because this warning message should *not* be shown ;)
Comment 5 Stefano Franchi 2008-11-11 18:35:46 UTC
Is there anyone who knows how to disable logging kdebug to a file, as George suggested (but didn't know how to do it)? I would really love to have this bug "fixed".....
Comment 6 George Kiagiadakis 2008-11-11 19:25:06 UTC
Here is your information, Stefano:
I finally found out how to enable/disable logging to a file and I reproduced the crash myself by setting the option to log to a file.

To disable logging, open $KDEHOME/share/config/kdebugrc and in the section [5006] (if it doesn't exist, create it) set WarnOutput=4 (4 means disabled), like this:

[5006]
WarnOutput=4

To enable logging to a file and reproduce the crash, set WarnOutput=0
Finally, to see the warning in the console, set WarnOutput=2

PS: The default in all cases is 2 (log to the console), so, if you didn't set this setting by yourself, it means that the packagers of your distribution have changed the default and this is not a very nice default imho. I'd suggest informing them about that....
Comment 7 Christoph Feck 2009-07-22 20:27:48 UTC
Fixed by David Faure in trunk. Unfortunately, the commit is quite large and consists of more than just the bug fix. I am not sure if this will/can be backported to KDE 4.3 branch.

WebSVN link: http://websvn.kde.org/?view=rev&revision=992810

David, please check if you can backport, and close this bug, thanks.
Comment 8 Christoph Feck 2010-02-23 22:48:29 UTC
Not backported, but fixed in KDE SC 4.4.0.