[PATCH v2 2/6] patman: Fix implicit command inserting

Simon Glass sjg at chromium.org
Tue Jul 5 11:59:06 CEST 2022


On Fri, 1 Jul 2022 at 14:24, Douglas Anderson <dianders at chromium.org> wrote:
>
> The logic to insert an implicit command has always been a bit broken
> but it was masked by another bug fixed in the patch ("patman: Don't
> look at sys.argv when parsing settings"). Specifically, imagine that
> you're just calling patman like this:
>
>   patman -c1
>
> After the parse_known_args() command then the "-c1" will have been
> parsed and we'll have no command. The "rest" variable will be an empty
> list. Going into the logic you can see that nargs = 0. The implicit
> insertion of send ideally would create an argument list of:
>   ['-c1', 'send']
> ...but it doesn't because argv[:-0] is the same as argv[:0] and that's
> an empty list.
>
> Let's fix this little glitch.
>
> Signed-off-by: Douglas Anderson <dianders at chromium.org>
> Tested-by: Brian Norris <briannorris at chromium.org>
> Reviewed-by: Brian Norris <briannorris at chromium.org>
> ---
>
> (no changes since v1)
>
>  tools/patman/main.py | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list