Skip to content

Commit 2f324dd

Browse files
SylfrenaJuliaLawall
authored andcommitted
scripts: coccicheck: Add quotes to improve portability
While fetching the number of threads per core with lscpu, the [:digit:] set is used for translation of digits from 0-9. However, using [:digit:] instead of "[:digit:]" does not seem to work uniformly for some shell types and configurations (such as zsh). Therefore, modify coccicheck to use double quotes around the [:digit:] set for uniformity and better portability. Signed-off-by: Sumera Priyadarsini <sylphrenadin@gmail.com> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
1 parent 28c185a commit 2f324dd

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

scripts/coccicheck

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ else
7676
fi
7777

7878
# Use only one thread per core by default if hyperthreading is enabled
79-
THREADS_PER_CORE=$(lscpu | grep "Thread(s) per core: " | tr -cd [:digit:])
79+
THREADS_PER_CORE=$(lscpu | grep "Thread(s) per core: " | tr -cd "[:digit:]")
8080
if [ -z "$J" ]; then
8181
NPROC=$(getconf _NPROCESSORS_ONLN)
8282
if [ $THREADS_PER_CORE -gt 1 -a $NPROC -gt 2 ] ; then

0 commit comments

Comments
 (0)