[PATCH 5/6] mccmon6: Quote recovery_status in bootcmd test

Łukasz Majewski lukma at nabladev.com
Mon May 4 08:34:28 CEST 2026


On Sun,  3 May 2026 14:49:23 -0600
Simon Glass <sjg at chromium.org> wrote:

> The mccmon6 bootcmd starts with:
> 
>     if test -n ${recovery_status}; then run boot_recovery; ...
> 
> The default state is "no recovery requested", i.e. recovery_status
> unset.  The expression then expands to 'test -n' with no operand and
> relies on a U-Boot 'test' quirk that treats a missing operand as
> false to skip recovery.
> 
> Quote the variable so an unset recovery_status expands to 'test -n ""'
> and the emptiness check is explicit.
> 
> Fixes: 8b0619579b22 ("cmd: test: fix handling of single-argument form
> of test") Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> 
>  include/configs/mccmon6.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/configs/mccmon6.h b/include/configs/mccmon6.h
> index 9f401718bfb..0cf62d6bda8 100644
> --- a/include/configs/mccmon6.h
> +++ b/include/configs/mccmon6.h
> @@ -88,7 +88,7 @@
>  		     "bootm $loadaddr};reset;" \
>  		"fi\0" \
>  	"bootcmd=" \
> -		"if test -n ${recovery_status}; then " \
> +		"if test -n \"${recovery_status}\"; then " \
>  		     "run boot_recovery;" \
>  		"else " \
>  		     "if test ! -n ${boot_medium}; then " \

Reviewed-by: Łukasz Majewski <lukma at nabladev.com>

-- 
Best regards,

Lukasz Majewski

--
Nabla Software Engineering GmbH
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: office at nabladev.com
Managing Director : Stefano Babic


More information about the U-Boot mailing list