On 1/8/26 1:06 PM, Rahul Sandhu wrote:
> Quoting variables properly prevents against accidental splitting. Some
> have been left unquoted, as they are being intentionally split for now,
> but future patches will use more arrays allowing us to drop at least a
> couple of those variables.
>
> Surrounding variables with `{}` makes it more clear where the variable
> actually begins and ends, and is good practice in general.
>
> Signed-off-by: Rahul Sandhu <[email protected]>
> ---
> eclass/selinux-policy-2.eclass | 86 +++++++++++++++++-----------------
> 1 file changed, 43 insertions(+), 43 deletions(-)
>
> diff --git a/eclass/selinux-policy-2.eclass b/eclass/selinux-policy-2.eclass
> index 76ac40f2719e..96e0ae40f1ca 100644
> --- a/eclass/selinux-policy-2.eclass
> +++ b/eclass/selinux-policy-2.eclass
> @@ -55,7 +55,7 @@ _SELINUX_POLICY_2_ECLASS=1
> # (space-separated) or a bash array.
> : "${POLICY_FILES:=""}"
>
> -if [[ ${EAPI} = 7 ]]; then
> +if [[ "${EAPI}" = 7 ]]; then
Specifically for [[ it is unnecessary to quote, and no other eclass
AFAICT quotes ${EAPI} in either
case ${EAPI} in
or e.g.
if [[ ${EAPI} != 7 ]]; then
...
There is that one freak eclass doing
if ! has "${EAPI}" 7 8; then
and it is quoted there since "has" is an ordinary command and its
arguments may be word-split by the shell before invoking `has`.
--
Eli Schwartz
OpenPGP_signature.asc
Description: OpenPGP digital signature
