[PATCH 3/4] MAKEALL: error out on options placed after the defconfig argument

Ahmad Fatoum a.fatoum at barebox.org
Mon Feb 23 03:31:34 PST 2026


getopts stops parsing at the first non-option argument, so options
like -k after the defconfig name silently end up as positional
arguments. For bare defconfigs these get misinterpreted as pytest
options and are silently ignored, leading to a build without the
intended configuration.

Detect this by checking for trailing arguments when any positional
argument is a bare defconfig (not a labgrid .yaml config, where
extra arguments are intentionally forwarded to pytest).

Co-Authored-By: Claude Opus 4.6 <noreply at anthropic.com>
Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
 MAKEALL | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/MAKEALL b/MAKEALL
index c36aed625820..dd0b7f8003cc 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -440,6 +440,15 @@ else
 
 		configs+=($i)
 	done
+	if [ ${#pytest_opts[@]} -gt 0 ]; then
+		for i in "${configs[@]}"; do
+			if ! [[ $i =~ .yaml$ ]]; then
+				echo "error: unexpected arguments after defconfig: ${pytest_opts[*]}" >&2
+				echo "hint: place all options before the defconfig argument" >&2
+				exit 1
+			fi
+		done
+	fi
 	for i in "${configs[@]}"; do
 		config=$i
 		if [[ $i =~ ^.*/([^/]+)/([^@]*@|)([^.]+).yaml$ ]]; then
-- 
2.47.3




More information about the barebox mailing list