A C program inherits its locale environment variables when it starts up. This happens automatically. However, these variables do not automatically control the locale used by the library functions, because ISO C says that all programs start by default in the standard ‘C’ locale.
Fixes warnings: Warning when reading ar archive header: Pathname can't be converted from UTF-8 to current locale. (errno=84) Signed-off-by: Piotr Łobacz <[email protected]> --- ...le-from-system-environment-variables.patch | 48 +++++++++++++++++++ meta/recipes-devtools/opkg/opkg_0.6.1.bb | 1 + 2 files changed, 49 insertions(+) create mode 100644 meta/recipes-devtools/opkg/opkg/0003-opkg-set-locale-from-system-environment-variables.patch diff --git a/meta/recipes-devtools/opkg/opkg/0003-opkg-set-locale-from-system-environment-variables.patch b/meta/recipes-devtools/opkg/opkg/0003-opkg-set-locale-from-system-environment-variables.patch new file mode 100644 index 0000000000..71240ec8fd --- /dev/null +++ b/meta/recipes-devtools/opkg/opkg/0003-opkg-set-locale-from-system-environment-variables.patch @@ -0,0 +1,48 @@ +From 712895b1914bf63ee4d669863bfd106814329076 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Piotr=20=C5=81obacz?= <[email protected]> +Date: Wed, 19 Jul 2023 21:26:09 +0200 +Subject: [PATCH] opkg: set locale from system environment variables +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +A C program inherits its locale environment variables when it starts up. +This happens automatically. However, these variables do not automatically +control the locale used by the library functions, because ISO C says that +all programs start by default in the standard ‘C’ locale. + +Fixes warnings: +Warning when reading ar archive header: Pathname can't be converted from UTF-8 to current locale. (errno=84) + +Upstream-Status: Submitted [https://groups.google.com/g/opkg-devel/c/16kgZfJ26mQ] + +[1] https://www.gnu.org/software/libc/manual/html_node/Setting-the-Locale.html + +Signed-off-by: Piotr Łobacz <[email protected]> +--- + src/opkg.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/opkg.c b/src/opkg.c +index 544c58a..0c729ff 100644 +--- a/src/opkg.c ++++ b/src/opkg.c +@@ -27,6 +27,7 @@ + #include <stdio.h> + #include <getopt.h> + #include <stdlib.h> ++#include <locale.h> + + #include "opkg_conf.h" + #include "opkg_cmd.h" +@@ -408,6 +409,7 @@ int main(int argc, char *argv[]) + if (opkg_conf_init()) + goto err0; + ++ setlocale(LC_ALL, ""); + opkg_config->verbosity = NOTICE; + + opts = args_parse(argc, argv); +-- +2.34.1 + diff --git a/meta/recipes-devtools/opkg/opkg_0.6.1.bb b/meta/recipes-devtools/opkg/opkg_0.6.1.bb index 2cac4af644..c7b8709112 100644 --- a/meta/recipes-devtools/opkg/opkg_0.6.1.bb +++ b/meta/recipes-devtools/opkg/opkg_0.6.1.bb @@ -16,6 +16,7 @@ SRC_URI = "http://downloads.yoctoproject.org/releases/${BPN}/${BPN}-${PV}.tar.gz file://opkg.conf \ file://0001-opkg_conf-create-opkg.lock-in-run-instead-of-var-run.patch \ file://0002-opkg-key-remove-no-options-flag-from-gpg-calls.patch \ + file://0003-opkg-set-locale-from-system-environment-variables.patch \ file://0001-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch \ file://0002-Add-options-to-enable-support-for-acl-and-xattr.patch \ file://run-ptest \ -- 2.34.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#184599): https://lists.openembedded.org/g/openembedded-core/message/184599 Mute This Topic: https://lists.openembedded.org/mt/100242740/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
