Bug 369391

Summary: ksmserver captures and discards standard output/error - debug information lost
Product: [Plasma] ksmserver Reporter: Jonathan Marten <jjm>
Component: generalAssignee: Lubos Lunak <l.lunak>
Status: RESOLVED FIXED    
Severity: normal CC: bernhardu, rdieter
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: ksmserver: Make sure stdout and stderr gets forwarded to .xsession-errors.

Description Jonathan Marten 2016-09-26 19:46:46 UTC
All processes started from ksmserver - in practice, this means almost every workspace or application process apart from kwin - appear to have their standard output and error piped back to ksmserver.  ksmserver, though, does nothing with the output and discards it.

This does not affect normal desktop operation, but it means that no debug messages will appear in the session error log file (~/.xsession-errors or similar).  So if the user gets the troubleshooting advice "enable debug messages then look in ~/.xession-errors to see if there are any messages from...", there will not be any.

If this behaviour is not intentional, it may be the result of porting ksmserver from KProcess to QProcess.  The default output channel mode was ForwardedChannels in KProcess, but is SeparateChannels in QProcess.  Setting this to ForwardedChannels in KSMServer::slotAutoStart() would restore the previous logging behaviour.


Reproducible: Always




This is plasma-workspace commit 459b53bc.

$ ksmserver --version
ksmserver 0.4
Comment 1 Bernhard Übelacker 2017-02-01 22:02:56 UTC
Created attachment 103756 [details]
ksmserver: Make sure stdout and stderr gets forwarded to .xsession-errors.

In my Debian Stretch system I noticed that no logging from
e.g. powerdevil arrives in .xsession-errors.

Just before opening a new bug I found that Jonathan Marten already
described just the exact same problem.

Please find attached a patch against Debian version of
plasma-workspace_5.8.4-1,
enabling the forwarding to ksmservers stdout/stderr.
Comment 3 Lubos Lunak 2017-04-21 12:03:11 UTC
Git commit 17eeb58ae42596195d6a841c06d17721b7af2c14 by Luboš Luňák.
Committed on 21/04/2017 at 12:00.
Pushed by lunakl into branch 'Plasma/5.8'.

use KProcess instead of QProcess to launch apps in ksmserver

Follow-up to the previous commit. KProcess has saner defaults for simply
launching an app and being done with it, no lost stdout/stderr or even SIGPIPE.
Related: bug 370528

M  +3    -2    ksmserver/startup.cpp

https://commits.kde.org/plasma-workspace/17eeb58ae42596195d6a841c06d17721b7af2c14
Comment 4 Lubos Lunak 2017-04-21 12:03:11 UTC
Git commit 0f19e92f3e85d064de9cebf280fa8e085485c2e0 by Luboš Luňák.
Committed on 21/04/2017 at 11:59.
Pushed by lunakl into branch 'Plasma/5.8'.

launch autostart apps in ksmserver using KRun, not QProcess

The "move" (copy in fact) of the autostart code from klauncher simply
switched to QProcess. This resulted in a number of problems, as the incorrect
handling of .desktop file command if it had placeholders (worked around
already), kdeinit is no longer used (not sure how much that matters nowadays)
and finally QProcess simply eats all stdout/stderr of all such processes
(which, when daemonized, can lead even to the processes getting SIGPIPE'd).
If the application to start is a KService, simply launch it as such.
Related: bug 370528

M  +3    -13   ksmserver/startup.cpp

https://commits.kde.org/plasma-workspace/0f19e92f3e85d064de9cebf280fa8e085485c2e0
Comment 5 Lubos Lunak 2017-04-21 12:03:31 UTC
Git commit da44dd6eae8b9ef4161680efcb9319a7267fe77e by Luboš Luňák.
Committed on 21/04/2017 at 12:00.
Pushed by lunakl into branch 'Plasma/5.9'.

launch autostart apps in ksmserver using KRun, not QProcess

The "move" (copy in fact) of the autostart code from klauncher simply
switched to QProcess. This resulted in a number of problems, as the incorrect
handling of .desktop file command if it had placeholders (worked around
already), kdeinit is no longer used (not sure how much that matters nowadays)
and finally QProcess simply eats all stdout/stderr of all such processes
(which, when daemonized, can lead even to the processes getting SIGPIPE'd).
If the application to start is a KService, simply launch it as such.
Related: bug 370528

M  +3    -13   ksmserver/startup.cpp

https://commits.kde.org/plasma-workspace/da44dd6eae8b9ef4161680efcb9319a7267fe77e
Comment 6 Lubos Lunak 2017-04-21 12:03:31 UTC
Git commit c7d21ae2b834bd101d8dba1edaea05edcdb6e8f5 by Luboš Luňák.
Committed on 21/04/2017 at 12:00.
Pushed by lunakl into branch 'Plasma/5.9'.

use KProcess instead of QProcess to launch apps in ksmserver

Follow-up to the previous commit. KProcess has saner defaults for simply
launching an app and being done with it, no lost stdout/stderr or even SIGPIPE.
Related: bug 370528

M  +3    -2    ksmserver/startup.cpp

https://commits.kde.org/plasma-workspace/c7d21ae2b834bd101d8dba1edaea05edcdb6e8f5