Re: [PATCH] eclass/kernel-2.eclass: Remove <<< for heredoc in globl scope

Ionen Wolkens <[email protected]> Wed, 8 Jul 2026 21:09:59 -0400
Newsgroups gmane.linux.gentoo.devel
Message-ID <ak7059CdQMrcG8nW@eversor>
--n5YDWO2WLEf6fv8O
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Jul 08, 2026 at 01:50:45PM -0400, Mike Pagano wrote:
> This will mitigate the forthcoming portage throwing a
> sandbox violation
>=20
> Bug: https://bugs.gentoo.org/978939
>=20
> Signed-off-by: Mike Pagano <[email protected]>
> ---
>  eclass/kernel-2.eclass | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>=20
> diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
> index 8a675db7a..52feddaeb 100644
> --- a/eclass/kernel-2.eclass
> +++ b/eclass/kernel-2.eclass
> @@ -334,6 +334,7 @@ debug-print-kernel2-variables() {
>  # add genpatches to list of patches to apply if wanted
> =20
>  handle_genpatches() {
> +

Mistakenly inserted newline?

>  	local tarball want_unipatch_list
>  	[[ -z ${K_WANT_GENPATCHES} || -z ${K_GENPATCHES_VER} ]] && return 1
> =20
> @@ -350,7 +351,7 @@ handle_genpatches() {
> =20
>  	debug-print "Inside handle_genpatches"
>  	local OKV_ARRAY
> -	IFS=3D"." read -r -a OKV_ARRAY <<<"${OKV}"
> +	OLDIFS=3D"$IFS"; IFS=3D'.'; OKV_ARRAY=3D(${OKV}); IFS=3D"$OLDIFS"

OLDIFS is not local, but either way can skip using it by doing:

    local IFS=3D.; OKV_ARRAY=3D(${OKV}); unset IFS

The function caller's IFS won't be unset and, if unset, it returns
to defaults.

Alternatively, could use default IFS by replacing . with
spaces:

    local IFS OKV_ARRAY
    OKV_ARRAY=3D(${OKV//./ })

The `local IFS` set to nothing is just to ensure we're actually on
default IFS and not inheriting something weird from the caller's.
No need to unset it given it's the defaults. local IFS wouldn't be
needed if caller can be trusted to not leak its own IFS, but guess
there could be weird kernel packages in overlays...

On a side-note, the old heredoc method would be fine if this was
EAPI >=3D9-only given bash no longer uses temporary files with
BASH_COMPAT=3D5.3 (eapi9) unless the heredoc is very large which
is absolutely not the case here. So restoring someday is an option
if wanted.

> =20
>  	# for > 3.0 kernels, handle genpatches tarball name
>  	# genpatches for 3.0 and 3.0.1 might be named
> @@ -411,7 +412,7 @@ detect_version() {
>  	KV_MAJOR=3D$(ver_cut 1 ${OKV})
>  	# handle if OKV is X.Y or X.Y.Z (e.g. 3.0 or 3.0.1)
>  	local OKV_ARRAY
> -	IFS=3D"." read -r -a OKV_ARRAY <<<"${OKV}"
> +	OLDIFS=3D"$IFS"; IFS=3D'.'; OKV_ARRAY=3D(${OKV}); IFS=3D"$OLDIFS"
> =20
>  	# if KV_MAJOR >=3D 3, then we have no more KV_MINOR
>  	#if [[ ${KV_MAJOR} -lt 3 ]]; then
> @@ -792,7 +793,7 @@ universal_unpack() {
>  	debug-print "Inside universal_unpack"
> =20
>  	local OKV_ARRAY
> -	IFS=3D"." read -r -a OKV_ARRAY <<<"${OKV}"
> +	OLDIFS=3D"$IFS"; IFS=3D'.'; OKV_ARRAY=3D(${OKV}); IFS=3D"$OLDIFS"
> =20
>  	cd "${WORKDIR}" || die
>  	if [[ ${#OKV_ARRAY[@]} -ge 3 && ${KV_MAJOR} -ge 3 ]]; then
> --=20
> 2.54.0
>=20
>=20

--=20
ionen

--n5YDWO2WLEf6fv8O
Content-Type: application/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----

iQFPBAABCAA5FiEEx3SLh1HBoPy/yLVYskQGsLCsQzQFAmpO9OYbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyAAoJELJEBrCwrEM0lJIIAK4kWxpuIuEfHqxJ73II
Y5vILflZVEVVVKjkFIsllbJWvr7yPESGWWPziv8zpsO5Gzryjz50BsAT14SPZUz5
fYorEQGJyQlGKCklh1dW7dFmBRZaurZqDAW700Q9hjCZwUTdLW9/Hx12NTq28MDF
eTb+GUZv4MsY1fmRqOor2HytVsUFuyCF/yp4pdhajtxCoYGdda/GOOjiyUEXLPXO
v86b0qZaPmqpaNiS4+ZhRAz8iuySmMIos8mkBtO4Jv1arlY5r8C6mX14+Mw12f84
ggJREEHzMzeBMz+xSHI27Ugmac4hhmCOZBG2MyB97Zs10WpUUL2jib75+5lAUZyQ
WuM=
=EGvc
-----END PGP SIGNATURE-----

--n5YDWO2WLEf6fv8O--