Bug 155700

Summary: KRun.init can trigger assertion failure in KAuthorizedPrivate() (empty applicationName)
Product: [Plasma] krunner Reporter: Daniel Hahler <kde-bugzilla>
Component: generalAssignee: David Faure <faure>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Proposed patch
New proposed patch: sets applicationName in kfmclient before calling KRun

Description Daniel Hahler 2008-01-14 00:47:44 UTC
Version:            (using KDE KDE 4.0.0)
Installed from:    Ubuntu Packages

"kfmclient openURL http://kde.org text/html" triggers an assertion failure in kde4libs-4.0.0/kdecore/kernel/kauthorized.cpp, line 195 - if you have configured a default browser to use in "Default applications".

The reason is that KRun is instantiated in kdebase-kde4-4.0.0/apps/konqueror/client/kfmclient.cpp and it appears that no application name is set then.

My proposed patch fixes this in kde4libs-4.0.0/kio/kio/krun.cpp, where the given URL is used to set the applicationName, if it isn't set yet, so that the following call to KAuthorized::authorizeUrlAction() will not cause the assert to fail.

Here's the output with non-patched kde4libs:
$ LANG=C kfmclient-kde4 openURL http://kde.org text/html
kfmclient(20835) ClientApp::doIt: Creating ClientApp
kfmclient(20835)/konqueror ClientApp::createNewWindow: ClientApp::createNewWindow "http://kde.org" mimetype= "text/html"
kfmclient(20835) ClientApp::createNewWindow: "!konqueror"
kfmclient(20835)/kio (KRun) KRun::KRunPrivate::init: new KRun KRun(0x8104220) "http://kde.org" timer= QTimer(0x8103ac0, name = "KRun::timer")
kfmclient(20835)/kio (KRun) KRun::slotTimeout: KRun(0x8104220) slotTimeout called
kfmclient(20835)/kio (KRun) KRun::init: INIT called
ASSERT failure in KAuthorizedPrivate(): "There has to be an application name set (See QCoreApplication::instance()->setApplicationName)", file /build/buildd/kde4libs-4.0.0/kdecore/kernel/kauthorized.cpp, line 195
Aborted (core dumped)

I've reported the bug for Ubuntu at https://launchpad.net/bugs/182718
Comment 1 Daniel Hahler 2008-01-14 00:48:50 UTC
Created attachment 23017 [details]
Proposed patch
Comment 2 David Faure 2008-01-14 17:24:31 UTC
Hmm, well, I think it's a kfmclient bug, it should set an app name like well-behaved apps do.

Setting the app name to the URL doesn't make any sense ;-)
Comment 3 Daniel Hahler 2008-01-14 18:11:32 UTC
Ok, makes sense. I just thought that adding this down in KRun would be a decent fallback.
What application name should kfmclient use, despite of the URL? "Opening $URL..."?

Will you fix it properly yourself, or should I submit an improved patch?
Comment 4 David Faure 2008-01-15 13:13:24 UTC
kfmclient should use "kfmclient" as application name :-)
Or maybe konqueror, since for KIOSK purposes people will consider it as part of konqueror.
I'll fix it when I find the time, patches are always appreciated meanwhile :)
Comment 5 Daniel Hahler 2008-01-16 23:26:02 UTC
Created attachment 23090 [details]
New proposed patch: sets applicationName in kfmclient before calling KRun
Comment 6 David Faure 2008-01-16 23:46:17 UTC
SVN commit 762398 by dfaure:

I was right when I wrote the first line of this comment: there is no reason for this assert to be here at all, KAuthorized works fine without an applicationName. KGlobal doesn't need one to get a config file (it needs a componentData instead); the only fallback to applicationName in KGlobal is in KGlobal::caption() which is completely irrelevant...
BUG: 155700


 M  +0 -3      kauthorized.cpp  


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