bug-bash
[Top][All Lists]
Advanced

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

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


From: Chet Ramey
Subject: Re: declare a="$b" if $a previously set as array
Date: Sun, 14 Dec 2014 16:05:09 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 12/9/14 5:51 PM, konsolebox wrote:
> On Tue, Dec 9, 2014 at 7:29 AM, Linda Walsh <bash@tlinx.org> wrote:
> 
>>         Instead of dumbing down bash, why not lobby for bash to record
>> which variables contain tainted input -- and throw an error they are eval'ed
>> (based on an option setting, of course)?
> 
> For compatibility's sake I think it's a good idea to have an option
> (through shopt [and set / a command-line argument]) to make a strict
> behavior of declare in which assignment of variables are strictly the
> same as the way they are normally assigned without it.

This is unnecessarily limiting.  There's no reason to completely disallow
constructs like `declare -x $one=$two' or even `declare -l a=$value'.  The
question is what to do about potentially dangerous -- from some
perspectives -- uses of those constructs.  So far we've identified
compound assignment as one of those uses; assignment to an associative
array using a subscript containing a command substitution might be another.

-- 
``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]