KNewStuff: Fix file path and process call
ClosedPublic

Authored by alex on Apr 22 2020, 4:00 PM.

Details

Summary

BUG: 420312

The bug was caused by two issues: The file path that was stored was wrong, for example:
Old paths:
/home/user/.local/share/servicemenu-download//rootactions_servicemenu_2.9.1.tar.gz
New paths:
/home/user/.local/share/servicemenu-download/iso_mounter_unmounter.desktop

Additionally the overload for the process call always fails, for example:

qWarning() << QProcess::execute("echo \"Hello there!\""); // Works
qWarning() << QProcess::execute("echo",{"\"Hello there!\""}); // Works
qWarning() << QProcess::execute("echo \"Hello there!\"",{}); // Fails, returns -2
Test Plan

Try out what was described in bug report

Diff Detail

Repository
R304 KNewStuff
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
alex created this revision.Apr 22 2020, 4:00 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptApr 22 2020, 4:00 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
alex requested review of this revision.Apr 22 2020, 4:00 PM
alex updated this revision to Diff 81062.Apr 24 2020, 6:06 AM

Use KShell to split args

alex edited the summary of this revision. (Show Details)Apr 24 2020, 6:07 AM
meven retitled this revision from WIP BUG: 420312 Fix file path and process call to WIP Fix file path and process call.Apr 24 2020, 6:13 AM
meven edited the summary of this revision. (Show Details)
alex retitled this revision from WIP Fix file path and process call to KNewStuff: Fix file path and process call.Apr 24 2020, 7:01 AM
leinir accepted this revision as: leinir.Apr 28 2020, 8:18 AM

That's well spotted. Thanks for taking that one on :)

This revision is now accepted and ready to land.Apr 28 2020, 8:18 AM
anthonyfieroni added inline comments.
src/core/installation.cpp
610

Get program in exclusive line

auto program = args.takeFirst();
int exitcode = QProcess::execute(program, args);

The problem is args is modified at argument pass time, then second parameter expect it is. That's not guaranteed you should expect compiler to do the right thing.

alex updated this revision to Diff 81467.Apr 28 2020, 7:30 PM

Get program in exclusive line

And should this go to release/20.04?

alex added a comment.May 2 2020, 6:45 PM

Friendly ping regarding the question :-)

anthonyfieroni accepted this revision.May 2 2020, 7:01 PM

KNewstuff is framework, it has only master.

alex added a comment.May 2 2020, 7:02 PM

Ups, that makes sense ^^
Thanks!

This revision was automatically updated to reflect the committed changes.