Skip to contentSkip to conversation

punctcheck.pl: Fix false positive by stricter pattern for \acr{}

PATCH Applied Akira Yokosawa 2 participants 3 messages Jan 7, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 punctcheck.pl: Fix false positive by stricter pattern for \acr{}

A false positive in defer/rcuintro.tex by punctcheck.pl made Paul do a wrong band-aide change in commit 8e3364bead00 ("defer/rcuintro: Fix ThomasEHart2006a punctuation issue.").

It was because the pattern "\{.+\}" matches all of "{qsbr}~\cite{ThomasEHart2006a}" and the script saw the sentence as if it ended with "\IXacrfst{}."

Silence the false positive by using a stricter pattern of "\{[^\}]+\}".

---
 utilities/punctcheck.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
utilities/punctcheck.pl +1 -1
index 3488e5b6..7d23cc57 100755
@@ -62,7 +62,7 @@ sub check_line {
 	$ng = 0;
 	if ($line =~ /^(?=[\s]*+[^%])[^%]*[A-Z][\)\']*[\.\?\!\:][\)\}\']*$/ ||
 	    $line =~ /^(?=[\s]*+[^%])[^%]*[A-Z][\)\']*[\.\?\!\:]\\footnote/ ||
-	    $line =~ /^(?=[\s]*+[^%])[^%]*[Aa]crm?(f|fst)?\{.+\}[\)\']*[\.\?\!\:][\)\}\']*$/ ||
+	    $line =~ /^(?=[\s]*+[^%])[^%]*[Aa]crm?(f|fst)?\{[^\}]+\}[\)\']*[\.\?\!\:][\)\}\']*$/ ||
 	    $line_raw =~ /\\[Cc]ref\{(cha|chp)\:app:[^\}]*\}[\.\?\!\:][\)\}\']*$/ ) {
 	    $ng += 1;
 	    if ($next_line =~ /^\s*$/ || $next_line =~ /^\s*%/ ||

base-commit: f21271f0939bb620a95b1bb3d76ac0259c4bb54c

Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 Revert "defer/rcuintro: Fix ThomasEHart2006a punctuation issue."

This reverts commit 8e3364bead009d44f7ec8ef2a42d667211cb1fcc.

It was neither necessary nor right.

The warning from punctcheck.pl observed after commit dee11baa44fa ("treewide: Add acronym tags for QSBR and EBR") was a false positive, which has been fixed by using a stricter pattern.

---
 defer/rcuintro.tex | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
defer/rcuintro.tex +1 -1
index dbea667f..13b0b1be 100644
@@ -429,7 +429,7 @@ state shown at the bottom of
 \label{fig:defer:QSBR: Waiting for Pre-Existing Readers}
 \end{figure}
 
-This approach is termed \IXacrfst{qsbr}~\cite{ThomasEHart2006a}.\@
+This approach is termed \IXacrfst{qsbr}~\cite{ThomasEHart2006a}.
 A QSBR schematic is shown in
 \cref{fig:defer:QSBR: Waiting for Pre-Existing Readers},
 with time advancing from the top of the figure to the bottom.
Signature · 1 line
2.17.1
#2 lore raw
In reply to Akira Yokosawa
Quoted 4 lines · Akira Yokosawa

A false positive in defer/rcuintro.tex by punctcheck.pl made Paul do a wrong band-aide change in commit 8e3364bead00 ("defer/rcuintro: Fix ThomasEHart2006a punctuation issue.").

Quoted 8 lines

It was because the pattern "\{.+\}" matches all of "{qsbr}~\cite{ThomasEHart2006a}" and the script saw the sentence as if it ended with "\IXacrfst{}."

Silence the false positive by using a stricter pattern of "\{[^\}]+\}".

I was wondering about that. ;-)

Queued, thank you!!!

Thanx, Paul

Quoted 22 lines
---
 utilities/punctcheck.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
utilities/punctcheck.pl +1 -1
index 3488e5b6..7d23cc57 100755
@@ -62,7 +62,7 @@ sub check_line {
 	$ng = 0;
 	if ($line =~ /^(?=[\s]*+[^%])[^%]*[A-Z][\)\']*[\.\?\!\:][\)\}\']*$/ ||
 	    $line =~ /^(?=[\s]*+[^%])[^%]*[A-Z][\)\']*[\.\?\!\:]\\footnote/ ||
-	    $line =~ /^(?=[\s]*+[^%])[^%]*[Aa]crm?(f|fst)?\{.+\}[\)\']*[\.\?\!\:][\)\}\']*$/ ||
+	    $line =~ /^(?=[\s]*+[^%])[^%]*[Aa]crm?(f|fst)?\{[^\}]+\}[\)\']*[\.\?\!\:][\)\}\']*$/ ||
 	    $line_raw =~ /\\[Cc]ref\{(cha|chp)\:app:[^\}]*\}[\.\?\!\:][\)\}\']*$/ ) {
 	    $ng += 1;
 	    if ($next_line =~ /^\s*$/ || $next_line =~ /^\s*%/ ||

base-commit: f21271f0939bb620a95b1bb3d76ac0259c4bb54c

Signature · 1 line
2.17.1