mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@barebox.org>
Cc: barebox@lists.infradead.org, "Claude Opus 4.6" <noreply@anthropic.com>
Subject: Re: [PATCH 3/4] MAKEALL: error out on options placed after the defconfig argument
Date: Mon, 23 Feb 2026 13:05:25 +0100	[thread overview]
Message-ID: <aZxChX3LLwJqhLHh@pengutronix.de> (raw)
In-Reply-To: <e9d4562c-b3cc-40e9-899f-f929e25d135f@barebox.org>

On Mon, Feb 23, 2026 at 12:52:52PM +0100, Ahmad Fatoum wrote:
> Hi,
> 
> On 2/23/26 12:50 PM, Sascha Hauer wrote:
> > On Mon, Feb 23, 2026 at 12:31:34PM +0100, Ahmad Fatoum wrote:
> >> 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).
> > 
> > Can't we use getopt for MAKEALL instead of getopts? getopt just does the
> > right thing.
> 
> When using MAKEALL with a labgrid yaml instead of a defconfig, it
> derives the defconfig name and interprets the options after the yaml as
> pytest options, so use of getopt would break that.

You can use -- as final argument which stops getopt parsing.

Sascha

> 
> Cheers,
> Ahmad
> 
> > 
> > Sascha
> > 
> >>
> >> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
> >> Signed-off-by: Ahmad Fatoum <a.fatoum@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
> >>
> >>
> >>
> > 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



  reply	other threads:[~2026-02-23 12:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-23 11:31 [PATCH 0/4] MAKEALL: sanity check command-line options more Ahmad Fatoum
2026-02-23 11:31 ` [PATCH 1/4] MAKEALL: early exit if config specified, but no arch Ahmad Fatoum
2026-02-23 11:31 ` [PATCH 2/4] MAKEALL: devel mode: abort if no positional config Ahmad Fatoum
2026-02-23 11:31 ` [PATCH 3/4] MAKEALL: error out on options placed after the defconfig argument Ahmad Fatoum
2026-02-23 11:50   ` Sascha Hauer
2026-02-23 11:52     ` Ahmad Fatoum
2026-02-23 12:05       ` Sascha Hauer [this message]
2026-02-23 12:06         ` Ahmad Fatoum
2026-02-23 11:31 ` [PATCH 4/4] MAKEALL: flock build directory to prevent concurrent builds Ahmad Fatoum
2026-02-23 14:55 ` (subset) [PATCH 0/4] MAKEALL: sanity check command-line options more Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aZxChX3LLwJqhLHh@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=a.fatoum@barebox.org \
    --cc=barebox@lists.infradead.org \
    --cc=noreply@anthropic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox