From kde-panel-devel Sat Apr 30 16:21:27 2016 From: Rob Wu Date: Sat, 30 Apr 2016 16:21:27 +0000 To: kde-panel-devel Subject: Re: Review Request 127571: [taskmanager] Stop parsing executables as .desktop files Message-Id: <20160430162127.11646.28518 () mimi ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-panel-devel&m=146203330618548 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============3340563678291553639==" --===============3340563678291553639== Content-Type: multipart/alternative; boundary="===============7277151254497721357==" --===============7277151254497721357== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://git.reviewboard.kde.org/r/127571/ ----------------------------------------------------------- (Updated April 30, 2016, 6:21 p.m.) Status ------ This change has been marked as submitted. Review request for Plasma. Changes ------- Submitted with commit 71055e2b725fbb65e16055588f86a57c373d8b47 by Kai Uwe Broulik on behalf of Rob Wu to branch Plasma/5.6. Repository: plasma-desktop Description ------- When a binary is launched via an absolute path, then launcherUrl is not empty because of [1], even though it is not a .desktop file. Consequently, when a user right-clicks on the task item, plasmashell attempts to parse the executable as a .desktop configuration file. Since this file is obviously not a .desktop file, parsing it as such will fail, and KConfig floods ~/.xsession-errors with lots of errors. This can quickly add hundreds of megabytes per right-click... This patch resolves the problem by not constructing a KDesktopFile if the launcherUrl is not a .desktop file. An alternative (and more general) way to get rid of the symptoms is to modify KDesktopFile / KConfig to stop parsing on the first error and write the launcherUrl to the error log (or at the very least limit the number of displayed errors). However, it can be argued that you should not pass a non-.desktop file to KDesktopFile. [1] https://quickgit.kde.org/?p=kde-workspace.git&a=commit&h=3a4b9c85fc21d14838ceac04bb0a70656ee7c701 Diffs ----- applets/taskmanager/plugin/backend.cpp 07ddfbe Diff: https://git.reviewboard.kde.org/r/127571/diff/ Testing ------- The following steps demonstrate the issue, and confirms that the patch fixes the bug. 1. Create a simple GUI program, as follows: ``` // Compile: clang++ `pkg-config --cflags --libs Qt5Widgets` app.cpp -o app -g -fPIE #include #include int main(int argc, char **argv) { QApplication app(argc, argv); QLabel label("Some GUI app"); label.show(); return app.exec(); } ``` 2. Run the program via an absolute path: $PWD/app.sh 3. Right-click on the task item in the task bar (i.e. the program that you just launched). 4. Look at ~/.xsession-errors and observe that the following lines were added. > "KConfigIni: In file /tmp/some-qt-app/app, line 1: " Invalid entry (missing '=') "KConfigIni: In file /tmp/some-qt-app/app, line 2: " Invalid entry (missing '=') "KConfigIni: In file /tmp/some-qt-app/app, line 3: " Invalid entry (missing '=') "KConfigIni: In file /tmp/some-qt-app/app, line 4: " Invalid entry (missing '=') "KConfigIni: In file /tmp/some-qt-app/app, line 5: " Invalid entry (missing ']') "KConfigIni: In file /tmp/some-qt-app/app, line 6: " "Invalid escape sequence \"\\A\"." "KConfigIni: In file /tmp/some-qt-app/app, line 6: " "Invalid escape sequence \"\\\u0001\"." ... hundreds of similar lines 5. Compile plasma-desktop with this patch and restart plasmashell. 6. Repeat step 2 and 3. 7. Look at ~/.xsession-errors and observe that the errors are gone. Thanks, Rob Wu --===============7277151254497721357== MIME-Version: 1.0 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: 7bit
This is an automatically generated e-mail. To reply, visit: https://git.reviewboard.kde.org/r/127571/

This change has been marked as submitted.


Review request for Plasma.
By Rob Wu.

Updated April 30, 2016, 6:21 p.m.

Changes

Submitted with commit 71055e2b725fbb65e16055588f86a57c373d8b47 by Kai Uwe Broulik on behalf of Rob Wu to branch Plasma/5.6.
Repository: plasma-desktop

Description

When a binary is launched via an absolute path, then launcherUrl is not
empty because of [1], even though it is not a .desktop file.
Consequently, when a user right-clicks on the task item, plasmashell
attempts to parse the executable as a .desktop configuration file.
Since this file is obviously not a .desktop file, parsing it as such
will fail, and KConfig floods ~/.xsession-errors with lots of errors.
This can quickly add hundreds of megabytes per right-click...

This patch resolves the problem by not constructing a KDesktopFile if
the launcherUrl is not a .desktop file.

An alternative (and more general) way to get rid of the symptoms is to
modify KDesktopFile / KConfig to stop parsing on the first error and
write the launcherUrl to the error log (or at the very least limit the
number of displayed errors). However, it can be argued that you should
not pass a non-.desktop file to KDesktopFile.

[1] https://quickgit.kde.org/?p=kde-workspace.git&a=commit&h=3a4b9c85fc21d14838ceac04bb0a70656ee7c701

Testing

The following steps demonstrate the issue, and confirms that the patch fixes the bug.

  1. Create a simple GUI program, as follows:

// Compile: clang++ `pkg-config --cflags --libs Qt5Widgets` app.cpp -o app -g -fPIE
#include <QApplication>
#include <QLabel>

int main(int argc, char **argv) {
    QApplication app(argc, argv);
    QLabel label("Some GUI app");
    label.show();

    return app.exec();
}

  1. Run the program via an absolute path: $PWD/app.sh
  2. Right-click on the task item in the task bar (i.e. the program that you just launched).
  3. Look at ~/.xsession-errors and observe that the following lines were added.

    "KConfigIni: In file /tmp/some-qt-app/app, line 1: " Invalid entry (missing '=') "KConfigIni: In file /tmp/some-qt-app/app, line 2: " Invalid entry (missing '=') "KConfigIni: In file /tmp/some-qt-app/app, line 3: " Invalid entry (missing '=') "KConfigIni: In file /tmp/some-qt-app/app, line 4: " Invalid entry (missing '=') "KConfigIni: In file /tmp/some-qt-app/app, line 5: " Invalid entry (missing ']') "KConfigIni: In file /tmp/some-qt-app/app, line 6: " "Invalid escape sequence \"\\A\"." "KConfigIni: In file /tmp/some-qt-app/app, line 6: " "Invalid escape sequence \"\\\u0001\"." ... hundreds of similar lines

  4. Compile plasma-desktop with this patch and restart plasmashell.

  5. Repeat step 2 and 3.
  6. Look at ~/.xsession-errors and observe that the errors are gone.

Diffs

  • applets/taskmanager/plugin/backend.cpp (07ddfbe)

View Diff

--===============7277151254497721357==-- --===============3340563678291553639== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KUGxhc21hLWRl dmVsIG1haWxpbmcgbGlzdApQbGFzbWEtZGV2ZWxAa2RlLm9yZwpodHRwczovL21haWwua2RlLm9y Zy9tYWlsbWFuL2xpc3RpbmZvL3BsYXNtYS1kZXZlbAo= --===============3340563678291553639==--