fallocate: --insert-range does not work with --posix

Johannes Schauer Marin Rodrigues <[email protected]>
Newsgroups org.kernel.vger.util-linux
Message-ID <173703231441.1463009.14898093986088300384@localhost>
Hi,

Steps to reproduce:

    $ fallocate -l 1024 test.img
    $ fallocate --posix --insert-range --offset=0 --length=4096 test.img
    $ ls -l test.img
    -rw-r--r-- 1 root root 4096 Jan 12 16:57 test.img

The size of test.img should be 5120 bytes and not 4096. It works fine
without --posix.

This issue can also be expressed as another test:

--- a/tests/expected/misc/fallocate
+++ b/tests/expected/misc/fallocate
@@ -1 +1,2 @@
 384
+4480
--- a/tests/ts/misc/fallocate
+++ b/tests/ts/misc/fallocate
@@ -34,6 +34,9 @@ else
                && ts_skip "'${fs_type}' not supported"
 fi
 
+$TS_CMD_FALLOCATE -x -i -o 0 -l 4096 $IMAGE >> $TS_OUTPUT 2>> $TS_ERRLOG
+stat -c "%s" $IMAGE >> $TS_OUTPUT 2>> $TS_ERRLOG
+
 rm -f $IMAGE
 
 ts_finalize

I also wonder why the size of --insert-range has to be 4096. If I try
smaller sizes, it does not work on my machine even when not using
--posix. If this is by design, maybe it should be mentioned in the
man page?

I'm running Debian bookworm and reproduced this with util-linux from
git.

Thanks!

cheers, josch
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEElFhU6KL81LF4wVq58sulx4+9g+EFAmeJAnUACgkQ8sulx4+9
g+F+HQ/9FAgAvXntXGig9S0A/ruhS8uSONYr5YBcsLEixVgkd6w0x9XOVbU9HkDL
mtvtF1hbKR0A7BoMrlNKbDDAIbcaxJePMhfPpVUuRF5YRA2WSm6hOc09fOMx1pvP
2gN8vuV2z26xlND1eyEXT+2gt49zGJZYucuGywiV3AK+wuAQ+XsUqWRxQ2d3JtIY
zvxylVhwhPgnfkWzNxGcThyadvY1G7SOUvwHqZTJWBgZpiDZN0L7AswH+VU6dXeL
wFTs7PRcJYIuosc6Vrdl5LcM26W2UNhg9Zw3nKWsTkB40IcRts8hwT4F5He4HHHo
pxlD/UK3Ad38L7uoX6opL5WPjq66KeRmA21doa5PkZAFqLkaIpfixMVifs8PfrXb
8oCOxpNEGPxKoLDzoulEwaDLGGAAChUqObVwG1+loz95At6lePGB6VQUsZBOtNmb
roRHrX3RRiMFuv0zsS2eiCj1AZPyLBYoialisnUUHwBYbubFgW4WbEVdZ819lE4W
7LCFBUFQ0zzCw32PoUC8QM7XcHz6jB1Hf4e0Vumjnu3JfJg9S14uQdu4aTNoz8xi
q+7N8F+k+9WFKADHeuY/A4/EGlq90Ad4KOYhvil7eRjnPe0bMgs096lnvUcxL9lN
vzCYCIFNeqZJY8ac3xfvOFeYBhzo9BJlh9wy70t35IzrECTcvak=
=zdOL
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.