{"record":{"id":"4b38ebc2b5637aa6","repo":"ungoogled-software/ungoogled-chromium","slug":"7z-commands-returned-non-zero-status-s","errorCode":null,"errorMessage":"7z commands returned non-zero status: %s","messagePattern":"7z commands returned non-zero status: (.+?)","errorType":"exception","errorClass":"ChildProcessError","httpStatus":null,"severity":"error","filePath":"utils/_extraction.py","lineNumber":108,"sourceCode":"def _extract_tar_with_7z(binary, archive_path, output_dir, relative_to):\n    get_logger().debug('Using 7-zip extractor')\n    if not relative_to is None and (output_dir / relative_to).exists():\n        get_logger().error('Temporary unpacking directory already exists: %s',\n                           output_dir / relative_to)\n        raise FileExistsError()\n    cmd1 = (binary, 'x', str(archive_path), '-so')\n    cmd2 = (binary, 'x', '-si', '-snld', '-aoa', '-ttar', f'-o{str(output_dir)}')\n    get_logger().debug('7z command line: %s | %s', ' '.join(cmd1), ' '.join(cmd2))\n\n    proc1 = subprocess.Popen(cmd1, stdout=subprocess.PIPE) #pylint: disable=consider-using-with\n    proc2 = subprocess.Popen(cmd2, stdin=proc1.stdout, stdout=subprocess.PIPE) #pylint: disable=consider-using-with\n    proc1.stdout.close()\n    (stdout_data, stderr_data) = proc2.communicate()\n    if proc2.returncode != 0:\n        get_logger().error('7z commands returned non-zero status: %s', proc2.returncode)\n        get_logger().debug('stdout: %s', stdout_data)\n        get_logger().debug('stderr: %s', stderr_data)\n        raise ChildProcessError()\n\n    _process_relative_to(output_dir, relative_to)\n\n\ndef _extract_tar_with_tar(binary, archive_path, output_dir, relative_to):\n    get_logger().debug('Using BSD or GNU tar extractor')\n    output_dir.mkdir(exist_ok=True)\n    cmd = (binary, '-xf', str(archive_path), '-C', str(output_dir))\n    get_logger().debug('tar command line: %s', ' '.join(cmd))\n    result = subprocess.run(cmd, check=False)\n    if result.returncode != 0:\n        get_logger().error('tar command returned %s', result.returncode)\n        raise ChildProcessError()\n\n    # for gnu tar, the --transform option could be used. but to keep compatibility with\n    # bsdtar on macos, we just do this ourselves\n    _process_relative_to(output_dir, relative_to)\n","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/ungoogled-software/ungoogled-chromium/blob/f85e84a480e2e17c103de7013de94320f9a2ba39/utils/_extraction.py#L90-L126","documentation":"_extract_tar_with_7z pipes two 7z processes (archive -> stdout, stdout -> files). If the second 7z process exits non-zero the function logs the status and stdout/stderr and raises ChildProcessError, meaning the tar stream extraction failed.","triggerScenarios":"Corrupt or truncated archive, 7z binary that cannot handle the compression (e.g. xz/zstd filters unsupported in that 7z build), insufficient disk space, or the first 7z process dying mid-stream.","commonSituations":"Outdated p7zip (classic) lacking modern filters like zstd, partially downloaded .tar.xz, antivirus interfering on Windows, or disk-full during unpacking.","solutions":["Test the archive manually: 7z x archive.tar.xz -so | 7z x -si -ttar -oout and read stderr","Upgrade 7-zip to a current release or fall back to the tar/python extractor","Re-download or re-create the archive to rule out corruption","Check free disk space on output_dir's filesystem"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import subprocess\nprobe = subprocess.run([sevenzip_bin, 't', str(archive_path)], capture_output=True)\nif probe.returncode != 0:\n    raise RuntimeError(f'archive integrity check failed: {probe.stderr!r}')","typeGuard":null,"tryCatchPattern":"try:\n    extract_tar_file(archive, out)\nexcept ChildProcessError:\n    # log archive checksum, disk space, and 7z version; fall back\n    extract_with_python_fallback(archive, out)","preventionTips":["Verify archive checksums after download","Keep 7-zip updated for modern compression filters","Monitor free disk space before large extractions","Have a pure-Python (tarfile) fallback path"],"tags":["subprocess","archive-extraction","nonzero-exit"],"backgroundTag":"extractor-nonzero-exit-code","analyzedSha":"f85e84a480e2e17c103de7013de94320f9a2ba39","analyzedAt":"2026-08-29T10:07:17.606Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}