From 10cf8e46f43a7a2094e4d861c1296db6af0e0fa1 Mon Sep 17 00:00:00 2001 From: Frederick Grose Date: Sun, 27 Nov 2022 13:52:27 -0500 Subject: [PATCH] fix(load_fstype): avoid false positive searchs Refactor to avoid substring matches and to speed processing. Also avoid xtracing. --- modules.d/99base/dracut-lib.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh index 218cb13b91..14f20d78ab 100755 --- a/modules.d/99base/dracut-lib.sh +++ b/modules.d/99base/dracut-lib.sh @@ -1140,5 +1140,10 @@ remove_hostonly_files() { # returns OK if kernel_module is loaded # modprobe fails if /lib/modules is not available (--no-kernel use case) load_fstype() { - strstr "$(cat /proc/filesystems)" "${2:-$1}" || modprobe "$1" + local - fs _fs="${2:-$1}" + set +x + while read -r d fs || [ "$d" ]; do + [ "${fs:-$d}" = "$_fs" ] && return 0 + done < /proc/filesystems + modprobe "$1" }