[pacman-dev] [PATCH 7/7] libmakepkg: disallow using 'any' with other arches
Morgan Adamiec
morganamilo at gmail.com
Mon Jun 11 22:57:49 UTC 2018
On Mon, 11 Jun 2018 at 22:27, Eli Schwartz <eschwartz at archlinux.org> wrote:
>
> 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
>
Yeah I see that now. Bash Isn't really my thing so I didn't really
take note of the (( ))
Just to be sure before I send another patch it would be
if [[ $arch == 'any' && (( ${#arch[@]} == 1 )) ]];
right? With the (( )) nested in the [[ ]].
Thanks for the feedback by the way, It helps a lot.
More information about the pacman-dev
mailing list