public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Bash declare built-in regression loses array quotations
@ 2017-01-13 20:00 Matt D.
  2017-01-13 20:11 ` Eric Blake
  2017-01-13 20:15 ` Matt D.
  0 siblings, 2 replies; 4+ messages in thread
From: Matt D. @ 2017-01-13 20:00 UTC (permalink / raw)
  To: cygwin

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.

The following test will illustrate the change:
declare -A list
list[a]=1
list[b]=2
list[c]=3
declare -p | grep list=

On Bash 4.4.5(1) the output is:
declare -A list=([a]="1" [b]="2" [c]="3" )

Previously the result was:
declare -A list='([a]="1" [b]="2" [c]="3" )'

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.

I have rolled back to Bash 4.3.48-8 which has restored the previous 
functionality.

Please advise.

Matt D.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bash declare built-in regression loses array quotations
  2017-01-13 20:00 Bash declare built-in regression loses array quotations Matt D.
@ 2017-01-13 20:11 ` Eric Blake
  2017-01-13 20:56   ` Matt D.
  2017-01-13 20:15 ` Matt D.
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Blake @ 2017-01-13 20:11 UTC (permalink / raw)
  To: cygwin


[-- Attachment #1.1: Type: text/plain, Size: 2419 bytes --]

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.
> 
> The following test will illustrate the change:
> declare -A list
> list[a]=1
> list[b]=2
> list[c]=3
> declare -p | grep list=
> 
> On Bash 4.4.5(1) the output is:
> declare -A list=([a]="1" [b]="2" [c]="3" )
> 
> Previously the result was:
> declare -A list='([a]="1" [b]="2" [c]="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 the
>> 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 compatibility
>> options in COMPAT or the man page for more details. 
...
>> q.  The declare builtin no longer displays array variables using the compound
>>     assignment syntax with quotes; that will generate warnings when re-used 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 '').

> 
> 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.

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bash declare built-in regression loses array quotations
  2017-01-13 20:00 Bash declare built-in regression loses array quotations Matt D.
  2017-01-13 20:11 ` Eric Blake
@ 2017-01-13 20:15 ` Matt D.
  1 sibling, 0 replies; 4+ messages in thread
From: Matt D. @ 2017-01-13 20:15 UTC (permalink / raw)
  To: cygwin

While my simple test passed, I am now experiencing runtime assertions 
with Cygwin. These assertions occur on 2.6.1-1 and the alternatively 
available 2.6.0-1:

assertion "(s - envblock) <= tl" failed: file 
"/home/corinna/src/cygwin/cygwin-2.6.1/cygwin-2.6.1-1.i686/src/newlib-cygwin/winsup/cygwin/environ.cc", 
line 1242, function: char** build_env(const char* const*, WCHAR*&, int&, 
bool, HANDLE)
/c/data/workspaces/remote/plugins/shared/scripts/plugin.sh: line 64: 
8448 Aborted                 (core dumped) 
/usr/local/lib/codespunk/scra.exp --p "$p" "bin/$plugin.jar" 
"$user@$host:$path/other/plugins/$plugin.jar"
assertion "(s - envblock) <= tl" failed: file 
"/home/corinna/src/cygwin/cygwin-2.6.1/cygwin-2.6.1-1.i686/src/newlib-cygwin/winsup/cygwin/environ.cc", 
line 1242, function: char** build_env(const char* const*, WCHAR*&, int&, 
bool, HANDLE)
/c/data/workspaces/remote/plugins/shared/scripts/plugin.sh: line 64: 
13920 Aborted                 (core dumped) 
/usr/local/lib/codespunk/scrb.exp $h --u "$u" --p "$p" "chmod 660 
$path/other/plugins/$plugin.jar"


This bug is SEVERE and I can no longer perform any builds with these 
assertions. The Cygwin installer does not appear to provide a working 
version for me to roll back to.

Please advise. I cannot get any work done with in this state.

Matt D.



On 1/13/2017 3: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.
>
> The following test will illustrate the change:
> declare -A list
> list[a]=1
> list[b]=2
> list[c]=3
> declare -p | grep list=
>
> On Bash 4.4.5(1) the output is:
> declare -A list=([a]="1" [b]="2" [c]="3" )
>
> Previously the result was:
> declare -A list='([a]="1" [b]="2" [c]="3" )'
>
> 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.
>
> I have rolled back to Bash 4.3.48-8 which has restored the previous
> functionality.
>
> Please advise.
>
> Matt D.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bash declare built-in regression loses array quotations
  2017-01-13 20:11 ` Eric Blake
@ 2017-01-13 20:56   ` Matt D.
  0 siblings, 0 replies; 4+ messages in thread
From: Matt D. @ 2017-01-13 20:56 UTC (permalink / raw)
  To: cygwin

My scripts have been updated to account for breaking changes in Bash 4.4 
and I have updated all of my Cygwin packages back to the latest version.

I am no longer receiving any assertions. Was I wrong to assume that I 
could selectively roll back Bash to 4.3 as I did?


Matt D.

On 1/13/2017 3:11 PM, Eric Blake wrote:
> 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.
>>
>> The following test will illustrate the change:
>> declare -A list
>> list[a]=1
>> list[b]=2
>> list[c]=3
>> declare -p | grep list=
>>
>> On Bash 4.4.5(1) the output is:
>> declare -A list=([a]="1" [b]="2" [c]="3" )
>>
>> Previously the result was:
>> declare -A list='([a]="1" [b]="2" [c]="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 the
>>> 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 compatibility
>>> options in COMPAT or the man page for more details.
> ...
>>> q.  The declare builtin no longer displays array variables using the compound
>>>      assignment syntax with quotes; that will generate warnings when re-used 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 '').
>
>>
>> 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.
>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-13 20:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-13 20:00 Bash declare built-in regression loses array quotations Matt D.
2017-01-13 20:11 ` Eric Blake
2017-01-13 20:56   ` Matt D.
2017-01-13 20:15 ` Matt D.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).