Re: [PATCH 1/2] cargo.eclass: for EAPI 9, ban cargo_src_install
Eli Schwartz <[email protected]> Fri, 29 May 2026 00:50:02 -0400
| Newsgroups | gmane.linux.gentoo.devel |
|---|---|
| Message-ID | <[email protected]> |
On 5/28/26 8:25 PM, Ionen Wolkens wrote:
>> + [[ ${EAPI} = 8 ]] || die "cargo.eclass: src_install no longer provided since EAPI 9"
>> +
>
> = 8 -> == 8
>
> Either works but it's for consistency given we use == nearly everywhere
> to avoid confusion with assignments (bash also doesn't document = as
> being valid for comparisons afaik, posix test(1) does but this is
> bash's [[ which we likewise prefer).
"""
When the == and != operators are used, the string to the right of the
operator is considered a pattern and matched according to the rules
described below under Pattern Matching, as if the extglob shell option
were enabled. The = operator is equivalent to ==.
"""
POSIX = came first. The bashism == was added as a pure alias -- a second
spelling for the same thing.
It is the leading cause of broken shell scripts such as ./configure that
use #!/bin/sh.
See e.g. https://gitlab.com/fastjet/siscone/-/merge_requests/2
"It should never be used under any circumstances. All developers must
immediately forget that it exists. Using it is non-portable and does not
work in /bin/sh scripts such as configure scripts, and it results in
dangerous muscle memory when used in bash scripts because it makes
people unthinkingly use the double equals even in /bin/sh scripts."
I'll add that I wholeheartedly believe bash upstream MUST make it an
un-quietable unconditional warning if double-equals is used in scripts,
regardless of shebang or set -o posix, as a desperate measure to flag it
as obsolescent and stop people from doing it.
bash [[ is genuinely featureful, unlike ==, and has good reason to be
used. People ***do not*** forget to avoid [[ the way they forget to
avoid ==.
> Others may further prefer != 8 && die given they find || confusing, but well
> -- personally I actually prefer || when it's for abort conditions like
> die so I'd leave it like that.
Well, != has the advantage of not forcing me to give up my sense of
personal integrity, so there is that in its favor. I agree it's
convoluted and wrong, but it is *less* wrong than "=="...
--
Eli Schwartz
OpenPGP_signature.asc
(application/pgp-signature, 236 B)
-----BEGIN PGP SIGNATURE----- wnsEABYIACMWIQTnFNnmK0TPZHnXm3qEp9ErcA0vVwUCahka+gUDAAAAAAAKCRCEp9ErcA0vV0Rd AP465YoOM2UM0h1S+VfCHy9997rOwH9xDxSO3BWnbaAJlQD/VAIwRvwnogDI1UIAf+dPML9zGqGq ARUH4lmzBvXlSAk= =KisO -----END PGP SIGNATURE-----