From nobody Mon Jun 8 05:24:41 2026 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D4DE32937A for ; Mon, 1 Jun 2026 21:19:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780348760; cv=none; b=eVTqCjmMw0FKdF8qUJnoRYyJTCyb7HwQVrIKplKMFe/n7rSbCNqL24qCQSUDX8HrtGtbOKvf9BpwiBNKeo2zCcgE3d3h5r03yKzH2ocKLJDz2CmQKeNV95A0PDfQrHDOlUQn+EyLolRTcJh8KdSU/bzrFZhXksITPsPJBgodq7o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780348760; c=relaxed/simple; bh=IfPIiZW0gCIHgOF0/+IIrxBC8ZG3r9xHJsxK0+0F0kg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rGpdXSnecShb/X/Jt3OHqQkvsACnAvSikqQeCBMJs0GP53KYSOQryZBPFUhNIo2k04hjmoGYlSQ0DKE0Tc3CneaQb+6lUoT+onulgWQ06RyWbSPH4Ct81ClVGwoD4iWWd2lw7FS4/ZlXEyciDe46mtWO5dJR1ksA2DXmtjdyixc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=o3ipgcmU; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="o3ipgcmU" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-460166910e6so523037f8f.2 for ; Mon, 01 Jun 2026 14:19:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780348758; x=1780953558; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JuVHAspRZOzT54Q3CeGYfhWxBcncLtAKm4G7e3ZGvNU=; b=o3ipgcmUluH9ud6bWumsrmuDdH9Gtfcr7BDcN1KYANa/V7Wyrm0ZVKSPv/9tWDyiPf 4wt8MHAgTn2cIT3CPJ+zDvhzP6OeLiSMnGVEcUMK2Urcxi0Mzdj439ocdQqDtvOFBb3D YSdRJfc0PKf4SLJhXWipVSQr5uSt3RgB48vKJfH2WzinHUmvphwqPqEioWQQduieJ/x4 B6JmYc9s84jSJAuZzTqA+lqeEth4SUky09gKVQRykYU2MsCu2pEAT0FxVj9iNhvr9Vr+ Z75yW6cD0C5m+fDElR2DU+dpqjFAcyud7fGJ3g0NAwB1jw4nv4i4RSV2hQdqxh2HlAOG 5hNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780348758; x=1780953558; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=JuVHAspRZOzT54Q3CeGYfhWxBcncLtAKm4G7e3ZGvNU=; b=rhkOjKds1X9n1hhYxorfrGkym7pj+zZAp2xcToG0LKr/GHMntZQXuNRLzstwwRkZhc GOtz/Q+5iRplRz9y5VbCAkFc3ocEPuvLOLivC/Xu2jZnQEYkT6iVBYJ1Bk0niMTc9aMo VGPh4zOXMiwEX485KgHGVa5Q0fTyS0Ly+t4RuT2Gg1Do9gaZjcIJRKbZwlgA9LGgIvOb XORYoZhs5x2JBVxs4NgMSQTTlQAfSWGrr3LZXDELNzIN39WF+GQZSnDcgkZv/bFAkFLW tPbMPqr3mXHsuXHpEEXQJbRzsESJaCy6NsfiTqfnDKpoAqo+8b/5iVKhSgK3CTTi1R3C r1GA== X-Forwarded-Encrypted: i=1; AFNElJ+OTSKtK5dScTKGM918zrTNEZAic0KPnOzTy+bTIsNJy+KjZkJThkPwNysdoM5ljUrP//PkLanU7zMnzgQ=@vger.kernel.org X-Gm-Message-State: AOJu0YyUMYzn4JuM6jqxIU/ePrw8Mx0XY/IxlQ22YEv8WctNHc73lR42 uOFcYf5ExMqsRJ+tsMAOdzFAPjv4fgtqtil1mc+RTy6QWa2RoHm+k1M/MO0pQpQN X-Gm-Gg: Acq92OHNdf83dKs4GPa172c45Jx+4umyVrezA4fldYL+PLMY/fMkAs6X/0de2Ugrfb9 JHsj/bdpRxK3iLDn4HwEIlZ14EOtJzc/AnZp+eiOQ/TiXC1mUgaHuvxupPtUh6eempom12doc5D dedwWpHGydmpyZoIex+UVQYRY6MH0TpCEo9+wtAlMklDZi0nfmvJvkSPdqA0XscR9AZwPNOwFoE 2ic3+xO/57sOlJ/fNi3b0DEYKsog6cSB3ibfa+sRoRYQJoU9dPgzhV59CjzsDQs9ADYotICtnFx 1727rxvUbQxrQCDyffbyADKJRBI2MYlMGw/xZOwnEYnGgHk4oYGCJzSOtYoPo+ITq8Dhpnf2uWZ i27Du1Jn7JG7hlnMoWH/5p6DIMF7x/pv/z+kzmOjeNrEiwuLbj0lHKBB81ojxwd/T7/iliiAw5D 3XOsJlY203QhENEnbu35sgKXVbEn64R439qZd1wyb0yzMJb+m2B+U+efA= X-Received: by 2002:a05:6000:4b02:b0:45f:1bd:a053 with SMTP id ffacd0b85a97d-45f01bda1famr19783269f8f.1.1780348757529; Mon, 01 Jun 2026 14:19:17 -0700 (PDT) Received: from localhost (a89-182-201-205.net-htp.de. [89.182.201.205]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-45ef3587072sm28494538f8f.34.2026.06.01.14.19.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 Jun 2026 14:19:17 -0700 (PDT) From: Sergei Litvin To: miguel.ojeda.sandonis@gmail.com, nathan@kernel.org, nsc@kernel.org Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, ojeda@kernel.org, Sergei Litvin Subject: [PATCH v3] scripts/tags.sh: fix "make COMPILED_SOURCE=1 cscope" command ends up with *.rlib, *.rmeta, *.so filenames in cscope.files Date: Mon, 1 Jun 2026 23:18:50 +0200 Message-ID: <20260601211850.3378-1-litvindev@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable PROBLEM (1) When executing the command `make COMPILED_SOURCE=3D1 cscope`, the `cscope.files` file generated by it includes filenames with the extensions *.rlib, *.rmeta, and *.so (taken from *.cmd files, which, in tur= n, are generated from *.d dependency files by the `fixdep` utility). (2) When executing the command `make cscope`, the `cscope.files` file gener= ated by it includes only filenames with the extensions *.h, *.c, *.S and not inc= ludes filenames with *.rs extensions. SOLUTION (1) Modify the regular expression in the `all_compiled_sources()` function = so that only files with the extensions *.h, *.c, *.S, and *.rs are accepted. This causes `make COMPILED_SOURCE=3D1 cscope` command to generate the `cscope.files` file that contains only files with the extensions *.h, *.c, = *.S, and *.rs. (2) Modify the functions `find_arch_sources()`, `find_arch_include_sources(= )`, `find_include_sources()`, and `find_other_sources()` so that they no longer accept the filename pattern as the last argument, but instead retrieve it f= rom the new variable `pattern` (analogous to the variables `ignore`, `prune`, a= nd `tree`) which includes *.rs along with *.h, *.c, *.S. This causes `make cscope` command to generate a `cscope.files` file that contains *.rs files along with *.h, *.c, *.S Signed-off-by: Sergei Litvin --- Changes since V2: https://lore.kernel.org/lkml/20260530085821.19689-1-litvindev@gmail.com/ - The functions find_arch_sources()`, `find_arch_include_sources()`, `find_include_sources()`, and `find_other_sources()` have been modified rat= her than having their calls duplicated to avoid redundant directory traversals (suggested by Sashiko). =E2=80=93 The regular expression in the `all_compiled_sources()` function w= as improved by adding a lookahead anchor (?=3D\s) to the first branch (also suggested b= y Sashiko). Changes between the V1 and V2: https://lore.kernel.org/lkml/20260530085821.19689-1-litvindev@gmail.com/ https://lore.kernel.org/lkml/20260530070631.14955-1-litvindev@gmail.com/ - In Version V1, the `-name` parameters to the `find` calls in the functions `find_arch_sources()`, `find_arch_include_sources()`, `find_include_sources= ()`, and `find_other_sources()` were replaced by `-regextype posix-extended -regex`. However, as noted by Sashiko, the `-regextype` option is a GNU-spe= cific extension; therefore, in V2, duplicate function calls were introduced inste= ad. --- scripts/tags.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/scripts/tags.sh b/scripts/tags.sh index 243373683f98..be7c2ffd2d4e 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -12,6 +12,9 @@ if [[ "$KBUILD_VERBOSE" =3D~ 1 ]]; then set -x fi =20 +# sources to searh +pattern=3D"( -name *.[chS] -o -name *.rs )" + # RCS_FIND_IGNORE has escaped ()s -- remove them. ignore=3D"$(echo "$RCS_FIND_IGNORE" | sed 's|\\||g' )" # tags and cscope files should also ignore MODVERSION *.mod.c files @@ -52,7 +55,7 @@ find_arch_sources() for i in $archincludedir; do local prune=3D"$prune ( -path $i ) -prune -o" done - find ${tree}arch/$1 $ignore $prune -name "$2" -not -type l -print; + find ${tree}arch/$1 $ignore $prune $pattern -not -type l -print; } =20 # find sources in arch/$1/include @@ -61,14 +64,14 @@ find_arch_include_sources() local include=3D$(find ${tree}arch/$1/ -name include -type d -print); if [ -n "$include" ]; then archincludedir=3D"$archincludedir $include" - find $include $ignore -name "$2" -not -type l -print; + find $include $ignore $pattern -not -type l -print; fi } =20 # 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 $pattern \ -not -type l -print; } =20 @@ -78,21 +81,21 @@ find_other_sources() { find ${tree}* $ignore \ \( -path ${tree}include -o -path ${tree}arch -o -name '.tmp_*' \) -p= rune -o \ - -name "$1" -not -type l -print; + $pattern -not -type l -print; } =20 all_sources() { - find_arch_include_sources ${SRCARCH} '*.[chS]' + find_arch_include_sources ${SRCARCH} if [ -n "$archinclude" ]; then - find_arch_include_sources $archinclude '*.[chS]' + find_arch_include_sources $archinclude fi - find_include_sources '*.[chS]' + find_include_sources for arch in $ALLSOURCE_ARCHS do - find_arch_sources $arch '*.[chS]' + find_arch_sources $arch done - find_other_sources '*.[chS]' + find_other_sources } =20 all_compiled_sources() @@ -100,7 +103,7 @@ all_compiled_sources() { echo include/generated/autoconf.h find $ignore -name "*.cmd" -exec \ - grep -Poh '(?<=3D^ )\S+|(?<=3D=3D )\S+[^\\](?=3D$)' {} \+ | + grep -Poh '(?<=3D^ )\S+\.([chS]|rs)(?=3D\s)|(?<=3D=3D )\S+\.(?1)(?=3D$= )' {} \+ | awk '!a[$0]++' } | xargs realpath -esq $([ -z "$KBUILD_ABS_SRCTREE" ] && echo --relative= -to=3D.) | sort -u --=20 2.54.0