Skip to content

fsck.erofs reads deflate images back: erofs is built with libdeflate, and mkfs.erofs takes -zlibdeflate - #92

Merged
closer-claudio merged 1 commit into
mainfrom
claudio/20261121-fsck-deflate
Nov 22, 2026
Merged

closer-claudio merged 1 commit into
mainfrom
claudio/20261121-fsck-deflate

Conversation

@closer-claudio

Copy link
Copy Markdown
Contributor

🎯 Why

mkfs.erofs here writes deflate images with erofs-utils' own compressor, but erofs-utils reads deflate back with zlib or libdeflate, and the build had neither. fsck.erofs --extract on this build's own -zdeflate image exited 1 ("Failed to extract filesystem"), while fsck.erofs --version listed deflate. A consumer holding its deflate images to this fsck.erofs got a failure that said nothing of the image.

🛠️ What

  • pins.yaml: libdeflate 1.26 at its release tag, by digest. MIT (COPYING).
  • erofs/build.sh: compiles libdeflate's raw deflate (utils, deflate_compress, deflate_decompress, the two cpu_features) with its own build's flags, -O2 -std=gnu11 -DNDEBUG, and adds compressor_libdeflate to liberofs.
  • erofs/config.h: HAVE_LIBDEFLATE on every target, so the five mkfs.erofs stay one configuration. erofs-utils 1.9.4 reads it in lib/decompress.c (the inflater) and lib/compressor.c (a second compressor name).
  • .justfile: fetches it; each archive carries LICENSE.libdeflate.
  • erofs/smoke.sh: every image is extracted and compared with the tar, the deflate one included.
  • READMEs updated.

🔀 What a caller sees change

  • fsck.erofs --extract reads deflate images.
  • mkfs.erofs takes -zlibdeflate. -zdeflate is still erofs-utils' own compressor and writes the same images: the smoke test's five digests are unchanged.

🧪 How

On darwin-arm64: just erofs-test passes, five digests unchanged, five images extracted identical to the tar. mkfs.erofs -zlibdeflate then fsck.erofs --extract exits 0. Before, on the v0.4.0 binaries, fsck.erofs --extract of the -zdeflate image exits 1.

The linux and windows builds (libdeflate under MinGW and on x86) were not run locally: the checks on this pull request run them.

mkfs.erofs writes deflate with erofs-utils' own compressor, and
erofs-utils reads deflate with zlib or libdeflate, which the build had
neither of: `fsck.erofs --extract` on this build's own `-zdeflate` image
exited 1 ("Failed to extract filesystem") while `--version` listed
deflate, so a consumer holding its deflate images to this fsck got a
failure that said nothing of the image.

libdeflate (MIT) is pinned at its release tag and its raw deflate is
compiled in, as its own build compiles it; HAVE_LIBDEFLATE is on for
every target, so the five mkfs.erofs stay one configuration. With it
mkfs.erofs also takes `-zlibdeflate`, erofs-utils' second deflate
compressor. The archives carry libdeflate's notice.

The smoke test now extracts the deflate image too, and its five image
digests are unchanged. Run on darwin-arm64.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: closer-claudio <claudio@farcloser.world>
@closer-claudio

Copy link
Copy Markdown
Contributor Author

Reviewed at c97789f

@closer-claudio
closer-claudio merged commit 00e92dd into main Nov 22, 2026
27 checks passed
@closer-claudio
closer-claudio deleted the claudio/20261121-fsck-deflate branch November 22, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants