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