Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail From: Mike Frysinger 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: References: <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 , bug-bash To: Chet Ramey Envelope-to: bug-bash@gnu.org Mail-Followup-To: Chet Ramey , isabella parakiss , bug-bash 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11392 --geqNt1NAoYRYy2Pr Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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: > >=20 > > $ var=3Dfoo; declare -A "arr$var=3D([x]=3Dy)" > > bash: warning: arrfoo=3D([x]=3Dy): quoted compound array assignment dep= recated > > $ var=3Dfoo; declare -A arr$var=3D([x]=3Dy) > > bash: syntax error near unexpected token `(' > > $ var=3Dfoo; declare -A "arr$var"=3D([x]=3Dy) > > bash: syntax error near unexpected token `(' > >=20 > > I don't think this should be the default behaiour... >=20 > 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. >=20 > You can read the extensive discussion starting at > http://lists.gnu.org/archive/html/bug-bash/2014-12/msg00028.html. >=20 > 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=3D(a b c); export foo; declare -p foo' declare -ax foo=3D'([0]=3D"a" [1]=3D"b" [2]=3D"c")' $ bash-4.4 -c "declare -a foo=3D'(a b c)'" bash-4.4: warning: foo=3D(a b c): quoted compound array assignment deprecat= ed 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 --geqNt1NAoYRYy2Pr Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJV0/rmAAoJEEFjO5/oN/WBfVwP/jMtn38OQAIcQ4ZXlONkyIwy XJWLiwm1+YehWeIWn3MZ/Ump8m501w+PTkY+hm8KgO+QZjIYyUyML58f06OV8I1b AFpsyhmWcszEYyt0wbq2PDvHzlv+Nmb0M3h1aEPHYET7Y118XtPBeDmw3ha9bxpS 8VHY+mz1RmosLgqHSfpsSVDwe2NUpID+zLSlGoNB6oDrPadqkzdCZ5DnzD1eZKI6 gpQyGdB/1rUmTy0R5rXfHNjfk1fDA7DeHod7vZN23j2X0ffYniYMJkk9pcUrC3zB FjF3u7qhwjkuDSjANmF2e4159FD0sTqwRNtMe71wlvil1m88/KRD50Qq0L3iWcN3 5Okq/IuGuHERwcUsonvDv5jbjfPfeya8l9a2SJO0R6QxJ/OVXvi0y68UCOAvMAOJ QGGvoIWlpUR0DJwjoDpykXwsbvCvmIjN+a0lDNzOHHxQDn+2qvx8Q7FMZ2Tq0mnS J5G4FqGZLKhmzY0ltxqn2C5PHoxnSpVNcrT+XYOYxtWkBwXJdOO8j0pHkEaaQvsK jNgbo12sLhZeKmaYbCxCoxNoSV/Oi20SHhMxObJ/Iu/wiiwi1yNwAMmic56JS5kl GKQzsjYNoDzcLoP3s8SrPsKxrfIdGJB33J5EkADg/svdd/YfVPTNrgpkKicMpXlm 7lIAcfo07vjD7IvrJQxO =uUqL -----END PGP SIGNATURE----- --geqNt1NAoYRYy2Pr--