{"record":{"id":"1ff4f0339af6848a","repo":"dotnet/maui","slug":"unsupported-compression-format-file-extension","errorCode":null,"errorMessage":"Unsupported compression format: {file_extension}","messagePattern":"Unsupported compression format: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"eng/common/cross/install-debs.py","lineNumber":268,"sourceCode":"        subprocess.run(f\"{ar_tool} p {os.path.abspath(deb_file)} {tar_filename} > {tar_file_path}\", check=True, shell=True)\n\n        file_extension = os.path.splitext(tar_file_path)[1].lower()\n\n        if file_extension == \".xz\":\n            mode = \"r:xz\"\n        elif file_extension == \".gz\":\n            mode = \"r:gz\"\n        elif file_extension == \".zst\":\n            # zstd is not supported by standard library yet\n            decompressed_tar_path = tar_file_path.replace(\".zst\", \"\")\n            with open(tar_file_path, \"rb\") as zst_file, open(decompressed_tar_path, \"wb\") as decompressed_file:\n                dctx = zstandard.ZstdDecompressor()\n                dctx.copy_stream(zst_file, decompressed_file)\n\n            tar_file_path = decompressed_tar_path\n            mode = \"r\"\n        else:\n            raise ValueError(f\"Unsupported compression format: {file_extension}\")\n\n        with tarfile.open(tar_file_path, mode) as tar:\n            tar.extractall(path=extract_dir, filter='fully_trusted')\n\ndef finalize_setup(rootfsdir):\n    lib_dir = os.path.join(rootfsdir, 'lib')\n    usr_lib_dir = os.path.join(rootfsdir, 'usr', 'lib')\n\n    if os.path.exists(lib_dir):\n        if os.path.islink(lib_dir):\n            os.remove(lib_dir)\n        else:\n            os.makedirs(usr_lib_dir, exist_ok=True)\n\n            for item in os.listdir(lib_dir):\n                src = os.path.join(lib_dir, item)\n                dest = os.path.join(usr_lib_dir, item)\n","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/eng/common/cross/install-debs.py#L250-L286","documentation":"extract_debs raises ValueError when the data.tar member's extension is not one of .xz, .gz, or .zst. The script only knows how to open those compression modes; any other extension (e.g. .bz2, .lzma, or no extension) is rejected after the archive is already extracted from the .deb.","triggerScenarios":"A .deb whose data member is data.tar.bz2 or another unsupported compression, or a tar_file_path whose extension parsing yields an unexpected value (e.g. data.tar with no compression suffix).","commonSituations":"Older Debian archives using bzip2, experimental lzma-compressed debs, or a renamed/mangled member name that confuses splitext.","solutions":["Prefer a suite/mirror whose debs use xz or zst (current Debian/Ubuntu default).","If .bz2 support is required, extend the branch to add `mode = 'r:bz2'` for the .bz2 case.","Verify the member name with `ar t file.deb`; if it is data.tar (uncompressed), add an `else: mode = 'r'` branch.","Avoid hand-modified debs with non-standard compression."],"exampleFix":"# before\nelif file_extension == \".zst\":\n    ...\nelse:\n    raise ValueError(f\"Unsupported compression format: {file_extension}\")\n\n# after\nelif file_extension == \".bz2\":\n    mode = \"r:bz2\"\nelif file_extension == \".zst\":\n    ...\nelse:\n    raise ValueError(f\"Unsupported compression format: {file_extension}\")","handlingStrategy":"validation","validationCode":"ext = os.path.splitext(tar_file_path)[1].lower()\nif ext not in ('.xz', '.gz', '.zst'):\n    raise ValueError(f\"Unsupported compression format: {ext}\")","typeGuard":"def is_supported_compression(ext): return ext.lower() in ('.xz', '.gz', '.zst')","tryCatchPattern":"try:\n    extract_debs([deb], ...)\nexcept ValueError as e:\n    print(e); re_fetch_from_xz_mirror(deb)","preventionTips":["Prefer suites whose debs use xz or zst.","Extend the compression branch if you must support bz2/lzma.","Inspect member names with `ar t` before extraction."],"tags":["python","cross-build","rootfs","compression"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}