Skip to content

fix: support .tgz and .tar.gz firmware inputs - #75

Open
Shyam-vadgama wants to merge 1 commit into
AndroidDumps:masterfrom
Shyam-vadgama:fix/tgz-input
Open

Shyam-vadgama wants to merge 1 commit into
AndroidDumps:masterfrom
Shyam-vadgama:fix/tgz-input

Conversation

@Shyam-vadgama

@Shyam-vadgama Shyam-vadgama commented Nov 14, 2026 •

Copy link
Copy Markdown

Summary

dumpyara.sh cannot process .tgz/.tar.gz firmware packages (common for Xiaomi/POCO fastboot ROMs). Extraction reports success, but the output directory is empty, so the dump only contains a blank README.md.

Root cause

Firmware_extractor detects archive formats with 7z l. For a gzip-compressed tar, 7-Zip only exposes the inner .tar:

$ 7z l -ba warm_in_...tgz
2026-07-17 ... 3383404544 6081669112 warm_in_...tar

None of the extractor's format branches match (rawprogram, super.img, system.img, tar.md5, ...), so nothing is extracted. Additionally, 7-Zip truncates the inner tar at ~3.78 GiB because gzip's ISIZE field is 32-bit (the tar is ~7.68 GiB).

Fix

Decompress .tgz/.tar.gz inputs to a temporary .tar with gzip -dc before calling Firmware_extractor, then let the extractor handle the tar. The temporary file is removed with an EXIT trap, including failure paths. The dump directory name is unchanged.

Verification

Tested with warm_in_global_images_OS3.0.303.0.WGVINXM_20260717.0000.00_16.0_in_92a2156f88.tgz (POCO warm, Android 16):

  • Before: extractor exited 0, output directory contained 0 files, README.md was blank.
  • After: dump completed with system, vendor, product, system_ext, mi_ext, odm, system_dlkm, vendor_dlkm (10,190 entries in all_files.txt).
  • A corrupt .tgz now aborts with Failed to decompress ... and leaves no partial tarball.

This PR needs the companion Firmware_extractor fix for the QFIL super.img clobbering bug (AndroidDumps/Firmware_extractor#49), otherwise the dump stops after the boot/recovery images.

'7z' only exposes the inner '.tar' of a gzip-compressed tar and truncates gzip streams larger than 4 GiB (gzip's ISIZE field is 32-bit), so Firmware_extractor never detected the archive and returned success with an empty output directory.

Decompress '.tgz'/'.tar.gz' inputs to a temporary '.tar' with gzip and let Firmware_extractor handle it. The temporary file is removed on exit, including failure paths.
Copilot AI balanced review requested due to automatic review settings November 14, 2026 12:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

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