<table><tr><td style="">marten created this revision.<br />marten added reviewers: Frameworks, dfaure.<br />Herald added a project: Frameworks.<br />Herald added a subscriber: kde-frameworks-devel.<br />marten requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D29738">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p><a href="https://bugs.kde.org/show_bug.cgi?id=421374" class="remarkup-link" target="_blank" rel="noreferrer">https://bugs.kde.org/show_bug.cgi?id=421374</a> describes how a service file specified to run in a terminal gives an error saying that it cannot find 'konsole' or the user's configured terminal program.</p>
<p>The problem is that KIO::DesktopExecParser::resultingArguments(), if service.terminal() is true, prepends the terminal application to the command line. If this is a relative path, as it is most likely to be (and will be in the default 'konsole' case), the "realExecutable" check in KProcessRunner::KProcessRunner() is triggered and the job aborts with an error message.</p>
<p>This change expands the specified terminal executable into a full path in KIO::DesktopExecParser::resultingArguments(), and returns an error immediately if it cannot be found. This is then prepended to the command line. When KProcessRunner::KProcessRunner() checks the realExecutable (the first word of the command line) it will be an absolute path and the check will not fail.</p>
<p>The order of the code blocks in KProcessRunner::KProcessRunner() is adjusted so that execParser.resultingArguments() is checked for being empty (an error return) before the first word of the command is accessed. This means that the "realExecutable = execParser.resultingArguments().at(0)" test will not assert if resultingArguments() is an empty list.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Built kio with this change, tested with the sample desktop file at <a href="https://bugs.kde.org/show_bug.cgi?id=421374#c8" class="remarkup-link" target="_blank" rel="noreferrer">https://bugs.kde.org/show_bug.cgi?id=421374#c8</a>. The command correctly runs in a terminal.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R241 KIO</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D29738">https://phabricator.kde.org/D29738</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/core/desktopexecparser.cpp<br />
src/gui/kprocessrunner.cpp</div></div></div><br /><div><strong>To: </strong>marten, Frameworks, dfaure<br /><strong>Cc: </strong>kde-frameworks-devel, LeGast00n, cblack, michaelh, ngraham, bruns<br /></div>