find-provides.ksyms: set LC_ALL=C globally

This makes the sort order a bit more predictable across various
environments and also speeds up grep/sed/sort a bit as they no longer
need to deal with non-trivial collations and multibyte sequences
that may appear when some garbage is being parsed accidentally.

* find-provides.ksyms: Add "export LC_ALL=C", remove "LC_ALL=C" from the
specific calls.

Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
Resolves: #2135047
This commit is contained in:
Eugene Syromiatnikov 2023-02-05 01:11:15 +01:00
parent c8c9d28cff
commit 7945a35005

View File

@ -1,6 +1,7 @@
#! /bin/bash
IFS=$'\n'
export LC_ALL=C
for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') "$@"; do
dep_pfx="ksym"
@ -37,7 +38,7 @@ for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') "$@"; do
nm $module \
| sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p' \
| awk --non-decimal-data '{printf("'"${dep_pfx}"'(%s) = 0x%08x\n", $2, $1)}' \
| LC_ALL=C sort -u
| sort -u
else
ELFRODATA=$(readelf -R .rodata $module | awk '/0x/{printf $2$3$4$5}')
if [[ -n $(readelf -h $module | grep "little endian") ]]; then
@ -49,7 +50,7 @@ for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') "$@"; do
echo $sym $RODATA
done \
| awk --non-decimal-data '{printf("'"${dep_pfx}"'(%s) = 0x%08s\n", $2, substr($3,($1*2)+1,8))}' \
| LC_ALL=C sort -u
| sort -u
fi
[ -z "$tmpfile" ] || rm -f -- "$tmpfile"