Skip to contentSkip to conversation

scripts/tags.sh: Prevent binary files appearing in cscope.files

PATCH Superseded Sergei Litvin 3 participants 14 messages Jul 5 – Jul 15 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): https://lore.kernel.org/lkml/akVkIrcpNxZrrfii@levanger/

#1 lore raw

PATCH 1/1 scripts/tags.sh: Prevent binary files appearing in cscope.files

PROBLEM

When executing the command make COMPILED_SOURCE=1 cscope, the resulting cscope.files file contains filenames with the extensions *.rlib, *.rmeta, and *.so.

SOLUTION

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 is the first part of this patch:
https://lore.kernel.org/lkml/[email protected]/

which I have split into two parts, as suggested by Nicolas Schier here:
https://lore.kernel.org/lkml/akVkIrcpNxZrrfii@levanger/

---
 scripts/tags.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/tags.sh +1 -1
index 243373683f98..c9dc2763a505 100755
@@ -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)|(?<== )\S+\.(?1)(?=$)' {} \+ |
 		awk '!a[$0]++'
 	} | xargs realpath -esq $([ -z "$KBUILD_ABS_SRCTREE" ] && echo --relative-to=.) |
 	sort -u
Signature · 1 line
2.54.0
#2 lore raw
Quoted 4 lines · Sergei Litvin

PROBLEM

SOLUTION

We don't typically use titles like these in commits. (Same for the other patch.)

Quoted 2 lines

This causes make cscope command to generate a cscope.files file that contains *.rs files along with *.h, *.c, *.S

Missing Signed-off-by -- the one you wrote is below, in the part that doesn't go into the commit, i.e. after the --- line. (Same for the other patch.)

Also consider using -v2 in git format-patch to annotate which version it is.

By the way, this sounds like it could be backported? i.e. perhaps we want a Fixes: tag and Cc: [email protected].

Thanks!

Cheers,
Miguel

#3 lore raw

PATCH v2 1/1 scripts/tags.sh: Prevent binary files appearing in cscope.files

When executing the command make COMPILED_SOURCE=1 cscope, the resulting cscope.files file contains filenames with the extensions *.rlib, *.rmeta, and *.so.

To fix this, modify the regular expression in the all_compiled_sources() function so that only files with the extensions *.h, *.c, *.S, and *.rs are accepted.

The issue has been introduced by commit 4f491bb6ea2a ("scripts/tags.sh: collect compiled source precisely") which implemented the parsing of compiled sources from *.cmd files instead of using the "find" command.

Fixes 4f491bb6ea2a ("scripts/tags.sh: collect compiled source precisely")

---

This is the first part of this patch:
https://lore.kernel.org/lkml/[email protected]/

which I have split into two parts, as suggested by Nicolas Schier here:
https://lore.kernel.org/lkml/akVkIrcpNxZrrfii@levanger/

Changes since V1:
https://lore.kernel.org/lkml/[email protected]/

as suggested by Miguel Ojeda here:
https://lore.kernel.org/lkml/CANiq72kHbVQfNrum5D2a5sCd3mFQHNtigrQxP1WW=YcggxA=WQ@mail.gmail.com/

- Add "Cc: [email protected]" tag
- Add "Fixes:" tag
- Add missed "Signed-off-by:" tag

---
 scripts/tags.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/tags.sh +1 -1
index 243373683f98..c9dc2763a505 100755
@@ -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)|(?<== )\S+\.(?1)(?=$)' {} \+ |
 		awk '!a[$0]++'
 	} | xargs realpath -esq $([ -z "$KBUILD_ABS_SRCTREE" ] && echo --relative-to=.) |
 	sort -u
Signature · 1 line
2.55.0
maintainer Tested-by Reviewed-by on v2 1/1
#4 lore raw
Quoted 12 lines · Sergei Litvin

When executing the command make COMPILED_SOURCE=1 cscope, the resulting cscope.files file contains filenames with the extensions *.rlib, *.rmeta, and *.so.

To fix this, modify the regular expression in the all_compiled_sources() function so that only files with the extensions *.h, *.c, *.S, and *.rs are accepted.

The issue has been introduced by commit 4f491bb6ea2a ("scripts/tags.sh: collect compiled source precisely") which implemented the parsing of compiled sources from *.cmd files instead of using the "find" command.

Quoted 8 lines
Fixes 4f491bb6ea2a ("scripts/tags.sh: collect compiled source precisely")

---

Thanks, looks good to me. W/o this patch 'make COMPILED_SOURCE=1 cscope' is actually not usable on my system, as soon as some rust libs are in my build tree, so thanks for fixing!

As this is a not really a build relevant bug, I think this should go via some -next rather than a -fixes tree [1].

Miguel, are you with with it if I take this patch as well as the second one [2] via kbuild-next?

(I tend to remove the Cc trailers from this patch here, as they are incomplete.)

Kind regards,
Nicolas

[1]: https://lore.kernel.org/r/CAHk-=wjt1NiKOdyAMz_DT7NmZ++SizPOhRSi492ukdTnpDzHQw@mail.gmail.com/
[2]: [PATCH v4] scripts/tags.sh: Add support for rust source files

     https://lore.kernel.org/linux-kbuild/[email protected]/T/#u
Acked-by
#5 lore raw
Quoted 3 lines · Nicolas Schier

Miguel, are you with with it if I take this patch as well as the second one [2] via kbuild-next?

Yes, of course, thanks!

(If the cscope target is actually broken in some cases, then I think it would still be fine in -fixes; but since nobody complained so far, I guess it is not that urgent anyway...).

Cheers,
Miguel

maintainer
#6 lore raw
In reply to Sergei Litvin
Quoted 4 lines · Sergei Litvin

When executing the command make COMPILED_SOURCE=1 cscope, the resulting cscope.files file contains filenames with the extensions *.rlib, *.rmeta, and *.so.

With removed Cc trailers and adjusted line break in the commit message, applied to kbuild/linux.git (kbuild-next-unstable), thanks!

[1/1] scripts/tags.sh: Prevent binary files appearing in cscope.files

      https://git.kernel.org/kbuild/c/1e5ebc3f

Please look out for regression or issue reports or other follow up comments, as they may result in the patch/series getting dropped, reverted or modified (e.g. trailers). Patches applied to the kbuild-next-unstable branch are accepted pending wider testing in linux-next and any post-commit review; they will generally be moved to the kbuild-next branch in about a week if no issues are found.

Best regards,

Signature · 1 line
Nicolas
#7 lore raw

PATCH v2 1/1 scripts/tags.sh: Add support for rust source files

In reply to Miguel Ojeda

When executing the command make cscope, the cscope.files file generated by it includes only filenames with the extensions *.h, *.c, *.S and not includes filenames with *.rs extensions.

To fix this, modify the functions find_arch_sources(), find_arch_include_sources(), find_include_sources(), and find_other_sources() so that they can accept an unlimited number of filename patterns as parameters for the search. Add the setup_name_pattern() function to convert these filename pattern parameters into a list of parameters that can be passed to the find utility via the new pattern variable.

---

This is the second part of this patch:
https://lore.kernel.org/lkml/[email protected]/

which I have split into two parts, as suggested by Nicolas Schier here:
https://lore.kernel.org/lkml/akVkIrcpNxZrrfii@levanger/

Changes since V1:
https://lore.kernel.org/lkml/[email protected]/

as suggested by Miguel Ojeda here:
https://lore.kernel.org/lkml/CANiq72kHbVQfNrum5D2a5sCd3mFQHNtigrQxP1WW=YcggxA=WQ@mail.gmail.com/

- Add "Cc: [email protected]" tag
- Add missed "Signed-off-by:" tag

---
 scripts/tags.sh | 40 +++++++++++++++++++++++++++++++---------
 1 file changed, 31 insertions(+), 9 deletions(-)
scripts/tags.sh +31 -9
index c9dc2763a505..41e38df96984 100755
@@ -46,13 +46,31 @@ elif [ "${ALLSOURCE_ARCHS}" = "all" ]; then
 	ALLSOURCE_ARCHS=$(find ${tree}arch/ -mindepth 1 -maxdepth 1 -type d -printf '%f ')
 fi
 
+setup_name_pattern()
+{
+	pattern=()
+	for ext; do
+		if [ ${#pattern[@]} -gt 0 ]; then
+			pattern+=("-o" "-name" "$ext")
+		else
+			pattern+=("(" "-name" "$ext")
+		fi
+	done
+	if [ ${#pattern[@]} -gt 0 ]; then
+		pattern+=(")")
+	fi
+}
+
 # find sources in arch/$1
 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;
+	local src=${tree}arch/$1
+	shift
+	setup_name_pattern "$@"
+	find $src $ignore $prune "${pattern[@]}" -not -type l -print;
 }
 
 # find sources in arch/$1/include
@@ -61,14 +79,17 @@ 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;
+		shift
+		setup_name_pattern "$@"
+		find $include $ignore "${pattern[@]}" -not -type l -print;
 	fi
 }
 
 # find sources in include/
 find_include_sources()
 {
-	find ${tree}include $ignore -name config -prune -o -name "$1" \
+	setup_name_pattern "$@"
+	find ${tree}include $ignore -name config -prune -o "${pattern[@]}" \
 		-not -type l -print;
 }
 
@@ -76,23 +97,24 @@ find_include_sources()
 # we could benefit from a list of dirs to search in here
 find_other_sources()
 {
+	setup_name_pattern "$@"
 	find ${tree}* $ignore \
 	     \( -path ${tree}include -o -path ${tree}arch -o -name '.tmp_*' \) -prune -o \
-	       -name "$1" -not -type l -print;
+	       "${pattern[@]}" -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()
Signature · 1 line
2.55.0
#8 lore raw

Re: [PATCH v2] scripts/tags.sh: Add support for rust source files

Quoted 2 lines · Sergei Litvin

To clarify, I meant this one for the other one, i.e. this one sounds a bit more like a feature.

But I am not sure -- to decide whether it is a fix, it would be nice to get a description of how each of them breaks something, to decide whether it is a fix or not, e.g. the other one sounded to me like it was a mistake because it added extra unexpected files (and I guess that could in principle confuse tooling or perhaps makes cscope print non-sense in some cases), but does it?

Similarly, for this one, what breaks "in practice" for the end user? e.g. is there an error message, or does some workflow break, etc.? (It would be nice to show it in the commit message if so.)

Finally, if this one is a fix too, then this should likely has the
Fixes: hash too.

(By the way, if you send a new version, please Cc the entire RUST entry if you don't mind).

Thanks!

Cheers,
Miguel

#9 lore raw

PATCH v3 1/1 scripts/tags.sh: Add support for rust source files

When executing the command make cscope, the cscope.files file generated by it includes only filenames with the extensions *.h, *.c, *.S and not includes filenames with *.rs extensions.

To fix this, modify the functions find_arch_sources(), find_arch_include_sources(), find_include_sources(), and find_other_sources() so that they can accept an unlimited number of filename patterns as parameters for the search. Add the setup_name_pattern() function to convert these filename pattern parameters into a list of parameters that can be passed to the find utility via the new pattern variable.

Cc Miguel Ojeda <[email protected]>
Cc Boqun Feng <[email protected]>
Cc Gary Guo <[email protected]>
Cc Björn Roy Baron <[email protected]>
Cc Benno Lossin <[email protected]>
Cc Andreas Hindborg <[email protected]>
Cc Alice Ryhl <[email protected]>
Cc Trevor Gross <[email protected]>
Cc Danilo Krummrich <[email protected]>
Cc Daniel Almeida <[email protected]>
Cc Tamir Duberstein <[email protected]>
Cc Alexandre Courbot <[email protected]>
Cc Onur Özkan <[email protected]>

---

This is the second part of this patch:
https://lore.kernel.org/lkml/[email protected]/

which I have split into two parts, as suggested by Nicolas Schier here:
https://lore.kernel.org/lkml/akVkIrcpNxZrrfii@levanger/

Changes since V2:
https://lore.kernel.org/lkml/[email protected]/

as suggested by Miguel Ojeda here:
https://lore.kernel.org/lkml/CANiq72k0RbkWk=8hiNzHUmFWr=6OA2DBHAUew4OfZb_Umb=6hA@mail.gmail.com/

- Remove "Cc: [email protected]" tag, because this commit introduces a new feature.

---
 scripts/tags.sh | 40 +++++++++++++++++++++++++++++++---------
 1 file changed, 31 insertions(+), 9 deletions(-)
scripts/tags.sh +31 -9
index c9dc2763a505..41e38df96984 100755
@@ -46,13 +46,31 @@ elif [ "${ALLSOURCE_ARCHS}" = "all" ]; then
 	ALLSOURCE_ARCHS=$(find ${tree}arch/ -mindepth 1 -maxdepth 1 -type d -printf '%f ')
 fi
 
+setup_name_pattern()
+{
+	pattern=()
+	for ext; do
+		if [ ${#pattern[@]} -gt 0 ]; then
+			pattern+=("-o" "-name" "$ext")
+		else
+			pattern+=("(" "-name" "$ext")
+		fi
+	done
+	if [ ${#pattern[@]} -gt 0 ]; then
+		pattern+=(")")
+	fi
+}
+
 # find sources in arch/$1
 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;
+	local src=${tree}arch/$1
+	shift
+	setup_name_pattern "$@"
+	find $src $ignore $prune "${pattern[@]}" -not -type l -print;
 }
 
 # find sources in arch/$1/include
@@ -61,14 +79,17 @@ 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;
+		shift
+		setup_name_pattern "$@"
+		find $include $ignore "${pattern[@]}" -not -type l -print;
 	fi
 }
 
 # find sources in include/
 find_include_sources()
 {
-	find ${tree}include $ignore -name config -prune -o -name "$1" \
+	setup_name_pattern "$@"
+	find ${tree}include $ignore -name config -prune -o "${pattern[@]}" \
 		-not -type l -print;
 }
 
@@ -76,23 +97,24 @@ find_include_sources()
 # we could benefit from a list of dirs to search in here
 find_other_sources()
 {
+	setup_name_pattern "$@"
 	find ${tree}* $ignore \
 	     \( -path ${tree}include -o -path ${tree}arch -o -name '.tmp_*' \) -prune -o \
-	       -name "$1" -not -type l -print;
+	       "${pattern[@]}" -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()
Signature · 1 line
2.55.0
#10 lore raw

PATCH v4 1/1 scripts/tags.sh: Add support for rust source files

When executing the command make cscope, the cscope.files file generated by it includes only filenames with the extensions *.h, *.c, *.S and not includes filenames with *.rs extensions.

To fix this, modify the functions find_arch_sources(), find_arch_include_sources(), find_include_sources(), and find_other_sources() so that they can accept an unlimited number of filename patterns as parameters for the search. Add the setup_name_pattern() function to convert these filename pattern parameters into a list of parameters that can be passed to the find utility via the new pattern variable.

Cc Miguel Ojeda <[email protected]>
Cc Boqun Feng <[email protected]>
Cc Gary Guo <[email protected]>
Cc Björn Roy Baron <[email protected]>
Cc Benno Lossin <[email protected]>
Cc Andreas Hindborg <[email protected]>
Cc Alice Ryhl <[email protected]>
Cc Trevor Gross <[email protected]>
Cc Danilo Krummrich <[email protected]>
Cc Daniel Almeida <[email protected]>
Cc Tamir Duberstein <[email protected]>
Cc Alexandre Courbot <[email protected]>
Cc Onur Özkan <[email protected]>

---

This is the second part of this patch:
https://lore.kernel.org/lkml/[email protected]/

which I have split into two parts, as suggested by Nicolas Schier here:
https://lore.kernel.org/lkml/akVkIrcpNxZrrfii@levanger/

Changes since V3:
https://lore.kernel.org/lkml/[email protected]/

- Fixed list of "Cc:" tags

Changes since V2:
https://lore.kernel.org/lkml/[email protected]/

as suggested by Miguel Ojeda here:
https://lore.kernel.org/lkml/CANiq72k0RbkWk=8hiNzHUmFWr=6OA2DBHAUew4OfZb_Umb=6hA@mail.gmail.com/

- Remove "Cc: [email protected]" tag, because this commit introduces a new feature.

Changes since V1:
https://lore.kernel.org/lkml/[email protected]/

as suggested by Miguel Ojeda here:
https://lore.kernel.org/lkml/CANiq72kHbVQfNrum5D2a5sCd3mFQHNtigrQxP1WW=YcggxA=WQ@mail.gmail.com/

- Add "Cc: [email protected]" tag
- Add missed "Signed-off-by:" tag

---
 scripts/tags.sh | 40 +++++++++++++++++++++++++++++++---------
 1 file changed, 31 insertions(+), 9 deletions(-)
scripts/tags.sh +31 -9
index c9dc2763a505..41e38df96984 100755
@@ -46,13 +46,31 @@ elif [ "${ALLSOURCE_ARCHS}" = "all" ]; then
 	ALLSOURCE_ARCHS=$(find ${tree}arch/ -mindepth 1 -maxdepth 1 -type d -printf '%f ')
 fi
 
+setup_name_pattern()
+{
+	pattern=()
+	for ext; do
+		if [ ${#pattern[@]} -gt 0 ]; then
+			pattern+=("-o" "-name" "$ext")
+		else
+			pattern+=("(" "-name" "$ext")
+		fi
+	done
+	if [ ${#pattern[@]} -gt 0 ]; then
+		pattern+=(")")
+	fi
+}
+
 # find sources in arch/$1
 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;
+	local src=${tree}arch/$1
+	shift
+	setup_name_pattern "$@"
+	find $src $ignore $prune "${pattern[@]}" -not -type l -print;
 }
 
 # find sources in arch/$1/include
@@ -61,14 +79,17 @@ 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;
+		shift
+		setup_name_pattern "$@"
+		find $include $ignore "${pattern[@]}" -not -type l -print;
 	fi
 }
 
 # find sources in include/
 find_include_sources()
 {
-	find ${tree}include $ignore -name config -prune -o -name "$1" \
+	setup_name_pattern "$@"
+	find ${tree}include $ignore -name config -prune -o "${pattern[@]}" \
 		-not -type l -print;
 }
 
@@ -76,23 +97,24 @@ find_include_sources()
 # we could benefit from a list of dirs to search in here
 find_other_sources()
 {
+	setup_name_pattern "$@"
 	find ${tree}* $ignore \
 	     \( -path ${tree}include -o -path ${tree}arch -o -name '.tmp_*' \) -prune -o \
-	       -name "$1" -not -type l -print;
+	       "${pattern[@]}" -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()
Signature · 1 line
2.55.0
maintainer Tested-by Reviewed-by on v4 1/1
#11 lore raw

Re: [PATCH v4] scripts/tags.sh: Add support for rust source files

Quoted 53 lines · Sergei Litvin

When executing the command make cscope, the cscope.files file generated by it includes only filenames with the extensions *.h, *.c, *.S and not includes filenames with *.rs extensions.

To fix this, modify the functions find_arch_sources(), find_arch_include_sources(), find_include_sources(), and find_other_sources() so that they can accept an unlimited number of filename patterns as parameters for the search. Add the setup_name_pattern() function to convert these filename pattern parameters into a list of parameters that can be passed to the find utility via the new pattern variable.

Cc Miguel Ojeda <[email protected]>
Cc Boqun Feng <[email protected]>
Cc Gary Guo <[email protected]>
Cc Björn Roy Baron <[email protected]>
Cc Benno Lossin <[email protected]>
Cc Andreas Hindborg <[email protected]>
Cc Alice Ryhl <[email protected]>
Cc Trevor Gross <[email protected]>
Cc Danilo Krummrich <[email protected]>
Cc Daniel Almeida <[email protected]>
Cc Tamir Duberstein <[email protected]>
Cc Alexandre Courbot <[email protected]>
Cc Onur Özkan <[email protected]>

---

This is the second part of this patch:
https://lore.kernel.org/lkml/[email protected]/

which I have split into two parts, as suggested by Nicolas Schier here:
https://lore.kernel.org/lkml/akVkIrcpNxZrrfii@levanger/

Changes since V3:
https://lore.kernel.org/lkml/[email protected]/

- Fixed list of "Cc:" tags

Changes since V2:
https://lore.kernel.org/lkml/[email protected]/

as suggested by Miguel Ojeda here:
https://lore.kernel.org/lkml/CANiq72k0RbkWk=8hiNzHUmFWr=6OA2DBHAUew4OfZb_Umb=6hA@mail.gmail.com/

- Remove "Cc: [email protected]" tag, because this commit introduces a new feature.

Changes since V1:
https://lore.kernel.org/lkml/[email protected]/

Quoted 9 lines

as suggested by Miguel Ojeda here:
https://lore.kernel.org/lkml/CANiq72kHbVQfNrum5D2a5sCd3mFQHNtigrQxP1WW=YcggxA=WQ@mail.gmail.com/

- Add "Cc: [email protected]" tag
- Add missed "Signed-off-by:" tag

---
 scripts/tags.sh | 40 +++++++++++++++++++++++++++++++---------
 1 file changed, 31 insertions(+), 9 deletions(-)
Signature · 1 line
Nicolas
#12 lore raw

Re: [PATCH v4] scripts/tags.sh: Add support for rust source files

In reply to Sergei Litvin
Quoted 2 lines · Sergei Litvin

- Fixed list of "Cc:" tags

Just to clarify, I meant to Cc in the header, rather than add everyone as an explicit Cc tag -- the Cc: tag is (usually) meant to be a more explicit Cc to indicate in the commit message that the particular person had a chance to comment etc.

[ Some people do use it for every single Cc, but that is a minority last time I took a look at it. I think it may make things easier for some tooling, but it adds a lot of noise and reduces the signal of the tag. ]

In any case, no need for a new version to change that! :)

Thanks!

Cheers,
Miguel

maintainer
#13 lore raw

Re: [PATCH v4] scripts/tags.sh: Add support for rust source files

In reply to Sergei Litvin
Quoted 3 lines · Sergei Litvin

When executing the command make cscope, the cscope.files file generated by it includes only filenames with the extensions *.h, *.c, *.S and not includes filenames with *.rs extensions.

With removed Cc trailers and adjusted line break in the commit message, applied to kbuild/linux.git (kbuild-next-unstable), thanks!

[1/1] scripts/tags.sh: Prevent binary files appearing in cscope.files

      https://git.kernel.org/kbuild/c/4859c0d5

Please look out for regression or issue reports or other follow up comments, as they may result in the patch/series getting dropped, reverted or modified (e.g. trailers). Patches applied to the kbuild-next-unstable branch are accepted pending wider testing in linux-next and any post-commit review; they will generally be moved to the kbuild-next branch in about a week if no issues are found.

Best regards,

Signature · 1 line
Nicolas
#14 lore raw

PATCH 1/1 scripts/tags.sh: Add support for rust source files

In reply to a message not in the archive

PROBLEM

When executing the command make cscope, the cscope.files file generated by it includes only filenames with the extensions *.h, *.c, *.S and not includes filenames with *.rs extensions.

SOLUTION

Modify the functions find_arch_sources(), find_arch_include_sources(), find_include_sources(), and find_other_sources() so that they can accept an unlimited number of filename patterns as parameters for the search. Add the setup_name_pattern() function to convert these filename pattern parameters into a list of parameters that can be passed to the find utility via the new pattern variable.

This causes make cscope command to generate a cscope.files file that contains *.rs files along with *.h, *.c, *.S

---

This is the second part of this patch:
https://lore.kernel.org/lkml/[email protected]/

which I have split into two parts, as suggested by Nicolas Schier here:
https://lore.kernel.org/lkml/akVkIrcpNxZrrfii@levanger/

---
 scripts/tags.sh | 40 +++++++++++++++++++++++++++++++---------
 1 file changed, 31 insertions(+), 9 deletions(-)
scripts/tags.sh +31 -9
index c9dc2763a505..41e38df96984 100755
@@ -46,13 +46,31 @@ elif [ "${ALLSOURCE_ARCHS}" = "all" ]; then
 	ALLSOURCE_ARCHS=$(find ${tree}arch/ -mindepth 1 -maxdepth 1 -type d -printf '%f ')
 fi
 
+setup_name_pattern()
+{
+	pattern=()
+	for ext; do
+		if [ ${#pattern[@]} -gt 0 ]; then
+			pattern+=("-o" "-name" "$ext")
+		else
+			pattern+=("(" "-name" "$ext")
+		fi
+	done
+	if [ ${#pattern[@]} -gt 0 ]; then
+		pattern+=(")")
+	fi
+}
+
 # find sources in arch/$1
 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;
+	local src=${tree}arch/$1
+	shift
+	setup_name_pattern "$@"
+	find $src $ignore $prune "${pattern[@]}" -not -type l -print;
 }
 
 # find sources in arch/$1/include
@@ -61,14 +79,17 @@ 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;
+		shift
+		setup_name_pattern "$@"
+		find $include $ignore "${pattern[@]}" -not -type l -print;
 	fi
 }
 
 # find sources in include/
 find_include_sources()
 {
-	find ${tree}include $ignore -name config -prune -o -name "$1" \
+	setup_name_pattern "$@"
+	find ${tree}include $ignore -name config -prune -o "${pattern[@]}" \
 		-not -type l -print;
 }
 
@@ -76,23 +97,24 @@ find_include_sources()
 # we could benefit from a list of dirs to search in here
 find_other_sources()
 {
+	setup_name_pattern "$@"
 	find ${tree}* $ignore \
 	     \( -path ${tree}include -o -path ${tree}arch -o -name '.tmp_*' \) -prune -o \
-	       -name "$1" -not -type l -print;
+	       "${pattern[@]}" -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()
Signature · 1 line
2.54.0