From 7945a35005f04fa76d0dd3646972efdf31ef17bb Mon Sep 17 00:00:00 2001 From: Eugene Syromiatnikov Date: Sun, 5 Feb 2023 01:11:15 +0100 Subject: [PATCH] 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 Resolves: #2135047 --- find-provides.ksyms | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/find-provides.ksyms b/find-provides.ksyms index af98b90..60ea837 100755 --- a/find-provides.ksyms +++ b/find-provides.ksyms @@ -1,12 +1,13 @@ #! /bin/bash IFS=$'\n' +export LC_ALL=C for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') "$@"; do dep_pfx="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 \ - || dep_pfx="kernel" + || dep_pfx="kernel" tmpfile="" 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 \ | 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"