Bug 315040

Summary: "there are kde applications running" message on updating
Product: kde-windows Reporter: Mihai Sorin Dobrescu <msdobrescu>
Component: installerAssignee: KDE-Windows <kde-windows>
Status: RESOLVED REMIND    
Severity: major CC: msdobrescu, ralf.habacker
Priority: NOR    
Version: 4.8   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:

Description Mihai Sorin Dobrescu 2013-02-13 07:58:46 UTC
I have installed KDE on Windows 7 Enterprise 64bit, msvc build, and I try to update it.
There are no KDE processes except the KDE installer itself, but the "there are kde applications running" message appears and KDE can't be updated.



Reproducible: Always

Steps to Reproduce:
Follow the update procedure: 
1. Start the installer only (nu other KDE apps running)
2. Let it detect the updates
3. Start update
4. A dialog box appears saying: "there are kde applications running"
5. The installation stops as the installer closes.
Actual Results:  
The upgrading fails.

Expected Results:  
The KDE processes should be identified correctly and the installation (upgrading) should continue.

The issue is in the code:

bool InstallerEngine::isAnyKDEProcessRunning()
{
QString cmd = m_root +""/bin/kdeinit4.exe"";
QProcess p;
QStringList args = QStringList() << ""--list"";
p.start(cmd,args);
if (!p.waitForStarted())
{
qCritical() << ""could not start"" << cmd << args;
return false;
}
if (!p.waitForFinished())
{
qCritical() << ""failed to run"" << cmd << args;
return false;
}
QByteArray _stderr = p.readAllStandardError();
qDebug() << ""run"" << cmd << args << ""without errors"" << _stderr;
QList<QByteArray> lines = _stderr.split('\n');
int ret = lines.size() - 1; // because of trailing '\n'
// one line means ony kdeinit4 is running
return ret > 1;
}

M:\KDE\bin>kdeinit4 --list
path: M:/KDE/SETUP name: kdewin-installer-gui-latest pid: 3936
path: M:/KDE/bin name: kdeinit4 pid: 7732

M:\KDE\bin>

So, there is an additional line, because kdeinit4 reports itself, the installer process is also there and the \n too.
Comment 1 Ralf Habacker 2013-08-10 17:02:08 UTC
With commit http://commits.kde.org/kdewin-installer/a737033ea1038ed154c95e5416c8d91b224a5cd7 the installer has been excluded from the list of kde application in use, but im not sure if this really solve the problem. 

Normally the installer will be copied to a temporary location before running
main.cpp
    //
    // when installer is located in install root dir run it from a temporary location 
    // to avoid installer executable acess problem for update and removal,
    //
    if (SelfInstaller::instance().isRunningFromInstallRoot())
    {
        QStringList args = QApplication::arguments(); 
        args.removeFirst();
        SelfInstaller::instance().runFromTemporayLocation(args);
    }
  and your report 

path: M:/KDE/SETUP name: kdewin-installer-gui-latest pid: 3936

indicates that this did not happens. 

There must be a problem with this detection in isRunningFromInstallRoot()