public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: "Piotr Łobacz" <p.lobacz@welotec.com>
To: openembedded-core@lists.openembedded.org
Cc: "Piotr Łobacz" <p.lobacz@welotec.com>
Subject: [OE-Core][PATCH v11][master-next 5/5] opkg: set locale from system environment variables
Date: Wed, 26 Jul 2023 11:22:28 +0200	[thread overview]
Message-ID: <20230726092228.1005306-5-p.lobacz@welotec.com> (raw)
In-Reply-To: <20230726092228.1005306-1-p.lobacz@welotec.com>

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 <p.lobacz@welotec.com>
---
 ...le-from-system-environment-variables.patch | 48 +++++++++++++++++++
 meta/recipes-devtools/opkg/opkg_0.6.2.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?= <p.lobacz@welotec.com>
+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 <p.lobacz@welotec.com>
+---
+ 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.2.bb b/meta/recipes-devtools/opkg/opkg_0.6.2.bb
index d7dc6ab715..3b5d51d74a 100644
--- a/meta/recipes-devtools/opkg/opkg_0.6.2.bb
+++ b/meta/recipes-devtools/opkg/opkg_0.6.2.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-Add-options-to-enable-support-for-acl-and-xattr.patch \
+           file://0003-opkg-set-locale-from-system-environment-variables.patch \
            file://run-ptest \
            "
 
-- 
2.34.1



  parent reply	other threads:[~2023-07-26  9:22 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-26  9:22 [OE-Core][PATCH v11][master-next 1/5] package_ipk.bbclass: add support for ACLs and xattr Piotr Łobacz
2023-07-26  9:22 ` [OE-Core][PATCH v11][master-next 2/5] package.bbclass: " Piotr Łobacz
2023-07-26  9:22 ` [OE-Core][PATCH v11][master-next 3/5] opkg-utils: add acl and xattr support Piotr Łobacz
2023-07-26  9:22 ` [OE-Core][PATCH v11][master-next 4/5] opkg: add options to enable support for acl and xattr Piotr Łobacz
2023-07-26  9:22 ` Piotr Łobacz [this message]
2023-07-26  9:27 ` ODP: [OE-Core][PATCH v11][master-next 1/5] package_ipk.bbclass: add support for ACLs " Piotr Łobacz
2023-07-27 14:18   ` Alexandre Belloni
2023-07-27 15:30     ` ODP: " Piotr Łobacz
2023-07-28 22:58     ` Piotr Łobacz
     [not found]     ` <17762A3A069807A3.31298@lists.openembedded.org>
2023-07-31 19:03       ` Piotr Łobacz
2023-07-31 19:09         ` Piotr Łobacz
2023-07-31 20:25           ` Joshua Watt
2023-07-31 21:19             ` Richard Purdie
2023-07-31 21:23               ` Piotr Łobacz
     [not found]               ` <177710C9CE043B33.12785@lists.openembedded.org>
2023-07-31 21:28                 ` ODP: " Piotr Łobacz
2023-08-01 13:04                   ` Martin Jansa
2023-08-01 13:27                     ` ODP: " Piotr Łobacz
     [not found]                     ` <1777455C95C57250.15736@lists.openembedded.org>
2023-08-01 15:16                       ` Piotr Łobacz
2023-08-01 15:41                         ` Richard Purdie
2023-08-01 16:00                           ` ODP: " Piotr Łobacz
     [not found]                           ` <17774DB8C4C2BE4F.15736@lists.openembedded.org>
2023-08-02  1:17                             ` Piotr Łobacz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230726092228.1005306-5-p.lobacz@welotec.com \
    --to=p.lobacz@welotec.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox