fix(nativeguest): load glibc locales and iconv modules without proot (#3096)

* fix(nativeguest): load glibc locales and iconv modules without proot

glibc opens its locale files and gconv modules with its own internal
open(), which the hook never sees, so every program ran in the C locale
and iconv knew only built-in charsets: Qt warned it could not switch to
UTF-8, setlocale() failed for C.UTF-8 and the app's language, and
iconv -t latin1 was unsupported. The hook now points LOCPATH and
GCONV_PATH at the rootfs; droiddeck-fex keeps x86 guests on their own
gconv modules.

* test(nativeguest): the locale default test ignores the developer's own paths
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-11-23 18:36:48 -05:00
1 parent 59e98afae7
commit ec31c9e2b6
4 files changed
+33 -1

No files matched your search

+13
View File
@@ -84,6 +84,19 @@ static void init_ddnatv_hook(void) {
setenv("TZDIR", tzdir_buf, 0);
}
const char *curr_locpath = getenv("LOCPATH");
if (!curr_locpath || curr_locpath[0] == '\0') {
char locpath_buf[PATH_MAX];
snprintf(locpath_buf, sizeof(locpath_buf), "%s/usr/lib/locale", g_ddnatv_root);
setenv("LOCPATH", locpath_buf, 1);
}
if (!getenv("GCONV_PATH")) {
char gconv_buf[PATH_MAX];
snprintf(gconv_buf, sizeof(gconv_buf), "%s/usr/lib/aarch64-linux-gnu/gconv", g_ddnatv_root);
setenv("GCONV_PATH", gconv_buf, 0);
}
const char *curr_cert = getenv("SSL_CERT_FILE");
if (!curr_cert || curr_cert[0] == '\0' || strcmp(curr_cert, "/etc/ssl/certs/ca-certificates.crt") == 0) {
char cert_buf[PATH_MAX];