[pacman-dev] [PATCH 7/7] libmakepkg: disallow using 'any' with other arches

Eli Schwartz eschwartz at archlinux.org
Mon Jun 11 21:27:41 UTC 2018


On 06/11/2018 04:53 PM, morganamilo wrote:
> Error if the arch array contains any and any other values. This also
> fixes a bug where the check for `$arch == 'any'` which only evaluated
> the first value in the array, meaning the rest of the values would not
> be linted.
> 
> Signed-off-by: morganamilo <morganamilo at gmail.com>
> ---
>  scripts/libmakepkg/lint_pkgbuild/arch.sh.in | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/libmakepkg/lint_pkgbuild/arch.sh.in b/scripts/libmakepkg/lint_pkgbuild/arch.sh.in
> index f2c80c73..8a1d2c11 100644
> --- a/scripts/libmakepkg/lint_pkgbuild/arch.sh.in
> +++ b/scripts/libmakepkg/lint_pkgbuild/arch.sh.in
> @@ -38,11 +38,16 @@ lint_arch() {
>  		return 1
>  	fi
>  
> -	if [[ $arch == 'any' ]]; then
> +	if [[ $arch == 'any' && ${#arch[@]} == 1 ]]; then


[[ ${#arch[@]} = 1 ]] is a string comparison (the test keyword or
builtin uses -eq to handle numeric values).

(( ${#arch[@]} == 1 )) is an integer comparison (shell arithmetic is
generally superior when available).

I specifically mentioned the latter in my previous email.

-- 
Eli Schwartz
Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20180611/1e219a25/attachment.asc>


More information about the pacman-dev mailing list