[U-Boot] [PATCH v5 4/5] cmd: nvedit: env import can now import only variables passed as parameters
Wolfgang Denk
wd at denx.de
Fri Jun 29 12:52:29 UTC 2018
Dear Quentin,
In message <20180629121942.lm4qbfmm5ya7fsx2 at qschulz> you wrote:
>
> > I suggest that this isNOT the default behaviour. I think most
> > peaople would expect that this command only adds/replaces
> > environment settings, so omitting one value should not cause
> > unexpected behaviour.
>
> It's the default behaviour of himport_r.
Hm.... I don't see what you mean. himport_r imports a set of new
name=value pairs (in different formats); however, ther eis no way to
specify a name without a value, so himport_r by itself will not
delete any variables - it only overrides or adds.
> However, there's already a flag parameter so maybe I could just add an
> H_KEEP_VAR flag to keep the current default behaviour of himport_r
> (which is in a library) but add the feature you requested in the env
> import cmd, that should work I guess.
>
> There's already a -d option which basically, if I understood correctly,
> tells himport_r to erase the current env and use only the imported env.
Um... right - only with the -d option h_import_r will erase any
variables - without any name list, it process _all_ variables from
the import, and erase _any_ other. With a list of specified names,
it seems logical to me that only this list will be processed - i. e.
only these will be impoted or erased.
That was what I had in mind with consistent behaviour.
> Let's add a -k (for H_KEEP_VAR) to tell himport_r we want to keep
> variables that aren't in the imported env but requested to be loaded (or
> present in the imported env in one of the forms `var` or `var=`).
>
> Does this make sense? Is it the way you see it implemented?
No. I think it should be done as I explained before. Only with
"-d" existing variables shall be deleted, if they are not in the
imported blob. Then the behaviour is all the same, only the
selection of the names is different: without an argument list, it's
all names, and with an argument list it's only the names in the
list.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
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
There are very few personal problems that cannot be solved through a
suitable application of high explosives.
More information about the U-Boot
mailing list