From a13fe51936c9f211cf4a7ef9c6f8557a2705d0b0 Mon Sep 17 00:00:00 2001 From: Victor Vogel Date: Wed, 11 Nov 2026 15:38:25 +0000 Subject: [PATCH] extract-vendor-firmware: say build.prop can't be read, not that there is none When the copy of the vendor partition's build.prop fails, the tool said "vendor.img has no build.prop" although the file is in the image: a work directory on a full disk does it, since debugfs then writes an empty build.prop and reports "No space left on device". The message now says "build.prop can't be read from vendor.img", which is true when the file is missing, empty or its copy failed, as suggested on #647. Nothing else changes: the run still stops unless -f is given. Tested: tests/extract-vendor-firmware, with a new case whose build.prop is in the image and whose copy fails (the stand-in debugfs reports a write error); main's tool fails it and the four checks that now expect the new words. By hand, the tool on a real ext4 image in a factory zip, with the work directory on a full 8 MiB tmpfs: main says the image has no build.prop, this branch that it can't be read. Not tested: a Google factory image. extract-vendor-chroot and extract-fingerprint-vendor say the same "has no build.prop" on a full work disk; they are left as they are. Co-Authored-By: Claude Opus 5.5 --- tests/extract-vendor-firmware | 12 +++++++----- tools/extract-vendor-firmware | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/extract-vendor-firmware b/tests/extract-vendor-firmware index 610000f9b..6fda1e098 100755 --- a/tests/extract-vendor-firmware +++ b/tests/extract-vendor-firmware @@ -13,7 +13,7 @@ # short write, also under a file size limit, a failed sanity check, a # missing camera APEX) leaves the previous outputs and the -c file byte # for byte, so an older file can't pass for a missing one; an image whose -# build.prop is missing or empty is refused, as its device can't be +# build.prop is missing, empty or not copied is refused, as it can't be # checked, and staged with -f; a -c that is a directory or inside the # outputs is refused; an -o that resolves to / is refused before anything # is written; and a move that fails while publishing puts the previous @@ -238,9 +238,11 @@ pass_since "$n" "a registry short write under a file size limit: refused, the pr # Without a readable build.prop the device check can't run: refused, unless -f rm -rf "$t/v2-noprop"; cp -r "$t/v2" "$t/v2-noprop"; rm "$t/v2-noprop/build.prop" rm -rf "$t/v2-emptyprop"; cp -r "$t/v2" "$t/v2-emptyprop"; : > "$t/v2-emptyprop/build.prop" -refuses "no build.prop (ext4)" "vendor.img has no build.prop" "$t/v2-noprop" "$t/ext4.img" -refuses "no build.prop (EROFS)" "vendor.img has no build.prop" "$t/v2-noprop" "$t/erofs.img" -refuses "an empty build.prop" "vendor.img has no build.prop" "$t/v2-emptyprop" "$t/ext4.img" +rm -rf "$t/v2-propfail"; cp -r "$t/v2" "$t/v2-propfail"; echo build.prop > "$t/v2-propfail/.fail-dump" +refuses "no build.prop (ext4)" "build.prop can't be read from vendor.img" "$t/v2-noprop" "$t/ext4.img" +refuses "no build.prop (EROFS)" "build.prop can't be read from vendor.img" "$t/v2-noprop" "$t/erofs.img" +refuses "an empty build.prop" "build.prop can't be read from vendor.img" "$t/v2-emptyprop" "$t/ext4.img" +refuses "a build.prop whose copy fails" "build.prop can't be read from vendor.img" "$t/v2-propfail" "$t/ext4.img" o=$t/noprop-forced seed "$o" if run "$t/v2-noprop" "$t/ext4.img" -f -o "$o" && [[ $(listed "$o") == "$CHEETAH_FILES" ]]; then @@ -377,7 +379,7 @@ if realdfs=$(command -v debugfs) && mkfs.ext4 -q -F -d "$t/v2" "$t/real.img" 8M before=$(snap "$o") if "$EVF" -w "$t/work" -o "$o" "$t/real-noprop.img" > "$t/log" 2>&1; then fail "real ext4: an image without build.prop is refused" - elif ! grep -qF "vendor.img has no build.prop" "$t/log" || [[ $(snap "$o") != "$before" ]]; then + elif ! grep -qF "build.prop can't be read from vendor.img" "$t/log" || [[ $(snap "$o") != "$before" ]]; then cat "$t/log"; fail "real ext4: an image without build.prop is refused, the previous outputs untouched" else pass "real ext4: an image without build.prop is refused, the previous outputs untouched" diff --git a/tools/extract-vendor-firmware b/tools/extract-vendor-firmware index 6ff18ab1c..82ae0b1be 100755 --- a/tools/extract-vendor-firmware +++ b/tools/extract-vendor-firmware @@ -395,7 +395,7 @@ if get_file build.prop "$WORK/build.prop"; then die "vendor partition is for '${dev:-unknown}', not $DEVICE; use -f to override" say "Vendor partition: $(sed -n 's/^ro.vendor.build.fingerprint=//p' "$WORK/build.prop" | head -1)" else - [[ -n "$FORCE" ]] || die "vendor.img has no build.prop; use -f to override" + [[ -n "$FORCE" ]] || die "build.prop can't be read from vendor.img; use -f to override" fi # The new generation: everything below is written into $new, which starts