pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/mk/scripts
Module Name: pkgsrc
Committed By: rillig
Date: Sun May 10 07:48:10 UTC 2020
Modified Files:
pkgsrc/mk/scripts: genreadme.awk htmloptions.awk
Log Message:
mk/scripts: fix a few of the HTML injections in README generation
These are needed for the djb-errno-hack option, which includes the <>
characters.
To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 pkgsrc/mk/scripts/genreadme.awk
cvs rdiff -u -r1.2 -r1.3 pkgsrc/mk/scripts/htmloptions.awk
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/mk/scripts/genreadme.awk
diff -u pkgsrc/mk/scripts/genreadme.awk:1.38 pkgsrc/mk/scripts/genreadme.awk:1.39
--- pkgsrc/mk/scripts/genreadme.awk:1.38 Wed Aug 22 20:48:37 2018
+++ pkgsrc/mk/scripts/genreadme.awk Sun May 10 07:48:10 2020
@@ -1,5 +1,5 @@
#!/usr/bin/awk -f
-# $NetBSD: genreadme.awk,v 1.38 2018/08/22 20:48:37 maya Exp $
+# $NetBSD: genreadme.awk,v 1.39 2020/05/10 07:48:10 rillig Exp $
#
# Copyright (c) 2002, 2003, 2005, 2006, 2015 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -397,7 +397,7 @@ END {
gsub(/%%VULNERABILITIES%%/, ""vul"");
gsub(/%%VULDATE%%/, ""vuldate"");
gsub(/%%RUN_DEPENDS%%/, ""rundeps"");
- gsub(/%%OPTIONS%%/, ""options[toppkg]"");
+ gsub(/%%OPTIONS%%/, escape_re_replacement(""options[toppkg]""));
line = $0;
@@ -684,6 +684,11 @@ function reg2str(reg){
return(reg);
}
+function escape_re_replacement(s) {
+ gsub(/&/, "\\\\\\&", s);
+ return s;
+}
+
#
# take a string which has a shell glob pattern and turn it into
# an awk regular expression.
Index: pkgsrc/mk/scripts/htmloptions.awk
diff -u pkgsrc/mk/scripts/htmloptions.awk:1.2 pkgsrc/mk/scripts/htmloptions.awk:1.3
--- pkgsrc/mk/scripts/htmloptions.awk:1.2 Wed Aug 22 20:48:37 2018
+++ pkgsrc/mk/scripts/htmloptions.awk Sun May 10 07:48:10 2020
@@ -1,5 +1,5 @@
#!/usr/bin/awk -f
-# $NetBSD: htmloptions.awk,v 1.2 2018/08/22 20:48:37 maya Exp $
+# $NetBSD: htmloptions.awk,v 1.3 2020/05/10 07:48:10 rillig Exp $
#
# Copyright (c) 2015 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -32,7 +32,7 @@ BEGIN {
/^\t/ {
o++;
- printf "<dt>%s</dt><dd>%s</dd>", $2, $3;
+ printf "<dt>%s</dt><dd>%s</dd>\n", escape_html($2), escape_html($3);
}
/^These options are/ {
@@ -49,3 +49,10 @@ function finalize() {
printf "<dt><em>(none)</em></dt>";
}
}
+
+function escape_html(s) {
+ gsub(/&/, "\\&", s);
+ gsub(/</, "\\<", s);
+ gsub(/>/, "\\>", s);
+ return s;
+}
Home |
Main Index |
Thread Index |
Old Index