[pve-devel] [PATCH docs v3 1/2] asciidoc-pve: disallow certain characters in onlineHelp keys

Stefan Sterz s.sterz at proxmox.com
Mon Nov 14 12:38:27 CET 2022


this removes the lazily evaluated part of the regex used to detect
`onlineHelp` keys in order to match them with asciidoc anchors in the
documentation. it uses a pattern that excludes curly braces, brackets
and quotations instead. this allows for greedy matching and also
removes an issue where keys that are set via CBind were included
incorrectly. the script would try to find an anchor name that was
equivalent to the CBind placeholder, which would fail.

since brackets, curly braces and quotation marks aren't allowed in
asciidoc anchors anyway, excluding them like this should be safe.

Signed-off-by: Stefan Sterz <s.sterz at proxmox.com>
---
 asciidoc-pve.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/asciidoc-pve.in b/asciidoc-pve.in
index d638a38..49e54bd 100644
--- a/asciidoc-pve.in
+++ b/asciidoc-pve.in
@@ -465,7 +465,7 @@ sub scan_extjs_file {
     debug("scan-extjs $filename");
 
     while(defined(my $line = <$fh>)) {
-	if ($line =~ m/\s+onlineHelp:\s*[\'\"](.*?)[\'\"]/) {
+	if ($line =~ m/\s+onlineHelp:\s*[\'\"]([^{}\[\]\'\"]+)[\'\"]/) {
 	    my $blockid = $1;
 	    my $link = $fileinfo->{blockid_target}->{default}->{$blockid};
 	    die "undefined blockid '$blockid' ($filename, line $.)\n"
-- 
2.30.2






More information about the pve-devel mailing list