D29738: Fix service file specifying 'Run in terminal' giving an error code 100

2020-05-17 Thread David Faure
dfaure added a comment.


  (Intrusive) fix is up at 
https://invent.kde.org/frameworks/kio/-/merge_requests/3

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D29738

To: marten, #frameworks, dfaure
Cc: meven, kde-frameworks-devel, LeGast00n, cblack, michaelh, ngraham, bruns


D29738: Fix service file specifying 'Run in terminal' giving an error code 100

2020-05-17 Thread David Faure
dfaure added a comment.


  Well spotted. Indeed, when using kioexec (because of the DeleteTemporaryFiles 
option) we no longer detect non-existing executables. I'll look into fixing 
this.

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D29738

To: marten, #frameworks, dfaure
Cc: meven, kde-frameworks-devel, LeGast00n, cblack, michaelh, ngraham, bruns


D29738: Fix service file specifying 'Run in terminal' giving an error code 100

2020-05-16 Thread Méven Car
meven added a comment.


  It seems it is causing two failures in kiogui_applicationlauncherjobtest :
  
https://build.kde.org/job/Frameworks/job/kio/job/kf5-qt5%20SUSEQt5.14/105/testReport/junit/projectroot/autotests/kiogui_applicationlauncherjobtest/

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D29738

To: marten, #frameworks, dfaure
Cc: meven, kde-frameworks-devel, LeGast00n, cblack, michaelh, ngraham, bruns


D29738: Fix service file specifying 'Run in terminal' giving an error code 100

2020-05-14 Thread Jonathan Marten
This revision was automatically updated to reflect the committed changes.
Closed by commit R241:6452a34cf01d: Fix service file specifying 'Run in 
terminal' giving an error code 100 (authored by marten).

REPOSITORY
  R241 KIO

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D29738?vs=82823&id=82874

REVISION DETAIL
  https://phabricator.kde.org/D29738

AFFECTED FILES
  src/core/desktopexecparser.cpp
  src/gui/kprocessrunner.cpp

To: marten, #frameworks, dfaure
Cc: kde-frameworks-devel, LeGast00n, cblack, michaelh, ngraham, bruns


D29738: Fix service file specifying 'Run in terminal' giving an error code 100

2020-05-14 Thread David Faure
dfaure accepted this revision.
dfaure added a comment.
This revision is now accepted and ready to land.


  Nice! In addition to the bugfix, calling resultingArguments() only once is a 
definite improvement, given everything that happens in there. I didn't realize 
we were calling it twice.

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D29738

To: marten, #frameworks, dfaure
Cc: kde-frameworks-devel, LeGast00n, cblack, michaelh, ngraham, bruns


D29738: Fix service file specifying 'Run in terminal' giving an error code 100

2020-05-14 Thread Nathaniel Graham
ngraham edited the summary of this revision.

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D29738

To: marten, #frameworks, dfaure
Cc: kde-frameworks-devel, LeGast00n, cblack, michaelh, ngraham, bruns


D29738: Fix service file specifying 'Run in terminal' giving an error code 100

2020-05-14 Thread Jonathan Marten
marten created this revision.
marten added reviewers: Frameworks, dfaure.
Herald added a project: Frameworks.
Herald added a subscriber: kde-frameworks-devel.
marten requested review of this revision.

REVISION SUMMARY
  https://bugs.kde.org/show_bug.cgi?id=421374 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.
  
  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.
  
  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.
  
  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.

TEST PLAN
  Built kio with this change, tested with the sample desktop file at 
https://bugs.kde.org/show_bug.cgi?id=421374#c8.  The command correctly runs in 
a terminal.

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D29738

AFFECTED FILES
  src/core/desktopexecparser.cpp
  src/gui/kprocessrunner.cpp

To: marten, #frameworks, dfaure
Cc: kde-frameworks-devel, LeGast00n, cblack, michaelh, ngraham, bruns