Skip to content

extract-vendor-firmware: say why build.prop can't be read - #882

Merged
derekross merged 1 commit into
derekross:mainfrom
only21mil:build/extract-vendor-firmware-debugfs-reason
Nov 18, 2026
Merged

derekross merged 1 commit into
derekross:mainfrom
only21mil:build/extract-vendor-firmware-debugfs-reason

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

What and why

When debugfs can't copy build.prop out of an ext4 vendor.img, tools/extract-vendor-firmware refuses but drops debugfs's message, so a missing file, a full work directory and a damaged image all read the same. As the maintainer suggested on #795, the refusal now ends with debugfs's reason in #795's words, so the three extractors agree.

dfs() keeps debugfs's last stderr line (none if it is only the banner), and the refusal adds it before ; use -f to override. I took the last line, as #795 does. It differs from the line dfs() stopped on only for a damaged superblock: there the first line names the work path, and the last, dump: Filesystem not open, is what the other two tools print. A lookup error's trailing blank is dropped, since text follows. EROFS, -f, the exit status, the staging generation and every other refusal are unchanged.

AI agents made every run below. Reproduction: the real tool with the host's debugfs 1.47.2 on made-up ext4 image zips (mkfs.ext4 -d), sandboxed, one outside fault per case: no build.prop, an empty one, the image cut short, a damaged inode or superblock, or a full tmpfs work directory. Controls: EROFS, -f, a good image. On main b87751a every refusal is the bare line; on e872440 five lines change, each ending with debugfs's reason, and the rest are identical. Both runs are in the block, untrimmed.

Regression test (a stand-in, not the reproduction): tests/extract-vendor-firmware checks the whole refusal line for no build.prop and a failed copy (its stand-in debugfs now prints real debugfs's words), for an empty one and EROFS (no reason), and on real ext4 images without build.prop or with a damaged superblock. With main's tool (EVF=), 4 checks fail, and only those.

Device and build

  • Phone: none: docs/tools only
  • Kernel release (uname -r): no phone
  • Packages changed, with versions: none

Checks (no phone needed)

  • tools/pr-check origin/main passes (AI agent)
  • tests/all passes (AI agent; with a stand-in fastboot on PATH, see below)
  • tests/packages passes (or the packages I touched: none, so not run)
  • Each changed package has its version bumped, and the new version is in the commit subject: no package changed
  • Commits have area prefixes and bodies that say why; any AI help is a Co-Authored-By: or Assisted-by: trailer, never a Signed-off-by:

On the phone

  • I ran this on my own phone, booted into this build: no: a laptop tool
  • Runbook steps passed (plan, step, result): none, no plan step
  • What I did not test: no agent ran a Google factory image; sparse and super.img sources; debugfs exiting non-zero; e2fsprogs releases other than 1.47.2
  • Nothing in this change writes outside slot B and userdata, weakens the storage guard, or reads registers from userspace (AGENTS.md §1)
tools/phone-smoke report

Not applicable: a laptop tool that never runs on a phone (CONTRIBUTING.md §6.5).

AI agents made every run in this description, on an x86_64 desktop running Ubuntu 26.04. The tests and checks ran on e872440. That machine has no fastboot, and tests/install-slot-descriptor stops tests/all without one, on main b87751a's own tree too; with a stand-in fastboot that exits 1 on PATH, it passes on both and tests/all passes on e872440. e872440 merges cleanly with main 8934987 (git merge-tree), and the same runs on that merged tree print the same text as on e872440.

Setup: Ubuntu 26.04 on x86_64, debugfs 1.47.2; one set of made-up image zips, read by both commits; the tool runs in a sandbox with that commit's tools/ first on PATH.

Steps: build the made-up image zips → run the tool on each of the five faulty images → on the good image with the 8 MiB work directory → on the EROFS image → on the image without build.prop with -f → on the good image with room

Before, on main b87751a0:

$ extract-vendor-firmware -w work -o out image-cheetah-noprop.zip
==> Unpacking vendor.img
==> vendor.img is ext4; reading it with debugfs (no mount)
error: build.prop can't be read from vendor.img; use -f to override
exit=1
$ extract-vendor-firmware -w work -o out image-cheetah-emptyprop.zip
==> Unpacking vendor.img
==> vendor.img is ext4; reading it with debugfs (no mount)
error: build.prop can't be read from vendor.img; use -f to override
exit=1
$ extract-vendor-firmware -w work -o out image-cheetah-truncated.zip
==> Unpacking vendor.img
==> vendor.img is ext4; reading it with debugfs (no mount)
error: build.prop can't be read from vendor.img; use -f to override
exit=1
$ extract-vendor-firmware -w work -o out image-cheetah-inode.zip
==> Unpacking vendor.img
==> vendor.img is ext4; reading it with debugfs (no mount)
error: build.prop can't be read from vendor.img; use -f to override
exit=1
$ extract-vendor-firmware -w work -o out image-cheetah-unopenable.zip
==> Unpacking vendor.img
==> vendor.img is ext4; reading it with debugfs (no mount)
error: build.prop can't be read from vendor.img; use -f to override
exit=1
$ extract-vendor-firmware -w /mnt/w -o out image-cheetah-good.zip
==> Unpacking vendor.img
==> vendor.img is ext4; reading it with debugfs (no mount)
error: build.prop can't be read from vendor.img; use -f to override
exit=1
$ extract-vendor-firmware -w work -o out image-cheetah-erofs.zip
==> Unpacking vendor.img
==> vendor.img is EROFS; extracting it with fsck.erofs
error: build.prop can't be read from vendor.img; use -f to override
exit=1
$ extract-vendor-firmware -f -w work -o out image-cheetah-noprop.zip
==> Unpacking vendor.img
==> vendor.img is ext4; reading it with debugfs (no mount)
error: /vendor/firmware/fw_bcmdhd.bin is missing from this image or could not be copied
exit=1
$ extract-vendor-firmware -w work -o out image-cheetah-good.zip
==> Unpacking vendor.img
==> vendor.img is ext4; reading it with debugfs (no mount)
==> Vendor partition: fictional/cheetah-demo
error: /vendor/firmware/fw_bcmdhd.bin is missing from this image or could not be copied
exit=1

After, on e8724409:

$ extract-vendor-firmware -w work -o out image-cheetah-noprop.zip
==> Unpacking vendor.img
==> vendor.img is ext4; reading it with debugfs (no mount)
error: build.prop can't be read from vendor.img: /build.prop: File not found by ext2_lookup; use -f to override
exit=1
$ extract-vendor-firmware -w work -o out image-cheetah-emptyprop.zip
==> Unpacking vendor.img
==> vendor.img is ext4; reading it with debugfs (no mount)
error: build.prop can't be read from vendor.img; use -f to override
exit=1
$ extract-vendor-firmware -w work -o out image-cheetah-truncated.zip
==> Unpacking vendor.img
==> vendor.img is ext4; reading it with debugfs (no mount)
error: build.prop can't be read from vendor.img: dump: Attempt to read block from filesystem resulted in short read while reading ext2 file; use -f to override
exit=1
$ extract-vendor-firmware -w work -o out image-cheetah-inode.zip
==> Unpacking vendor.img
==> vendor.img is ext4; reading it with debugfs (no mount)
error: build.prop can't be read from vendor.img: dump: Inode checksum does not match inode while reading inode 13; use -f to override
exit=1
$ extract-vendor-firmware -w work -o out image-cheetah-unopenable.zip
==> Unpacking vendor.img
==> vendor.img is ext4; reading it with debugfs (no mount)
error: build.prop can't be read from vendor.img: dump: Filesystem not open; use -f to override
exit=1
$ extract-vendor-firmware -w /mnt/w -o out image-cheetah-good.zip
==> Unpacking vendor.img
==> vendor.img is ext4; reading it with debugfs (no mount)
error: build.prop can't be read from vendor.img: dump: No space left on device while writing file; use -f to override
exit=1
$ extract-vendor-firmware -w work -o out image-cheetah-erofs.zip
==> Unpacking vendor.img
==> vendor.img is EROFS; extracting it with fsck.erofs
error: build.prop can't be read from vendor.img; use -f to override
exit=1
$ extract-vendor-firmware -f -w work -o out image-cheetah-noprop.zip
==> Unpacking vendor.img
==> vendor.img is ext4; reading it with debugfs (no mount)
error: /vendor/firmware/fw_bcmdhd.bin is missing from this image or could not be copied
exit=1
$ extract-vendor-firmware -w work -o out image-cheetah-good.zip
==> Unpacking vendor.img
==> vendor.img is ext4; reading it with debugfs (no mount)
==> Vendor partition: fictional/cheetah-demo
error: /vendor/firmware/fw_bcmdhd.bin is missing from this image or could not be copied
exit=1

Links: the maintainer's note on #795; the regression test, tests/extract-vendor-firmware at e872440. The scripts that build the images and drive the tool are not published; the reproduction paragraph above says what they do.

Not shown:

  • No agent ran a Google factory image.
  • Sparse and super.img sources.
  • debugfs exiting non-zero: no check covered it before this change either.
  • e2fsprogs releases other than 1.47.2.

Generated with Claude Opus 5.5 in T3 Code Nightly

When debugfs can't copy build.prop out of an ext4 vendor.img, the tool
refused with "build.prop can't be read from vendor.img; use -f to
override" and dropped what debugfs had said, so a missing file, a full
work directory and a damaged image all read the same. derekross#795 gave
extract-vendor-chroot and extract-fingerprint-vendor debugfs's reason on
this refusal; this gives it to the third extractor, in the same words:

  error: build.prop can't be read from vendor.img: dump: No space left
  on device while writing file; use -f to override

dfs() now keeps debugfs's last stderr line in $reason, none when that
line is only its banner, and the refusal adds it with derekross#795's
${reason:+: $reason} before "; use -f to override". The reason is the
last line, as in derekross#795, rather than the line dfs() stopped on: with real
debugfs 1.47.2 the two are the same line for a missing build.prop, an
empty one, a full work directory, an image cut short and a damaged
inode, and differ only for a damaged superblock, where the first line
names the work directory's path ("The ext2 superblock is corrupt while
trying to open .../vendor.img") and the last is "dump: Filesystem not
open", what the other two tools print. A lookup error ends in a blank,
which is dropped here because text follows it. The EROFS path has no
debugfs and keeps its words; $reason is set empty before the format
check, so nothing from the environment reaches it. -f, the exit status,
the staging generation and every other refusal are unchanged; the map
loop's, the registry's and the camera APEX's refusals are left as they
are.

Tested: tests/extract-vendor-firmware checks the whole refusal line for
no build.prop and a failed copy (its stand-in debugfs now prints real
debugfs's words for both), no reason for an empty build.prop or on
EROFS, and on real ext4 images without build.prop or with a damaged
superblock the line ends with what the host's debugfs says; with base's
tool 4 of those checks fail, and only they. Each new line of the fix,
undone, fails the suite, except the one that carries base's
"|| return 1" over (debugfs exiting non-zero), which no check covered
before either. The tool ran through its own command line on made-up
ext4 image zips with the host's debugfs, before and after.
tools/pr-check origin/main passes, and tests/all with a stand-in
fastboot on PATH (main's tests/install-slot-descriptor needs one, and
fails without it on main's own tree too). Not tested: Google factory
images, a sparse or super.img vendor, debugfs exiting non-zero, and
other e2fsprogs versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derekross

Copy link
Copy Markdown
Owner

Thank you, @only21mil. This is the third extractor I asked about on #795, done in the same words, and done narrowly: the check on which phone the image is for, -f, the exit status and the staging are untouched, and only the one refusal's text changes. On your branch merged with today's main tests/extract-vendor-firmware passes (42, the real-ext4 cases included), and with main's tool behind EVF= exactly your four new checks fail and nothing else. I like that the real-image cases ask the host's own debugfs what it says instead of pinning 1.47.2's wording, and that a reason in the environment is shown not to reach the EROFS refusal. CI is green. Merging.

Thank you also for the note that tests/install-slot-descriptor fails without fastboot on main: that suite runs the installer with no check for its programs. I'll get that fixed.

@derekross
derekross merged commit 13f0af3 into derekross:main Nov 18, 2026
2 checks passed
derekross added a commit that referenced this pull request Nov 18, 2026
…nd a failure says why (#893)

install-phone checks for its programs before it reads INSTALL_SLOT, so on a computer without fastboot the suite stopped tests/all (reported on #882 and #884). A stand-in at the end of PATH now answers command -v for whatever is missing; a real program always wins, and a stand-in that is ever run fails the suite. The failure report also read the wrong output file and printed only a cat error; it now shows the installer's message.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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