Skip to content

partitioning: fix #9201 /etc/fstab entry (double comma)#9488

Open
iav wants to merge 1 commit intomainfrom
fix/9201-fstab-double-comma
Open

partitioning: fix #9201 /etc/fstab entry (double comma)#9488
iav wants to merge 1 commit intomainfrom
fix/9201-fstab-double-comma

Conversation

@iav
Copy link
Copy Markdown
Contributor

@iav iav commented Mar 5, 2026

Summary

Fixes #9201: double-comma bug in generated /etc/fstab entries (e.g. defaults,,commit=120,errors=remount-ro for ext4).

The root cause: mountopts[] values start with a leading comma by convention (see line 26 comment), but all call sites were adding an explicit comma before the expansion, doubling it.

This is the complete fix suggested by @EvilOlaf in #9227 (#9227 (comment)) — removing the hardcoded , after defaults at all call sites, rather than patching only line 369.

Changes

Summary by CodeRabbit

  • Refactor
    • Normalized how filesystem mount options are concatenated for Btrfs root and subvolume mounts. Formatting-only change; effective options (e.g., commit settings) and user behavior remain unchanged.

@iav iav requested a review from a team as a code owner March 5, 2026 00:43
@iav iav requested review from TRSx80 and hzyitc and removed request for a team March 5, 2026 00:43
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 5, 2026

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • Needs review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8f2413a8-566f-4b81-95f2-121867137faa

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Normalization of mount option concatenation in lib/functions/image/partitioning.sh: adjusted how ${mountopts[$ROOTFS_TYPE]} is concatenated into mount commands and /etc/fstab entries to eliminate spurious commas and preserve intended options (e.g., commit=120) without changing effective option sets.

Changes

Cohort / File(s) Summary
Partitioning mount-option normalization
lib/functions/image/partitioning.sh
Removed explicit per-rootfs-type mountopts assignment and updated concatenation patterns for root and subvolume mounts and corresponding fstab entries (changed -odefaults,${mountopts[...]}-odefaults${mountopts[...]} and defaults,${mountopts[...]}defaults${mountopts[...]}) to prevent double commas and normalize formatting.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I nudged a comma out of line,
No more double, systems shine.
Mounts now join as friends, not foes,
fstab sings where chaos froze.
Hoppity, boot bliss—onward it goes.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the specific bug fix (double comma in /etc/fstab) and references the related issue #9201, accurately summarizing the main change.
Linked Issues check ✅ Passed The pull request successfully addresses all coding requirements from issue #9201: eliminating double commas in /etc/fstab mount options, fixing root filesystem mount option assembly, and ensuring consistency across all affected lines.
Out of Scope Changes check ✅ Passed All changes in lib/functions/image/partitioning.sh are directly related to fixing the double comma issue in /etc/fstab entries described in issue #9201; no out-of-scope modifications detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/9201-fstab-double-comma

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 size/small PR with less then 50 lines Needs review Seeking for review Framework Framework components labels Mar 5, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
lib/functions/image/partitioning.sh (1)

345-345: Avoid overriding mountopts[btrfs] inside the btrfs block.

Line 345 duplicates the default from Line 85 and can silently override custom mount options set earlier via hooks. Consider removing this reassignment and keeping a single source of truth.

♻️ Proposed cleanup
-			mountopts[$ROOTFS_TYPE]=',commit=120'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/functions/image/partitioning.sh` at line 345, Inside the btrfs-specific
block you are reassigning mountopts[$ROOTFS_TYPE] to ',commit=120' which
overrides any earlier customizations; remove that reassignment (or change it to
only set a default when mountopts[$ROOTFS_TYPE] is empty, e.g., test -z
"${mountopts[$ROOTFS_TYPE]}" && mountopts[$ROOTFS_TYPE]=',commit=120') so
mountopts[btrfs] remains the single source of truth and hooks can override it.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@lib/functions/image/partitioning.sh`:
- Line 345: Inside the btrfs-specific block you are reassigning
mountopts[$ROOTFS_TYPE] to ',commit=120' which overrides any earlier
customizations; remove that reassignment (or change it to only set a default
when mountopts[$ROOTFS_TYPE] is empty, e.g., test -z
"${mountopts[$ROOTFS_TYPE]}" && mountopts[$ROOTFS_TYPE]=',commit=120') so
mountopts[btrfs] remains the single source of truth and hooks can override it.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d935693f-6500-43c3-a9e1-ba6e343e4c89

📥 Commits

Reviewing files that changed from the base of the PR and between ae08545 and ee8bec9.

📒 Files selected for processing (1)
  • lib/functions/image/partitioning.sh

@iav iav force-pushed the fix/9201-fstab-double-comma branch from ee8bec9 to e267a65 Compare March 5, 2026 00:52
@iav iav requested a review from EvilOlaf March 5, 2026 00:53
mountopts[] values start with a leading comma by convention (line 26),
but all call sites added an explicit comma before the expansion, producing
e.g. `defaults,,commit=120,errors=remount-ro` for ext4.

Also removed duplicate mountopts[btrfs] override (line 345 duplicated
line 85 and would silently clobber options set by hooks).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@iav iav force-pushed the fix/9201-fstab-double-comma branch from e267a65 to af898a4 Compare April 16, 2026 19:23
@iav
Copy link
Copy Markdown
Contributor Author

iav commented Apr 16, 2026

rebased

@github-actions
Copy link
Copy Markdown
Contributor

✅ This PR has been reviewed and approved — all set for merge!

@github-actions github-actions bot added Ready to merge Reviewed, tested and ready for merge and removed Needs review Seeking for review labels Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

05 Milestone: Second quarter release Framework Framework components Ready to merge Reviewed, tested and ready for merge size/small PR with less then 50 lines

Development

Successfully merging this pull request may close these issues.

[Bug]: Malformed /etc/fstab entry (double comma) in partitioning.sh causes boot failure

2 participants