[PATCH] RFC: nvedit: support doing one (extra) expansion of the value in "env set"

Wolfgang Denk wd at denx.de
Tue Feb 11 17:30:55 CET 2020


Dear Rasmus Villemoes,

In message <20200205010812.20373-1-rasmus.villemoes at prevas.dk> you wrote:
> Currently, there's no way to fetch the value of an environment
> variable whose name is stored in some other variable, or generated from
> such - in non-working pseudo-code,
>
>   ${${varname}}
>   ${array${index}}

HUSH does not support arrays anyway...

> This forces some scripts to needlessly duplicate logic and hardcode
> assumptions. For example, in an A/B scheme with three variables
>
> BOOT_ORDER # Either "A B" or "B A" depending on which slot was last updated
> BOOT_A_LEFT # 0..3
> BOOT_B_LEFT # 0..3
>
> when one needs to determine the slot to boot from, one does something
> like

Well, there _are_ other ways...

> This has been lightly tested in the sandbox. I'll add some proper unit
> tests, update the help texts and try to handle the Kconfig issue if
> this is something that might be accepted.

I'm pretty sure this will blow up in your face in real life, because
if side effects on existing shell scripts even if you don't
expect this.  This needs _lots_ of testing with existing code /
scripts.

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
"The greatest warriors are the ones who fight for peace."
- Holly Near


More information about the U-Boot mailing list