Bug 441010 - KCM shows invalid locales and allows them to be chosen, which can break various parts of the system
Summary: KCM shows invalid locales and allows them to be chosen, which can break vario...
Status: RESOLVED DUPLICATE of bug 403580
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_formats (show other bugs)
Version: 5.22.4
Platform: Fedora RPMs Linux
: HI normal
Target Milestone: ---
Assignee: Sebastian Kügler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-15 17:37 UTC by Rick Kerkhof
Modified: 2021-10-24 11:06 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
An example of a locale configured while the system does not support it (19.76 KB, image/jpeg)
2021-08-15 17:37 UTC, Rick Kerkhof
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rick Kerkhof 2021-08-15 17:37:19 UTC
Created attachment 140752 [details]
An example of a locale configured while the system does not support it

SUMMARY
I could not find a dedicated Bugzilla project for plasma-workspace, so I filed it here; I'm sorry if this is incorrect.

Plasma lists *all* locales in its Formats KCM (System Settings -> Regional Settings -> Formats), even ones which are not supported by the underlying system, unlike the Language KCM.

Setting one of these unsupported locales breaks some software which relies on proper locale configuration and causes warnings in others. For example, Minecraft's launcher no longer launches and crashes, and DNF throws warnings.

STEPS TO REPRODUCE
1. Open the Formats KCM;
2. Set an unsupported locale by your system, for example nl_EN;
3. Restart your session and observe application behaviour.

OBSERVED RESULT
The Minecraft launcher breaks and DNF and other programs throw locale errors.

> Failed to set locale, defaulting to C.UTF-8

EXPECTED RESULT
Plasma should not break the locale settings the way it currently does and all programs should continue working.

SOFTWARE/OS VERSIONS
Operating System: Fedora 34
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2
Kernel Version: 5.13.9-200.fc34.x86_64 (64-bit)
Graphics Platform: X11
Processors: 4 × Intel® Core™ i5-5200U CPU @ 2.20GHz
Memory: 15,4 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 5500

ADDITIONAL INFORMATION
From what I could find in the repos, the Formats KCM relies on the output of QLocale::matchingLocales:

https://invent.kde.org/plasma/plasma-workspace/-/blob/master/kcms/formats/kcmformats.cpp#L72

This method, https://doc.qt.io/qt-5/qlocale.html#matchingLocales , in turn relies on a list of locale data built in to Qt:

https://github.com/qt/qtbase/blob/dev/src/corelib/text/qlocale_data_p.h#L79-L88

A possible solution therefore would be to filter the list given by Qt on locales known by the system.

On top of this, Plasma itself seems to not have any issues with the locale and seems to honour it quite well. So another thought would be to set the system locale to C.UTF-8 or something similar if the selected locale is not supported, and maybe show a warning to the user?
Comment 1 Nate Graham 2021-08-16 18:04:38 UTC
Thanks for investigating already! Please do feel free to submit a merge request to fix it. Your idea seems reasonable to me.
Comment 2 Nate Graham 2021-09-30 17:49:39 UTC
*** Bug 441468 has been marked as a duplicate of this bug. ***
Comment 3 Nate Graham 2021-09-30 17:51:11 UTC

*** This bug has been marked as a duplicate of bug 403580 ***