]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libfdisk: improve collision reporting
authorKarel Zak <kzak@redhat.com>
Mon, 8 Sep 2025 09:44:16 +0000 (11:44 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 8 Sep 2025 09:44:16 +0000 (11:44 +0200)
commite873aa0322f42167a402e95dd398fcc4eb256119
tree5e64e8444749459d9d9fed99fc73daafcc7fbda3
parentd073aab9d34eea205545c77222947691f4abf5aa
libfdisk: improve collision reporting

In some cases, a collision occurs in the first sector. Creating a new
partition table overwrites this sector, but updating an existing table
does not. In the latter case, promising to wipe the collision is a
bug.

Because we cannot know whether the collision is expected (e.g., hybrid
or boot disks) or unintended, we inform the user and let them decide.
libfdisk can wipe the unwanted signature only when creating a new
partition table; otherwise, the user can use wipefs.

This commit introduces fdisk_is_collision_area(), an API to detect
where the collision occurs. The function is generic and not limited to
the first sector.

Fixes: https://github.com/util-linux/util-linux/issues/3659
Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/fdisk.c
disk-utils/sfdisk.c
libfdisk/docs/libfdisk-sections.txt
libfdisk/src/context.c
libfdisk/src/fdiskP.h
libfdisk/src/libfdisk.h.in
libfdisk/src/libfdisk.sym
libfdisk/src/wipe.c