klauncher: fix appId matching for flatpak apps
ClosedPublic

Authored by elvisangelaccio on Aug 23 2017, 10:43 AM.

Details

Summary

With flatpak applications we can have the following scenario:

appId= "org.kde.ark.kdbus-_1_769" newAppId= "org.kde.ark.kdbus" pendingAppId= "org.kde.ark"

because of https://phabricator.kde.org/D5775

This breaks matchesPendingRequest(), resulting in an annoying
"KDEInit could not launch '/usr/bin/flatpak'" dialog after closing the app.

This patch adds an explicit check for this case.

Test Plan
  • install ark flatpak
  • kde-open5 foo.zip
  • close ark

Diff Detail

Repository
R303 KInit
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
Restricted Application added a project: Frameworks. · View Herald TranscriptAug 23 2017, 10:43 AM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript

I just realized that ".kdbus" is appended by KDBusAddons, not by flatpak. Maybe we could also fix it there...

I just realized that ".kdbus" is appended by KDBusAddons, not by flatpak. Maybe we could also fix it there...

Nope, it's intentional (see D5775). So this fix in klauncher should be ok.

Btw kate is also affected, while for some reasons okular is not.

elvisangelaccio edited the summary of this revision. (Show Details)Aug 23 2017, 1:22 PM
dfaure added inline comments.Aug 23 2017, 8:43 PM
src/klauncher/klauncher.cpp
364

QString::endsWith() has a QLatin1String overload, which would be slightly better here.

365

So if I start kdesudoku and kdesu quickly, when kdesudoku is started, the pending entry for kdesu will think it matches? ;)
It would be technically more correct to do newAppId.left(newAppId.length() - 6) == pendingAppId, I think.

  • Fixed David's issues.
elvisangelaccio marked 2 inline comments as done.Aug 24 2017, 5:36 PM
dfaure added inline comments.Aug 24 2017, 7:18 PM
src/klauncher/klauncher.cpp
323–324

This seems to be mixed with an unrelated change, now.

dfaure edited edge metadata.Aug 24 2017, 7:19 PM

Hint: arc diff HEAD~

dfaure accepted this revision.Aug 24 2017, 9:33 PM

Now that I think about it, leftRef() would be even better...

This revision is now accepted and ready to land.Aug 24 2017, 9:33 PM

Use leftRef()

dfaure accepted this revision.Aug 25 2017, 4:04 PM
This revision was automatically updated to reflect the committed changes.