[PATCH] env: introduce CONFIG_ENV_DOTVARS_TEMPORARY

Rasmus Villemoes rasmus.villemoes at prevas.dk
Tue Jan 21 08:44:37 CET 2020


On 20/01/2020 17.44, Wolfgang Denk wrote:
> Dear Rasmus Villemoes,
> 
> In message <20200108134247.31443-1-rasmus.villemoes at prevas.dk> you wrote:
>> The printenv command already by default hides variables beginning with
>> a dot. It can be useful to take that convention even further, and
>> prevent such variables from ever being stored persistently (and
>> ignored if they happen to exist in stable storage).
>>
>> This way, one can freely use such variable names in script logic,
>> without worrying about random temporary variables leaking to
>> persistent storage and/or to/from another U-boot "session".
> 
> This is not a good idea. The decision whether a variable shall be
> stored permanently or not, or wheter it is readonly or writable, and
> other such properties should never based on their name. 

Sorry, but what other property of the variable could possibly determine
those things, then?

 There may
> be many good reasons that some .name variable _shall_ be persistent.

Sure, absolutely. Which is why this is entirely opt-in for those who
know they won't need that, but do have some semi-complicated script that
interacts with various commands that return their output via an
environment variable.

> Naked-by: Wolfgang Denk <wd at denx.de>

Ah, now I see how  env_flags_varaccess is actually implemented,
involving a .flags special variable. OK, then I can certainly see why
one would not want that to be excluded from the environment - I just
thought the idea behind "printenv" hiding dot-variables by default was
that those were considered temporary, and not special in this way.

So, would you accept introducing env_flags_varaccess_temporary, for
which I could then add tmp_.*:st ?

Thanks,
Rasmus


More information about the U-Boot mailing list