bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Chet Ramey
Subject: Re: param expansion with single-character special vars in the environment
Date: Sun, 1 May 2016 22:06:40 -0400
User-agent: 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.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]