Repository navigation
Conversation
factory-index add checks that the outer file name matches <codename>-<build>-factory-<8 hex>.zip and that the top folder inside it is <codename>-<build>, but android_info() matched any [^/]+/image-<codename>-[a-z0-9.]+\.zip without verifying that the inner image zip names the same build. A repacked archive whose top folder matches the outer file name while its inner image zip belongs to another build would record the other build's bootloader and baseband versions under the outer build id. Return the full inner member path from android_info() (cmd_add() is its only caller) and update its docstring to match. In cmd_add(), keep the top-folder check where it is and check the inner image zip name against the lower-case build from the outer file name after the check_build() and duplicate-build checks, before inserting and saving, so every existing error message keeps precedence while mismatched archives are refused before writing the index. Keep the inner-zip selection regex unchanged so archives with zero or multiple image zips still report the count error. Extend tests/factory-index's factory helper with an optional inner build id and test that patch and carrier-suffix mismatches fail with exit 1, name the inner member, and leave the index byte-identical, and that an inner mismatch combined with a wrong digest or an already-indexed build still reports the existing error and leaves the index unchanged. Assisted-by: Gemini 4 Neon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
When a factory zip's inner
image-<codename>-<build>.zipnames a different build from the zip's name and top folder,factory-index addrecords that inner image's versions under the outer build instead of refusing.android_info()now returns that path, andcmd_add()refuses a mismatch after the existing name, digest and duplicate checks, before the index is written.Setup: Ubuntu 26.04.1 x86_64, Python 3.14.4, synthetic zip (no Google files).
Steps: Build .001 zip with .009 inner zip →
factory-index add→ check exit/index.Before (
a40fced5):After (
8c310516):Links: base a40fced5, head 8c310516, tests/factory-index.
Not shown:
Device and build
uname -r): noneChecks (no phone needed)
tools/pr-check origin/mainpasses (7/7; checks by an AI agent)tests/allpasses (871 pass, 5 skip, 1 fail mark-slot-b as on a40fced; factory-index 9/9, extract-vendor-firmware 44/44)tests/packagespasses (or the packages I touched: none): private /tmp, 28/33 pass; same 5 fail on a40fced (dbus AppArmor, no qmake6, audio UCM); none touches this diffversionbumped, and the new version is in the commit subject (no package changed)Co-Authored-By:orAssisted-by:trailer, never aSigned-off-by:On the phone
userdata, weakens the storage guard, or reads registers from userspace (AGENTS.md §1)tools/phone-smokereportGenerated with Gemini 4 Neon in T3 Code Nightly