* [PATCH] scripts: coccicheck: fix troubles on non-English builds
@ 2021-05-18 9:05 Mauro Carvalho Chehab
2021-05-18 9:09 ` Julia Lawall
0 siblings, 1 reply; 2+ messages in thread
From: Mauro Carvalho Chehab @ 2021-05-18 9:05 UTC (permalink / raw)
To: Julia Lawall
Cc: linuxarm, mauro.chehab, Mauro Carvalho Chehab, Gilles Muller,
Michal Marek, Nicolas Palix, cocci, linux-kernel
When LANG is not set to English, the logic which checks the
number of CPUs fail, as the messages can be localized, and
the logic at:
THREADS_PER_CORE=$(lscpu | grep "Thread(s) per core: " | tr -cd "[:digit:]")
will not get the number of threads per core.
This causes the script to not run properly, as it will produce
a warning:
$ make coccicheck COCCI=$PWD/scripts/coccinelle/misc/add_namespace.cocci MODE=report drivers/media/
./scripts/coccicheck: linha 93: [: número excessivo de argumentos
Fix it by forcing LANG=C when calling lscpu.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
scripts/coccicheck | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/coccicheck b/scripts/coccicheck
index 65fee63aeadb..caba0bff6da7 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -87,7 +87,7 @@ else
fi
# Use only one thread per core by default if hyperthreading is enabled
- THREADS_PER_CORE=$(lscpu | grep "Thread(s) per core: " | tr -cd "[:digit:]")
+ THREADS_PER_CORE=$(LANG=C lscpu | grep "Thread(s) per core: " | tr -cd "[:digit:]")
if [ -z "$J" ]; then
NPROC=$(getconf _NPROCESSORS_ONLN)
if [ $THREADS_PER_CORE -gt 1 -a $NPROC -gt 4 ] ; then
--
2.31.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] scripts: coccicheck: fix troubles on non-English builds
2021-05-18 9:05 [PATCH] scripts: coccicheck: fix troubles on non-English builds Mauro Carvalho Chehab
@ 2021-05-18 9:09 ` Julia Lawall
0 siblings, 0 replies; 2+ messages in thread
From: Julia Lawall @ 2021-05-18 9:09 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: linuxarm, mauro.chehab, Gilles Muller, Michal Marek,
Nicolas Palix, cocci, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1401 bytes --]
On Tue, 18 May 2021, Mauro Carvalho Chehab wrote:
> When LANG is not set to English, the logic which checks the
> number of CPUs fail, as the messages can be localized, and
> the logic at:
>
> THREADS_PER_CORE=$(lscpu | grep "Thread(s) per core: " | tr -cd "[:digit:]")
>
> will not get the number of threads per core.
>
> This causes the script to not run properly, as it will produce
> a warning:
>
> $ make coccicheck COCCI=$PWD/scripts/coccinelle/misc/add_namespace.cocci MODE=report drivers/media/
> ./scripts/coccicheck: linha 93: [: número excessivo de argumentos
>
> Fix it by forcing LANG=C when calling lscpu.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Applied, thanks.
julia
> ---
> scripts/coccicheck | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/coccicheck b/scripts/coccicheck
> index 65fee63aeadb..caba0bff6da7 100755
> --- a/scripts/coccicheck
> +++ b/scripts/coccicheck
> @@ -87,7 +87,7 @@ else
> fi
>
> # Use only one thread per core by default if hyperthreading is enabled
> - THREADS_PER_CORE=$(lscpu | grep "Thread(s) per core: " | tr -cd "[:digit:]")
> + THREADS_PER_CORE=$(LANG=C lscpu | grep "Thread(s) per core: " | tr -cd "[:digit:]")
> if [ -z "$J" ]; then
> NPROC=$(getconf _NPROCESSORS_ONLN)
> if [ $THREADS_PER_CORE -gt 1 -a $NPROC -gt 4 ] ; then
> --
> 2.31.1
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-18 9:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 9:05 [PATCH] scripts: coccicheck: fix troubles on non-English builds Mauro Carvalho Chehab
2021-05-18 9:09 ` Julia Lawall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®