Repository navigation
fix: support .tgz and .tar.gz firmware inputs - #75
Open
Shyam-vadgama wants to merge 1 commit into
Open
Shyam-vadgama wants to merge 1 commit into
Shyam-vadgama wants to merge 1 commit into
Conversation
'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.
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.
Summary
dumpyara.shcannot process.tgz/.tar.gzfirmware packages (common for Xiaomi/POCO fastboot ROMs). Extraction reports success, but the output directory is empty, so the dump only contains a blankREADME.md.Root cause
Firmware_extractordetects archive formats with7z l. For a gzip-compressed tar, 7-Zip only exposes the inner.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'sISIZEfield is 32-bit (the tar is ~7.68 GiB).Fix
Decompress
.tgz/.tar.gzinputs to a temporary.tarwithgzip -dcbefore callingFirmware_extractor, then let the extractor handle the tar. The temporary file is removed with anEXITtrap, 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(POCOwarm, Android 16):0, output directory contained 0 files,README.mdwas blank.system,vendor,product,system_ext,mi_ext,odm,system_dlkm,vendor_dlkm(10,190 entries inall_files.txt)..tgznow aborts withFailed to decompress ...and leaves no partial tarball.This PR needs the companion
Firmware_extractorfix for the QFILsuper.imgclobbering bug (AndroidDumps/Firmware_extractor#49), otherwise the dump stops after the boot/recovery images.