On 4/25/16 3:48 PM, Grisha Levit wrote: > There seems to be a bug that if an array variable with a name matching one > of the special single-character variables exists, then that variable is > used during substring expansion and parameter transformation. > > There is also a potential issue with namerefs, in that they allow > creating/modifying variables with invalid identifiers if a variable is > defined first and subsequently given the nameref attribute, which is how > the above behavior can be uncovered.
Yes, clearly the set of names that is acceptable as a value to a nameref variable needs to be constrained. That set should include valid shell identifiers, valid array references, and positional parameters (for compatibility with ksh93). Once you limit the set of names to omit the problematic ones, bugs like the one above don't happen. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/