Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 780009 - Require Bash 4.4 as minimum version for EAPI 8
Summary: Require Bash 4.4 as minimum version for EAPI 8
Status: RESOLVED DUPLICATE of bug 636652
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: PMS/EAPI (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PMS/EAPI
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-04 17:50 UTC by konsolebox
Modified: 2021-04-05 11:17 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description konsolebox 2021-04-04 17:50:13 UTC
This would allow checking if a variable is an indexed array variable using [[ ${array@a} == *a* ]] instead of [[ $(declare -p array) == "declare -a "* ]] which calls a builtin and opens a subshell. Many eclasses use the latter and them being called repeatedly significantly slows down loading of ebuilds.
Comment 1 konsolebox 2021-04-04 17:58:46 UTC
Alternatively, EAPI 8 or an eclass can provide a common function that eclasses/ebuilds can use. This has already been done in portage itself:

if [[ BASH_VERSINFO -gt 4 || (BASH_VERSINFO -eq 4 && BASH_VERSINFO[1] -ge 4) ]] ; then
	___is_indexed_array_var() {
		[[ ${!1@a} == *a* ]]
	}
else
	___is_indexed_array_var() {
		[[ $(declare -p "$1" 2>/dev/null) == 'declare -a'* ]]
	}
fi

I still prefer the minimum version upgrade.
Comment 2 Ionen Wolkens gentoo-dev 2021-04-04 19:53:20 UTC
This goes further (bash 5) and is already in:
https://wiki.gentoo.org/wiki/Future_EAPI/EAPI_8_tentative_features

bug #636652
Comment 3 konsolebox 2021-04-04 19:58:59 UTC
I see. I agree with further upgrading to 5.0 because of mapfile/readarray's -d.
Comment 4 konsolebox 2021-04-04 20:03:03 UTC
Not only that. It would be simpler to check bash's version. Through `[[ BASH_VERSINFO -ge 5 ]]`.
Comment 5 Ulrich Müller gentoo-dev 2021-04-05 11:17:38 UTC

*** This bug has been marked as a duplicate of bug 636652 ***