kioslave: preserve argv[0], to fix applicationDirPath() on non-Linux
ClosedPublic

Authored by dfaure on May 18 2019, 10:50 PM.

Details

Summary

Linux has /proc so it doesn't matter there, but e.g. on FreeBSD
lying about argc[0] leads to applicationDirPath() being wrong,
which leads to the kioslave executable not being found in CI
(because it's looking in applicationDirPath(), which for a kioslave
was build/bin/kf5/kio, where e.g. trash.so can be found)

Test Plan

commenting out the Q_OS_LINUX block in qcoreapplication.cpp,
uninstalling kio, then running bin/dropjobtest shouldDropFromTrash.
Failed with "kioslave not found", works after this fix.

Diff Detail

Repository
R241 KIO
Branch
2019_freebsd_fixed
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 11945
Build 11963: arc lint + arc unit
dfaure created this revision.May 18 2019, 10:50 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptMay 18 2019, 10:50 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
dfaure requested review of this revision.May 18 2019, 10:50 PM
apol accepted this revision.May 19 2019, 12:26 AM

LTGM

This revision is now accepted and ready to land.May 19 2019, 12:26 AM
anthonyfieroni added inline comments.
src/kioslave/kioslave.cpp
132

Now has a leak, use vector instead.

dfaure updated this revision to Diff 58289.May 19 2019, 11:17 AM

Use QVarLengthArray to fix the memory leak

dfaure closed this revision.May 20 2019, 7:51 AM

Just out of curiosity: Does one need the exit(func(...)) call or wouldn't a return func...(); be enough?

Good question. It seems to me that return would indeed be much better so that the stack gets unwinded... I'll make the change.