Skip to contentSkip to conversation

check-symbol-change: relax rule for identifying a section

PATCH Applied Neil Horman 3 participants 3 messages Aug 16, 2018 – Aug 21, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 check-symbol-change: relax rule for identifying a section

It was reported recently that some patches that add symbols to an existing EXPERIMENTAL section of a version map file generate errors because the check-symbol-change script was identifying the section as "@@" rather than EXPERIMENTAL. This was fairly clearly due to the fact that the rule identifying the version section expected the whole section to be added, rather than having it already exist, with only new symbols being added to the existing section. This led the match rule to misread the format of that line and pull the wrong word out of it.

The fix is to relax the rule slightly. Rather than assume that the section must exist on a line that was added, allow the section name to be set by any line that ends in a '{', which should be correct, given our coding practices. The section name is then extracted as the next to the last word on the line ( $(NF-1) ).

Tested by the reporter with good results

---
 devtools/check-symbol-change.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
devtools/check-symbol-change.sh +3 -3
index daaf45e14..cf9cfc745 100755
@@ -25,14 +25,14 @@ build_map_changes()
 		# supresses the subordonate rules below
 		/[-+] a\/.*\.^(map)/ {in_map=0}
 
-		# Triggering this rule, which starts a line with a + and ends it
+		# Triggering this rule, which starts a line and ends it
 		# with a { identifies a versioned section.  The section name is
 		# the rest of the line with the + and { symbols remvoed.
 		# Triggering this rule sets in_sec to 1, which actives the
 		# symbol rule below
-		/+.*{/ {gsub("+","");
+		/^.*{/ {
 			if (in_map == 1) {
-				sec=$1; in_sec=1;
+				sec=$(NF-1); in_sec=1;
 			}
 		}
 
Signature · 1 line
2.17.1
Tested-by on v1 1/1
#1 lore raw
Quoted 38 lines · Neil Horman

It was reported recently that some patches that add symbols to an existing EXPERIMENTAL section of a version map file generate errors because the check-symbol-change script was identifying the section as "@@" rather than EXPERIMENTAL. This was fairly clearly due to the fact that the rule identifying the version section expected the whole section to be added, rather than having it already exist, with only new symbols being added to the existing section. This led the match rule to misread the format of that line and pull the wrong word out of it.

The fix is to relax the rule slightly. Rather than assume that the section must exist on a line that was added, allow the section name to be set by any line that ends in a '{', which should be correct, given our coding practices. The section name is then extracted as the next to the last word on the line ( $(NF-1) ).

Tested by the reporter with good results

---
  devtools/check-symbol-change.sh | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
devtools/check-symbol-change.sh +1 -1
index daaf45e14..cf9cfc745 100755
@@ -25,14 +25,14 @@ build_map_changes()
  		# supresses the subordonate rules below
  		/[-+] a\/.*\.^(map)/ {in_map=0}
 
-		# Triggering this rule, which starts a line with a + and ends it
+		# Triggering this rule, which starts a line and ends it
  		# with a { identifies a versioned section.  The section name is
  		# the rest of the line with the + and { symbols remvoed.

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

Quoted 10 lines
devtools/check-symbol-change.sh +2 -2
  		# Triggering this rule sets in_sec to 1, which actives the
  		# symbol rule below
-		/+.*{/ {gsub("+","");
+		/^.*{/ {
  			if (in_map == 1) {
-				sec=$1; in_sec=1;
+				sec=$(NF-1); in_sec=1;
  			}
  		}
 
#2 lore raw

17/08/2018 05:03, Rao, Nikhil:

Quoted 16 lines · Neil Horman
Quoted 15 lines

It was reported recently that some patches that add symbols to an existing EXPERIMENTAL section of a version map file generate errors because the check-symbol-change script was identifying the section as "@@" rather than EXPERIMENTAL. This was fairly clearly due to the fact that the rule identifying the version section expected the whole section to be added, rather than having it already exist, with only new symbols being added to the existing section. This led the match rule to misread the format of that line and pull the wrong word out of it.

The fix is to relax the rule slightly. Rather than assume that the section must exist on a line that was added, allow the section name to be set by any line that ends in a '{', which should be correct, given our coding practices. The section name is then extracted as the next to the last word on the line ( $(NF-1) ).

Quoted 6 lines
Quoted 5 lines

Tested by the reporter with good results

Applied, thanks