I see no reference about extglob anywhere in EAPI 8. It's wrong to have this enabled in a single ebuild so please have this enabled by default in 9. Replace strings is one of its useful uses: ${PV//@(alpha|beta)/&.} As a bonus maybe make sure `patsub_replacement` is also enabled even though it's enabled by default as apparent. Maybe even extend that to others; have a list of which bash options that should be or are expected to be enabled. Reproducible: Always
I would support extglob being on only in the event that EAPI 9 makes bash >=5.2 a requirement. Allow me to explain. As we know, portage makes a point of adjusting BASH_COMPAT in accordance with the EAPI level, for better or - perhaps increasingly - worse. Now, one of the few encouraging aspects of the 5.2 release was this: "The most notable new feature is the rewritten command substitution parsing code, which calls the bison parser recursively. This replaces the ad-hoc parsing used in previous versions, and allows better syntax checking and catches syntax errors much earlier." Unfortunately, that lead to a storm in a teacup as regards Gentoo's ostensible backward compatibility needs, causing Chet to make (in my view, a wholly uncalled for) concession to the Gentoo camp in a late stage release candidate. The ensuing code was a cack-handed compromise, introducing special cases to the otherwise-improved parser so as to permit obviously invalid code in the case that BASH_COMPAT is set to "51" or lower. I opined at the time that it would end up causing problems and so it did - and then some. This remains a completely undocumented feature by the way, and we are now stuck with it. To summarise, owing to the very nature of extglob, it certainly should be activated as early as possible in the case that it is considered sufficiently useful, at which point tying it to a new EAPI level makes some sense. Yet, I would strongly counsel against ever simultaneously activating extglob and setting a bash compatibility level of 51 or lower. Hence, the suggestion to make >=5.2 an accompanying requirement, so that the recursive parser can operate without being impeded by an undocumented, poorly implemented backward-compatibility feature that is destined to bitrot. As for patsub_replacement, though I can see it being occasionally useful, I do not think that it should be supported until such time as there is no longer any need for the Gentoo ecosystem to support EAPI levels older than 8. The rather depressing reason for this is explained by https://bugs.gentoo.org/881383#c10.
Also, https://bugs.gentoo.org/881383#c18 still applies. Ramey's response to Briden's perfectly legitimate bug report was, quite literally, "shopt -u patsub_replacement". It will never be fixed.