1 |
>>>>> On Tue, 10 Nov 2015, Mike Frysinger wrote: |
2 |
|
3 |
> + # Set the compat level in case things change with newer ones. We must not |
4 |
> + # export this into the env otherwise we might break other shell scripts we |
5 |
> + # execute (e.g. ones in /usr/bin). |
6 |
> + BASH_COMPAT="${maj}.${min}" |
7 |
> + |
8 |
> + # The variable above is new to bash-4.3. For older versions, we have to use |
9 |
> + # a compat knob. Further, the compat knob only exists with older versions |
10 |
> + # (e.g. bash-4.3 has compat42 but not compat43). This means we only need to |
11 |
> + # turn the knob with older EAPIs, and only when running newer bash versions: |
12 |
> + # there is no bash-3.3 (it went 3.2 to 4.0), and when requiring bash-4.2, the |
13 |
> + # var works with bash-4.3+, and you don't need to set compat to 4.2 when you |
14 |
> + # are already running 4.2. |
15 |
> + if __eapi_bash_3_2 && [[ ${BASH_VERSINFO[0]} -gt 3 ]] ; then |
16 |
> + shopt -s compat32 |
17 |
> + fi |
18 |
|
19 |
Wouldn't this profit from an additional test for <bash-4.3? If I |
20 |
understood the upstream discussion correctly, they were thinking about |
21 |
dropping the compat* options in some future version? |
22 |
|
23 |
That is, the conditional should look like: |
24 |
|
25 |
if __eapi_bash_3_2 \ |
26 |
&& [[ ${BASH_VERSINFO[0]} -eq 4 \ |
27 |
&& ${BASH_VERSINFO[1]} -lt 3 ]] ; then |
28 |
shopt -s compat32 |
29 |
fi |
30 |
|
31 |
Ulrich |