Bug 454132

Summary: phrases irrelevant to calculator generate gibberish results
Product: [Plasma] krunner Reporter: afedotov861
Component: calculatorAssignee: Alexander Lohnau <alexander.lohnau>
Status: RESOLVED FIXED    
Severity: normal CC: nate, plasma-bugs
Priority: NOR    
Version: 5.24.5   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.26
Attachments: SDL_VIDEODRIVER= gibberish
GNUPGHOME= gibberish

Description afedotov861 2022-05-21 07:58:21 UTC
Created attachment 149057 [details]
SDL_VIDEODRIVER= gibberish

SUMMARY
Some strings followed by equals signs when input into krunner will cause the calculator runner to output garbage. (some will crash krunner entirely, see https://bugs.kde.org/show_bug.cgi?id=454130)

STEPS TO REPRODUCE
Type certain phrases followed by equals signs into krunner

OBSERVED RESULT
Gibberish from calculator krunner

EXPECTED RESULT
Calculator runner should probably not be parsing strings like this

SOFTWARE/OS VERSIONS
Arch Linux
(available in About System)
KDE Plasma Version: 5.24.5
KDE Frameworks Version: 5.94.0
Qt Version: 5.15.4
Comment 1 afedotov861 2022-05-21 07:59:16 UTC
Created attachment 149058 [details]
GNUPGHOME= gibberish

Here's another example.
Comment 2 Nate Graham 2022-05-23 17:45:36 UTC
Amazing.
Comment 3 Alexander Lohnau 2022-05-23 19:13:24 UTC
I could not find an easy way to detect an error from evaluating the qalculate statement. Unless anyone has ideas, I will open an issue on their Github tracker.
Comment 4 Bug Janitor Service 2022-06-19 16:42:14 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1856
Comment 5 Alexander Lohnau 2022-07-25 15:05:35 UTC
Git commit 4b35701a31092e25e5226205d550dc294737a69a by Alexander Lohnau.
Committed on 25/07/2022 at 15:05.
Pushed by alex into branch 'master'.

runners/calculator: Do not show results when expression is invalid

See https://github.com/Qalculate/libqalculate/issues/442 for the code snippets.
I have only adjusted those to compile inside of the plugin.

M  +7    -0    runners/calculator/autotests/calculatorrunnertest.cpp
M  +40   -0    runners/calculator/qalculate_engine.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/4b35701a31092e25e5226205d550dc294737a69a