Bug 441337

Summary: Krunner currency conversion plugin cannot be triggered until a dotfile is removed
Product: [Frameworks and Libraries] frameworks-kunitconversion Reporter: Kishore Gopalakrishnan <kishore96>
Component: generalAssignee: Andreas Cord-Landwehr <cordlandwehr>
Status: RESOLVED FIXED    
Severity: normal CC: alexander.lohnau, asturm, bharadwaj.raju777, cordlandwehr, kdelibs-bugs, nate
Priority: HI Keywords: regression
Version: 5.85.0   
Target Milestone: ---   
Platform: Other   
OS: Other   
Latest Commit: Version Fixed In: 5.86
Attachments: The file that's broken

Description Kishore Gopalakrishnan 2021-08-22 06:16:11 UTC
SUMMARY
The krunner currency conversion plugin cannot be triggered until I delete `~/.local/share/libkunitconversion/currency.xml` and log in again. Deleting this file makes the currency conversion work for one session.

STEPS TO REPRODUCE
1. In a tty, run `rm ~/.local/share/libkunitconversion/currency.xml`
2. Login (to the graphical session)
3. In krunner, type '1 usd'
4. logout
5. Login
6. In krunner, type '1 usd'

OBSERVED RESULTS
Krunner shows currency conversions after step 3 but not after step 6. Repeating step 1 and logging in again makes the currency conversion work for one session.

EXPECTED RESULTS
Currency conversion should work after both steps 3 and 6.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
A. Also reproducible on KDE Neon unstable (updated today).
B. The `currency.xml` file does not change between steps 3 and 6 of the reproduction steps (checked with diff), so this does not seem to simply be a case of a corrupted file.
Comment 1 Andreas Sturmlechner 2021-08-22 19:45:16 UTC
I can confirm the observation using all the same package versions in Gentoo.
Comment 2 Andreas Sturmlechner 2021-08-23 15:56:29 UTC
Not a problem with Frameworks 5.82.0.
Comment 3 Nate Graham 2021-08-24 13:53:27 UTC
Created attachment 141011 [details]
The file that's broken

Can confirm. I'm attaching my version of the file for inspection.
Comment 4 Bharadwaj Raju 2021-08-24 14:21:47 UTC
I think this bug was introduced in https://invent.kde.org/frameworks/kunitconversion/-/commit/92eea5a566357c7d30286cebec6dc388401e0e08 ("Make currency conversion table fetching explicit")
Comment 5 Bug Janitor Service 2021-08-24 19:11:04 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kunitconversion/-/merge_requests/9
Comment 6 Andreas Cord-Landwehr 2021-08-29 05:25:36 UTC
Git commit 6e41104426a3ae59bcb90be708abcc3092155436 by Andreas Cord-Landwehr.
Committed on 24/08/2021 at 19:06.
Pushed by cordlandwehr into branch 'master'.

Fix automatic currency file sync after 24h

Conversion plugin in Krunner depends on automatic refresh of currency
table. std::call_once does not work there, because process is never
stopped.

M  +16   -0    autotests/convertertest.cpp
M  +6    -0    autotests/convertertest.h
M  +6    -3    src/currency.cpp

https://invent.kde.org/frameworks/kunitconversion/commit/6e41104426a3ae59bcb90be708abcc3092155436
Comment 7 Andreas Cord-Landwehr 2021-08-29 05:25:44 UTC
Git commit 2a57f9d1c6b2f8d9e2babcdaca66f1cf2a3c5849 by Andreas Cord-Landwehr.
Committed on 28/08/2021 at 13:57.
Pushed by cordlandwehr into branch 'master'.

Fix initialization of currency values

If there is already a recent currency.xml file provided then use this to
initialize the currency converter.

M  +8    -0    autotests/CMakeLists.txt
A  +33   -0    autotests/currencytableinittest.cpp     [License: LGPL(v2.0+)]
A  +26   -0    autotests/currencytableinittest.h     [License: LGPL(v2.0+)]
A  +43   -0    autotests/currencytableinittest/currency.xml
A  +5    -0    autotests/currencytableinittest/data.qrc
M  +6    -0    autotests/valuetest.cpp
M  +7    -3    src/currency.cpp

https://invent.kde.org/frameworks/kunitconversion/commit/2a57f9d1c6b2f8d9e2babcdaca66f1cf2a3c5849