[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: param expansion with single-character special vars in the environmen
Re: param expansion with single-character special vars in the environment
Sun, 1 May 2016 22:06:40 -0400
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.0
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.
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU address@hidden http://cnswww.cns.cwru.edu/~chet/
- Re: param expansion with single-character special vars in the environment,
Chet Ramey <=