Bug 323722 - kontact crash when going to open a doc attached to an email
Summary: kontact crash when going to open a doc attached to an email
Status: RESOLVED DOWNSTREAM
Alias: None
Product: kontact
Classification: Applications
Component: general (show other bugs)
Version: 4.11
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: kdepim bugs
URL: https://bugs.gentoo.org/show_bug.cgi?...
Keywords: drkonqi
: 327562 328852 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-08-19 14:07 UTC by Darin McBride
Modified: 2013-12-16 11:28 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
New crash information added by DrKonqi (9.09 KB, text/plain)
2013-08-19 16:13 UTC, Darin McBride
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Darin McBride 2013-08-19 14:07:08 UTC
Application: kontact (4.11)
KDE Platform Version: 4.11.00 (Compiled from sources)
Qt Version: 4.8.4
Operating System: Linux 3.10.7-gentoo x86_64
Distribution: "NAME=Gentoo"

-- Information about the crash:
- What I was doing when the application crashed:

I have an email with an attached .doc file, I went to open it, clicking on the attachment then on "Open with 'LibreOffice Writer'".  At this point, it crashed.

Saving via "Save As..." works fine.  Also, "Open With..." and then choosing "lowriter" works fine.  This also worked fine with KDE 4.10, from which I upgraded only yesterday.

The crash can be reproduced every time.

-- Backtrace:
Application: Kontact (kontact), signal: Aborted
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f5cdf26f7c0 (LWP 4813))]

Thread 3 (Thread 0x7f5cc4a15700 (LWP 4814)):
#0  0x00007f5cd693259c in pthread_cond_wait () from /lib64/libpthread.so.0
#1  0x00007f5cd9c6c654 in WTF::TCMalloc_PageHeap::runScavengerThread(void*) () from /usr/lib64/qt4/libQtWebKit.so.4
#2  0x00007f5cd692dd96 in start_thread () from /lib64/libpthread.so.0
#3  0x00007f5cdc49b46d in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7f5cc4114700 (LWP 4815)):
#0  0x00007f5cdc4926a3 in poll () from /lib64/libc.so.6
#1  0x00007f5cd58f0e95 in g_main_context_iterate.isra.23.part.24 () from /usr/lib64/libglib-2.0.so.0
#2  0x00007f5cd58f1005 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#3  0x00007f5cdda6e906 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#4  0x00007f5cdda34c72 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#5  0x00007f5cdda34eb7 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#6  0x00007f5cdd911708 in QThread::exec() () from /usr/lib64/qt4/libQtCore.so.4
#7  0x00007f5cdd914aee in QThreadPrivate::start(void*) () from /usr/lib64/qt4/libQtCore.so.4
#8  0x00007f5cd692dd96 in start_thread () from /lib64/libpthread.so.0
#9  0x00007f5cdc49b46d in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f5cdf26f7c0 (LWP 4813)):
[KCrash Handler]
#6  0x00007f5cdc3e5aa5 in raise () from /lib64/libc.so.6
#7  0x00007f5cdc3e6da5 in abort () from /lib64/libc.so.6
#8  0x00007f5cdd909a14 in qt_message_output(QtMsgType, char const*) () from /usr/lib64/qt4/libQtCore.so.4
#9  0x00007f5cdd909b9f in qt_message(QtMsgType, char const*, __va_list_tag*) () from /usr/lib64/qt4/libQtCore.so.4
#10 0x00007f5cdd909d44 in qFatal(char const*, ...) () from /usr/lib64/qt4/libQtCore.so.4
#11 0x00007f5cdbda240d in supportedProtocols(KService const&) () from /usr/lib64/libkio.so.5
#12 0x00007f5cdbda5688 in KRun::run(KService const&, KUrl::List const&, QWidget*, bool, QString const&, QByteArray const&) () from /usr/lib64/libkio.so.5
#13 0x00007f5c79f75000 in MessageViewer::ViewerPrivate::attachmentOpenWith(KMime::Content*, KSharedPtr<KService>) () from /usr/lib64/libmessageviewer.so.4
#14 0x00007f5c79f7b7ed in MessageViewer::ViewerPrivate::openAttachment(KMime::Content*, QString const&) () from /usr/lib64/libmessageviewer.so.4
#15 0x00007f5c79f5b946 in (anonymous namespace)::AttachmentURLHandler::handleClick(KUrl const&, MessageViewer::ViewerPrivate*) const () from /usr/lib64/libmessageviewer.so.4
#16 0x00007f5c79f5e558 in MessageViewer::URLHandlerManager::handleClick(KUrl const&, MessageViewer::ViewerPrivate*) const () from /usr/lib64/libmessageviewer.so.4
#17 0x00007f5c79f6ac75 in MessageViewer::ViewerPrivate::slotUrlOpen(QUrl const&) () from /usr/lib64/libmessageviewer.so.4
#18 0x00007f5c79f85d10 in MessageViewer::ViewerPrivate::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib64/libmessageviewer.so.4
#19 0x00007f5cdda5533e in QObject::event(QEvent*) () from /usr/lib64/qt4/libQtCore.so.4
#20 0x00007f5cdcc3ae12 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/qt4/libQtGui.so.4
#21 0x00007f5cdcc40e5b in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/qt4/libQtGui.so.4
#22 0x00007f5cde598ef6 in KApplication::notify(QObject*, QEvent*) () from /usr/lib64/libkdeui.so.5
#23 0x00007f5cdda3711c in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/qt4/libQtCore.so.4
#24 0x00007f5cdda3ac43 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib64/qt4/libQtCore.so.4
#25 0x00007f5cdda6e433 in postEventSourceDispatch(_GSource*, int (*)(void*), void*) () from /usr/lib64/qt4/libQtCore.so.4
#26 0x00007f5cd58f0bd3 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#27 0x00007f5cd58f0ed8 in g_main_context_iterate.isra.23.part.24 () from /usr/lib64/libglib-2.0.so.0
#28 0x00007f5cd58f1005 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#29 0x00007f5cdda6e89f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#30 0x00007f5cdccf78be in QGuiEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtGui.so.4
#31 0x00007f5cdda34c72 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#32 0x00007f5cdda34eb7 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#33 0x00007f5cdda3b055 in QCoreApplication::exec() () from /usr/lib64/qt4/libQtCore.so.4
#34 0x0000000000403be9 in main ()

Reported using DrKonqi
Comment 1 Jekyll Wu 2013-08-19 15:01:53 UTC
> #11 0x00007f5cdbda240d in supportedProtocols(KService const&) () from /usr/lib64/libkio.so.5 
> #12 0x00007f5cdbda5688 in KRun::run(KService const&, KUrl::List const&, QWidget*, bool, QString const&, QByteArray const&) () from /usr/lib64/libkio.so.5

Since you can reproduce the crash every time, please rebuild related packages[1] with debug symbols and provide a better backtrace. 

[1] http://www.gentoo.org/proj/en/qa/backtraces.xml
Comment 2 Darin McBride 2013-08-19 16:13:07 UTC
Created attachment 81789 [details]
New crash information added by DrKonqi

kontact (4.11) on KDE Platform 4.11.00 using Qt 4.8.4

Same as earlier - but this time I've recompiled a bunch of stuff with the -ggdb flag as requested.

Thanks!

-- Backtrace (Reduced):
#11 0x00007f0279cb640d in supportedProtocols (_service=...) at /var/tmp/portage/kde-base/kdelibs-4.11.0/work/kdelibs-4.11.0/kio/kio/krun.cpp:377
#12 0x00007f0279cb9688 in resolveURLs (_service=..., _urls=...) at /var/tmp/portage/kde-base/kdelibs-4.11.0/work/kdelibs-4.11.0/kio/kio/krun.cpp:742
#13 KRun::run (_service=..., _urls=..., window=<optimized out>, tempFiles=<optimized out>, suggestedFileName=..., asn=...) at /var/tmp/portage/kde-base/kdelibs-4.11.0/work/kdelibs-4.11.0/kio/kio/krun.cpp:1007
#14 0x00007f0217e33000 in MessageViewer::ViewerPrivate::attachmentOpenWith (this=0x1d0bba0, node=<optimized out>, offer=...) at /var/tmp/portage/kde-base/kdepim-common-libs-4.11.0/work/kdepim-common-libs-4.11.0/messageviewer/viewer/viewer_p.cpp:761
#15 0x00007f0217e397ed in MessageViewer::ViewerPrivate::openAttachment (this=0x1d0bba0, node=0x26bc680, name=...) at /var/tmp/portage/kde-base/kdepim-common-libs-4.11.0/work/kdepim-common-libs-4.11.0/messageviewer/viewer/viewer_p.cpp:392
Comment 3 Laurent Montel 2013-08-20 16:21:20 UTC
It's an assert in code
    if (mx1.expandMacrosShellQuote(exec) && !mx1.hasUrls) {
        Q_ASSERT(supportedProtocols.isEmpty());   // huh? If you support protocols you need %u or %U...
    }

it's a pb with gentoo + desktop file.
So it's not a kontact problem
Comment 4 Darin McBride 2013-08-21 19:58:34 UTC
Well, I'm not sure that crashing due to a distro doing something wrong is necessarily the best way to handle it...

But can you help me discern which desktop file it is that needs changing, and what kind of change it needs so I can go to the gentoo devs to fix?

Thanks
Comment 5 Christophe Marin 2013-08-29 12:05:58 UTC
(In reply to comment #4)
> 
> But can you help me discern which desktop file it is that needs changing,
> and what kind of change it needs so I can go to the gentoo devs to fix?
> 
you already gave the answer: in your bug report: "[...] clicking on the attachment then on "Open with 'LibreOffice Writer'"."

So, look in the libreoffice writer desktop file (called writer.desktop)

The issue comes from your libreoffice build as stated before:
The desktop files in libreoffice/sysui/desktop/share/brand.pl substitute %%FILE%% to %U if --urls is true (else, it uses %F)
"--urls" is defined in libreoffice/sysui/CustomTarget_share.mk if ENABLE_GIO or ENABLE_GNOMEVFS is true.
and finally ENABLE_GNOMEVFS is true if gnome-vfs is found while configuring libreoffice
Comment 6 Christophe Marin 2013-09-01 15:19:27 UTC
looks like this was reported to gentoo already https://bugs.gentoo.org/show_bug.cgi?id=482036
Comment 7 Darin McBride 2013-09-04 22:00:02 UTC
So, because this is now marked "resolved downstream", I take it to mean that crashing on bad input is considered acceptable behaviour, as opposed to, perhaps, a message box or something alerting the user to the bad input?
Comment 8 Christophe Marin 2013-09-05 08:45:59 UTC
It crashes because you use a debug build (Q_ASSERT are ignored on release builds). Read https://bugs.kde.org/show_bug.cgi?id=321787#c5
Comment 9 Darin McBride 2013-09-05 12:21:49 UTC
From Code Complete 2: "Use error-handling for conditions you expect to occur; use assertions for conditions that should never occur."

Since we're talking about a desktop file, which is not under KDE's control, this is an error condition, not something that should be asserted.

But that's just my opinion.  If you disagree, no response required.
Comment 10 Darin McBride 2013-09-11 20:32:55 UTC
For posterity, problem seems to have disappeared after upgrading Qt from 4.8.4 to 4.8.5.  Now %F does not cause a crash, and libreoffice opens fine.
Comment 11 Jekyll Wu 2013-11-14 01:33:37 UTC
*** Bug 327562 has been marked as a duplicate of this bug. ***
Comment 12 Jekyll Wu 2013-12-16 03:58:24 UTC
*** Bug 328852 has been marked as a duplicate of this bug. ***
Comment 13 Vincent de Phily 2013-12-16 11:28:50 UTC
I was already on 4.8.5 when I noticed the bug; it doesn't change anything for me.

While the libreoffice desktop file certainly should get fixed, I agree with Darin that even complete garbage in a desktop file should not crash a KDE component.

Since desktop files can be created and edited by end users, KDE should expect to find weird stuff in them and work around or help diagnose any problem found. Incidentally, when reading thru krun.cpp it seems that we do just that (print a warning and return a default value) for some problems, while other problems trigger an assert. Could we do that in all cases ?