Re: nitpick: a=([9223372036854775807]=1 2 3)

2014-12-16 Thread Chet Ramey
On 12/16/14 5:10 PM, Stephane Chazelas wrote: > bash-4.3$ a=([9223372036854775806]=1 2 3 4) > bash-4.3$ echo "${!a[@]}" > -9223372036854775808 -9223372036854775807 9223372036854775806 > 9223372036854775807 > > That wraps but as signed longs, which means we get negative > indexes which we can't ea

Re: declare a="$b" if $a previously set as array

2014-12-16 Thread Stephane Chazelas
2014-12-16 21:49:58 +, Stephane Chazelas: [...] > 1.1 litteral array assignment. [...] > 1.2 litteral scalar assignment [...] > 2. words that don't form valid assignments. > > Those are parsed as normal command line arguments. > > declare \a=(...) > > would get a syntax error because of the

nitpick: a=([9223372036854775807]=1 2 3)

2014-12-16 Thread Stephane Chazelas
bash-4.3$ a=([9223372036854775806]=1 2 3 4) bash-4.3$ echo "${!a[@]}" -9223372036854775808 -9223372036854775807 9223372036854775806 9223372036854775807 That wraps but as signed longs, which means we get negative indexes which we can't easily use. bash-4.3$ echo "${a[@]}" 3 4 1 2 bash-4.3$ for i

Re: declare a="$b" if $a previously set as array

2014-12-16 Thread Stephane Chazelas
2014-12-15 22:00:54 -0500, Chet Ramey: > On 12/14/14 4:44 PM, Stephane Chazelas wrote: > > > There's still a (security) issue with > > > > declare -x/-l/-r > > that may still be used in non-function contexts (not "export" or > > "readonly"), and as result for things like: > > > > saved=$(export

Re: declare a="$b" if $a previously set as array

2014-12-16 Thread Chet Ramey
On 12/15/14, 9:41 PM, Linda Walsh wrote: > Though I just ran into a bit of weirdness (in 4.2.45) > (output is commented out and indented): > > env -i /bin/bash --norc --noprofile > declare -a ar=(ONE TWO THREE) > declare -p ar > # declare -a ar='([0]="ONE" [1]="TWO" [2]="THREE")' > >

Re: declare a="$b" if $a previously set as array

2014-12-16 Thread Chet Ramey
On 12/16/14, 2:53 AM, Dan Douglas wrote: > On Sunday, December 14, 2014 02:39:29 PM Chet Ramey wrote: >> And we get to the fundamental issue. Is it appropriate to require >> arguments to declaration commands to be valid assignment statements when >> the parser sees them, instead of when the builti

Re: declare a="$b" if $a previously set as array

2014-12-16 Thread Stephane Chazelas
2014-12-16 12:30:52 +, Stephane Chazelas: > 2014-12-16 01:53:52 -0600, Dan Douglas: > [...] > > That would be one way but I think this can be solved without going quite > > so far. How do you feel about these rules? > > > > 1. If a word that is an argument to declare is parsed as a valid >

Re: declare a="$b" if $a previously set as array

2014-12-16 Thread Stephane Chazelas
2014-12-16 01:53:52 -0600, Dan Douglas: [...] > That would be one way but I think this can be solved without going quite > so far. How do you feel about these rules? > > 1. If a word that is an argument to declare is parsed as a valid > assignment, then perform the assignment immedi