[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Incorrect documentation for compat43
From: |
Chet Ramey |
Subject: |
Re: Incorrect documentation for compat43 |
Date: |
Tue, 2 Jul 2024 16:41:49 -0400 |
User-agent: |
Mozilla Thunderbird |
On 7/2/24 3:04 PM, Emanuele Torre wrote:
From the bash man page:
compat43
• the shell does not print a warning message if an attempt
is made to use a quoted compound assignment as an argument
to declare (e.g., declare -a foo='(1 2)'). Later versions
warn that this usage is deprecated
But declare -a foo='(1 2)' does not print a warning in bash 5.2.26, so
that paragraph is at least irrelevant to newer versions of bash that
don't output a warning:
$ declare -a foo='(1 2)'
$ declare -p foo BASH_VERSION
declare -a foo=([0]="1" [1]="2")
declare -- BASH_VERSION="5.2.26(1)-release"
I also tried the same command in 4.4.23, 5.0.18, and 5.1.16, and they
all didn't output a warning either, so I wonder if that warning actually
ever existed in a release.
It still exists in the current release
$ grep deprecated builtins/declare.def
internal_warning (_("%s: quoted compound array assignment deprecated"),
list->word->word);
but I tightened the conditions under which it would actually be printed
before bash-4.4 came out, the result of
https://lists.gnu.org/archive/html/bug-bash/2015-08/msg00089.html
to specifically exempt the case where you use -a/-A to `declare' so you
can dynamically construct the array name, which I guess people were doing.
I suppose that item can go.
--
``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/