Bug 170043

Summary: [PATCH] KConfigGroupPrivate::expandString causes kdeinit crash with Fedora configuration
Product: [Frameworks and Libraries] kdelibs Reporter: Kevin Kofler <kevin.kofler>
Component: kdecoreAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Patch for kde#170043 / rh#455130

Description Kevin Kofler 2008-08-29 17:20:46 UTC
Version:           >= 4.0.98 (using KDE 4.1.1)
OS:                Linux
Installed from:    Fedora RPMs

Since revision 829259, i.e. in KDE >= 4.0.98, kinit.cpp uses KConfig without a KComponentData to read the "Documents" path, because initializing a KComponentData at that place was breaking kioslave translations.

Unfortunately, if the setting for Documents contains a shell command, as it does in the Fedora configuration:
Documents[$e]=$(xdg-user-dir DOCUMENTS)
KConfigGroupPrivate::expandString gets called and tries to unconditionally access the KComponentData which has not been initialized yet. This causes either an assertion failure or a NULL pointer dereference, depending on whether NDEBUG is defined or not.

See: https://bugzilla.redhat.com/show_bug.cgi?id=455130 for the Fedora bug report.

The change triggering the regression (plus followup fix):
http://websvn.kde.org/?view=rev&revision=829259
http://websvn.kde.org/?view=rev&revision=829264
At first, we "fixed" this in Fedora by reverting those changes, but we have a proper fix now, which I'm about to attach.
Comment 1 Kevin Kofler 2008-08-29 17:22:50 UTC
Created attachment 27127 [details]
Patch for kde#170043 / rh#455130

This one-line patch fixes KConfigGroupPrivate::expandString not to try accessing the "exe" path from KComponentData before it has been initialized. When called in that situation, it falls back to only searching the system PATH for the command to run.
Comment 2 Oswald Buddenhagen 2008-08-31 12:03:35 UTC
fixed for kde 4.2 and 4.1.2