[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: shopt -u compat* (re)sets BASH_COMPAT to 51

From: Chet Ramey
Subject: Re: shopt -u compat* (re)sets BASH_COMPAT to 51
Date: Sun, 13 Feb 2022 16:50:36 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.0

On 2/12/22 4:11 AM, Mihai Moldovan wrote:
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: x86_64-pc-linux-gnu-gcc
Compilation CFLAGS: -march=native -mtune=native -Wall -pipe -g3 -ggdb3 -gdwarf-4
                     -O2 -fno-omit-frame-pointer
uname output: Linux apgunner 5.15.11 #1 SMP PREEMPT Thu Dec 23 09:06:30 CET 2021
               x86_64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz GenuineIntel
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.1
Patch Level: 16
Release Status: release

        The only way to set a compat level of 50 is to use the BASH_COMPAT
        variable. However, unsetting any compatNN shopt value will (re)set
        BASH_COMPAT to 51 (with bash-5.1), which is not something users might

        Technically, the result isn't wrong, since, i.e., shopt -u compat43 did
        what it was asked to - not setting the compat value to 43. It's
        counter-intuitive and the old value should be retained, though.

Hmmmm. So what you're proposing is that `shopt -u compat43' if compat43 is
not set should not reset the compatibility level to the current version.

I think we could do this by interrogating $BASH_COMPAT after unsetting the
appropriate compat_NN option.

Or maybe leaving shell_compatibility_level alone if it's > 44 (the last
compat_NN option) and <= DEFAULT_COMPATIBILITY_LEVEL (the current version)
instead of unconditionally setting it to DEFAULT_COMPATIBILITY_LEVEL. But
then you'd be required to unset BASH_COMPAT to get back to the current
compatibility level, which is supported now but not required.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]