-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Config file are locale dependent. #15756
Comments
I have a bug similar to #15200 when I connect a wireless Xbox 360 controller because of this config file locale issue. In my language, the decimal separator is ",". If I start retroarch with Xbox 360 controller connected and retroarch.cfg containing : Manually editing retroarch.conf to replace "," with "." in the above variable fixes the issue, until retroarch writes back ",". |
Currently I work around it by launching retroarch with |
I took a look as well and could not find an obvious place where it would go wrong. |
|
Looks like I've opened a duplicate here: #15775 I'm also having this issue. The strange thing is that it started happening without me changing RetroArch versions.
@zoltanvb Here is mine:
@patlefort As you're on Arch and I'm on Manjaro, could this be specific to Arch-based distros? |
Another strange thing that I think started happening at the same time of this issue, is the fact that now I can't start RetroArch through the VSCode built-in terminal window, while it worked perfectly before. Now I get this error:
RetroArch launches fine if I run it through the KDE Konsole terminal. Please note that VSCode runs under XWayland and not Wayland. I find it very strange that both these issues showed up at the same time. EDIT: |
I checked the code again, and did not really find why it would set the locale to C, though it certainly behaves (used to behave) like that. Theoretically, the fix is easy, but it would be good to understand what happened. My working assumption is that in one of the included dynamic libraries, there was a setlocale(), which is now removed, or the other way around. The feature list is largely similar to mine, and it uses following dynamic libraries (you can check your binary with
Can you take a look at the package update history, if any of these appear recently, around the time when the problem started? I do not use Arch/Manjaro myself, but the log may be in |
@zoltanvb I checked the pacman log and, from your list above (and mine), the following libraries were updated on my system when the problem started:
At first I thought qt5-location could be related, but it seems it's a library for mapping stuff such as Open Street Maps, and not system location. |
Thanks for the check! glibc seems to have a few commits related to some problem with "C" locale at end of September, but I guess those are more like the fix, rather than the cause: |
Note to myself: So, that should work without any setting. Adding an explicit setlocale() at startup may help prevent such errors. |
The behavior observed will happen if some library somewhere call |
Found the culprit! It's the This also fixes the error I was getting on trying to launch RetroArch from the VSCode terminal window, as I described on this post above: #15756 (comment) So, is this a RetroArch, or a libdecor problem? |
Apparently this issue had already been opened on libdecor's side, but it also came from someone using RetroArch. |
This issue has now been fixed on libdecor with this Merge Request: If no one else has any issues with it, I think we can close this. |
I still think it's not a good idea to not set the locale to 'C' in retroarch before parsing or formatting. This bug could happen again at any time and will seriously break a user's config. |
Would it be possible to build the change (you can pull from my fork: https://github.com/zoltanvb/RetroArch/tree/locale_problem ) and see if it solves the problem when the faulty libdecor version is present? It is a bit hard to decode exactly when the change occurs, and I would prefer submitting an improvement that protects against this particular issue at least. |
@zoltanvb I tested it and it sadly doesn't resolve the issue. I understand it's just a quick fix but I must stress that the only way to fully guard against this issue is to set the locale to 'C' right before parsing or formatting or using locale independent functions. |
Thank you for the check. I will look for a better place, hopefully still avoiding having to call setlocale() on each float read/write to config file. |
As @patlefort said, shouldn't we use locale independent functions instead, in this case? |
Considering all platforms RA is built for: there is no easy way that I see for that. Codebase should compile for C89. In the meantime, I pushed small changes for the branch above, in another attempt to have a temporary solution. |
Would it be possible to check this last change? I cannot easily reproduce the environment, and since there is no new libdecor version released yet, this bug may bite more users still. |
Yes, that branch. Thank you! |
@zoltanvb That fixes it when using the broken libdecor version, yes. :) |
Just for reference, the combination of libdecor 0.2.0 (in Wayland environments) and RetroArch 1.16 (or earlier) exhibits the fault, libdecor 0.2.1 contains the fix, RetroArch nightly builds after 2023-10-30 + next stable release (whenever that may be) contain a workaround. |
@patlefort Should we close this issue ? Thank you. |
I suppose yes, the issue at hand is fixed, it's up to the devs to implement locale independent functions if they want to. |
Description
Parsing and formatting functions used by retroarch are affected by the locale of the user. Floating points for example could be formatted with a ',' instead of a '.'. It might be a separate bug but retroarch is unable to parse floating points numbers with a ',' and they lose their decimal digits. Also, it makes retroarch config non portable.
Using
setlocale()
withC
should fix it before parsing or formatting a file.Expected behavior
All formatting and parsing of config files should be done with the 'C' locale.
Actual behavior
The locale of the user is used.
Steps to reproduce the bug
Try to launch retroarch with
LC_NUMERIC=fr_CA.UTF-8
for example.Version/Commit
Environment information
The text was updated successfully, but these errors were encountered: