|
Bugzilla – Full Text Bug Listing |
| Summary: | Embedded Perl Interpreter Messes up Locale Environment of Calling Process | ||
|---|---|---|---|
| Product: | [openSUSE] openSUSE Tumbleweed | Reporter: | Stefan Hundhammer <shundhammer> |
| Component: | Other | Assignee: | Michael Schröder <mls> |
| Status: | RESOLVED FIXED | QA Contact: | E-mail List <qa-bugs> |
| Severity: | Normal | ||
| Priority: | P5 - None | CC: | aschnell, fvogt, mls, mvidner, snwint |
| Version: | Current | ||
| Target Milestone: | --- | ||
| Hardware: | x86-64 | ||
| OS: | Other | ||
| Whiteboard: | |||
| Found By: | --- | Services Priority: | |
| Business Priority: | Blocker: | --- | |
| Marketing QA Status: | --- | IT Deployment: | --- |
| Attachments: |
Test program
Test program with our fix / workaround |
||
|
Description
Stefan Hundhammer
2024-02-22 10:40:27 UTC
Screenshots showing the problem: https://bugzilla.suse.com/attachment.cgi?id=870506 YaST storage proposal in Japanese. Notice the '????' in the white box in the center; those are messages from libstorage-ng which were affected. Notice that the Qt UI elements everywhere else are not affected; probably because Qt is initialized first, and they are using much more sophisticated methods for locale handling, not just setlocale() and nl_langinfo(). https://bugzilla.suse.com/attachment.cgi?id=872716 YaST storage proposal in Czech; same problem. This also shows an xterm opened from within YaST with Ctrl-Shift-Alt-X which inherits the environment variables from the YaST process. https://bugzilla.suse.com/attachment.cgi?id=872798 Screenshot of a popup dialog in German showing messages that come partly from some Perl code ("Sie haben nur Kleinbuchstaben f?r das Passwort verwendet") and Ruby code ("Möchten Sie dieses Passwort wirklich verwenden"). The messages are confirmed to be correct UTF_8 in the translation file. Created attachment 872927 [details]
Test program
Output:
initial locale: de_DE.UTF-8
initial codeset: UTF-8
codeset after perl_construct(): ANSI_X3.4-1968
locale: de_DE.UTF-8
codeset: ANSI_X3.4-1968
Created attachment 872929 [details]
Test program with our fix / workaround
This just adds a
uselocale( LC_GLOBAL_LOCALE );
after intitializing the embedded Perl interpreter, and it has the desired effect. Output:
initial locale: de_DE.UTF-8
initial codeset: UTF-8
codeset after perl_alloc: UTF-8
codeset after perl_construct(): ANSI_X3.4-1968
switching to the global locale
locale: de_DE.UTF-8
codeset: UTF-8
I have no idea if any code other than YaST is affected by this. It may affect other programs using an embedded Perl interpreter. It may also affect Perl code that just tries to use translations via GNU gettext; this remains to be investigated. Maybe this is also worth to be reported upstream. Or maybe it's a WONTFIX on our side. But in any case, I wanted this to be on public record, if only for others to find our workaround. Our workaround https://github.com/yast/yast-perl-bindings/pull/31 appears to cause bug #1220375 (yast2 users crashing with an idle-looping 'Zypp-main' process with 100% CPU usage). We'll have to revert it or at least find a less aggressive approach. Possibly related: bug #1220972 This is already fixed in perl and just needs a backport: https://github.com/Perl/perl5/commit/bf38d1cf744fcc49b715b9d633761aa67436c002 See https://github.com/Perl/perl5/issues/21366 (In reply to Fabian Vogt from comment #7) > This is already fixed in perl and just needs a backport: > > https://github.com/Perl/perl5/commit/bf38d1cf744fcc49b715b9d633761aa67436c002 > > See https://github.com/Perl/perl5/issues/21366 ping Hmm, it's unclear if this is really the correct fix for this. Let's give it a try, though. That won't work at all. I'll try reverting 7af2d2037375d58e700f9e1b217efb2c4db66133 as suggested by upstream This is an autogenerated message for OBS integration: This bug (1220195) was mentioned in https://build.opensuse.org/request/show/1167043 Factory / perl Thanks, I have tested that it fixes the problem in YaST! |