Skip to content

fix(interactive): parse case alternatives in get_kernel_info_for_branch#9798

Open
iav wants to merge 1 commit into
mainfrom
fix/interactive-kernel-desc-case-alt
Open

fix(interactive): parse case alternatives in get_kernel_info_for_branch#9798
iav wants to merge 1 commit into
mainfrom
fix/interactive-kernel-desc-case-alt

Conversation

@iav
Copy link
Copy Markdown
Contributor

@iav iav commented May 10, 2026

Summary

Fixes #8957.

The awk parser in get_kernel_info_for_branch() searched the family conf for ^[[:space:]]*<branch>\), which matches a single-pattern case label like current) but not a case label with alternation like vendor | vendor-rt). With no match, the function returned an empty description and the menu fell back to a hardcoded label ("Vendor BSP kernel" for the vendor branch), so any custom KERNEL_DESCRIPTION inside an alternation block was silently lost.

Fix: extract the label (everything before the closing paren), split on | (with optional surrounding whitespace) and check each alternative against the requested branch.

Real-world impact: families/k3.conf and families/k3-beagle.conf both use vendor | vendor-rt) to share kernel/u-boot config between the two branches. Their KERNEL_DESCRIPTION was effectively dead code before this fix.

Single-label labels (vendor-edge), current) etc.) continue to match — they are just an n=1 case of the new alternation logic.

Test plan

Verified via standalone scaffold (.tmp/test-kernel-info-8957.sh) against real fixtures in the repo:

  • vendor in k3 family (alternation) → returns "Texas Instruments currently supported Processor SDK kernel" (was: empty → fallback "Vendor BSP kernel")
  • vendor-rt in k3 family (alternation) → returns same description (was: empty)
  • vendor in k3-beagle family (alternation) → returns "BeagleBoard.org (vendor) kernel" (was: empty)
  • vendor-rt in k3-beagle family (alternation) → returns same (was: empty)
  • vendor-edge in k3 family (single label, regression check) → returns "Texas Instruments latest pre-released Processor SDK kernel" (unchanged)
  • Unknown branch → returns empty (caller's fallback path handles)

Notes

  • Userpatches/board-conf overrides of KERNEL_DESCRIPTION are not addressed here — that's a separate architectural problem (text awk on a single file vs runtime evaluation of the full config flow). This PR fixes only the pat | pat) parser shortfall.

Summary by CodeRabbit

  • Bug Fixes
    • Improved kernel label parsing so single or multi-alternative branch labels are recognized exactly, producing more accurate kernel version and description info across boards.
    • Interactive kernel selection behavior unchanged; users will see correct descriptions and versions when choosing a kernel.

Review Change Stack

@iav iav requested a review from a team as a code owner May 10, 2026 18:38
@iav iav requested review from catalinii and martinayotte and removed request for a team May 10, 2026 18:38
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 49d4edc2-7ebd-479b-82ea-043782f4827e

📥 Commits

Reviewing files that changed from the base of the PR and between c8ad3b6 and 1055dd8.

📒 Files selected for processing (1)
  • lib/functions/configuration/interactive.sh

📝 Walkthrough

Walkthrough

Rewrites get_kernel_info_for_branch to parse both single and pipe-separated case labels in family config files, matching alternatives exactly; interactive_config_ask_branch retains previous behavior and only had formatting changes.

Changes

Kernel Configuration Parser

Layer / File(s) Summary
Kernel Info Parser Logic
lib/functions/configuration/interactive.sh
The awk matcher in get_kernel_info_for_branch now accepts both branch) and `pat1

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • armbian/build#9843: Touches get_kernel_info_for_branch with formatting-only changes; closely related to parser edits here.

Suggested reviewers

  • igorpecovnik

Poem

A rabbit hops through config lines with care,
It trims and splits each pipe to find a pair,
Branches matched exactly, descriptions clear,
No tangled labels left to disappear,
🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: parsing case alternatives in the get_kernel_info_for_branch function to handle combined labels like 'vendor | vendor-rt)'.
Linked Issues check ✅ Passed The PR directly addresses #8957 by fixing the awk-based parser to handle alternation-style case labels, restoring KERNEL_DESCRIPTION detection that was previously lost with fallback to defaults.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the case label parsing issue in get_kernel_info_for_branch; no unrelated modifications detected beyond the stated fix and whitespace normalization.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/interactive-kernel-desc-case-alt

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added 05 Milestone: Second quarter release Needs review Seeking for review Framework Framework components size/medium PR with more then 50 and less then 250 lines labels May 10, 2026
@igorpecovnik
Copy link
Copy Markdown
Member

I guess its correct now:
image

@Grippy98

@igorpecovnik igorpecovnik added 08 Milestone: Third quarter release and removed 05 Milestone: Second quarter release labels May 16, 2026
@iav iav force-pushed the fix/interactive-kernel-desc-case-alt branch from b0fd31e to c8ad3b6 Compare May 20, 2026 00:56
@github-actions github-actions Bot added the 05 Milestone: Second quarter release label May 20, 2026
…ch (#8957)

Fixes #8957.

The awk parser in get_kernel_info_for_branch() searched the family
conf for `^[[:space:]]*<branch>\)`, which matches a single-pattern
case label like `current)` but NOT a case label with alternation
like `vendor | vendor-rt)`. With no match, the function returned
an empty description and the menu fell back to a hardcoded label
("Vendor BSP kernel" for the vendor branch), so any custom
KERNEL_DESCRIPTION inside an alternation block was silently lost.

Fix: extract the label (everything before the closing paren),
split on `|` (with optional surrounding whitespace) and check each
alternative against the requested branch.

Real-world impact: families/k3.conf and families/k3-beagle.conf
both use `vendor | vendor-rt)` to share kernel/u-boot config
between the two branches. Their `KERNEL_DESCRIPTION` was effectively
dead code before this fix.

Single-label labels (`vendor-edge)`, `current)` etc.) continue to
match — they are just an n=1 case of the new alternation logic.

Assisted-by: Claude:claude-opus-4.7
@iav iav force-pushed the fix/interactive-kernel-desc-case-alt branch from c8ad3b6 to 1055dd8 Compare May 21, 2026 19:12
@github-actions github-actions Bot added size/small PR with less then 50 lines and removed size/medium PR with more then 50 and less then 250 lines labels May 21, 2026
@iav
Copy link
Copy Markdown
Contributor Author

iav commented May 21, 2026

@Grippy98 what do you think for #8957?

@Grippy98
Copy link
Copy Markdown
Contributor

This is great thank you for the fix!

@Grippy98
Copy link
Copy Markdown
Contributor

@martinayotte Can this be merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

05 Milestone: Second quarter release 08 Milestone: Third quarter release Framework Framework components Needs review Seeking for review size/small PR with less then 50 lines

Development

Successfully merging this pull request may close these issues.

[Bug]: Kernel Description and Version revert to defaults even if set as part of Board Config.

3 participants