tools: don't attempt to overwrite kconfig if checking fails
What changed, and why it matters
This is a small fix to a developer helper script (format.sh) used during code formatting. It prevents the script from trying to move a temporary file into place when a configuration-file check fails or never creates that temporary file. The change is about avoiding a build-tool error, not about stopping an attacker or protecting user funds.
No security action required; treat as a normal tooling fix.
Security signals we found
No security-relevant signal in the diff
Change is in a build/development helper script, not firmware logic, cryptography, or network handling
Evidence from the diff
The patch modifies format.sh. Previously the script ran check_kconfigs.py on main/Kconfig.projbuild and then unconditionally moved ${KCONFIG_FILE}.new over ${KCONFIG_FILE}. If the checker failed without producing the .new file, mv would error out. The patch deletes any stale .new file first and only moves the .new file if it exists. This is a robustness improvement in a formatting/checking helper, not a security boundary fix.
Changed components
format.shInspect captured patch +2 / −1
diff --git a/format.sh b/format.sh
index 663049c..edefa68 100755
--- a/format.sh
+++ b/format.sh
@@ -30,6 +30,7 @@ fi
KCONFIG_FILE=main/Kconfig.projbuild
if [ -x ${IDF_PATH}/tools/ci/check_kconfigs.py ]; then
+ rm -f ${KCONFIG_FILE}.new
${IDF_PATH}/tools/ci/check_kconfigs.py ${KCONFIG_FILE} || true
- mv ${KCONFIG_FILE}.new ${KCONFIG_FILE}
+ [ -f ${KCONFIG_FILE}.new ] && mv ${KCONFIG_FILE}.new ${KCONFIG_FILE}
fi
Why this scored 17/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.