DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev]  devtools: fix symbol change file matching
@ 2019-07-10  9:57 Bing Zhao
  2019-07-10 11:10 ` Neil Horman
  0 siblings, 1 reply; 2+ messages in thread
From: Bing Zhao @ 2019-07-10  9:57 UTC (permalink / raw)
  To: nhorman; +Cc: dev, stable

The previous regex miss a situation that a new file is added after
the map file. It will starts with '/dev/null' instead of 'a /', so
all the content in the patch file after 'map' will be considered in
the symbol map file. Also, a second regex matching is used for map
and other files, the '^map' in square brackets is not quite exact
the same with the design even if it works.

Fixes: 4bec48184e33 ("devtools: add checks for ABI symbol addition")
Cc: nhorman@tuxdriver.com

Signed-off-by: Bing Zhao <bingz@mellanox.com>
---
 devtools/check-symbol-change.sh | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/devtools/check-symbol-change.sh b/devtools/check-symbol-change.sh
index c5434f3..eac71f3 100755
--- a/devtools/check-symbol-change.sh
+++ b/devtools/check-symbol-change.sh
@@ -11,19 +11,32 @@ build_map_changes()
 		# Initialize our variables
 		BEGIN {map="";sym="";ar="";sec=""; in_sec=0; in_map=0}
 
-		# Anything that starts with + or -, followed by an a
+		# Anything that starts with + or -, followed by an a or b
 		# and ends in the string .map is the name of our map file
 		# This may appear multiple times in a patch if multiple
 		# map files are altered, and all section/symbol names
 		# appearing between a triggering of this rule and the
 		# next trigger of this rule are associated with this file
-		/[-+] a\/.*\.map/ {map=$2; in_map=1}
 
 		# Same pattern as above, only it matches on anything that
-		# does not end in 'map', indicating we have left the map chunk.
+		# does not end in "map", indicating we have left the map chunk.
 		# When we hit this, turn off the in_map variable, which
 		# supresses the subordonate rules below
-		/[-+] a\/.*\.[^map]/ {in_map=0}
+		# Currently, using the same pattern for all the files matching,
+		# and a second RE matching is used to distinguish map files from
+		# other types of files
+		/[-+] [ab]\/.*\.[[:alnum:]]+$/ {
+			if ($2 ~ /\.map$/) {
+				if (in_map == 0) {in_map = 1}
+			} else {
+				if (in_map == 1) {in_map = 0}
+			}
+		}
+
+		# Indeed, this RE matching has no use. The only purpose here
+		# is to remind that the git will have a third file pattern
+		# "-+ /dev/null" besides "-a /" and "+b /"
+		/[-+] \/dev\/null$/ {next}
 
 		# Triggering this rule, which starts a line and ends it
 		# with a { identifies a versioned section.  The section name is
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] devtools: fix symbol change file matching
  2019-07-10  9:57 [dpdk-dev] devtools: fix symbol change file matching Bing Zhao
@ 2019-07-10 11:10 ` Neil Horman
  0 siblings, 0 replies; 2+ messages in thread
From: Neil Horman @ 2019-07-10 11:10 UTC (permalink / raw)
  To: Bing Zhao; +Cc: dev, stable

On Wed, Jul 10, 2019 at 05:57:14PM +0800, Bing Zhao wrote:
> The previous regex miss a situation that a new file is added after
> the map file. It will starts with '/dev/null' instead of 'a /', so
> all the content in the patch file after 'map' will be considered in
> the symbol map file. Also, a second regex matching is used for map
> and other files, the '^map' in square brackets is not quite exact
> the same with the design even if it works.
> 
> Fixes: 4bec48184e33 ("devtools: add checks for ABI symbol addition")
> Cc: nhorman@tuxdriver.com
> 
> Signed-off-by: Bing Zhao <bingz@mellanox.com>
> ---
>  devtools/check-symbol-change.sh | 21 +++++++++++++++++----
>  1 file changed, 17 insertions(+), 4 deletions(-)
> 
> diff --git a/devtools/check-symbol-change.sh b/devtools/check-symbol-change.sh
> index c5434f3..eac71f3 100755
> --- a/devtools/check-symbol-change.sh
> +++ b/devtools/check-symbol-change.sh
> @@ -11,19 +11,32 @@ build_map_changes()
>  		# Initialize our variables
>  		BEGIN {map="";sym="";ar="";sec=""; in_sec=0; in_map=0}
>  
> -		# Anything that starts with + or -, followed by an a
> +		# Anything that starts with + or -, followed by an a or b
>  		# and ends in the string .map is the name of our map file
>  		# This may appear multiple times in a patch if multiple
>  		# map files are altered, and all section/symbol names
>  		# appearing between a triggering of this rule and the
>  		# next trigger of this rule are associated with this file
> -		/[-+] a\/.*\.map/ {map=$2; in_map=1}
>  
>  		# Same pattern as above, only it matches on anything that
> -		# does not end in 'map', indicating we have left the map chunk.
> +		# does not end in "map", indicating we have left the map chunk.
>  		# When we hit this, turn off the in_map variable, which
>  		# supresses the subordonate rules below
> -		/[-+] a\/.*\.[^map]/ {in_map=0}
> +		# Currently, using the same pattern for all the files matching,
> +		# and a second RE matching is used to distinguish map files from
> +		# other types of files
> +		/[-+] [ab]\/.*\.[[:alnum:]]+$/ {
> +			if ($2 ~ /\.map$/) {
> +				if (in_map == 0) {in_map = 1}
> +			} else {
> +				if (in_map == 1) {in_map = 0}
> +			}
> +		}
> +
> +		# Indeed, this RE matching has no use. The only purpose here
> +		# is to remind that the git will have a third file pattern
> +		# "-+ /dev/null" besides "-a /" and "+b /"
> +		/[-+] \/dev\/null$/ {next}
>  
>  		# Triggering this rule, which starts a line and ends it
>  		# with a { identifies a versioned section.  The section name is
> -- 
> 1.8.3.1
> 
> 
Acked-by: Neil Horman <nhorman@tuxdriver.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-07-10 12:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-10  9:57 [dpdk-dev] devtools: fix symbol change file matching Bing Zhao
2019-07-10 11:10 ` Neil Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).