It is quite expensive to call grep, evenmoreso in a pipe, just to check the filename.
find-provides.ksyms is invoked ~8000 times during rpmbuild of a kernel. This takes >10 minutes. It's beneficial to speed it up This construct is slow (probably entails 2-3 forks, and one exec): dep_pfx="ksym" printf "%s" "$module" | grep -v "^${RPM_BUILD_ROOT}/\?lib/modules/[1-9][^/]*/kernel" > /dev/null \ || dep_pfx="kernel" What is seems to do is to set dep_pfx for "kernel" if path is /lib/modules/Nxxxxxx/kernel/yyyyyy. (well... what is that "\?" for?... anyway). This can be achieved with shell string manipulations: a=${module#${RPM_BUILD_ROOT}lib/modules/[0-9]*/kernel/} a=${a#${RPM_BUILD_ROOT}/lib/modules/[0-9]*/kernel/} If $a is not equal to $module, then the path was ${RPM_BUILD_ROOT}/lib/modules/Nxxxxxx/kernel/yyyyyy (or ${RPM_BUILD_ROOT}lib/modules/Nxxxxxx/kernel/yyyyyy, that is, there was a slash at the end of ${RPM_BUILD_ROOT} expansion)
*** Bug 2172514 has been marked as a duplicate of this bug. ***
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle. Changing version to 39.