From a3cd779fd6fe3d1a9c83daa85b8a9df2a9661a15 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Mon, 24 Mar 2025 17:44:17 +0100 Subject: [PATCH] modulecmd: bugfix: smb-cmds 'avail' and 'search' are case insensitive --- Pmodules/modulecmd.bash.in | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index 9880cf6..0683b14 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1206,6 +1206,11 @@ get_available_modules() { # otherwise match max one slash fpattern=".*/${pattern}[^/]*/*[^/]+" fi + local -- opt_regex='-regex' + if [[ "${mode}" != 'load' ]]; then + opt_regex='-iregex' + fi + local -- dir='' # loop over all entries in given module path for dir in "${dirs[@]}"; do @@ -1259,7 +1264,7 @@ get_available_modules() { fi [[ "${add}" == 'no' ]] && continue if [[ "${mode}" == 'search' ]]; then - [[ "${mod}" =~ ${pattern} ]] || continue + [[ "${mod,,}" =~ ${pattern,,} ]] || continue else if [[ "${pattern}" == */* ]]; then [[ "${mod}" == ${pattern} ]] || continue @@ -1287,7 +1292,7 @@ get_available_modules() { [[ "${mode}" != 'search' ]] && return 0 done < <(${find} -L "${dir}" \ -not -name ".*" \ - \( -regex "${fpattern}" \ + \( "${opt_regex}" "${fpattern}" \ -regextype posix-basic \) \ \( -type f -o -type l \) \ -printf "%P\n" \