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

Mike Pagano <[email protected]> Thu, 9 Jul 2026 08:41:00 -0400
Newsgroups gmane.linux.gentoo.devel
Message-ID <[email protected]>
On 7/8/26 9:09 PM, Ionen Wolkens wrote:
> On Wed, Jul 08, 2026 at 01:50:45PM -0400, Mike Pagano wrote:
>> This will mitigate the forthcoming portage throwing a
>> sandbox violation
>>
>> Bug: https://bugs.gentoo.org/978939
>>
>> Signed-off-by: Mike Pagano <[email protected]>
>> ---
>>   eclass/kernel-2.eclass | 7 ++++---
>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> 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
>>   
>>   handle_genpatches() {
>> +
> 
> Mistakenly inserted newline?
> 
>>   	local tarball want_unipatch_list
>>   	[[ -z ${K_WANT_GENPATCHES} || -z ${K_GENPATCHES_VER} ]] && return 1
>>   
>> @@ -350,7 +351,7 @@ handle_genpatches() {
>>   
>>   	debug-print "Inside handle_genpatches"
>>   	local OKV_ARRAY
>> -	IFS="." read -r -a OKV_ARRAY <<<"${OKV}"
>> +	OLDIFS="$IFS"; IFS='.'; OKV_ARRAY=(${OKV}); IFS="$OLDIFS"
> 
> OLDIFS is not local, but either way can skip using it by doing:
> 
>      local IFS=.; OKV_ARRAY=(${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=(${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 >=9-only given bash no longer uses temporary files with
> BASH_COMPAT=5.3 (eapi9) unless the heredoc is very large which
> is absolutely not the case here. So restoring someday is an option
> if wanted.
> 
>>   
>>   	# 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=$(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="." read -r -a OKV_ARRAY <<<"${OKV}"
>> +	OLDIFS="$IFS"; IFS='.'; OKV_ARRAY=(${OKV}); IFS="$OLDIFS"
>>   
>>   	# if KV_MAJOR >= 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"
>>   
>>   	local OKV_ARRAY
>> -	IFS="." read -r -a OKV_ARRAY <<<"${OKV}"
>> +	OLDIFS="$IFS"; IFS='.'; OKV_ARRAY=(${OKV}); IFS="$OLDIFS"
>>   
>>   	cd "${WORKDIR}" || die
>>   	if [[ ${#OKV_ARRAY[@]} -ge 3 && ${KV_MAJOR} -ge 3 ]]; then
>> -- 
>> 2.54.0
>>
>>
> 

Committed with suggested changes. Thanks for the review.

-- 
Mike Pagano
Gentoo Developer
E-Mail     : [email protected]
GnuPG FP   : 52CC A0B0 F631 0B17 0142 F83F 92A6 DBEC 81F2 B137
Public Key : http://pgp.mit.edu/pks/lookup?search=0x92A6DBEC81F2B137&op=index