Skip to contentSkip to conversation

devtools: fix check symbol change script

PATCH Superseded Nithin Dabilpuram 5 participants 12 messages Mar 19, 2020 – Mar 23, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devtools: fix check symbol change script

Fix check symbol change script to detect new diff file when it is in between "--- /dev/null" to "b/lib/...". Current awk line expects line to start with "a/..." which is not always true for all diffs.
As a result if in_map was '1' earlier, it will not be changed to '0' and we get check patch errors which are not true as the non version.map files get interpreted as version map file.

Fixes 4bec48184e33 ("devtools: add checks for ABI symbol addition")

---
Note: We have two examples where checkpatch errors are because of this because the version.map file change comes earlier in the diff. Because of this bug, any new file change that comes after version.map file diff as "/dev/null" to "b/.." gets misdetected as version.map file.
* http://patches.dpdk.org/patch/66878/
* https://patchwork.dpdk.org/patch/66900/

 devtools/check-symbol-change.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
devtools/check-symbol-change.sh +2 -2
index c5434f3..19ce82f 100755
@@ -17,13 +17,13 @@ build_map_changes()
 		# 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}
+		/[-+] [ab]\/.*\.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.
 		# When we hit this, turn off the in_map variable, which
 		# supresses the subordonate rules below
-		/[-+] a\/.*\.[^map]/ {in_map=0}
+		/[-+] [ab]\/.*\.[^map]/ {in_map=0}
 
 		# Triggering this rule, which starts a line and ends it
 		# with a { identifies a versioned section.  The section name is
Signature · 1 line
2.8.4
#1 lore raw
Quoted 9 lines · Nithin Dabilpuram

Fix check symbol change script to detect new diff file when it is in between "--- /dev/null" to "b/lib/...". Current awk line expects line to start with "a/..." which is not always true for all diffs.
As a result if in_map was '1' earlier, it will not be changed to '0' and we get check patch errors which are not true as the non version.map files get interpreted as version map file.

Quoted 3 lines
Fixes 4bec48184e33 ("devtools: add checks for ABI symbol addition")

There was a previous attempt at fixing this that did not get a review.
http://patchwork.dpdk.org/patch/56303/

I prefer the last submitted patch as it is simpler, but maybe I missed something in Bing patch.

Neil, wdyt?

Signature · 1 line
David Marchand
Quoted 35 lines

---
Note: We have two examples where checkpatch errors are because of this because the version.map file change comes earlier in the diff. Because of this bug, any new file change that comes after version.map file diff as "/dev/null" to "b/.." gets misdetected as version.map file.
* http://patches.dpdk.org/patch/66878/
* https://patchwork.dpdk.org/patch/66900/

 devtools/check-symbol-change.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
devtools/check-symbol-change.sh +2 -3
index c5434f3..19ce82f 100755
@@ -17,13 +17,13 @@ build_map_changes()
                # 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}
+               /[-+] [ab]\/.*\.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.
                # When we hit this, turn off the in_map variable, which
                # supresses the subordonate rules below
-               /[-+] a\/.*\.[^map]/ {in_map=0}
+               /[-+] [ab]\/.*\.[^map]/ {in_map=0}
 
                # Triggering this rule, which starts a line and ends it
                # with a { identifies a versioned section.  The section name is
--

2.8.4

#2 lore raw
Quoted 15 lines · David Marchand
Quoted 9 lines · Nithin Dabilpuram

Fix check symbol change script to detect new diff file when it is in between "--- /dev/null" to "b/lib/...". Current awk line expects line to start with "a/..." which is not always true for all diffs.
As a result if in_map was '1' earlier, it will not be changed to '0' and we get check patch errors which are not true as the non version.map files get interpreted as version map file.

Quoted 3 lines
Fixes 4bec48184e33 ("devtools: add checks for ABI symbol addition")
Quoted 8 lines

There was a previous attempt at fixing this that did not get a review.
http://patchwork.dpdk.org/patch/56303/

I prefer the last submitted patch as it is simpler, but maybe I missed something in Bing patch.

Neil, wdyt?

I'm not sure why I didn't review the previous patch you refrenced, apologies for that.

That said, I'm not sure how this patch detects /dev/null patterns. It looks like you still expect all lines to start with [+-] [ab]...

Neil

Quoted 42 lines
Signature · 2 lines
-- 
David Marchand
Quoted 35 lines

---
Note: We have two examples where checkpatch errors are because of this because the version.map file change comes earlier in the diff. Because of this bug, any new file change that comes after version.map file diff as "/dev/null" to "b/.." gets misdetected as version.map file.
* http://patches.dpdk.org/patch/66878/
* https://patchwork.dpdk.org/patch/66900/

 devtools/check-symbol-change.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
devtools/check-symbol-change.sh +2 -3
index c5434f3..19ce82f 100755
@@ -17,13 +17,13 @@ build_map_changes()
                # 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}
+               /[-+] [ab]\/.*\.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.
                # When we hit this, turn off the in_map variable, which
                # supresses the subordonate rules below
-               /[-+] a\/.*\.[^map]/ {in_map=0}
+               /[-+] [ab]\/.*\.[^map]/ {in_map=0}
 
                # Triggering this rule, which starts a line and ends it
                # with a { identifies a versioned section.  The section name is
--

2.8.4

#3 lore raw
Quoted 25 lines · Neil Horman

External Email

----------------------------------------------------------------------

Quoted 21 lines · David Marchand
Quoted 9 lines · Nithin Dabilpuram

Fix check symbol change script to detect new diff file when it is in between "--- /dev/null" to "b/lib/...". Current awk line expects line to start with "a/..." which is not always true for all diffs.
As a result if in_map was '1' earlier, it will not be changed to '0' and we get check patch errors which are not true as the non version.map files get interpreted as version map file.

Quoted 3 lines
Fixes 4bec48184e33 ("devtools: add checks for ABI symbol addition")

There was a previous attempt at fixing this that did not get a review.
https://urldefense.proofpoint.com/v2/url?u=http-3A__patchwork.dpdk.org_patch_56303_&d=DwIBAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=FZ_tPCbgFOh18zwRPO9H0yDx8VW38vuapifdDfc8SFQ&m=HnuykZkNgy_2cx1i0_QuR-C_vdVYLTJ9rSUA1dCM7WI&s=TW-ZZ_dYy8x6EcvJHtYrv9vaIHSmd0GshvClMwiWPi4&e=

I prefer the last submitted patch as it is simpler, but maybe I missed something in Bing patch.

Quoted 7 lines
Quoted 2 lines

Neil, wdyt?

I'm not sure why I didn't review the previous patch you refrenced, apologies for that.

That said, I'm not sure how this patch detects /dev/null patterns. It looks like you still expect all lines to start with [+-] [ab]...

It doesn't detect /dev/null but the line following /dev/null will start with "b/...". So this checks for .map in that line as well.

Quoted 45 lines

Neil

Quoted 42 lines
Signature · 2 lines
-- 
David Marchand
Quoted 35 lines

---
Note: We have two examples where checkpatch errors are because of this
because the version.map file change comes earlier in the diff. Because of
this bug, any new file change that comes after version.map file diff
as "/dev/null" to "b/.." gets misdetected as version.map file.
* https://urldefense.proofpoint.com/v2/url?u=http-3A__patches.dpdk.org_patch_66878_&d=DwIBAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=FZ_tPCbgFOh18zwRPO9H0yDx8VW38vuapifdDfc8SFQ&m=HnuykZkNgy_2cx1i0_QuR-C_vdVYLTJ9rSUA1dCM7WI&s=0szl1YpYLwfb1OF-R5H4_ci3f5XjBUHFrHVp-LdROFI&e=
* https://urldefense.proofpoint.com/v2/url?u=https-3A__patchwork.dpdk.org_patch_66900_&d=DwIBAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=FZ_tPCbgFOh18zwRPO9H0yDx8VW38vuapifdDfc8SFQ&m=HnuykZkNgy_2cx1i0_QuR-C_vdVYLTJ9rSUA1dCM7WI&s=ugH7B1XKoFQEEopU0sJgqKGwjDJS9Kl9OsijSazmyRc&e=

 devtools/check-symbol-change.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
devtools/check-symbol-change.sh +2 -3
index c5434f3..19ce82f 100755
@@ -17,13 +17,13 @@ build_map_changes()
                # 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}
+               /[-+] [ab]\/.*\.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.
                # When we hit this, turn off the in_map variable, which
                # supresses the subordonate rules below
-               /[-+] a\/.*\.[^map]/ {in_map=0}
+               /[-+] [ab]\/.*\.[^map]/ {in_map=0}
 
                # Triggering this rule, which starts a line and ends it
                # with a { identifies a versioned section.  The section name is
--

2.8.4

Acked-by
#4 lore raw
Quoted 28 lines · Nithin Dabilpuram
Quoted 27 lines · Neil Horman

External Email

----------------------------------------------------------------------

Quoted 23 lines · David Marchand
Quoted 9 lines · Nithin Dabilpuram

Fix check symbol change script to detect new diff file when it is in between "--- /dev/null" to "b/lib/...". Current awk line expects line to start with "a/..." which is not always true for all diffs.
As a result if in_map was '1' earlier, it will not be changed to '0' and we get check patch errors which are not true as the non version.map files get interpreted as version map file.

Quoted 3 lines
Fixes 4bec48184e33 ("devtools: add checks for ABI symbol addition")

There was a previous attempt at fixing this that did not get a review.
https://urldefense.proofpoint.com/v2/url?u=http-3A__patchwork.dpdk.org_patch_56303_&d=DwIBAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=FZ_tPCbgFOh18zwRPO9H0yDx8VW38vuapifdDfc8SFQ&m=HnuykZkNgy_2cx1i0_QuR-C_vdVYLTJ9rSUA1dCM7WI&s=TW-ZZ_dYy8x6EcvJHtYrv9vaIHSmd0GshvClMwiWPi4&e=

I prefer the last submitted patch as it is simpler, but maybe I missed something in Bing patch.

Neil, wdyt?

Quoted 9 lines
Quoted 5 lines

I'm not sure why I didn't review the previous patch you refrenced, apologies for that.

That said, I'm not sure how this patch detects /dev/null patterns. It looks like you still expect all lines to start with [+-] [ab]...

It doesn't detect /dev/null but the line following /dev/null will start with "b/...". So this checks for .map in that line as well.

Ah, in that case, I'd really be fine with either fix.

Quoted 46 lines
Quoted 45 lines

Neil

Quoted 42 lines
Signature · 2 lines
-- 
David Marchand
Quoted 35 lines

---
Note: We have two examples where checkpatch errors are because of this
because the version.map file change comes earlier in the diff. Because of
this bug, any new file change that comes after version.map file diff
as "/dev/null" to "b/.." gets misdetected as version.map file.
* https://urldefense.proofpoint.com/v2/url?u=http-3A__patches.dpdk.org_patch_66878_&d=DwIBAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=FZ_tPCbgFOh18zwRPO9H0yDx8VW38vuapifdDfc8SFQ&m=HnuykZkNgy_2cx1i0_QuR-C_vdVYLTJ9rSUA1dCM7WI&s=0szl1YpYLwfb1OF-R5H4_ci3f5XjBUHFrHVp-LdROFI&e=
* https://urldefense.proofpoint.com/v2/url?u=https-3A__patchwork.dpdk.org_patch_66900_&d=DwIBAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=FZ_tPCbgFOh18zwRPO9H0yDx8VW38vuapifdDfc8SFQ&m=HnuykZkNgy_2cx1i0_QuR-C_vdVYLTJ9rSUA1dCM7WI&s=ugH7B1XKoFQEEopU0sJgqKGwjDJS9Kl9OsijSazmyRc&e=

 devtools/check-symbol-change.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
devtools/check-symbol-change.sh +2 -3
index c5434f3..19ce82f 100755
@@ -17,13 +17,13 @@ build_map_changes()
                # 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}
+               /[-+] [ab]\/.*\.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.
                # When we hit this, turn off the in_map variable, which
                # supresses the subordonate rules below
-               /[-+] a\/.*\.[^map]/ {in_map=0}
+               /[-+] [ab]\/.*\.[^map]/ {in_map=0}
 
                # Triggering this rule, which starts a line and ends it
                # with a { identifies a versioned section.  The section name is
--

2.8.4

#5 lore raw
In reply to Neil Horman
Quoted 47 lines

-----Original Message-----
From: Neil Horman <[email protected]>
Sent: Thursday, March 19, 2020 11:41 PM
To: David Marchand <[email protected]>
Cc: Thomas Monjalon <[email protected]>; dev <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; Nithin Dabilpuram <[email protected]>; dpdk stable <[email protected]>; Bing Zhao <[email protected]>
Subject: Re: [PATCH] devtools: fix check symbol change script

Quoted 11 lines · David Marchand
Quoted 9 lines · Nithin Dabilpuram

Fix check symbol change script to detect new diff file when it is in between "--- /dev/null" to "b/lib/...".
Current awk line expects line to start with "a/..."
which is not always true for all diffs.
As a result if in_map was '1' earlier, it will not be changed to '0' and we get check patch errors which are not true as the non version.map files get interpreted as version map file.

Quoted 1 line
Quoted 1 line
Fixes 4bec48184e33 ("devtools: add checks for ABI symbol

addition")

Quoted 5 lines
Quoted 2 lines

There was a previous attempt at fixing this that did not get a review.

https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2F
patch

Quoted 1 line

work.dpdk.org%2Fpatch%2F56303%2F&amp;data=02%7C01%7Cbingz %40mellanox.c

Quoted 1 line

om%7C19a838a81f4f4649f40f08d7cc1be78a%7Ca652971c7d2e4d9ba6 a4d149256f46

Quoted 1 line

1b%7C0%7C0%7C637202292556475544&amp;sdata=wgz8LssuucgrWlY xsf978%2ByRVg

Quoted 7 lines

83btxZIm9aD56nekY%3D&amp;reserved=0

I prefer the last submitted patch as it is simpler, but maybe I missed something in Bing patch.

Neil, wdyt?

Quoted 7 lines

I'm not sure why I didn't review the previous patch you refrenced, apologies for that.

That said, I'm not sure how this patch detects /dev/null patterns. It looks like you still expect all lines to start with [+-] [ab]...

Neil

Hi David & Neil,
The cause and the fixing are almost the same for the two patches. Nithin's is simpler.
When matching on "/dev/null", it just needs to continue.

While in my patch, I think I also fix the [^map] matching even though it works. The behavior of RE in awk does not work as expected, .c and .h files don't match on the "NOT map" at the end of the line, but match on the signle letter not among the "m/a/p". (Correct me if anything wrong).

Thanks
Bing

Quoted 72 lines
Quoted 10 lines

--
David Marchand

Quoted 4 lines

---
Note: We have two examples where checkpatch errors are because

of

Quoted 3 lines
Quoted 3 lines

this because the version.map file change comes earlier in the diff. Because of this bug, any new file change that comes after version.map file diff as "/dev/null" to "b/.." gets misdetected as

version.map file.

Quoted 2 lines
Quoted 2 lines

*

https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2F
pat

Quoted 1 line
Quoted 1 line

ches.dpdk.org%2Fpatch%2F66878%2F&amp;data=02%7C01%7Cbingz% 40mellanox

Quoted 1 line
Quoted 1 line

.com%7C19a838a81f4f4649f40f08d7cc1be78a%7Ca652971c7d2e4d

9ba6a4d14925

Quoted 1 line
Quoted 1 line

6f461b%7C0%7C0%7C637202292556475544&amp;sdata=ElLbgB9IJ7B6 kuNTAjKAFr

Quoted 3 lines
Quoted 3 lines

WpNy8Jdq5%2BmfoRTxN72tI%3D&amp;reserved=0
*

https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2F
pa

Quoted 1 line
Quoted 1 line

tchwork.dpdk.org%2Fpatch%2F66900%2F&amp;data=02%7C01%7Cbin gz%40mella

Quoted 1 line
Quoted 1 line

nox.com%7C19a838a81f4f4649f40f08d7cc1be78a%7Ca652971c7d2e4d 9ba6a4d14

Quoted 1 line
Quoted 1 line

9256f461b%7C0%7C0%7C637202292556475544&amp;sdata=iT%2Ft9os A4HFTQ2kh3

Quoted 15 lines
Quoted 15 lines

baWClvD3B%2FFdGzIrQgTvB5SfqU%3D&amp;reserved=0

 devtools/check-symbol-change.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/devtools/check-symbol-change.sh index c5434f3..19ce82f 100755

devtools/check-symbol-change.sh +1 -1
@@ -17,13 +17,13 @@ build_map_changes()
                # 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}
+               /[-+] [ab]\/.*\.map/ {map=$2; in_map=1}
 
Quoted 2 lines

devtools/check-symbol-change.sh build_map_changes() · line 23

Quoted 2 lines
devtools/check-symbol-change.sh +0 -0
                # Same pattern as above, only it matches on anything that
                # does not end in 'map', indicating we have left the map

chunk.

Quoted 13 lines
Quoted 11 lines
devtools/check-symbol-change.sh +1 -1
                # When we hit this, turn off the in_map variable, which
                # supresses the subordonate rules below
-               /[-+] a\/.*\.[^map]/ {in_map=0}
+               /[-+] [ab]\/.*\.[^map]/ {in_map=0}
 
                # Triggering this rule, which starts a line and ends it
                # with a { identifies a versioned section.  The

section name is
--
2.8.4

Tested-by on v1 1/1
#6 lore raw
In reply to Nithin Dabilpuram
Quoted 9 lines · Nithin Dabilpuram

Fix check symbol change script to detect new diff file when it is in between "--- /dev/null" to "b/lib/...". Current awk line expects line to start with "a/..." which is not always true for all diffs.
As a result if in_map was '1' earlier, it will not be changed to '0' and we get check patch errors which are not true as the non version.map files get interpreted as version map file.

Quoted 5 lines
Fixes 4bec48184e33 ("devtools: add checks for ABI symbol addition")
Quoted 33 lines

---
Note: We have two examples where checkpatch errors are because of this because the version.map file change comes earlier in the diff. Because of this bug, any new file change that comes after version.map file diff as "/dev/null" to "b/.." gets misdetected as version.map file.
* http://patches.dpdk.org/patch/66878/
* https://patchwork.dpdk.org/patch/66900/

 devtools/check-symbol-change.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
devtools/check-symbol-change.sh +2 -3
index c5434f3..19ce82f 100755
@@ -17,13 +17,13 @@ build_map_changes()
                # 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}
+               /[-+] [ab]\/.*\.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.
                # When we hit this, turn off the in_map variable, which
                # supresses the subordonate rules below
-               /[-+] a\/.*\.[^map]/ {in_map=0}
+               /[-+] [ab]\/.*\.[^map]/ {in_map=0}
 
                # Triggering this rule, which starts a line and ends it
                # with a { identifies a versioned section.  The section name is
--

2.8.4

#7 lore raw
In reply to Nithin Dabilpuram
Quoted 7 lines · Nithin Dabilpuram
devtools/check-symbol-change.sh +0 -0
index c5434f3..19ce82f 100755
@@ -17,13 +17,13 @@ build_map_changes()
                # map files are altered, and all section/symbol names
                # appearing between a triggering of this rule and the

devtools/check-symbol-change.sh build_map_changes() · line 26

Quoted 10 lines
devtools/check-symbol-change.sh +2 -2
                # next trigger of this rule are associated with this file
-               /[-+] a\/.*\.map/ {map=$2; in_map=1}
+               /[-+] [ab]\/.*\.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.
                # When we hit this, turn off the in_map variable, which
                # supresses the subordonate rules below
-               /[-+] a\/.*\.[^map]/ {in_map=0}
+               /[-+] [ab]\/.*\.[^map]/ {in_map=0}

[^map] does not mean "not word map" but actually "none of the character m, a or p".

So potentially, any file extension starting with m, a or p could trigger an issue.
For example, a change in .mk files, .py files and ./devtools/check-forbidden-tokens.awk ./devtools/libabigail.abignore could lead to incorrect symbol check.

How about the following change:

devtools/check-symbol-change.sh +4 -6
index c5434f3bb0..ed2178e36e 100755
@@ -17,13 +17,11 @@ build_map_changes()
                # 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}
+               /[-+] [ab]\/.*\.map/ {map=$2; in_map=1; next}
 
-               # Same pattern as above, only it matches on anything that
-               # 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}
+               # The previous rule catches all .map files, anything else
+               # indicates we left the map chunk.
+               /[-+] [ab]\// {in_map=0}
 
                # Triggering this rule, which starts a line and ends it
                # with a { identifies a versioned section.  The section name is
Signature · 1 line
David Marchand
#8 lore raw
Quoted 48 lines · David Marchand

External Email

----------------------------------------------------------------------

Quoted 7 lines · Nithin Dabilpuram
devtools/check-symbol-change.sh +0 -0
index c5434f3..19ce82f 100755
@@ -17,13 +17,13 @@ build_map_changes()
                # map files are altered, and all section/symbol names
                # appearing between a triggering of this rule and the

devtools/check-symbol-change.sh build_map_changes() · line 26

Quoted 10 lines
devtools/check-symbol-change.sh +2 -2
                # next trigger of this rule are associated with this file
-               /[-+] a\/.*\.map/ {map=$2; in_map=1}
+               /[-+] [ab]\/.*\.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.
                # When we hit this, turn off the in_map variable, which
                # supresses the subordonate rules below
-               /[-+] a\/.*\.[^map]/ {in_map=0}
+               /[-+] [ab]\/.*\.[^map]/ {in_map=0}

[^map] does not mean "not word map" but actually "none of the character m, a or p".

So potentially, any file extension starting with m, a or p could trigger an issue.
For example, a change in .mk files, .py files and ./devtools/check-forbidden-tokens.awk ./devtools/libabigail.abignore could lead to incorrect symbol check.

How about the following change:

devtools/check-symbol-change.sh +1 -2
index c5434f3bb0..ed2178e36e 100755
@@ -17,13 +17,11 @@ build_map_changes()
                # 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}
+               /[-+] [ab]\/.*\.map/ {map=$2; in_map=1; next}
 
-               # Same pattern as above, only it matches on anything that

devtools/check-symbol-change.sh build_map_changes() · line 27

Quoted 10 lines
devtools/check-symbol-change.sh +3 -4
-               # 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}
+               # The previous rule catches all .map files, anything else
+               # indicates we left the map chunk.
+               /[-+] [ab]\// {in_map=0}
 
                # Triggering this rule, which starts a line and ends it
                # with a { identifies a versioned section.  The section name is

Agreed. I tested and it works fine for me. I can send a V2 with this change if it is fine.

Quoted 3 lines
Signature · 1 line
David Marchand
#9 lore raw
Quoted 53 lines · Nithin Dabilpuram
Quoted 52 lines · David Marchand

----------------------------------------------------------------------

Quoted 7 lines · Nithin Dabilpuram
devtools/check-symbol-change.sh +0 -0
index c5434f3..19ce82f 100755
@@ -17,13 +17,13 @@ build_map_changes()
                # map files are altered, and all section/symbol names
                # appearing between a triggering of this rule and the

devtools/check-symbol-change.sh build_map_changes() · line 26

Quoted 10 lines
devtools/check-symbol-change.sh +2 -2
                # next trigger of this rule are associated with this file
-               /[-+] a\/.*\.map/ {map=$2; in_map=1}
+               /[-+] [ab]\/.*\.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.
                # When we hit this, turn off the in_map variable, which
                # supresses the subordonate rules below
-               /[-+] a\/.*\.[^map]/ {in_map=0}
+               /[-+] [ab]\/.*\.[^map]/ {in_map=0}

[^map] does not mean "not word map" but actually "none of the character m, a or p".

So potentially, any file extension starting with m, a or p could trigger an issue.
For example, a change in .mk files, .py files and ./devtools/check-forbidden-tokens.awk ./devtools/libabigail.abignore could lead to incorrect symbol check.

How about the following change:

devtools/check-symbol-change.sh +4 -6
index c5434f3bb0..ed2178e36e 100755
@@ -17,13 +17,11 @@ build_map_changes()
                # 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}
+               /[-+] [ab]\/.*\.map/ {map=$2; in_map=1; next}
 
-               # Same pattern as above, only it matches on anything that
-               # 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}
+               # The previous rule catches all .map files, anything else
+               # indicates we left the map chunk.
+               /[-+] [ab]\// {in_map=0}
 
Quoted 6 lines

devtools/check-symbol-change.sh build_map_changes() · line 27

Quoted 4 lines
devtools/check-symbol-change.sh +0 -0
                # Triggering this rule, which starts a line and ends it
                # with a { identifies a versioned section.  The section name is

Agreed. I tested and it works fine for me. I can send a V2 with this change if it is fine.

Sure, thanks!

Signature · 1 line
David Marchand
#10 lore raw

PATCH v2 1/1 devtools: fix check symbol change script

In reply to Nithin Dabilpuram

Fix check symbol change script to detect new diff file when it is in between "--- /dev/null" to "b/lib/...". Current awk line expects line to start with "a/..." which is not always true for all diffs.
As a result if in_map was '1' earlier, it will not be changed to '0' and we get check patch errors which are not true.

Fixes 4bec48184e33 ("devtools: add checks for ABI symbol addition")

---

v2:
- Updated logic from David to fix "not map" check

 devtools/check-symbol-change.sh | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
devtools/check-symbol-change.sh +4 -6
index c5434f3..ed2178e 100755
@@ -17,13 +17,11 @@ build_map_changes()
 		# 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}
+		/[-+] [ab]\/.*\.map/ {map=$2; in_map=1; next}
 
-		# Same pattern as above, only it matches on anything that
-		# 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}
+		# The previous rule catches all .map files, anything else
+		# indicates we left the map chunk.
+		/[-+] [ab]\// {in_map=0}
 
 		# Triggering this rule, which starts a line and ends it
 		# with a { identifies a versioned section.  The section name is
Signature · 1 line
2.8.4
#11 lore raw
Quoted 8 lines · Nithin Dabilpuram

Fix check symbol change script to detect new diff file when it is in between "--- /dev/null" to "b/lib/...". Current awk line expects line to start with "a/..." which is not always true for all diffs.
As a result if in_map was '1' earlier, it will not be changed to '0' and we get check patch errors which are not true.

Quoted 7 lines
Fixes 4bec48184e33 ("devtools: add checks for ABI symbol addition")

Thanks Nithin, applied.

Signature · 1 line
David Marchand