Bug 325155

Summary: Docs and code for X-KDE-autostart-phase disagree.
Product: [Frameworks and Libraries] kdelibs Reporter: John <john5342>
Component: kdeinitAssignee: kdelibs bugs <kdelibs-bugs>
Status: CONFIRMED ---    
Severity: minor CC: adaptee, kevin.kofler, lukas, mss, rdieter
Priority: NOR    
Version: Git   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description John 2013-09-21 22:34:45 UTC
While investigating another bug (ksmserver not finishing autostart) i found the default value for "X-KDE-autostart-phase" in .desktop files is supposed to be "1" (see e.g. kdelibs/kinit/README.autostart). The code that actually loads the desktop files seems to default to 2. The end result is that any autostart file without a X-KDE-autostart-phase entry will start later than expected. Cut down copy of relevant loading code below:

=== // kdelibs/kdecore/util/kautostart.cpp
KAutostart::StartPhase readEntry(const KConfigGroup &group, const char* key, const KAutostart::StartPhase& aDefault)
{
//...
    if (data == "0" || data == "BaseDesktop") {
        return KAutostart::BaseDesktop;
    } else if (data == "1" || data == "DesktopServices") {
        return KAutostart::DesktopServices;
    } else if (data == "2" || data == "Applications") {
        return KAutostart::Applications;
    }
//...
}

KAutostart::StartPhase KAutostart::startPhase() const
{
    return readEntry(d->df->desktopGroup(), "X-KDE-autostart-phase", Applications);
}
===

I didn't know what component to file against (kdeinit or kdecore) since i don't know if it's the documentation or code that is wrong but they probably ought to agree.

Reproducible: Always

Steps to Reproduce:
1. Create an autostart desktop file without X-KDE-autostart-phase item.

Actual Results:  
File is autostarted in phase 2.

Expected Results:  
file should be autostarted in phase 1 as the docs suggest.

A workaround is adding the relevant item to all desktop files that matter.
Comment 1 Rex Dieter 2013-12-07 15:20:25 UTC
confirmed, items are starting in phase 2 autostart after session restore.  I can think of lots of badness this could cause.  For example, xsettings-kde starting after session-restored apps