[PATCH] scripts/tags.sh: fix "make COMPILED_SOURCE=1 cscope" command ends up with *.rlib, *.rmeta, *.so filenames in cscope.files

From: Sergei Litvin

Date: Sat May 30 2026 - 03:06:47 EST


When executing the command `make COMPILED_SOURCE=1 cscope`, the `cscope.files`
file generated by it includes filenames with the extensions *.rlib, *.rmeta,
and *.so (taken from *.cmd files, which, in turn, are generated from *.d
dependency files by the `fixdep` utility).

Signed-off-by: Sergei Litvin <litvindev@xxxxxxxxx>
---
scripts/tags.sh | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/scripts/tags.sh b/scripts/tags.sh
index 243373683f98..f6642bb0f8ee 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -52,7 +52,7 @@ find_arch_sources()
for i in $archincludedir; do
local prune="$prune ( -path $i ) -prune -o"
done
- find ${tree}arch/$1 $ignore $prune -name "$2" -not -type l -print;
+ find ${tree}arch/$1 $ignore $prune -regextype posix-extended -regex "$2" -not -type l -print;
}

# find sources in arch/$1/include
@@ -61,14 +61,14 @@ find_arch_include_sources()
local include=$(find ${tree}arch/$1/ -name include -type d -print);
if [ -n "$include" ]; then
archincludedir="$archincludedir $include"
- find $include $ignore -name "$2" -not -type l -print;
+ find $include $ignore -regextype posix-extended -regex "$2" -not -type l -print;
fi
}

# find sources in include/
find_include_sources()
{
- find ${tree}include $ignore -name config -prune -o -name "$1" \
+ find ${tree}include $ignore -name config -prune -o -regextype posix-extended -regex "$1" \
-not -type l -print;
}

@@ -78,21 +78,21 @@ find_other_sources()
{
find ${tree}* $ignore \
\( -path ${tree}include -o -path ${tree}arch -o -name '.tmp_*' \) -prune -o \
- -name "$1" -not -type l -print;
+ -regextype posix-extended -regex "$1" -not -type l -print;
}

all_sources()
{
- find_arch_include_sources ${SRCARCH} '*.[chS]'
+ find_arch_include_sources ${SRCARCH} '.*\.([chS]|rs)'
if [ -n "$archinclude" ]; then
- find_arch_include_sources $archinclude '*.[chS]'
+ find_arch_include_sources $archinclude '.*\.([chS]|rs)'
fi
- find_include_sources '*.[chS]'
+ find_include_sources '.*\.([chS]|rs)'
for arch in $ALLSOURCE_ARCHS
do
- find_arch_sources $arch '*.[chS]'
+ find_arch_sources $arch '.*\.([chS]|rs)'
done
- find_other_sources '*.[chS]'
+ find_other_sources '.*\.([chS]|rs)'
}

all_compiled_sources()
@@ -100,7 +100,7 @@ all_compiled_sources()
{
echo include/generated/autoconf.h
find $ignore -name "*.cmd" -exec \
- grep -Poh '(?<=^ )\S+|(?<== )\S+[^\\](?=$)' {} \+ |
+ grep -Poh '(?<=^ )\S+\.([chS]|rs)|(?<== )\S+\.(?1)(?=$)' {} \+ |
awk '!a[$0]++'
} | xargs realpath -esq $([ -z "$KBUILD_ABS_SRCTREE" ] && echo --relative-to=.) |
sort -u
--
2.54.0