[pacman-dev,v2] libmakepkg: check if PACKAGER has the expected format for WKD lookup

Message ID 20190805163244.19962-1-diabonas@gmx.de
State New
Headers show
Series
  • [pacman-dev,v2] libmakepkg: check if PACKAGER has the expected format for WKD lookup
Related show

Commit Message

Jonas Witschel Aug. 5, 2019, 4:32 p.m. UTC
pacman should be able to extract an email address from PACKAGER for WKD
lookup, so issue a warning if it is not of the form
"Example Name <email@address.invalid>". Neither the name nor the email
address must contain additional angle brackets.

Signed-off-by: Jonas Witschel <diabonas@gmx.de>
---

v2: implement Eli's suggestion to improve regex and avoid escaping

 scripts/libmakepkg/lint_config/variable.sh.in | 6 ++++++
 1 file changed, 6 insertions(+)

--
2.22.0

Patch

diff --git a/scripts/libmakepkg/lint_config/variable.sh.in b/scripts/libmakepkg/lint_config/variable.sh.in
index 55ed6d6d..b0b731dd 100644
--- a/scripts/libmakepkg/lint_config/variable.sh.in
+++ b/scripts/libmakepkg/lint_config/variable.sh.in
@@ -60,5 +60,11 @@  lint_config_variables() {
 		fi
 	done

+	# pacman should be able to extract an email address from PACKAGER for WKD key lookup
+	local match='^([^<>]+ )?<[^<>]*>$'
+	if ! [[ $PACKAGER =~ $match ]]; then
+		warning "$(gettext "PACKAGER should have the format 'Example Name <email@address.invalid>'")"
+	fi
+
 	return $ret
 }