Skip to contentSkip to conversation

devtools: fix regex matching literal plus in patches

PATCH In review Thomas Monjalon 2 participants 3 messages May 5 – May 18

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devtools: fix regex matching literal plus in patches

In Extended Regular Expressions (ERE) as used in awk,
'+' is a quantifier, not a literal character.
The pattern /^+/ matches the start of any line
instead of only lines beginning with a literal '+'.
As a result, check_experimental_tags and check_internal_tags were matching context and removed lines in diffs, causing false positives.

Use [+] character class to unambiguously match a literal '+'.

Fixes cfe3aeb170b2 ("remove experimental tags from all symbol definitions")
Fixes fba5af82adc8 ("eal: add internal ABI tag definition")
---
 devtools/checkpatches.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
devtools/checkpatches.sh +4 -4
index 1c6099ac82..f5dd77443f 100755
@@ -321,10 +321,10 @@ check_experimental_tags() { # <patch>
 		current_file = "";
 		ret = 0;
 	}
-	/^+++ b\// {
+	/^[+][+][+] b\// {
 		current_file = $2;
 	}
-	/^+.*__rte_experimental/ {
+	/^[+].*__rte_experimental/ {
 		if (current_file ~ ".c$" ) {
 			print "Please only put __rte_experimental tags in " \
 				"headers ("current_file")";
@@ -351,10 +351,10 @@ check_internal_tags() { # <patch>
 		current_file = "";
 		ret = 0;
 	}
-	/^+++ b\// {
+	/^[+][+][+] b\// {
 		current_file = $2;
 	}
-	/^+.*__rte_internal/ {
+	/^[+].*__rte_internal/ {
 		if (current_file ~ ".c$" ) {
 			print "Please only put __rte_internal tags in " \
 				"headers ("current_file")";
Signature · 1 line
2.54.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Thomas Monjalon

In Extended Regular Expressions (ERE) as used in awk,
'+' is a quantifier, not a literal character.
The pattern /^+/ matches the start of any line
instead of only lines beginning with a literal '+'.
As a result, check_experimental_tags and check_internal_tags were matching context and removed lines in diffs, causing false positives.

Quoted 7 lines

Use [+] character class to unambiguously match a literal '+'.

Fixes cfe3aeb170b2 ("remove experimental tags from all symbol definitions")
Fixes fba5af82adc8 ("eal: add internal ABI tag definition")
Signature · 1 line
David Marchand
author Applied
#2 lore raw

18/05/2026 13:55, David Marchand:

Quoted 11 lines · Thomas Monjalon
Quoted 10 lines

In Extended Regular Expressions (ERE) as used in awk,
'+' is a quantifier, not a literal character.
The pattern /^+/ matches the start of any line
instead of only lines beginning with a literal '+'.
As a result, check_experimental_tags and check_internal_tags were matching context and removed lines in diffs, causing false positives.

Use [+] character class to unambiguously match a literal '+'.

Quoted 7 lines
Quoted 5 lines
Fixes cfe3aeb170b2 ("remove experimental tags from all symbol definitions")
Fixes fba5af82adc8 ("eal: add internal ABI tag definition")

Applied