delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/01/13/15:12:04

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type; q=dns; s=default; b=q1oG
Q7LYAkF30ncVYIB8jB3mHtNcvs6zqpFW+VboLKXzFPROQzyEBlF+M9t6KFL2evi/
0VZdfWyuqB7/fTQOCB1/+96UYuRq0hGjQ4IcPKrIaH5hjSZEM8U/pLA4OOaSyXA5
qmTTlJENV89Oi1WLWk4SPJLM2bjTF64rPyvdkGc=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type; s=default; bh=uGz5VEoOZ2
TVOmO6jWsDLxTOvzg=; b=Ts12c7WdoXtX12fGGbU5a/5V+eheOxH7W+6xMFsC6n
a6XhmwBAYm4cbtskGvDxzZm3FQKp7Xi3s+cGP/cJqoKFqKgMY7VByrj43u3TWBTW
9zrI2oZDJnJtuSm/0wJuNYnwv80lfp8nowgnfK1K5ruWUcPxdnNe+dtiosMOGHp3
Q=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2398, displays, intentional, compound
X-HELO: mx1.redhat.com
Subject: Re: Bash declare built-in regression loses array quotations
To: cygwin AT cygwin DOT com
References: <587931C1 DOT 5060509 AT gmail DOT com>
From: Eric Blake <eblake AT redhat DOT com>
Openpgp: url=http://people.redhat.com/eblake/eblake.gpg
Message-ID: <8adf1618-02c1-2bb5-042b-24c63046a56e@redhat.com>
Date: Fri, 13 Jan 2017 14:11:20 -0600
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0
MIME-Version: 1.0
In-Reply-To: <587931C1.5060509@gmail.com>
X-IsSubscribed: yes

--K1wT5v4dsJGsvnlNECvbcMuK7fJBltiIA
Content-Type: multipart/mixed; boundary="5wVgoUiHhTVq81pNOcEqu3icaqjeXtquR";
 protected-headers="v1"
From: Eric Blake <eblake AT redhat DOT com>
To: cygwin AT cygwin DOT com
Message-ID: <8adf1618-02c1-2bb5-042b-24c63046a56e AT redhat DOT com>
Subject: Re: Bash declare built-in regression loses array quotations
References: <587931C1 DOT 5060509 AT gmail DOT com>
In-Reply-To: <587931C1 DOT 5060509 AT gmail DOT com>


--5wVgoUiHhTVq81pNOcEqu3icaqjeXtquR
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 01/13/2017 02:00 PM, Matt D. wrote:
> I updated yesterday to the latest Cygwin x86 release which included an
> updated Bash 4.4.5(1). This release changes the default behavior of the
> built-in 'declare' command which is causing scripts which relied on this
> functionality to break.
>=20
> The following test will illustrate the change:
> declare -A list
> list[a]=3D1
> list[b]=3D2
> list[c]=3D3
> declare -p | grep list=3D
>=20
> On Bash 4.4.5(1) the output is:
> declare -A list=3D([a]=3D"1" [b]=3D"2" [c]=3D"3" )
>=20
> Previously the result was:
> declare -A list=3D'([a]=3D"1" [b]=3D"2" [c]=3D"3" )'

This is an intentional upstream behavior change.  Quoting the upstream
release notes:

>> There are a few incompatible changes between bash-4.3 and bash-4.4.  Bash
>> now retains the exit status only of asynchronous jobs, as opposed to all
>> jobs.  This means that it is not possible to use `wait' to retrieve the
>> status of a previously-completed synchronous command.  Bash no longer
>> attempts to perform compound assignment if a variable expansion on the
>> right-hand side of an assignment statement to `declare' or `local' has t=
he
>> form of a compound assignment.  There are other changes to compound array
>> assignments used as arguments to the `declare' and `local' builtins, but
>> those should be backwards compatible, albeit with warning messages about
>> deprecated constructs.  Read the descriptions of the various compatibili=
ty
>> options in COMPAT or the man page for more details.=20
...
>> q.  The declare builtin no longer displays array variables using the com=
pound
>>     assignment syntax with quotes; that will generate warnings when re-u=
sed as
>>     input, and isn't necessary.

Both output forms should produce the same results when re-evaluated;
except that the form with the extra '' now issues warnings (which is why
declare -p no longer uses the extra '').

>=20
> I can confirm that this has always been the expected output when running
> this command on Cygwin and Linux. I run CentOS which does not track the
> latest Bash release and I don't know the procedure to check whether this
> is an upstream regression or not.

It's not a regression, but an intentional change; you'll have to update
your script to quit relying on unspecified output.

--=20
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--5wVgoUiHhTVq81pNOcEqu3icaqjeXtquR--

--K1wT5v4dsJGsvnlNECvbcMuK7fJBltiIA
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJYeTRoAAoJEKeha0olJ0NqGrEH/2zQHiZA5FReaO8e1e8eniFC
56Vq+JTNJJ0p7Dz2N2OjMRNd+zU6uBxjQ7Whg5MAxFtVUbJH4yYdwUg1b/aGHsps
2ubdvb2pfbEuRXU4sHkYXIgjeKbzBhgVkhcFiTsjKPfA0gqYXD4piGRKfXZJiGpu
HGpKAm+QPSFViduD9GGDFchPORAs4Os7dQvkkIKiSCzvwMYxnj23O7JRF1gl3fmO
CyDF4h1oHWnfipSXmmAL6J7reSjtY32spH7ccur7957m0J+0azjyglvJmoolf+oq
Bw17sUPAFES7Y2gtB97h0SLVRvtQcIxGO9ddaAcDBaIAFbkW3C5or7Y48Kr2DDo=
=lvRS
-----END PGP SIGNATURE-----

--K1wT5v4dsJGsvnlNECvbcMuK7fJBltiIA--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019