fs: Fix parsing tune.exfat output with variable whitespace#1198
Conversation
The format of tune.exfat output changed from "key : value" to "key : value" with variable padding around the colon. Replace hard-coded prefix matching with key-name matching and a helper that finds the value after the first colon on the line. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthrough
ChangesexFAT parsing refactor
🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Infer (1.2.0)src/plugins/fs/exfat.csrc/plugins/fs/exfat.c:20:10: fatal error: 'blockdev/utils.h' file not found ... [truncated 701 characters] ... /infer-linux-x86_64-v1.2.0/lib/infer/facebook-clang-plugins/clang/install/lib/clang/18/include" 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/plugins/fs/exfat.c`:
- Around line 428-433: The parser currently uses g_strrstr() to find
BLOCK_SIZE_KEY/SECTORS_KEY/CLUSTERS_KEY anywhere in the line, causing false
positives; update the matching logic in the block that sets ret->sector_size,
ret->sector_count, and ret->cluster_count to first trim leading whitespace from
*line_p (or compute the substring before the first ':'), then check that the key
appears at the start of the trimmed line (e.g., starts-with BLOCK_SIZE_KEY) or
equals the trimmed pre-colon token before calling _exfat_parse_line_val, leaving
the existing assignments intact.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: fda999f5-f179-4903-965d-ccc202c92a31
📒 Files selected for processing (1)
src/plugins/fs/exfat.c
tbzatek
left a comment
There was a problem hiding this comment.
The g_strrstr() usage looks suspicious but I think that's still okay.
The format of tune.exfat output changed from "key : value" to
"key : value" with variable padding around the colon. Replace
hard-coded prefix matching with key-name matching and a helper that
finds the value after the first colon on the line.
Summary by CodeRabbit