summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2026-05-14 15:39:22 -0600
committerTom Rini <[email protected]>2026-05-14 15:39:22 -0600
commit9a13d08732509fd31e9070989570e6d6bd2ad007 (patch)
tree0489ed69b340eb610c676f1214e9218294cef0d0 /include
parente3e651c480c46b332f16a7555b97c6c6fd640a40 (diff)
parent93d7dc20e80e33ace9b871de44877548642f86cb (diff)
Merge patch series "test: Quote variables in 'test -n' expressions across boards"
Simon Glass <[email protected]> says: Several boards use 'test -n ${var}' (unquoted) in env scripts to detect an empty variable and trigger a fallback or skip a hook. That works only because of a U-Boot 'test' quirk where calls with argc < 3 returned false; an empty variable made the expression 'test -n' (one operand) and hit that path. Commit 8b0619579b22 ("cmd: test: fix handling of single-argument form of test") aligned 'test' with POSIX so those expressions flipped to true. f7e7c55e53e8 ("cmd: test: add bug-compatibility special case for 'test -n'") restored the old behaviour for the exact 'test -n' (one arg) case, so the boards are not broken at runtime today, but the reliance on a bug-compat path isn't great. This series updates various boards to quote each affected variable so the emptiness check is explicit and does not depend on the special-case path. Each commit carries a Fixes: tag pointing at 8b0619579b22 Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'include')
-rw-r--r--include/configs/aristainetos2.h2
-rw-r--r--include/configs/beaglev_fire.h2
-rw-r--r--include/configs/draco-etamin.h4
-rw-r--r--include/configs/mccmon6.h2
-rw-r--r--include/configs/siemens-am33x-common.h12
-rw-r--r--include/configs/siemens-env-common.h8
-rw-r--r--include/env/ti/ti_common.env2
7 files changed, 16 insertions, 16 deletions
diff --git a/include/configs/aristainetos2.h b/include/configs/aristainetos2.h
index 8a66b1275df..2078ebc5282 100644
--- a/include/configs/aristainetos2.h
+++ b/include/configs/aristainetos2.h
@@ -211,7 +211,7 @@
"${pubkey}\0" \
"rescueboot=echo Booting rescue system ...; " \
"run addmtd addmisc;" \
- "if test -n ${rescue_reason}; then run rescue_reason;fi;" \
+ "if test -n \"${rescue_reason}\"; then run rescue_reason;fi;" \
"run boot_board_type;" \
"if bootm ${fit_addr_r}; then ; " \
"else " \
diff --git a/include/configs/beaglev_fire.h b/include/configs/beaglev_fire.h
index e3ee0f02f2d..8724a71504c 100644
--- a/include/configs/beaglev_fire.h
+++ b/include/configs/beaglev_fire.h
@@ -30,7 +30,7 @@
#define BOOTENV_DESIGN_OVERLAYS \
"design_overlays=" \
- "if test -n ${no_of_overlays}; then " \
+ "if test -n \"${no_of_overlays}\"; then " \
"setenv inc 1; " \
"setenv idx 0; " \
"fdt resize ${dtbo_size}; " \
diff --git a/include/configs/draco-etamin.h b/include/configs/draco-etamin.h
index 6ae85b575b7..b1b403980b1 100644
--- a/include/configs/draco-etamin.h
+++ b/include/configs/draco-etamin.h
@@ -99,10 +99,10 @@
"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 " \
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 " \
diff --git a/include/configs/siemens-am33x-common.h b/include/configs/siemens-am33x-common.h
index a918dc1350c..da822556909 100644
--- a/include/configs/siemens-am33x-common.h
+++ b/include/configs/siemens-am33x-common.h
@@ -104,11 +104,11 @@
"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;" \
@@ -205,11 +205,11 @@
"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;" \
@@ -279,10 +279,10 @@
"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 " \
diff --git a/include/configs/siemens-env-common.h b/include/configs/siemens-env-common.h
index c028823e1eb..8ced77cc5e2 100644
--- a/include/configs/siemens-env-common.h
+++ b/include/configs/siemens-env-common.h
@@ -81,12 +81,12 @@
*/
#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; " \
@@ -103,11 +103,11 @@
*/
#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;" \
diff --git a/include/env/ti/ti_common.env b/include/env/ti/ti_common.env
index 62b93eb25c4..e6ceaa17adc 100644
--- a/include/env/ti/ti_common.env
+++ b/include/env/ti/ti_common.env
@@ -24,7 +24,7 @@ get_fit_config=setexpr name_fit_config gsub / _ conf-${fdtfile}
run_fit=run get_fit_config; bootm ${addr_fit}#${name_fit_config}${overlaystring}
bootcmd_ti_mmc=
run init_${boot};
- if test -n ${board_init}; then
+ if test -n "${board_init}"; then
echo Running board_init ...;
run board_init;
fi;