[U-Boot] [PATCH] Handle environment variables like commands

Wolfgang Denk wd at denx.de
Wed Oct 15 14:25:20 CEST 2008


Dear Stefano,

In message <48F5DBB7.4070307 at babic.homelinux.org> you wrote:
> Wolfgang Denk wrote:
> 
> > Good catch. Yes, this must be prevented. Any variable named "builtin"
> > must be ignored here - i. e. we should issue  an  erro  when  someone
> > tries  a  "setenv", and ignore this variable explicitly (just in case
> > someone sneaks this into the default environment,  or  uses  un-fixed
> > Linux tools to create such a variable).
> 
> I know, I wanted to know which is the preferred method to avoid that.
> One way is to avoid to set the variable, as you suggest.
> The other way is never execute a variable with the name "builtin" in the
> command interpreter: "setenv builtin <something>" remains possible but
> "builtin <command>" calls always the U-Boot commands.

We should do both: avoid that the variable gets set, and raise  error
messages  (both  in setenv() and in the fw_setenv Linux tool), but we
should also be defensive and never execute  it  if  we  run  into  it
(which  could  for  example  happen  if we're being poresented an old
environment where some user defined such a variable).

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You said you  didn't  want  to  use  CGI.pm,  but  methinks  you  are
needlessly reinventing the wheel, one spoke at a time. Either you are
masochistic,  or  you  just haven't seen enough of what CGI.pm can do
for you. -- Randal L. Schwartz in <8cyb81rg81.fsf at gadget.cscaper.com>


More information about the U-Boot mailing list