]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
siemens: Quote A/B flags in env tests
authorSimon Glass <sjg@chromium.org>
Sun, 3 May 2026 20:49:21 +0000 (14:49 -0600)
committerTom Rini <trini@konsulko.com>
Thu, 14 May 2026 21:39:09 +0000 (15:39 -0600)
The Siemens am33x-common, env-common and draco-etamin headers gate
boot-partition selection logic on:

    if test -n ${A}; then ...
    if test -n ${B}; then ...

A and B are flags that the upgrade machinery sets to mark "the other
partition just became active".  The default state is unset, in which
case the expression expands to 'test -n' with no operand and relies
on a U-Boot 'test' quirk that treats a missing operand as false to
skip the branch.

Quote each variable so an unset A or B 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@chromium.org>
include/configs/draco-etamin.h
include/configs/siemens-am33x-common.h
include/configs/siemens-env-common.h

index 6ae85b575b74bb8f375423e4b41c2a63a05c6079..b1b403980b1c16f86d52b78485456cce3ab1cf24 100644 (file)
        "nand_args=run bootargs_defaults;" \
                "mtdparts default;" \
                "setenv ${partitionset_active} true;" \
-               "if test -n ${A}; then " \
+               "if test -n \"${A}\"; then " \
                        "setenv nand_active_ubi_vol ${rootfs_name}_a;" \
                "fi;" \
-               "if test -n ${B}; then " \
+               "if test -n \"${B}\"; then " \
                        "setenv nand_active_ubi_vol ${rootfs_name}_b;" \
                "fi;" \
                "setenv nand_root ubi0:${nand_active_ubi_vol} rw " \
index a918dc1350c48e32d7cab6cab5b9613d271dc892..da822556909958281cdfa48d4edc466fcc41a127 100644 (file)
                                "then " \
                                "setenv upgrade_available 0;" \
                                "setenv ${partitionset_active} true;" \
-                               "if test -n ${A}; then " \
+                               "if test -n \"${A}\"; then " \
                                        "setenv partitionset_active B; " \
                                        "env delete A; " \
                                "fi;" \
-                               "if test -n ${B}; then " \
+                               "if test -n \"${B}\"; then " \
                                        "setenv partitionset_active A; " \
                                        "env delete B; " \
                                "fi;" \
        "nand_args=run bootargs_defaults;" \
                "mtdparts default;" \
                "setenv ${partitionset_active} true;" \
-               "if test -n ${A}; then " \
+               "if test -n \"${A}\"; then " \
                        "setenv nand_active_ubi_vol ${nand_active_ubi_vol_A};" \
                        "setenv nand_src_addr ${nand_src_addr_A};" \
                "fi;" \
-               "if test -n ${B}; then " \
+               "if test -n \"${B}\"; then " \
                        "setenv nand_active_ubi_vol ${nand_active_ubi_vol_B};" \
                        "setenv nand_src_addr ${nand_src_addr_B};" \
                "fi;" \
        "nand_args=run bootargs_defaults;" \
                "mtdparts default;" \
                "setenv ${partitionset_active} true;" \
-               "if test -n ${A}; then " \
+               "if test -n \"${A}\"; then " \
                        "setenv nand_active_ubi_vol ${rootfs_name}_a;" \
                "fi;" \
-               "if test -n ${B}; then " \
+               "if test -n \"${B}\"; then " \
                        "setenv nand_active_ubi_vol ${rootfs_name}_b;" \
                "fi;" \
                "setenv nand_root ubi0:${nand_active_ubi_vol} rw " \
index c028823e1ebd248a35fc383b6a9c88b73265b7bc..8ced77cc5e292e49881f939ce2bc0b660b5d6158 100644 (file)
  */
 #define ENV_FCT_TOGGLE_PARTITION "toggle_partition="\
        "setenv ${partitionset_active} true;" \
-       "if test -n ${A}; " \
+       "if test -n \"${A}\"; " \
        "then " \
                "setenv partitionset_active B; " \
                "env delete A; " \
        "fi;" \
-       "if test -n ${B}; "\
+       "if test -n \"${B}\"; "\
        "then " \
                "setenv partitionset_active A; " \
                "env delete B; " \
  */
 #define ENV_EMMC_FCT_SET_ACTIVE_PARTITION "set_partition=" \
        "setenv ${partitionset_active} true;" \
-       "if test -n ${A}; " \
+       "if test -n \"${A}\"; " \
        "then " \
                "setenv mmc_part_nr 1;" \
        "fi;" \
-       "if test -n ${B}; " \
+       "if test -n \"${B}\"; " \
        "then " \
                "setenv mmc_part_nr 2;" \
        "fi;" \