From 3ae06e966d183900a87ac72aa4fb4803d8a7df24 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 14 Oct 2024 11:45:32 +0200 Subject: [PATCH] libfdisk: make sure libblkid uses the same sector size Libfdisk uses libblkid to check for filesystems on the device. It makes sense for both libraries to share the logical sector size setting, as this setting can be modified by using the fdisk command line. We do not see this as an issue, as filesystem detection rarely depends on sector size (with the exception of some RAIDs). Additionally, libblkid is usually intelligent enough to check multiple locations independently of the current device's sector size setting. Addresses: https://github.com/util-linux/util-linux/pull/3235 Signed-off-by: Karel Zak (cherry picked from commit 7ada6547fcd1f649fadaa8021ff21e3e0f431459) --- libfdisk/src/wipe.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libfdisk/src/wipe.c b/libfdisk/src/wipe.c index bb5f1bb38b..f389ed4194 100644 --- a/libfdisk/src/wipe.c +++ b/libfdisk/src/wipe.c @@ -133,6 +133,7 @@ int fdisk_do_wipe(struct fdisk_context *cxt) DBG(WIPE, ul_debugobj(wp, "blkid_probe_set_device() failed [rc=%d]", rc)); return rc; } + blkid_probe_set_sectorsize(pr, cxt->sector_size); DBG(WIPE, ul_debugobj(wp, " wiping...")); blkid_wipe_all(pr); @@ -176,6 +177,8 @@ int fdisk_check_collisions(struct fdisk_context *cxt) free(cxt->collision); cxt->collision = NULL; + blkid_probe_set_sectorsize(pr, cxt->sector_size); + blkid_probe_enable_superblocks(pr, 1); blkid_probe_set_superblocks_flags(pr, BLKID_SUBLKS_TYPE | BLKID_SUBLKS_BADCSUM); -- 2.47.3