https://bugs.winehq.org/show_bug.cgi?id=49496
Bug ID: 49496 Summary: sprintf uses locale specific decimal point when it should not. Product: Wine Version: 5.11 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: bernhardu@mailbox.org Distribution: ---
This manifested first in Microsoft Word 2007 printing empty pages with wine-5.11. I could track this down to wineeps.drv using my locales "de_DE.UTF-8" decimalpoint ',' instead of the expected '.' from the "C" locale:
- /FontBBox [-0.476074 -0.193848 1.213867 0.952148] def + /FontBBox [-0,476074 -0,193848 1,213867 0,952148] def
This line is produced in wineps.drv\type42.c:207, which is surrounded by setlocale calls to use "C". But these do call into MSVCRT_setlocale, which seems not forward this into glibc. And in the end the "%f" format is forwarded to glibc's __sprintf.
A git bisect led to this commit:
b86dc3926bfe5cd92400aa96c89b0255eba1d447 is the first bad commit commit b86dc3926bfe5cd92400aa96c89b0255eba1d447 Author: Alexandre Julliard julliard@winehq.org Date: Thu Jun 11 11:38:16 2020 +0200
ntdll: Move the locales initialization to the Unix library.
Signed-off-by: Alexandre Julliard julliard@winehq.org
This, I guess, is also visible in the tests of ucrtbase:printf since that day, where some machines seem to use french locale:
https://test.winehq.org/data/tests/ucrtbase:printf.html
https://bugs.winehq.org/show_bug.cgi?id=49496
Piotr Caban piotr.caban@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |piotr.caban@gmail.com
--- Comment #1 from Piotr Caban piotr.caban@gmail.com --- FYI I'm working on changing the msvcrt printf implementation so it doesn't use sprintf from glibc for outputing floating point numbers. It still needs quite a lot of work.
https://bugs.winehq.org/show_bug.cgi?id=49496
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |regression Regression SHA1| |b86dc3926bfe5cd92400aa96c89 | |b0255eba1d447
https://bugs.winehq.org/show_bug.cgi?id=49496
--- Comment #2 from Bernhard Übelacker bernhardu@mailbox.org --- Did not test it yet, but I guess commit 031c744a1fb9 might fix this issue, until sprintf from glibc is no longer used. And then this bug might be also a duplicate of #49489.
https://bugs.winehq.org/show_bug.cgi?id=49496
Bernhard Übelacker bernhardu@mailbox.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED Fixed by SHA1| |031c744a1fb9b94f7a4634eae5f | |56845b586554d
--- Comment #3 from Bernhard Übelacker bernhardu@mailbox.org --- Found this could be reproduced also with just printing in notepad.
Additionally can confirm that 031c744a1fb9 indeed fixed the issue, therefore marking as resolved.
https://bugs.winehq.org/show_bug.cgi?id=49496
--- Comment #4 from Rafał Mużyło galtgendo@o2.pl --- ...ah, shrub, it isn't resolved yet.
If you'd read julliard's post on the list, you'd know that the workaround was green-lighted only because the proper solution was taking too much time.
Only once that is written and goes in we'll be in position to know how many regressions it will trigger.
Also, besides printf, its quite likely also scanf will need to be addressed.
https://bugs.winehq.org/show_bug.cgi?id=49496
--- Comment #5 from Bernhard Übelacker bernhardu@mailbox.org --- I opened this bug report as regression caused by commit b86dc3926bfe5 which got mitigated by commit 031c744a1fb9. Therefore I marked this report as fixed and I guess it will be up to Piotr to decide if he needs/wants this report stay open?
https://bugs.winehq.org/show_bug.cgi?id=49496
--- Comment #6 from Piotr Caban piotr.caban@gmail.com --- (In reply to Rafał Mużyło from comment #4)
Also, besides printf, its quite likely also scanf will need to be addressed.
Scanf is already not depending on glibc locale.
https://bugs.winehq.org/show_bug.cgi?id=49496
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #7 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 5.13.