Fix exitcode from kioexec when executable doesn't exist (and --tempfiles is set)
ClosedPublic

Authored by dfaure on Mar 15 2020, 4:09 PM.

Details

Test Plan

kioexec --tempfiles does_not_exist /tmp/foo
Used to exit with code 0, now it exits with code -1.
Found by a unittest that will soon be pushed as part of D28020.

Diff Detail

Repository
R241 KIO
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 23718
Build 23736: arc lint + arc unit
dfaure created this revision.Mar 15 2020, 4:09 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptMar 15 2020, 4:09 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
dfaure requested review of this revision.Mar 15 2020, 4:09 PM
ahmadsamir added a subscriber: ahmadsamir.EditedMar 15 2020, 4:26 PM

I tested it; before applying the diff:

$ /usr/lib64/libexec/kf5/kioexec --tempfiles does_not_exist /tmp/foo
command= "does_not_exist" args= ("does_not_exist", "/tmp/foo")
EXEC "does_not_exist /tmp/foo"
EXEC done
$ echo $?
0
$ /usr/lib64/libexec/kf5/kioexec --tempfiles ls /tmp/foo
command= "ls" args= ("ls", "/tmp/foo")
EXEC "/usr/bin/ls /tmp/foo"
/usr/bin/ls: cannot access '/tmp/foo': No such file or directory
EXEC done
$ echo $?
0

with the diff:

$ bin/kioexec --tempfiles does_not_exist /tmp/foo
command= "does_not_exist" args= ("does_not_exist", "/tmp/foo")
EXEC "does_not_exist /tmp/foo"
EXEC done
$ echo $?
254
$ building-dir/bin/kioexec --tempfiles ls /tmp/foo
command= "ls" args= ("ls", "/tmp/foo")
EXEC "/usr/bin/ls /tmp/foo"
/usr/bin/ls: cannot access '/tmp/foo': No such file or directory
EXEC done
$ echo $?
2

so the patch works.

EDIT:
So, IIUC, fix exitcode from kioexec:

  • when executable doesn't exist (and --tempfiles is set)
  • when executable exists and it exited with exit code != 0
davidedmundson accepted this revision.Mar 15 2020, 5:36 PM
This revision is now accepted and ready to land.Mar 15 2020, 5:36 PM
dfaure closed this revision.Mar 15 2020, 6:41 PM