Repository navigation
Use dmpart for partition tables instead of a private parser - #61
Merged
Merged
Conversation
The MBR/GPT parser (src/partitions.c) moved to dmpart, a small library module released with dmblkid (choco-technologies/dmblkid, libs/dmpart). dmblkid uses the same parser to tell a partitioned disk from a filesystem, so a medium that gets partition nodes here is always reported by dmblkid as a partition table - one implementation instead of two copies that could drift apart. find_partitions() now describes the medium as a dmpart_medium_t and calls dmpart_scan(); running out of memory while reading the table is logged instead of silently looking like "no table". dmpart also refuses to take an exFAT boot sector for an MBR (FAT was already excluded). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TgkwHQKqf6c4DzypSKzZT7
5 of 6 tasks
The test modules mount dmdevfs by name instead of depending on it, so ctest only installed the test module's dependencies (<name>.dmd). dmdevfs's dependencies were covered by accident until it gained dmpart: with dmpart missing, dmod_loader still loaded dmdevfs and the first dmpart_scan() call jumped to address 0 - every test that mounts dmdevfs crashed in CI once the real dmpart release was used. Install dmdevfs.dmd first. With dmpart 0.1 from the registry: ctest 8/8, test_partitions 12/12. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TgkwHQKqf6c4DzypSKzZT7
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.
Part of choco-technologies/dmod-ecosystem#23 / #17.
Summary
The MBR/GPT parser existed twice:
src/partitions.chere, for partition nodes, and a copy in dmblkid, for telling a partitioned disk from a filesystem. It now lives in one place, dmpart, a small library module in the dmblkid repository (libs/dmpart, released with dmblkid):src/partitions.c/.hremoved (−443 lines).find_partitions()describes the medium as admpart_medium_t(driver read callback, block size, block count) and callsdmpart_scan(). The callbacks are unchangedstaticfunctions.dmod_link_modules(... dmpart ...):dmdevfs.dmdnow requiresdmpart@>=0.1<1.0, so every package or image that contains dmdevfs must also contain dmpart.Tests: install dmdevfs's own dependencies (3ce65ac)
The test modules load dmdevfs by name (
Dmod_LoadModuleByName("dmdevfs")) instead of depending on it. ctest therefore only installed the test module's own.dmd. Until now, dmdevfs's dependencies happened to be covered by the tests' own dependencies (libsystemd pulls in dmini), but dmpart is not.With dmpart missing, dmod_loader correctly refused to load dmdevfs (
Cannot load required module 'dmpart').load_devfs()returned false, and the test steps, which do not check for that, then called the unset DIF pointers (g_fs.fopenis NULL). That NULL call caused the segfault in CI.The fix installs
dmdevfs.dmdbefore each test.Test plan
chocotechnologies/dmod:1.0.4, with dmpart 0.1 from the registry (no local packages):ctest: 8/8;test_partitions12/12, running on dmpart;test_dmdevfsandtest_dmdevmonstill pass.Cannot load required module 'dmpart', then a segfault in the test.read_dir_name_from_pathdefined but not used) is already onmain.test_dmpart, 15 steps, in dmblkid) cover the parser directly on an in-memory medium.🤖 Generated with Claude Code
https://claude.ai/code/session_01TgkwHQKqf6c4DzypSKzZT7