Skip to content

fs: Adjust to new mkfs.exfat behaviour in exfatprogs >= 1.4.0#1199

Merged
vojtechtrefny merged 1 commit into
storaged-project:masterfrom
vojtechtrefny:master_exfat-partition-table
Jun 3, 2026
Merged

fs: Adjust to new mkfs.exfat behaviour in exfatprogs >= 1.4.0#1199
vojtechtrefny merged 1 commit into
storaged-project:masterfrom
vojtechtrefny:master_exfat-partition-table

Conversation

@vojtechtrefny
Copy link
Copy Markdown
Member

@vojtechtrefny vojtechtrefny commented Jun 2, 2026

mkfs.exfat now also creates a partition table, similarly to how mkfs.vfat does it.

Summary by CodeRabbit

  • New Features
    • exFAT creation now supports explicitly controlling partition-table behavior during formatting.
  • Improvements
    • Automatic detection of the installed exfatprogs version to apply appropriate formatting flags for better compatibility.
  • Tests
    • Filesystem tests updated to detect exfatprogs version and exercise formatting with the conditional partition-table option.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f2d81a98-571e-4d52-87fa-a766a7ecbabd

📥 Commits

Reviewing files that changed from the base of the PR and between cdb5504 and 636abf0.

📒 Files selected for processing (3)
  • src/plugins/fs/exfat.c
  • src/plugins/fs/generic.c
  • tests/fs_tests/exfat_test.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/plugins/fs/exfat.c
  • src/plugins/fs/generic.c
  • tests/fs_tests/exfat_test.py

📝 Walkthrough

Walkthrough

Declare exFAT partition-table capability, add a version-aware mkfs.exfat check for exfatprogs >= 1.4.0 to conditionally append -P none when no_pt is set, and update tests to detect the installed exfatprogs version and pass options accordingly.

Changes

exFAT Partition Table Support

Layer / File(s) Summary
Filesystem capability declaration
src/plugins/fs/generic.c
EXFAT entry in fs_features now declares partition table support (BD_FS_FEATURE_PARTITION_TABLE) and adds BD_FS_MKFS_NOPT to mkfs flags.
Version-aware mkfs implementation
src/plugins/fs/exfat.c
bd_fs_exfat_mkfs_options() adds util-dep metadata for mkfs.exfat >= 1.4.0 and conditionally appends -P none when options->no_pt and version check passes.
Test version detection infrastructure
tests/fs_tests/exfat_test.py
Import packaging.version.Version, add _get_exfatprogs_version() to parse mkfs.exfat --version, and expose EXFATPROGS_VERSION.
Test validation with version-dependent behavior
tests/fs_tests/exfat_test.py
ExfatTestCase.setUp conditionally sets self._mkfs_options; feature assertions updated to expect NOPT and PARTITION_TABLE; tests call BlockDev.fs_exfat_mkfs(..., self._mkfs_options).

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers:

  • tbzatek

"A rabbit hops with code so spry,
Version checks beneath the sky.
If exfatprogs is new and keen,
-P none joins the mkfs scene.
Hooray — partitions tidy and dry! 🐇"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.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 'fs: Adjust to new mkfs.exfat behaviour in exfatprogs >= 1.4.0' directly and clearly summarizes the main purpose of the changeset—adapting libblockdev to handle the new partition table behavior introduced in exfatprogs 1.4.0.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.c

src/plugins/fs/exfat.c:20:10: fatal error: 'blockdev/utils.h' file not found
20 | #include <blockdev/utils.h>
| ^~~~~~~~~~~~~~~~~~
1 error generated.
Error: the following clang command did not run successfully:
/opt/infer-linux-x86_64-v1.2.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-18
@/tmp/coderabbit-infer/636abf0094cf834563fd154c3bbe6d19c6986c6a-b404a9c872919e7a/tmp/clang_command_.tmp.f1912c.txt
++Contents of '/tmp/coderabbit-infer/636abf0094cf834563fd154c3bbe6d19c6986c6a-b404a9c872919e7a/tmp/clang_command_.tmp.f1912c.txt':
"-cc1" "-load"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../../facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib"
"-add-plugin" "BiniouASTExporter" "-plugin-arg-BiniouASTExporter" "-"
"-plugin-arg-BiniouASTExporter" "PREPEND_CURRENT_DIR=1"
"-plugin-arg-BiniouASTExporter" "MAX_STRING_SIZE=65535" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disabl

... [truncated 701 characters] ...

/infer-linux-x86_64-v1.2.0/lib/infer/facebook-clang-plugins/clang/install/lib/clang/18/include"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-Wno-ignored-optimization-argument" "-Wno-everything"
"-ferror-limit" "19" "-fgnuc-version=4.2.1" "-fskip-odr-check-in-gmf"
"-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o"
"/tmp/coderabbit-infer/b404a9c872919e7a/file.o" "-x" "c"
"src/plugins/fs/exfat.c" "-O0" "-fno-builtin" "-include"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../lib/clang_wrappers/global_defines.h"
"-Wno-everything"

src/plugins/fs/generic.c

src/plugins/fs/generic.c:20:10: fatal error: 'glib.h' file not found
20 | #include <glib.h>
| ^~~~~~~~
1 error generated.
Error: the following clang command did not run successfully:
/opt/infer-linux-x86_64-v1.2.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-18
@/tmp/coderabbit-infer/636abf0094cf834563fd154c3bbe6d19c6986c6a-2bfb09df258abfd1/tmp/clang_command_.tmp.79c436.txt
++Contents of '/tmp/coderabbit-infer/636abf0094cf834563fd154c3bbe6d19c6986c6a-2bfb09df258abfd1/tmp/clang_command_.tmp.79c436.txt':
"-cc1" "-load"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../../facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib"
"-add-plugin" "BiniouASTExporter" "-plugin-arg-BiniouASTExporter" "-"
"-plugin-arg-BiniouASTExporter" "PREPEND_CURRENT_DIR=1"
"-plugin-arg-BiniouASTExporter" "MAX_STRING_SIZE=65535" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free"
"-clear-ast-befo

... [truncated 677 characters] ...

nfer-linux-x86_64-v1.2.0/lib/infer/facebook-clang-plugins/clang/install/lib/clang/18/include"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-Wno-ignored-optimization-argument" "-Wno-everything"
"-ferror-limit" "19" "-fgnuc-version=4.2.1" "-fskip-odr-check-in-gmf"
"-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o"
"/tmp/coderabbit-infer/2bfb09df258abfd1/file.o" "-x" "c"
"src/plugins/fs/generic.c" "-O0" "-fno-builtin" "-include"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../lib/clang_wrappers/global_defines.h"
"-Wno-everything"


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.

Copy link
Copy Markdown

@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.

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 `@tests/fs_tests/exfat_test.py`:
- Around line 15-24: Module-level exfatprogs version detection
(_get_exfatprogs_version and EXFATPROGS_VERSION) runs at import time and can
crash import if mkfs.exfat is missing; change it to lazy initialization so tests
can be skipped in ExfatTestCase.setUp. Remove the module-level call to
_get_exfatprogs_version and instead call it inside ExfatTestCase.setUp (or wrap
it in a helper that returns None on error), catch exceptions from
_get_exfatprogs_version there, set a per-instance flag or attribute (e.g.,
self.exfatprogs_version or self.exfat_available), and use that flag in setUp to
call self.skipTest when mkfs.exfat isn't available so import-time failures are
avoided.
🪄 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: fffb570a-b599-4fe8-acb4-cfc07e50e706

📥 Commits

Reviewing files that changed from the base of the PR and between 711c764 and cdb5504.

📒 Files selected for processing (3)
  • src/plugins/fs/exfat.c
  • src/plugins/fs/generic.c
  • tests/fs_tests/exfat_test.py

Comment thread tests/fs_tests/exfat_test.py
mkfs.exfat now also creates a partition table, similarly to how
mkfs.vfat does it.
@vojtechtrefny vojtechtrefny force-pushed the master_exfat-partition-table branch from cdb5504 to 636abf0 Compare June 3, 2026 07:52
@vojtechtrefny vojtechtrefny merged commit dcead0f into storaged-project:master Jun 3, 2026
46 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants