From: Petr Vorel <pvorel@suse.cz>
To: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: Yan Vugenfirer <yan@daynix.com>,
Yuri Benditovich <yuri.benditovich@daynix.com>,
ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] tst_test.sh: Unset the locale concerned variables
Date: Thu, 13 Oct 2022 14:24:07 +0200 [thread overview]
Message-ID: <Y0gDZ/d0TmDA+c8q@pevik> (raw)
In-Reply-To: <20221013055845.28904-1-akihiko.odaki@daynix.com>
Hi Akihiko,
> network/tcp_cmds/tracepath/tracepath01.sh fails with LANG=ja_JP.UTF-8
> because it parses localized output.
it works for me:
# export LC_ALL=ja_JP.UTF-8 LANG=ja_JP.UTF-8
# PATH="/opt/ltp/testcases/bin:$PATH" LANG=ja_JP.UTF-8 tracepath01.sh
tracepath01 1 TINFO: initialize 'lhost' 'ltp_ns_veth2' interface
tracepath01 1 TINFO: add local addr 10.0.0.2/24
tracepath01 1 TINFO: add local addr fd00:1:1:1::2/64
tracepath01 1 TINFO: initialize 'rhost' 'ltp_ns_veth1' interface
tracepath01 1 TINFO: add remote addr 10.0.0.1/24
tracepath01 1 TINFO: add remote addr fd00:1:1:1::1/64
tracepath01 1 TINFO: Network config (local -- remote):
tracepath01 1 TINFO: ltp_ns_veth2 -- ltp_ns_veth1
tracepath01 1 TINFO: 10.0.0.2/24 -- 10.0.0.1/24
tracepath01 1 TINFO: fd00:1:1:1::2/64 -- fd00:1:1:1::1/64
tracepath01 1 TINFO: timeout per run is 0h 5m 0s
tracepath01 1 TINFO: traceroute version:
tracepath01 1 TINFO: tracepath from iputils 20211215
tracepath01 1 TINFO: test tracepath with 10.0.0.1, pmtu is 1280
tracepath01 1 TPASS: traced path to '10.0.0.1' in 1 hops
Summary:
passed 1
failed 0
broken 0
skipped 0
warnings 0
> To avoid such a problem, we can always unset the locale concerned
> variables. network/stress/ns-tools/check_envval does that, but it is
> limited to the network stress test. Add similar code to tst_test.sh
> so that it can cover more tests.
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
> testcases/lib/tst_test.sh | 5 +++++
> 1 file changed, 5 insertions(+)
> diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> index 28b7d12ba..9a8b62f1e 100644
> --- a/testcases/lib/tst_test.sh
> +++ b/testcases/lib/tst_test.sh
> @@ -831,3 +831,8 @@ if [ -z "$TST_NO_DEFAULT_RUN" ]; then
> fi
> fi
> fi
> +
> +# Unset the locale cocerned variables
> +for env in $(locale | cut -f 1 -d =); do
> + unset $env
> +done
If we wanted to keep, we should also unset env, to not pollute the environment.
Instead of requiring locale being installed, prefer to follow kernel approach [1]
(well, they don't handle LANG)
unexport LC_ALL
LANG=C
LC_COLLATE=C
LC_NUMERIC=C
export LANG LC_COLLATE LC_NUMERIC
But as I wrote, is that really needed? Could you post your locale output?
Kind regards,
Petr
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Makefile?h=v6.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2022-10-13 12:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-13 5:58 [LTP] [PATCH] tst_test.sh: Unset the locale concerned variables Akihiko Odaki
2022-10-13 12:24 ` Petr Vorel [this message]
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=Y0gDZ/d0TmDA+c8q@pevik \
--to=pvorel@suse.cz \
--cc=akihiko.odaki@daynix.com \
--cc=ltp@lists.linux.it \
--cc=yan@daynix.com \
--cc=yuri.benditovich@daynix.com \
/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