Skip to contentSkip to conversation

oeqa: Set LANG in wine tests

PATCH In review Joshua Watt 3 participants 6 messages Oct 2, 2024 – Feb 25, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 oeqa: Set LANG in wine tests

Glib likes to try and determine the local name using the Windows GetConsoleOutputCP(), which doesn't work well running under wine in our test cases (it seems to be linked to stdin not being a terminal).

This results in the error message:

GLib-WARNING (recursed) **: Failed to determine console output code page: Invalid access.. Falling back to UTF-8

and then Glib falls back to the locale "UTF-8", which is invalid and the program will likely crash.

In particular, pkg-config seems to be sensitive to this on some hosts (e.g. Ubuntu 24.04)

Set the LANG variable to a valid language to make sure that this codepath in Glib is not triggered.

---
 lib/oeqa/sdkmingw/context.py | 6 ++++++
 1 file changed, 6 insertions(+)
lib/oeqa/sdkmingw/context.py +6 -0
index 5319223..5869e57 100644
@@ -40,6 +40,12 @@ class OESDKMinGWTestContext(OESDKTestContext):
         # Convenience variables to make test cases easier to write
         env['SDK_DIR'] = getattr(self, 'wine_sdk_dir', '')
 
+        # Set the language. If this is not set to a valid language, then
+        # program that use glib will attempt to determine the language from
+        # stdin, which results in an error, fallback to "UTF-8" which is
+        # invalid and crash
+        env["LANG"] = "C.UTF-8"
+
         return env
 
     def wine_path(self, p):
Signature · 1 line
2.46.2
#1 lore raw

Would it be possible to cherry-pick this commit to the styhead branch?
I'm seeing the same issue there.

Steve

Quoted 52 lines · Joshua Watt via lists.yoctoproject.org

Glib likes to try and determine the local name using the Windows GetConsoleOutputCP(), which doesn't work well running under wine in our test cases (it seems to be linked to stdin not being a terminal).

This results in the error message:

GLib-WARNING (recursed) **: Failed to determine console output code page: Invalid access.. Falling back to UTF-8

and then Glib falls back to the locale "UTF-8", which is invalid and the program will likely crash.

In particular, pkg-config seems to be sensitive to this on some hosts (e.g. Ubuntu 24.04)

Set the LANG variable to a valid language to make sure that this codepath in Glib is not triggered.

---
 lib/oeqa/sdkmingw/context.py | 6 ++++++
 1 file changed, 6 insertions(+)
lib/oeqa/sdkmingw/context.py +6 -1
index 5319223..5869e57 100644
@@ -40,6 +40,12 @@ class OESDKMinGWTestContext(OESDKTestContext):
         # Convenience variables to make test cases easier to write
         env['SDK_DIR'] = getattr(self, 'wine_sdk_dir', '')
 
+        # Set the language. If this is not set to a valid language, then
+        # program that use glib will attempt to determine the language from
+        # stdin, which results in an error, fallback to "UTF-8" which is
+        # invalid and crash
+        env["LANG"] = "C.UTF-8"
+
         return env
 
     def wine_path(self, p):
--

2.46.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#63932): https://lists.yoctoproject.org/g/yocto/message/63932
Mute This Topic: https://lists.yoctoproject.org/mt/108789984/3620601
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw
Quoted 3 lines · Steve Sakoman

Would it be possible to cherry-pick this commit to the styhead branch?
I'm seeing the same issue there.

Yes, that would be a good idea. It's based on the build host, not wine or Yocto, so I suspect we would see it on any branch using that host.

Pretty sure it will cherry-pick cleanly, do you want me to send a patch?

Quoted 57 lines

Steve

Quoted 52 lines · Joshua Watt via lists.yoctoproject.org

Glib likes to try and determine the local name using the Windows GetConsoleOutputCP(), which doesn't work well running under wine in our test cases (it seems to be linked to stdin not being a terminal).

This results in the error message:

GLib-WARNING (recursed) **: Failed to determine console output code page: Invalid access.. Falling back to UTF-8

and then Glib falls back to the locale "UTF-8", which is invalid and the program will likely crash.

In particular, pkg-config seems to be sensitive to this on some hosts (e.g. Ubuntu 24.04)

Set the LANG variable to a valid language to make sure that this codepath in Glib is not triggered.

---
 lib/oeqa/sdkmingw/context.py | 6 ++++++
 1 file changed, 6 insertions(+)
lib/oeqa/sdkmingw/context.py +6 -1
index 5319223..5869e57 100644
@@ -40,6 +40,12 @@ class OESDKMinGWTestContext(OESDKTestContext):
         # Convenience variables to make test cases easier to write
         env['SDK_DIR'] = getattr(self, 'wine_sdk_dir', '')
 
+        # Set the language. If this is not set to a valid language, then
+        # program that use glib will attempt to determine the language from
+        # stdin, which results in an error, fallback to "UTF-8" which is
+        # invalid and crash
+        env["LANG"] = "C.UTF-8"
+
         return env
 
     def wine_path(self, p):
--

2.46.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#63932): https://lists.yoctoproject.org/g/yocto/message/63932
Mute This Topic: https://lists.yoctoproject.org/mt/108789984/3620601
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw
Quoted 7 lines · Joshua Watt
Quoted 4 lines · Steve Sakoman

Would it be possible to cherry-pick this commit to the styhead branch?
 I'm seeing the same issue there.

Quoted 6 lines

Yes, that would be a good idea. It's based on the build host, not wine
or Yocto, so I suspect we would see it on any branch using that host.

Pretty sure it will cherry-pick cleanly, do you want me to send a patch?

I've sorted it, thanks.

Cheers,

Richard

#4 lore raw
Quoted 9 lines · Richard Purdie
Quoted 7 lines · Joshua Watt
Quoted 4 lines · Steve Sakoman

Would it be possible to cherry-pick this commit to the styhead branch?
I'm seeing the same issue there.

Quoted 8 lines
Quoted 6 lines

Yes, that would be a good idea. It's based on the build host, not wine
or Yocto, so I suspect we would see it on any branch using that host.

Pretty sure it will cherry-pick cleanly, do you want me to send a patch?

I've sorted it, thanks.

Looks like this was backported to kirkstone and styhead, but not scarthgap.

I'm seeing scarthgap meta-mingw failures when running on Ubuntu 24.04 workers.

Can we backport to scarthgap too?

Thanks,

Steve

#5 lore raw
Quoted 21 lines · Steve Sakoman
Quoted 14 lines · Richard Purdie
Quoted 12 lines · Joshua Watt
Quoted 4 lines · Steve Sakoman

Would it be possible to cherry-pick this commit to the styhead branch?
 I'm seeing the same issue there.

Yes, that would be a good idea. It's based on the build host, not wine
or Yocto, so I suspect we would see it on any branch using that host.

Quoted 4 lines
Quoted 2 lines

Pretty sure it will cherry-pick cleanly, do you want me to send a patch?

I've sorted it, thanks.

Quoted 7 lines

Looks like this was backported to kirkstone and styhead, but not scarthgap.

I'm seeing scarthgap meta-mingw failures when running on Ubuntu 24.04 workers.

Can we backport to scarthgap too?

Done.

Cheers,

Richard