Bug 336117 - "kde-open --noninteractive" crashes for HTTP(S) URIs
Summary: "kde-open --noninteractive" crashes for HTTP(S) URIs
Status: RESOLVED WORKSFORME
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 4.13.2
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: kdelibs bugs
URL: https://gist.github.com/joschi/e2463c...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-12 10:25 UTC by jochen+kdebugs
Modified: 2020-12-15 04:07 UTC (History)
15 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
"kde-open --noninteractive [...]" backtrace (3.96 KB, text/plain)
2014-06-13 18:47 UTC, jochen+kdebugs
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jochen+kdebugs 2014-06-12 10:25:15 UTC
When trying to open a HTTP(S) URI with `kde-open --noninteractive` (which is being used by `xdg-open`), the process dies instantaneously.

Reproducible: Always

Steps to Reproduce:
1. Run `kde-open --noninteractive "http://example.com"`
Actual Results:  
kde-open crashes with the following messages:

QWidget: Cannot create a QWidget when no GUI is being used
/usr/bin/xdg-open: line 513:  3830 Aborted                 (core dumped) kde-open --noninteractive "$1"

Expected Results:  
The URI should be opened in the configured application for HTTP(S) URIs.

Might be related to https://bugs.kde.org/show_bug.cgi?id=269823
Comment 1 Rex Dieter 2014-06-13 13:02:56 UTC
I cannot reproduce on my fedora 20 x86_64 box.

Can you post a backtrace?
Comment 2 Rex Dieter 2014-06-13 13:06:18 UTC
And, what happens if you try kde-open without --noninteractive option with a https url?
Comment 3 jochen+kdebugs 2014-06-13 18:46:28 UTC
(In reply to comment #2)
> And, what happens if you try kde-open without --noninteractive option with a
> https url?

Without the --noninteractive parameter, the command succeeds (see https://gist.github.com/joschi/e2463cea4fa81af7787e#file-gistfile1-txt-L16 in lines 16-18).
Comment 4 jochen+kdebugs 2014-06-13 18:47:09 UTC
Created attachment 87170 [details]
"kde-open --noninteractive [...]" backtrace

Backtrace of "kde-open --noninteractive [...]" as requested.
Comment 5 Rex Dieter 2014-06-13 21:09:34 UTC
It would appear you're missing necessary debug symbols for the backtrace to be usable (ie, the backtrace is missing line numbers).
Comment 6 Thomas Lübking 2014-06-14 20:00:04 UTC
Happens, have no better backtrace, but the call chain is deterministic anyway.

kde-open calls 
>>  return app.kde_open(args->url(0), QByteArray(), false);

kde_open will thus call
>>  KRun * run = new KRun( url, 0 );
>>  run->setRunExecutables(allowExec);
>>  this-exec();

the two unnamed symbols must be
>> runTempService()
>> runCommandInternal()

for the latter is what triggers
>> KStartupInfo::sendStartup(id, data);

what should not happen, since the --noninteractive mode doesn't open an X server connection, but KStartupInfo::sendStartup() creates "KXMessages msgs;" which requires a QWidget as helper to send the message (or alternatively X11 anyway)

I assume "asn" should be '"0"' (a char* containing "0") to prevent the startup notification (bouncannoyance) but is QByteArray() as default parameter, so 

kde-open -> kde_open should likely generate

>>  KRun * run = new KRun( url, 0, 0, false, false, "0" );

for at least the --noninteractive case.

Didn't test, though.
Comment 7 Rex Dieter 2014-06-16 12:12:38 UTC
with more testing, I can reproduce the crash now.  I'd switched default browser to chrome before.

Using the kde default (konqueror), I can now exhibit the crash (with a better backtrace shortly)
Comment 8 Rex Dieter 2014-06-16 12:30:07 UTC
#0  0xb7fff424 in __kernel_vsyscall ()
#1  0x429f4b96 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#2  0x429f63d3 in __GI_abort () at abort.c:89
#3  0x454517da in qt_message_output (msgType=QtFatalMsg, buf=0x8123590 "QWidget: Cannot create a QWidget when no GUI is being used") at global/qglobal.cpp:2359
#4  0x454519aa in qt_message(enum QtMsgType, const char *, va_list) (msgType=msgType@entry=QtFatalMsg, msg=msg@entry=0x4d507cd0 "QWidget: Cannot create a QWidget when no GUI is being used", ap=ap@entry=0xbfffe604 "`\021\022\b\017\267EE`unE")
    at global/qglobal.cpp:2405
#5  0x45451f69 in qFatal (msg=msg@entry=0x4d507cd0 "QWidget: Cannot create a QWidget when no GUI is being used") at global/qglobal.cpp:2588
#6  0x4ce07616 in QWidgetPrivate::init (this=0x811a9f8, parentWidget=parentWidget@entry=0x0, f=...) at kernel/qwidget.cpp:1284
#7  0x4ce078a4 in QWidget::QWidget (this=0x811f990, parent=0x0, f=...) at kernel/qwidget.cpp:1175
#8  0x47e34ae5 in ProgressWidget (parent=<optimized out>, object=0x8111088, job=0x80f5b30, this=0x811f990) at /usr/src/debug/kdelibs-4.13.1/kdeui/jobs/kwidgetjobtracker_p.h:83
#9  KWidgetJobTracker::registerJob (this=0x8111088, job=0x80f5b30) at /usr/src/debug/kdelibs-4.13.1/kdeui/jobs/kwidgetjobtracker.cpp:81
#10 0x4ae7fbc0 in KDynamicJobTracker::registerJob (this=0x810f4c8, job=0x80f5b30) at /usr/src/debug/kdelibs-4.13.1/kio/kio/kdynamicjobtracker.cpp:88
#11 0x4ae479f4 in newJob (flags=..., _staticData=..., packedArgs=..., command=67, url=...) at /usr/src/debug/kdelibs-4.13.1/kio/kio/job_p.h:325
#12 KIO::get (url=..., reload=reload@entry=KIO::NoReload, flags=...) at /usr/src/debug/kdelibs-4.13.1/kio/kio/job.cpp:1374
#13 0x4aeb44c9 in KRun::scanFile (this=0x80cf458) at /usr/src/debug/kdelibs-4.13.1/kio/kio/krun.cpp:1312
#14 0x4aebca50 in KRun::init (this=0x80cf458) at /usr/src/debug/kdelibs-4.13.1/kio/kio/krun.cpp:1233
#15 0x4aeb32d4 in KRun::slotTimeout (this=0x80cf458) at /usr/src/debug/kdelibs-4.13.1/kio/kio/krun.cpp:1329
#16 0x4aeb3dd0 in KRun::qt_static_metacall (_o=0x0, _id=6, _a=0xbfffeae4, _c=<optimized out>) at /usr/src/debug/kdelibs-4.13.1/i686-redhat-linux-gnu/kio/krun.moc:62
#17 0x45590395 in QMetaObject::activate (sender=sender@entry=0x80cf108, m=m@entry=0x456e6a18 <QTimer::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x0) at kernel/qobject.cpp:3567
#18 0x455e4246 in QTimer::timeout (this=this@entry=0x80cf108) at .moc/release-shared/moc_qtimer.cpp:147
#19 0x4559a326 in QTimer::timerEvent (this=0x80cf108, e=0xbfffee6c) at kernel/qtimer.cpp:280
#20 0x45594ae4 in QObject::event (this=0x80cf108, e=0xbfffee6c) at kernel/qobject.cpp:1184
#21 0x4cda7bd4 in QApplicationPrivate::notify_helper (this=0x80913c0, receiver=0x80cf108, e=0xbfffee6c) at kernel/qapplication.cpp:4565
#22 0x4cdaeb29 in QApplication::notify (this=0xbffff154, receiver=0x80cf108, e=0xbfffee6c) at kernel/qapplication.cpp:4351
#23 0x4557a5f6 in QCoreApplication::notifyInternal (this=0xbffff154, receiver=0x80cf108, event=event@entry=0xbfffee6c) at kernel/qcoreapplication.cpp:953
#24 0x455af2db in sendEvent (event=0xbfffee6c, receiver=<optimized out>) at kernel/qcoreapplication.h:231
#25 QTimerInfoList::activateTimers (this=this@entry=0x808cdac) at kernel/qeventdispatcher_unix.cpp:621
#26 0x455abfc9 in timerSourceDispatch (source=source@entry=0x808cd78) at kernel/qeventdispatcher_glib.cpp:193
#27 0x42f97556 in g_main_dispatch (context=0x8090658) at gmain.c:3066
#28 g_main_context_dispatch (context=context@entry=0x8090658) at gmain.c:3642
#29 0x42f97920 in g_main_context_iterate (context=context@entry=0x8090658, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3713
#30 0x42f979e9 in g_main_context_iteration (context=0x8090658, may_block=1) at gmain.c:3774
#31 0x455ac1c4 in QEventDispatcherGlib::processEvents (this=0x806fe60, flags=...) at kernel/qeventdispatcher_glib.cpp:450
#32 0x45578ea0 in QEventLoop::processEvents (this=this@entry=0xbffff064, flags=...) at kernel/qeventloop.cpp:149
#33 0x45579231 in QEventLoop::exec (this=this@entry=0xbffff064, flags=...) at kernel/qeventloop.cpp:204
#34 0x4557f06b in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1225
#35 0x4cda5ee5 in QApplication::exec () at kernel/qapplication.cpp:3823
#36 0x0804b40a in ClientApp::kde_open (this=this@entry=0xbffff154, url=..., mimeType=..., allowExec=allowExec@entry=false) at /usr/src/debug/kde-runtime-4.13.1/kioclient/kioclient.cpp:182
#37 0x0804b94f in ClientApp::doIt () at /usr/src/debug/kde-runtime-4.13.1/kioclient/kioclient.cpp:298
#38 0x0804a835 in main (argc=3, argv=0xbffff2a4) at /usr/src/debug/kde-runtime-4.13.1/kioclient/kioclient.cpp:145
Comment 9 Thomas Lübking 2014-06-16 19:01:18 UTC
That's a different backtrace, triggered by a different branch of KRun::init(), ie. KRun has multiple GUI dependencies.
Comment 10 Christoph Feck 2014-07-17 19:23:32 UTC
Hm, xdg-open script from openSUSE 13.1 does not use that flag, so it probably has been added recently. As a workaround, I suggest to remove it again.
Comment 12 sparhawk 2014-07-20 01:07:30 UTC
I also get this crash when trying to open an html page.

$ xdg-mime query filetype foo.html
text/html
$ xdg-open foo.html
unnamed app(15780) ClientApp::doIt: Creating ClientApp
kioclient(15780) ClientApp::kde_open: KUrl("file:///path/to/foo.html")
kioclient(15780)/kdecore (KSycoca) KSycocaPrivate::openDatabase: Trying to open ksycoca from "/var/tmp/kdecache-username/ksycoca4"
QWidget: Cannot create a QWidget when no GUI is being used
/usr/bin/xdg-open: line 513: 15780 Aborted                 kde-open --noninteractive "$1"
Comment 13 Justin Zobel 2020-12-14 01:37:07 UTC
Thank you for the crash reports.

As it has been a while since this was reported, can you please test and confirm if this issue is still occurring or if this bug report can be marked as resolved.

I have set the bug status to "needsinfo" pending your response, please change back to "reported" or "resolved/worksforme" when you respond, thank you.
Comment 14 sparhawk 2020-12-14 06:16:15 UTC
Does kde-open even exist still? Anyway, I tested my command [above](https://bugs.kde.org/show_bug.cgi?id=336117#c12) and xdg-open works fine with html pages.
Comment 15 Elvis Stansvik 2020-12-14 19:03:19 UTC
I cannot reproduce this anymore. Looks fine to close.
Comment 16 Justin Zobel 2020-12-15 04:07:51 UTC
Two users have confirmed working, setting to resolved. If any other users are still experiencing the issue please reopen.