erofs-utils: lib: disallow incremental builds with existing fragments

On incremental builds, the old packed inode is only partially loaded
into the temporary packed file, but the new packed inode is built from
the whole file, so existing fragments become zeroes:

$ mkfs.erofs -zlz4 -Efragments img.erofs dir1
$ mkfs.erofs -zlz4 -Efragments --incremental=data img.erofs dir2
$ fsck.erofs --extract=out img.erofs && cmp dir1/a1 out/a1
dir1/a1 out/a1 differ: byte 1, line 1

Using `--xattr-prefix` or `--zD` without `-Efragments` also triggers
the issue.

Refuse such builds for now until the old fragment data can be reused.

Fixes: f511cfbbc0da ("erofs-utils: introduce fragment cache")
Suggested-by: Gao Xiang <xiang@kernel.org>
Signed-off-by: Seula Lee <seula2.lee@lge.com>
Link: https://patch.msgid.link/20261201130159.1459418-1-seula2.lee@lge.com
Signed-off-by: Gao Xiang <xiang@kernel.org>
1 file changed