Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #11392
| Path | csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Mike Frysinger <vapier@gentoo.org> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: quoted compound array assignment deprecated |
| Date | Tue, 18 Aug 2015 23:41:26 -0400 |
| Lines | 69 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.8608.1439955696.904.bug-bash@gnu.org> (permalink) |
| References | <CAAZkfoJJdVc5A9WMmBcUqUMjN=2VBq6rtuoDYVO5iMQDoLjS9Q@mail.gmail.com> <55D34682.9000704@case.edu> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="geqNt1NAoYRYy2Pr" |
| X-Trace | usenet.stanford.edu 1439955697 5929 208.118.235.17 (19 Aug 2015 03:41:37 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| Cc | isabella parakiss <izaberina@gmail.com>, bug-bash <bug-bash@gnu.org> |
| To | Chet Ramey <chet.ramey@case.edu> |
| Envelope-to | bug-bash@gnu.org |
| Mail-Followup-To | Chet Ramey <chet.ramey@case.edu>, isabella parakiss <izaberina@gmail.com>, bug-bash <bug-bash@gnu.org> |
| Content-Disposition | inline |
| In-Reply-To | <55D34682.9000704@case.edu> |
| X-detected-operating-system | by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] |
| X-Received-From | 140.211.166.183 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.14 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <http://lists.gnu.org/archive/html/bug-bash> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| Xref | csiph.com gnu.bash.bug:11392 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
On 18 Aug 2015 10:51, Chet Ramey wrote:
> On 8/17/15 4:19 AM, isabella parakiss wrote:
> > Quoting is necessary in a few cases:
> >
> > $ var=foo; declare -A "arr$var=([x]=y)"
> > bash: warning: arrfoo=([x]=y): quoted compound array assignment deprecated
> > $ var=foo; declare -A arr$var=([x]=y)
> > bash: syntax error near unexpected token `('
> > $ var=foo; declare -A "arr$var"=([x]=y)
> > bash: syntax error near unexpected token `('
> >
> > I don't think this should be the default behaiour...
>
> This is exactly the case for which the warning is intended. If you want
> to construct variable names on the fly, use `eval' or don't mix
> declarations of constructed variable names with compound assignment.
>
> You can read the extensive discussion starting at
> http://lists.gnu.org/archive/html/bug-bash/2014-12/msg00028.html.
>
> http://lists.gnu.org/archive/html/bug-bash/2014-12/msg00115.html is the
> newest proposal.
just to double check, the warning from this code is expected ?
$ bash-4.3 -c 'declare -a foo=(a b c); export foo; declare -p foo'
declare -ax foo='([0]="a" [1]="b" [2]="c")'
$ bash-4.4 -c "declare -a foo='(a b c)'"
bash-4.4: warning: foo=(a b c): quoted compound array assignment deprecated
we see this in Gentoo because we save/restore build envs via bash. so all
builds done w/bash-4.3 and older use the quoted syntax, so updating with
bash-4.4 in the system triggers these warnings. we can adjust our tooling
to handle it, but would be nice if older bash didn't do it either. maybe
send out a 4.3-p43 ? ;)
-mike
Back to gnu.bash.bug | Previous | Next | Find similar
Re: quoted compound array assignment deprecated Mike Frysinger <vapier@gentoo.org> - 2015-08-18 23:41 -0400
csiph-web