]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
mkfs: fix blkid probe API violations causing weird output
authorDarrick J. Wong <djwong@kernel.org>
Thu, 24 Apr 2025 21:53:55 +0000 (14:53 -0700)
committerAndrey Albershteyn <aalbersh@kernel.org>
Mon, 28 Apr 2025 10:56:58 +0000 (12:56 +0200)
commit044e134fffff0706f1141a8fb1d19f95641abfdf
tree70cb7465ee45bc463aa62376e3cf2d356f1336f6
parentd6721943d6687fb4888a24ed79077e007f510869
mkfs: fix blkid probe API violations causing weird output

The blkid_do_fullprobe function in libblkid 2.38.1 will try to read the
last 512 bytes off the end of a block device.  If the block device has a
2k LBA size, that read will fail.  blkid_do_fullprobe passes the -EIO
back to the caller (mkfs) even though the API documentation says it
only returns 1, 0, or -1.

Change the "cannot detect existing fs" logic to look for any negative
number.  Otherwise, you get unhelpful output like this:

$ mkfs.xfs -l size=32m -b size=4096 /dev/loop3
mkfs.xfs: Use the -f option to force overwrite.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/topology.c