bug-bash
[Top][All Lists]
Advanced

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

Re: Stumped on a question of scoping and unset.


From: Andreas Schwab
Subject: Re: Stumped on a question of scoping and unset.
Date: Thu, 26 May 2011 17:40:40 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Freddy Vulto <fvulto@gmail.com> writes:

> On 09:11, Steven W. Orr wrote:
>> typeset $1 && upvars -a$nn $1 "${aval[@]}"
>> 
>> The implication seems to be that the typeset command can fail. Is
>> this a reasonable thing to worry about?
>
> The idea is that a typeset - besides declaring a variable local -
> protects upvars from malicious variable names:
>
>     $ typeset 'ls -l'
>     bash: typeset: `ls -l': not a valid identifier
>     $ echo $?
>     1

Unfortunately, that is subverted by the unquoted use of $1 above.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



reply via email to

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