Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Jun 2018 11:05:48 -0400
From:      Devin Teske <dteske@FreeBSD.org>
To:        Mathieu Arnold <mat@FreeBSD.org>
Cc:        Devin Teske <dteske@FreeBSD.org>, ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   Re: svn commit: r471991 - head/Mk/Scripts
Message-ID:  <85E66866-9D6C-4175-9972-21619A46B970@FreeBSD.org>
In-Reply-To: <201806080926.w589QVic044402@repo.freebsd.org>
References:  <201806080926.w589QVic044402@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

> On Jun 8, 2018, at 5:26 AM, Mathieu Arnold <mat@FreeBSD.org> wrote:
>=20
> Author: mat
> Date: Fri Jun  8 09:26:31 2018
> New Revision: 471991
> URL: https://svnweb.freebsd.org/changeset/ports/471991
>=20
> Log:
>  SC2015: Note that A && B || C is not if-then-else. C may run when A =
is true.
>=20
>  It's common to use A && B to run B when A is true, and A || C to run =
C
>  when A is false.
>=20
>  However, combining them into A && B || C is not the same as if A then =
B
>  else C.
>=20
>  In this case, if A is true but B is false, C will run.
>=20
>  If an if clause is used instead, this problem is avoided.
>=20
>  PR:             227109
>  Submitted by:   mat
>  Sponsored by:   Absolight
>=20
> Modified:
>  head/Mk/Scripts/qa.sh   (contents, props changed)
>=20
> Modified: head/Mk/Scripts/qa.sh
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/Mk/Scripts/qa.sh	Fri Jun  8 09:26:28 2018	=
(r471990)
> +++ head/Mk/Scripts/qa.sh	Fri Jun  8 09:26:31 2018	=
(r471991)
> @@ -261,9 +261,10 @@ suidfiles() {
> libtool() {
> 	if [ -z "${USESLIBTOOL}" ]; then
> 		find ${STAGEDIR} -name '*.la' | while read f; do
> -			grep -q 'libtool library' "${f}" &&
> -				err ".la libraries found, port needs =
USES=3Dlibtool" &&
> -				return 1 || true
> +			if grep -q 'libtool library' "${f}"; then
> +				err ".la libraries found, port needs =
USES=3Dlibtool"
> +				return 1
> +			fi
> 		done
> 		# The return above continues here.
> 	fi
>=20

Please don't use curlies around the variable name unless you have to =
slam characters after the expansion (terminating the variable name =
prematurely for the parser).

When you use curlies like you have above, you're making the parser do =
more work.

Inside of curlies, it has to parse for 7 additional possibilities aside =
from the normal valid characters.

It might be thought of as "it just reads until the ending curly" but =
parameter expansion features of the shell add complexity that is not =
being addressed here.

If you're not using parameter expansion features (e.g., "${f}") just use =
"$f"

Here's the ASCII man-page with portions highlighted to show you what the =
parser has to do when you use $var vs ${var}.



(and if this were bash, there would be even more orange boxes, but we're =
not talking bash)
--=20
Devin




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?85E66866-9D6C-4175-9972-21619A46B970>