Re: [PATCH 1/2] cargo.eclass: for EAPI 9, ban cargo_src_install

Ionen Wolkens <[email protected]> Fri, 29 May 2026 02:49:48 -0400
Newsgroups gmane.linux.gentoo.devel
Message-ID <ahk3DHr25bpg5Hze@eversor>
On Fri, May 29, 2026 at 12:50:02AM -0400, Eli Schwartz wrote:
> 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.

It's either way for consistency, now the eclass does it in two different
ways. And this isn't POSIX sh, we intentionally use bashism everywhere
because this is bash.

I'd at least keep style similar within a same eclass/ebuild regardless
of preferences.

> 
> 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




-- 
ionen
signature.asc (application/pgp-signature, 525 B)
-----BEGIN PGP SIGNATURE-----

iQFPBAABCAA5FiEEx3SLh1HBoPy/yLVYskQGsLCsQzQFAmoZNwwbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyAAoJELJEBrCwrEM0i+IH/3+t/SpbDsQ1mkIi2UJx
vbeKEeThbKBdAmyr/fF3rgPFlWOA41NbdffbZDkEUBW7Qk+PDJ/bTMbfmKSVYHwD
JaiecvdSVovw7LUHjZ0Pt0Bb7VX0J1VG4FwoHoO43tFOzwtRqK/8Byr6euCcB9SX
9d6XZX3w/mTJLuwI1d67t4HrfCbQMM+9wEJxX6cUShyvUA/GCbEvp3qMLxjR08Ps
oKgQ+Q2rB5O4pc+mtVNXYouUKH3aZo8OZd/lTxLRCAuvwwfFaVAVjIDwmVoAhag/
GWwDnkVwuIahhtR8B/VNx3xW8tPgOmi4Z3BsV3BPdeu22xzgFsLT/8NFtTdlmxU0
NVA=
=eBUQ
-----END PGP SIGNATURE-----