Re: [PATCH v2] checkkconfigsymbols: resolve revisions before resetting the tree

From: Nicolas Schier

Date: Fri Dec 04 2026 - 11:44:36 EST


On Mon, Sep 07, 2026 at 01:37:39PM +0300, Erkan Erdem wrote:
> The commit comparison resets the current branch to commit_a before
> resolving commit_b. If the second revision is HEAD or the current branch
> name, it then resolves to the first revision. For example, --diff
> HEAD^..HEAD compares the parent with itself and silently misses newly
> undefined symbols. The same problem affects --commit with the current
> branch name.
>
> Resolve and verify both revisions as commits before the first reset.
> This keeps their meaning stable throughout the comparison and rejects
> invalid endpoints before changing the working tree.
>
> Keep lookup diagnostics separate from the resolved hashes. Use the
> resolved range for --find too, since resetting also updates ORIG_HEAD.
>
> Fixes: b1a3f243485f ("checkkconfigsymbols.py: make it Git aware")
> Link: https://lore.kernel.org/20210901145212.478066-1-arielmarcovitch@xxxxxxxxx/
> Assisted-by: LLM
> Signed-off-by: Erkan Erdem <hexvalid@xxxxxxxxx>
> ---
>
> Changes in v2, addressing Julian Braha's review:
> - Submit this fix independently of the unrelated Kconfig input fix.
> - No code changes from v1.
> - Include the original Git-awareness author and contributors to the
> previous HEAD-reference fix in Cc.
>
> v1: https://lore.kernel.org/all/20260905123237.40670-2-hexvalid@xxxxxxxxx/
>
> An AI coding assistant found the issue, prepared the fix and changelog,
> and ran the original verification. The same assistant prepared this
> standalone v2 submission.
>
> Validation:
> - The code is unchanged from v1, which passed 15 actual-CLI cases in
> disposable Git repositories, including HEAD-relative ranges, branch
> names, hashes, tags, annotated tags, ambiguous names, --commit,
> --find, ORIG_HEAD and invalid or non-commit endpoints.
> - Those checks verified HEAD, current branch, index and tracked file
> contents after every invocation.
> - The script in mainline df2908090cda368b01ff43709f51890076c56157 still
> matches the original pre-fix file; this patch applies independently.
>
> scripts/checkkconfigsymbols.py | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/checkkconfigsymbols.py b/scripts/checkkconfigsymbols.py
> index 36c920e71..e0a1a631b 100755
> --- a/scripts/checkkconfigsymbols.py
> +++ b/scripts/checkkconfigsymbols.py
> @@ -150,6 +150,13 @@ def print_undefined_symbols():
> undefined_a = {}
> undefined_b = {}
>
> + commit_a = execute(["git", "rev-parse", "--verify", commit_a + "^{commit}"],
> + stderr=None).strip()
> + commit_b = execute(["git", "rev-parse", "--verify", commit_b + "^{commit}"],
> + stderr=None).strip()

Thanks, I like that fix.

Are you planning to send a v3, respecting the feedback from Julian and
Nathan?

--
Nicolas