engineering: [osmodifier follow-up] track submenu blocks and brace depth in find_non_recovery_linux_lines#661
Merged
bfjelds merged 1 commit intoMay 27, 2026
Conversation
7b69106 to
0355ba3
Compare
…_lines
On systems with multiple kernels installed, grub2-mkconfig produces a
top-level menuentry plus a submenu 'Advanced options for ...' containing
additional menuentries. The previous parser did not track brace depth or
submenu blocks, causing it to find >1 non-recovery linux lines and bail
with 'expected 1, found N'.
This commit adds brace-depth tracking (with quote-awareness) and skips
submenu { ... } blocks entirely, so only top-level menuentries contribute
linux lines. This goes beyond the Go implementation which has the same
limitation.
New tests cover: single-kernel with submenu, multi-kernel with submenu,
submenu-before-entry ordering, submenu-only (error case), and braces
inside quoted titles.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
eb548c7 to
88cc8b3
Compare
026dd6f
into
user/bfjelds/mjolnir/consolidate-grub-parser
12 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔍 Description
** This is a change in behavior from Go osmodifier behavior **
Follow up to:
On systems with multiple kernels installed, grub2-mkconfig produces a top-level menuentry plus a submenu 'Advanced options for ...' containing additional menuentries. The previous parser did not track brace depth or submenu blocks, causing it to find >1 non-recovery linux lines and bail with 'expected 1, found N'.
This commit adds brace-depth tracking (with quote-awareness) and skips submenu { ... } blocks entirely, so only top-level menuentries contribute linux lines. This goes beyond the Go implementation which has the same limitation.
New tests cover: single-kernel with submenu, multi-kernel with submenu, submenu-before-entry ordering, submenu-only (error case), and braces inside quoted titles.