sfdisk: honor --force for "All space for primary partitions is in use"#4397
Open
lzwind wants to merge 1 commit into
Open
sfdisk: honor --force for "All space for primary partitions is in use"#4397lzwind wants to merge 1 commit into
lzwind wants to merge 1 commit into
Conversation
The --force flag is documented as "disable all consistency checking" but sfdisk still refused to create a partition when all four primary slots are occupied, even with --force. Add a force bit to struct fdisk_context with fdisk_enable_force() API, propagate the sfdisk --force flag to the libfdisk context, and make the "All space for primary partitions" checks in dos_add_partition() conditional on the force flag. Fixes: util-linux#4320 Co-developed-by: Claude Sonnet 4.6 <noreply@anthropic.com>
d8902a2 to
b4c706f
Compare
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.
Summary
--forceis documented as "disable all consistency checking" but sfdisk still refused to create a partition when all four primary slots were occupiedforcebit tostruct fdisk_contextwithfdisk_enable_force()public APIsfdisk --forceflag to the libfdisk context-EINVALreturns indos_add_partition()conditional on the force flagFixes: #4320
Test plan
dd if=/dev/zero of=/tmp/part count=1 && echo 1 2 7 - | sfdisk --force /tmp/partshould succeed--force, the same command should still fail with the existing errorCo-developed-by: Claude Sonnet 4.6 noreply@anthropic.com