about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPiotr Wójcik <chocimier@tlen.pl>2023-07-08 23:57:11 +0200
committerLeah Neukirchen <leah@vuxu.org>2023-07-09 22:23:53 +0200
commit6982e53238234099420b9767abcc9d73254573f8 (patch)
tree835c4e51d0248fd70f9dd5fa715e099d7d16902c
parent2ebeae75528ea057be5232e5f1406cea65aea571 (diff)
downloadxtools-6982e53238234099420b9767abcc9d73254573f8.tar.gz
xtools-6982e53238234099420b9767abcc9d73254573f8.tar.xz
xtools-6982e53238234099420b9767abcc9d73254573f8.zip
Fix scan message substitution with bash as sh
before:
srcpkgs/nawk/template:2: custom variables should use _ prefix: 2
srcpkgs/nawk/template:2: variable set to empty string: 2
after:
srcpkgs/nawk/template:2: custom variables should use _ prefix: xxx=
srcpkgs/nawk/template:2: variable set to empty string: xxx=

Closes: #306 [via git-merge-pr]
-rwxr-xr-xxlint6
1 files changed, 3 insertions, 3 deletions
diff --git a/xlint b/xlint
index 34be9d5..891e735 100755
--- a/xlint
+++ b/xlint
@@ -6,7 +6,7 @@
 export LC_ALL=C
 
 scan() {
-	local rx="$1" msg="$(echo $2 | sed 's,/,\\/,g')"
+	local rx="$1" msg="$(printf '%s\n' "$2" | sed 's,/,\\/,g')"
 	grep -P -hn -e "$rx" "$template" |
 		grep -v -P -e "[^:]*:\s*#" |
 		sed "s/^\([^:]*\):\(.*\)/\1: $msg/" |
@@ -452,8 +452,8 @@ for argument; do
 	scan 'homepage=.*\$' "homepage should not use variables"
 	scan 'maintainer=(?!.*<.*@.*>).*' "maintainer needs email address"
 	scan 'maintainer=.*<.*@users.noreply.github.com>.*' "maintainer needs a valid address for sending mail"
-	scan '^(?!\s*('"$variables"'))[^\s=-]+=' "custom variables should use _ prefix: \\\2" | check_old_vars
-	scan '^[^ =]*=(""|''|)$' "variable set to empty string: \\\2"
+	scan '^(?!\s*('"$variables"'))[^\s=-]+=' "custom variables should use _ prefix: \\2" | check_old_vars
+	scan '^[^ =]*=(""|''|)$' "variable set to empty string: \\2"
 	scan '^(.*)-docs_package().*' 'use <pkgname>-doc subpackage for documentation'
 	scan 'distfiles=.*github.com.*/archive/.*\.zip[\"]?$' 'Use the distfile .tar.gz instead of .zip'
 	scan 'distfiles=.*downloads\.sourceforge\.net' 'use $SOURCEFORGE_SITE'