[pacman-dev] [PATCH] libmakepkg: check if PACKAGER has the expected format for WKD lookup
Eli Schwartz
eschwartz at archlinux.org
Mon Aug 5 15:59:04 UTC 2019
On 8/5/19 11:36 AM, Jonas Witschel wrote:
> 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 at address.invalid>". Neither the name nor the email
> address must contain additional angle brackets.
>
> Signed-off-by: Jonas Witschel <diabonas at gmx.de>
> ---
> scripts/libmakepkg/lint_config/variable.sh.in | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/scripts/libmakepkg/lint_config/variable.sh.in b/scripts/libmakepkg/lint_config/variable.sh.in
> index 55ed6d6d..fe1e6d63 100644
> --- a/scripts/libmakepkg/lint_config/variable.sh.in
> +++ b/scripts/libmakepkg/lint_config/variable.sh.in
> @@ -60,5 +60,10 @@ lint_config_variables() {
> fi
> done
>
> + # pacman should be able to extract an email address from PACKAGER for WKD key lookup
> + if ! [[ $PACKAGER =~ ^[^\<\>]*\ \<[^\<\>]*\>$ ]]; then
Too much escaping is making me seasick.
local match='^[^<>]* <[^<>]*>$'
if ! [[ $PACKAGER =~ $match ]]; then
Since you're making the portion before the <user at domain> optional (*
instead of +) this would require someone without a Name component to
have a leading space.
I recommend using this instead:
match='^([^<>]+ )?<[^<>]*>$'
> + warning "$(gettext "PACKAGER should have the format 'Example Name <email at address.invalid>'")"
> + fi
> +
> return $ret
> }
> --
> 2.22.0
>
--
Eli Schwartz
Bug Wrangler and Trusted User
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1601 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20190805/4867378a/attachment-0001.sig>
More information about the pacman-dev
mailing list