On 21 Oct 2015 00:03, Ulrich Mueller wrote:
> >>>>> On Tue, 20 Oct 2015, Mike Frysinger wrote:
> 
> >> EAPI 6: Bash version is 4.2.
> 
> > do we want to mandate the BASH_COMPAT aspect in PMS ?
> > or at least make into a recommendation ?
> 
> If I understand [1] correctly, coverage of BASH_COMPAT is incomplete:
> It only changes incompatible behaviour back to the old version, but it
> won't disallow using new features.

correct.  it would help when code changes behavior like when =~ changed quoting
behavior and we had to scramble to tweak its usage throughout the tree (although
it was more external programs than eclasses/ebuilds).  but if you're running
bash-4.3, setting BASH_COMPAT=4.2 would not keep code from using things like
${VAR^^}.

> Therefore I'd make it a recommendation at most. Something along the
> lines of: "The interpreter is assumed to be GNU bash, version as
> listed in table xyz, or any later version. If possible, the package
> manager should set the shell's compatibility level to the exact
> version specified."

and include the recommended snippet as well as add a warning about not exporting
the variable less it break external shell scripts.

> > https://bugs.gentoo.org/431340#c20
> >   local maj=4 min=2
> >   if ([[ ${BASH_VERSINFO[0]} -lt ${maj} ]] ||
> >       [[ ${BASH_VERSINFO[0]} -eq ${maj} && ${BASH_VERSINFO[1]} -lt ${min 
> > ]]) ; then
> 
> Why the subshell here?

it can be dropped.  was purely for grouping/line wrapping, but || gets you that.
-mike

Attachment: signature.asc
Description: Digital signature

Reply via email to