[PATCH] board: toradex: Quote variables in `test` cmd expression

Francesco Dolcini francesco at dolcini.it
Wed Apr 1 07:10:27 CEST 2026


On Tue, Mar 31, 2026 at 10:10:10AM +0200, Franz Schnyder wrote:
> From: Franz Schnyder <franz.schnyder at toradex.com>
> 
> With correct POSIX handling, unquoted empty variables can turn the
> expression like
> 	test -n ${fdtfile}
> into
> 	test -n
> 
> The POSIX handling for single argument `test` evaluates it as true,
> so the fallback initialization will be skipped unexpectedly.
> Quoting variable expansions in `test` expressions will always result in
> correct behavior for empty and non-empty values.
> This change was triggered by
> commit 8b0619579b22 ("cmd: test: fix handling of single-argument form of test")
> The aim is to have a less fragile codebase that is not dependent on a
> quirk of the shell implementation.
> 
> Use quoted variable expansions in `test` expressions throughout.
> 
> Signed-off-by: Franz Schnyder <franz.schnyder at toradex.com>

Acked-by: Francesco Dolcini <francesco.dolcini at toradex.com>



More information about the U-Boot mailing list