nameref/subscript fixes for unset builtin

2016-05-31 Thread Grisha Levit
The patch below addresses the following three issues: -- Doing unset -n n[0] actually unsets the target variable $ v=(0 1); declare -n n=v $ unset -n n[0] $ declare -p n vdeclare -n n="v" bash: declare: v: not found -- Unsetting namerefs t

[minor] declare -F issues w/ eval'ed functions

2016-05-31 Thread Grisha Levit
in an interactive shell, function definitions eval’ed in another function get a line number of 0 in declare -F output and in the presence of a DEBUG trap, they get some really bogus negative number (seems to depend on the line number where the function executed in the trap was defined?) $ s() { ev

Re: declare builtin prints erroneous error on array append

2016-05-31 Thread Chet Ramey
On 5/31/16 4:08 PM, Grisha Levit wrote: > The assignment works fine though… > > |$ declarevar+=(X) bash: declare: `var+': not a valid identifier $ *declare* > -p var declare -a var=([0]="X")| Thanks, another easy fix. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer

declare builtin prints erroneous error on array append

2016-05-31 Thread Grisha Levit
The assignment works fine though… $ declare var+=(X) bash: declare: `var+': not a valid identifier $ *declare* -p var declare -a var=([0]="X") ​

Re: declare checks on valid nameref names don't account for +=

2016-05-31 Thread Chet Ramey
On 5/31/16 3:40 PM, Grisha Levit wrote: > Also seems like after an invalid nameref assignment is encountered, > |declare| works oddly on remaining assignments that are part of the same > command: Thanks. This was an easy fix. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chauce

Re: declare checks on valid nameref names don't account for +=

2016-05-31 Thread Grisha Levit
Also seems like after an invalid nameref assignment is encountered, declare works oddly on remaining assignments that are part of the same command: $ *unset* -n bad good $ declare -n bad+=. good=var bash: declare: `.': not a valid identifier $ *declare* -p good declare -- good="var"# created,

Re: declare checks on valid nameref names don't account for +=

2016-05-31 Thread Grisha Levit
On Wed, May 25, 2016 at 3:29 PM, Chet Ramey wrote: > Thanks for the report. Both of these cases should be caught > Is it deliberate that with the latest changes a faulty += RHS causes an existing valid nameref to be unset? $ declare -n ref=re $ declare -n ref+=f bash: ref: nameref variable sel

Re: param expansion with single-character special vars in the environment

2016-05-31 Thread Chet Ramey
On 5/27/16 1:38 PM, Grisha Levit wrote: > How about removing the nameref attribute from an existing readonly > variable? This is currently allowed but perhaps for completeness it should > be forbidden? For ksh93 compatibility, bash should prevent the readonly attribute from being removed from re

Re: bash-4.3 p42 Parser bug: for ((; 1<(1);)); do ...; done

2016-05-31 Thread Chet Ramey
On 5/30/16 6:56 AM, Sergey Tselikh wrote: > Bash Version: 4.3 > Patch Level: 42 > Release Status: release > > Description: > "<(...)" construct triggers syntax error in "for ((...; ...; ...)); do ...; > done" syntax. > > Repeat-By: > $ for ((; 1<(1); )); do ...; done > bash: syntax error near un