Tar file extraction test suite · tar-minefield

tar-minefield

26 min read Original article ↗
Working draft

GitHubhaampie/tar-minefield DOI10.5281/zenodo.23617964

This project provides an extensive test suite and documentation for tar file extraction, with the goal of ensuring that implementations extract tar archives the same way.

There are many implementations of tar, from command line tools to libraries for programming languages. Because the tar file format leaves room for interpretation, different implementations can extract certain crafted tar files in different ways.

This is a security concern for file exchange: for example, when a security scanner and the extractor use different tar implementations, the scanner could inspect other files than the ones that end up on disk.

By assigning identifiers to these ambiguities, and providing test cases and usage data, this project aims for tar implementations to converge on strict parsing and identical behavior.

This project proposes a default policy that rejects the vast majority of ambiguities in tar files that could make implementations extract different files, while ensuring that nearly every source tarball already published can still be extracted. Of the 82,586 source tarballs of Spack, nixpkgs, Guix and live-bootstrap, and samples of PyPI, crates.io and RubyGems, it accepts 99.80%.

Comparison of different tar implementations

This table shows how different tar implementations behave on each test case. A green ✓ is the strict behavior that the default policy asks for; click a row for details about the case.

What implementations make of every case of the test suiteGNU tarbsdtarBusyBox tar7-ZipPython tarfile, filter=data, as in pipPython tarfile, filter=tarPython tarfile, filter=fully_trustednode-tarnode-tar, stricttar-fsJava Commons Compress.NET System.Formats.TarPHP PharData, as in ComposerGo containerd archive.ApplyRust tarRust astral-tokio-tarRust tar-codec, as in uvRubyGemsR untar, internalPerl Archive::TarHaskell tarJulia Tar.jluntar (PyPI)live-bootstrap untarlive-bootstrap untar, --non-strictall 188 casesGNU tar: 80 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept80GNU tar: 21 of 188, accepts a tolerated case and extracts its expected tree21GNU tar: 1 of 188, rejects a tolerated caseGNU tar: 86 of 188, accepts a case to reject, or crashes on it86bsdtar: 80 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept80bsdtar: 21 of 188, accepts a tolerated case and extracts its expected tree21bsdtar: 1 of 188, rejects a tolerated casebsdtar: 86 of 188, accepts a case to reject, or crashes on it86BusyBox tar: 63 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept63BusyBox tar: 20 of 188, accepts a tolerated case and extracts its expected tree20BusyBox tar: 1 of 188, rejects a tolerated caseBusyBox tar: 102 of 188, accepts a case to reject, or crashes on it102BusyBox tar: 2 of 188, rejects a case to accept, or extracts another tree than the expected one, or crashes on it7-Zip: 62 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept627-Zip: 18 of 188, accepts a tolerated case and extracts its expected tree187-Zip: 3 of 188, rejects a tolerated case7-Zip: 102 of 188, accepts a case to reject, or crashes on it1027-Zip: 3 of 188, rejects a case to accept, or extracts another tree than the expected one, or crashes on itPython tarfile, filter=data, as in pip: 73 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept73Python tarfile, filter=data, as in pip: 19 of 188, accepts a tolerated case and extracts its expected tree19Python tarfile, filter=data, as in pip: 3 of 188, rejects a tolerated casePython tarfile, filter=data, as in pip: 92 of 188, accepts a case to reject, or crashes on it92Python tarfile, filter=data, as in pip: 1 of 188, rejects a case to accept, or extracts another tree than the expected one, or crashes on itPython tarfile, filter=tar: 68 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept68Python tarfile, filter=tar: 21 of 188, accepts a tolerated case and extracts its expected tree21Python tarfile, filter=tar: 1 of 188, rejects a tolerated casePython tarfile, filter=tar: 98 of 188, accepts a case to reject, or crashes on it98Python tarfile, filter=fully_trusted: 65 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept65Python tarfile, filter=fully_trusted: 21 of 188, accepts a tolerated case and extracts its expected tree21Python tarfile, filter=fully_trusted: 1 of 188, rejects a tolerated casePython tarfile, filter=fully_trusted: 98 of 188, accepts a case to reject, or crashes on it98Python tarfile, filter=fully_trusted: 3 of 188, writes outside the destinationnode-tar: 38 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept38node-tar: 18 of 188, accepts a tolerated case and extracts its expected tree18node-tar: 2 of 188, rejects a tolerated casenode-tar: 124 of 188, accepts a case to reject, or crashes on it124node-tar: 6 of 188, rejects a case to accept, or extracts another tree than the expected one, or crashes on itnode-tar, strict: 62 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept62node-tar, strict: 18 of 188, accepts a tolerated case and extracts its expected tree18node-tar, strict: 4 of 188, rejects a tolerated casenode-tar, strict: 100 of 188, accepts a case to reject, or crashes on it100node-tar, strict: 4 of 188, rejects a case to accept, or extracts another tree than the expected one, or crashes on ittar-fs: 77 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept77tar-fs: 18 of 188, accepts a tolerated case and extracts its expected tree18tar-fs: 4 of 188, rejects a tolerated casetar-fs: 88 of 188, accepts a case to reject, or crashes on it88tar-fs: 1 of 188, rejects a case to accept, or extracts another tree than the expected one, or crashes on itJava Commons Compress: 65 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept65Java Commons Compress: 19 of 188, accepts a tolerated case and extracts its expected tree19Java Commons Compress: 94 of 188, accepts a case to reject, or crashes on it94Java Commons Compress: 10 of 188, rejects a case to accept, or extracts another tree than the expected one, or crashes on it10.NET System.Formats.Tar: 110 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept110.NET System.Formats.Tar: 19 of 188, accepts a tolerated case and extracts its expected tree19.NET System.Formats.Tar: 3 of 188, rejects a tolerated case.NET System.Formats.Tar: 52 of 188, accepts a case to reject, or crashes on it52.NET System.Formats.Tar: 4 of 188, rejects a case to accept, or extracts another tree than the expected one, or crashes on itPHP PharData, as in Composer: 52 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept52PHP PharData, as in Composer: 15 of 188, accepts a tolerated case and extracts its expected tree15PHP PharData, as in Composer: 4 of 188, rejects a tolerated casePHP PharData, as in Composer: 101 of 188, accepts a case to reject, or crashes on it101PHP PharData, as in Composer: 16 of 188, rejects a case to accept, or extracts another tree than the expected one, or crashes on it16Go containerd archive.Apply: 71 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept71Go containerd archive.Apply: 21 of 188, accepts a tolerated case and extracts its expected tree21Go containerd archive.Apply: 1 of 188, rejects a tolerated caseGo containerd archive.Apply: 93 of 188, accepts a case to reject, or crashes on it93Go containerd archive.Apply: 2 of 188, rejects a case to accept, or extracts another tree than the expected one, or crashes on itRust tar: 68 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept68Rust tar: 22 of 188, accepts a tolerated case and extracts its expected tree22Rust tar: 96 of 188, accepts a case to reject, or crashes on it96Rust tar: 2 of 188, rejects a case to accept, or extracts another tree than the expected one, or crashes on itRust astral-tokio-tar: 85 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept85Rust astral-tokio-tar: 21 of 188, accepts a tolerated case and extracts its expected tree21Rust astral-tokio-tar: 1 of 188, rejects a tolerated caseRust astral-tokio-tar: 79 of 188, accepts a case to reject, or crashes on it79Rust astral-tokio-tar: 2 of 188, rejects a case to accept, or extracts another tree than the expected one, or crashes on itRust tar-codec, as in uv: 143 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept143Rust tar-codec, as in uv: 9 of 188, accepts a tolerated case and extracts its expected tree9Rust tar-codec, as in uv: 13 of 188, rejects a tolerated case13Rust tar-codec, as in uv: 20 of 188, accepts a case to reject, or crashes on it20Rust tar-codec, as in uv: 3 of 188, rejects a case to accept, or extracts another tree than the expected one, or crashes on itRubyGems: 52 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept52RubyGems: 15 of 188, accepts a tolerated case and extracts its expected tree15RubyGems: 4 of 188, rejects a tolerated caseRubyGems: 97 of 188, accepts a case to reject, or crashes on it97RubyGems: 20 of 188, rejects a case to accept, or extracts another tree than the expected one, or crashes on it20R untar, internal: 56 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept56R untar, internal: 19 of 188, accepts a tolerated case and extracts its expected tree19R untar, internal: 3 of 188, rejects a tolerated caseR untar, internal: 100 of 188, accepts a case to reject, or crashes on it100R untar, internal: 10 of 188, rejects a case to accept, or extracts another tree than the expected one, or crashes on it10Perl Archive::Tar: 50 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept50Perl Archive::Tar: 17 of 188, accepts a tolerated case and extracts its expected tree17Perl Archive::Tar: 3 of 188, rejects a tolerated casePerl Archive::Tar: 103 of 188, accepts a case to reject, or crashes on it103Perl Archive::Tar: 15 of 188, rejects a case to accept, or extracts another tree than the expected one, or crashes on it15Haskell tar: 85 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept85Haskell tar: 14 of 188, accepts a tolerated case and extracts its expected tree14Haskell tar: 7 of 188, rejects a tolerated case7Haskell tar: 78 of 188, accepts a case to reject, or crashes on it78Haskell tar: 4 of 188, rejects a case to accept, or extracts another tree than the expected one, or crashes on itJulia Tar.jl: 104 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept104Julia Tar.jl: 19 of 188, accepts a tolerated case and extracts its expected tree19Julia Tar.jl: 3 of 188, rejects a tolerated caseJulia Tar.jl: 62 of 188, accepts a case to reject, or crashes on it62untar (PyPI): 163 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept163untar (PyPI): 18 of 188, accepts a tolerated case and extracts its expected tree18untar (PyPI): 4 of 188, rejects a tolerated caseuntar (PyPI): 3 of 188, accepts a case to reject, or crashes on itlive-bootstrap untar: 48 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept48live-bootstrap untar: 12 of 188, accepts a tolerated case and extracts its expected tree12live-bootstrap untar: 4 of 188, rejects a tolerated caselive-bootstrap untar: 84 of 188, accepts a case to reject, or crashes on it84live-bootstrap untar: 36 of 188, rejects a case to accept, or extracts another tree than the expected one, or crashes on it36live-bootstrap untar: 4 of 188, writes outside the destinationlive-bootstrap untar, --non-strict: 24 of 188, follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept24live-bootstrap untar, --non-strict: 12 of 188, accepts a tolerated case and extracts its expected tree12live-bootstrap untar, --non-strict: 3 of 188, rejects a tolerated caselive-bootstrap untar, --non-strict: 108 of 188, accepts a case to reject, or crashes on it108live-bootstrap untar, --non-strict: 37 of 188, rejects a case to accept, or extracts another tree than the expected one, or crashes on it37live-bootstrap untar, --non-strict: 4 of 188, writes outside the destinationto acceptF17pax-global-comment✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✗✗F28pax-newline-in-comment✓✓✓✓✓✓✓✗✗✓✓✗✓✓✓✓✓✓✗✓✓✓✓✗✗F31pax-xattr-not-utf8✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✗✗F57pax-newline-in-comment-path✓✓✓✓✓✓✓✗✗✓✓✗✓✓✗✓✓✓✗✓✓✓✓✗✗F58pax-newline-in-comment-then-size✓✓✓✓✓✓✓✓✓✓✓✗✓✓✓✓✓✓✗✓✓✓✓✗✗F59pax-nul-in-xattr✓✓✓✗✓✓✓✓✓✓✓✓✗✓✓✓✓✗✗✗✓✓✓✗✗F65archive-without-members✓✓✓✓✓✓✓✗✗✓✓✓✓✓✓✓✓✓✓✗✓✓✓✓✓F79number-uid-gid-empty✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓F80number-uid-base256✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✗✗F81pax-unknown-key✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✗✓✓✓✓✓✓✗✗F82pax-times✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✗✗K07dir-name-empty-with-prefix✓✓✓✓✓✓✓✓✓✓✓✓✗✓✓✓✓✓✓✗✓✓✓✗✗K09file-executable✓✓✓✓✓✓✓✓✓✓✗✓✓✓✓✗✓✓✓✓✓✓✓✗✗K10file-executable-group-other✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✗✓✓✓✓✓✓✓✓N01gnu-long-name✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✗✓✓✓✓✓✗✗N02name-fills-field✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✗✗N03pax-long-name✓✓✓✓✓✓✓✓✓✓✓✓✗✓✓✓✓✗✓✗✓✓✓✗✗N04ustar-prefix✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✗✗N27pax-long-symlink✓✓✓✓✓✓✓✓✓✓✗✓✗✓✓✓✓✗✓✗✗✓✓✗✗N28pax-long-hardlink✓✓✓✓✓✓✓✓✓✓✗✓✗✓✓✓✓✗✓✗✗✓✓✗✗N42gnu-long-name-dir✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✗✗✓✓✓✓✗✗N43pax-long-dir✓✓✓✓✓✓✓✓✓✓✓✓✗✓✓✓✓✗✗✗✓✓✓✗✗N44pax-path-name-empty✓✓✓✓✓✓✓✓✓✓✓✓✗✓✓✓✓✗✗✗✓✓✓✗✗N45gnu-long-name-field-slash✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✗✗✓✓✓✓✗✗N46pax-linkpath-linkname-empty✓✓✓✓✓✓✓✗✗✓✗✓✗✓✓✓✓✗✗✗✓✓✓✗✗N47gnu-long-link✓✓✓✓✓✓✓✓✓✓✗✓✗✓✓✓✓✗✓✗✓✓✓✗✗N54pax-path-not-ascii✓✓✓✓✓✓✓✓✓✓✓✓✗✓✓✓✓✗✓✗✗✓✓✗✗N55gnu-long-link-and-name✓✓✓✓✓✓✓✓✓✓✗✓✗✓✓✓✓✗✓✗✓✓✓✗✗N56pax-path-equals-sign✓✓✓✓✓✓✓✓✓✓✓✓✗✓✓✓✓✗✓✗✓✓✓✗✗N57ustar-prefix-fills-field✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✗✗N58ustar-prefix-under-pax✓✓✓✓✓✓✓✓✓✓✓✗✓✓✓✓✓✓✓✓✓✓✓✗✗N59symlink-target-dotdot-after-symlink✓✓✓✗✗✓✓✓✓✓✗✓✗✓✓✓✗✗✓✓✓✓✓✓✓N60pax-global-name-directory✓✓✓✓✓✓✓✓✓✓✓✓✓✗✗✗✓✗✓✓✓✓✓✗✗S01tree-dir-after-contents✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓S02tree-duplicate-dir✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓S25tree-dir-not-writable✓✓✗✓✓✓✓✓✓✗✓✓✓✗✓✓✓✗✗✓✓✓✓✗✗toleratedF01number-leading-space++++++++++++++++−++++++++F02end-data-after+++++++++−++++++++++−+−++F04end-missing+++−++++++++++++−+++−++−−F05magic-version-nuls+++++++++++−+++−−+++−++++F14pax-size-disagrees++✗+++++++++✗++++✗+✗✗+−✗✗F18pax-global-comment-after-members+++++++++++++++++++++++✗✗F32checksum-leading-space++++++++++++++++−++++++++F42pax-comment-not-utf8++++++++++++++++−++++++✗✗F43pax-global-comment-not-utf8++++++++++++++++−++++++✗✗F55type-contiguous+++++++++−+++−+++✗−✗+−−++F56number-size-base256++++++++++++−+++−−−++++−−F66archive-no-bytes−+−−−−−−−+++−+++−++−−+−−−K02linkname-on-file+++++++−−+++++++−++++−+++K16pax-linkpath-on-file+−++++++++++++++−+++−−+✗✗N05name-dot++++++++++++−++++−+++++++N06name-leading-dot-slash+++++++++++++++++++++++++N07symlink-absolute+++✗−++✗−−✗−✗+++−−+−−++++N15name-control-character++++++++++++++++−++++++++N35symlink-escapes+++−−++✗−−✗−✗+++−−+−−++++N49name-double-slash+++++++++++++++++++++++✗✗N50name-dot-component++++++++++++++++++−++++++S16hardlink-target-spelled-differently++++++++++✗+−++++✗+++++−✗to reject: framingF03end-lone-zero-block!!!!!!!!!!!!!!!!✓!!!✓!✓!!F06checksum-signed!!!!!!!✓✓✓!!✓!✓✓✓!!!✓✓✓!!F07end-archive-after!!!!!!!!!!!!!!!!!!!!✓!✓!!F08end-truncated-in-member✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓F09end-zero-block-then-member!!!!!!!!!!!!!✓!!✓!!!✓!✓!!F10extended-pax-size-before-gnu-long!!!!!!!!!!!✓!!!!✓!!!!!✓✓✓F11magic-odd-version!!!!!!!!!!!✓!!!!✓!!!✓✓✓!!F12number-size-gap!✓!!✓✓✓!!!✓✓✓✓✓✓✓✓!!!!✓!!F13pax-newline-in-path!!!!!!!!!!!✓!!!!✓!!!!!✓!!F15pax-size-on-dir!!!!!!!!!!!✓!!!!✓!!!!✓✓!!F16type-unknown!!✓!✓!!!!✓!✓!✓!!✓!✓!!✓✓!!F19pax-global-between-extended-and-member!!!!!!!!!!!✓!!!!✓!!!!!✓!!F20pax-global-size!✓!!!!!!!!!!!!!!✓!!!!!✓!!F21pax-size-empty✓!!!!!!!!!!!!!!✓✓!!!!✓✓!!F22pax-size-negative✓✓!!!!!!!✓✓✓!✓!✓✓!!!!✓✓!!F23pax-size-plus✓!!!!!!!!!!!!!!✓✓!!!!✓✓!!F24pax-size-leading-space✓!!!!!!!!!✓!!✓!✓✓!!!!!✓!!F25pax-size-not-ascii-digits✓!!!!!!!!✓!✓!✓!✓✓!!!!✓✓!!F26pax-size-leading-zero!!!!!!!!!!!!!!!!✓!!!!!✓!!F27pax-size-too-large✓✓!!✓✓✓✓✓✓✓✓!✓!✓✓!!!!✓✓!!F29number-size-base256-negative✓✓!✓✓✓✓!!✓✓✓✓✓✓✓✓✓✓!!✓✓✓✓F30number-size-base256-too-large✓✓!✓✓✓✓!✓✓✓✓✓✓!!✓✓✓!!✓✓✓✓F33size-on-dir!!!!!!!!!!!✓!!!!✓!!!!✓✓!!F34size-on-hardlink!!!!!!!!!!!✓!!!!✓!!!!✓✓✓!F35pax-size-on-hardlink!!!!!!!!!!!✓!!!!✓!!!!✓✓✓!F36pax-record-length-short✓✓!!✓✓✓!!!✓✓!✓!✓✓!!!!✓✓!!F37number-size-not-octal✓✓✓✓✓✓✓!!!✓✓✓✓✓✓✓✓✓!!✓✓!!F38size-on-hardlink-without-pax!!!!!!!!!!!✓!!!!✓!!!!✓✓✓!F39format-pax-after-v7!!!!!!!!!✓!!!!!!✓!!!!!✓!!F40number-size-no-terminator!!!!!!!!!!!!!!!!✓!!!!!✓!!F41number-size-leading-nul!!!!!!!!!!!!✓!✓✓✓!!!!✓✓!!F44pax-global-size-empty✓✓!!!!!!!!!!!!!!✓!!!!✓✓!!F45type-gnu-sparse!!✓!!!!!!✓!✓!✓!!✓✓✓!!✓✓!!F46pax-size-on-symlink!!!!!!!!!!!✓!!!!✓!✓!!✓✓!!F47checksum-wrong-after-first-member✓!✓✓!!!!✓✓!!✓✓✓✓✓!!!✓✓✓✓✓F48pax-record-length-plus✓✓!!✓✓✓!!!✓✓!!!!✓!!!!✓✓!!F49pax-record-empty-line✓✓!!✓✓✓!!!!✓!✓!✓✓!!!!✓✓!!F50pax-size-underscore✓!!!!!!!!!✓✓!✓!✓✓!!!!✓✓!!F51number-size-plus✓✓!✓!!!!!!✓✓✓✓!!✓✓✓!✓✓✓!!F52type-gnu-volume-label!!!!✓!!!!✓!✓!✓!!✓!✓!!✓✓!!F53type-gnu-old-long-name!!✓!✓!!!!!!✓!✓!!✓!✓!!✓✓✓✓F54format-pax-header-without-magic!!!!!!!!!✓!!!!!✓✓!!!!!✓!!F61number-uid-not-octal✓!✓!!!!!!!✓✓!✓!!✓✓!!!!!!!F62pax-schily-realsize!✓!!!!!!!!!!!!!!!!!!!!✓!!F63end-unpadded✓✓!✓✓✓✓✓✓✓✓✓✓!✓✓✓!✓✓✓✓✓✓✓F64end-truncated-in-header!✓✓✓!!!!!✓!✓✓✓✓✓✓!✓!✓✓✓✓✓F67extended-without-member!!✓✓✓✓✓!!!✓!!!✓✓✓!!!!✓✓!!F68size-on-symlink!!!!!!!!!!!✓!!!!✓!!!!✓✓!!F69number-size-octal-prefix✓✓✓✓!!!!!!✓✓✓✓✓✓✓✓✓!✓✓✓!!F70number-size-minus✓✓!✓✓✓✓!!✓✓✓✓✓✓✓✓✓✓!✓✓✓!!F71number-size-base256-marker✓✓!✓✓✓✓!✓✓!✓✓✓!!✓✓✓!✓✓✓✓✓F72pax-record-length-wraps✓✓!!✓✓✓!!!!✓!✓!✓✓!!!!!✓!!F73pax-record-without-equals✓✓!!✓✓✓!!!✓✓!✓!✓✓!!!!✓✓!!F74pax-size-twice!!!!!!!!!!!✓!!!!✓!!!!!✓!!F75pax-size-decimal-point✓!!!!!!!!!✓✓!✓!✓✓!!!!✓✓!!F76checksum-byte-after-nul!!!!!!!!!!✓!!!!!✓✓!!!!✓!!F77checksum-leading-nul!!✓✓!!!!✓!!!✓!✓✓✓!!!✓✓✓!!F78pax-nul-in-key✓!!!!!!!!!!!!✓!!✓!!!!!✓!!F83size-on-fifo!!!!✓!!!✓✓!✓!!!!✓!!!!✓✓✓!N48magic-gnu-version-00!!!!!!!!!✓✓✓!!!!✓!!!✓!✓!!to reject: namesN08extended-pax-path-and-gnu-long-name!!!!!!!!!!!!!!!✓✓!!!✓!✓✓✓N09extended-two-pax-headers!✓!!!!!!!!!✓!!✓✓✓!!!✓!✓!!N10format-star!!!!!!!!!!!!!!!!✓!!✓!!✓!!N11gnu-prefix-field!!!!!!!!!!!!!!!!!✓!!!!✓!!N12name-absolute!!!!!!↑!✓!✓✓!!!!✓✓!✓✓✓✓↑↑N13name-backslash!!!!!!!!!!!!!!!!✓!!!!!✓!!N14name-bytes-after-nul!!!!!!!!!!!!!!!!!✓!!!!✓!!N16name-dotdot✓✓!!✓✓↑!✓!✓✓!!!!✓✓✓✓✓✓✓↑↑N17name-empty✓✓✓!✓✓✓✓✓✓✓✓✓!!!✓✓✓✓✓✓✓!!N18name-not-utf8!!!!!!!!!!!!!!!!✓!!!!!✓✓✓N19pax-nul-in-path!!!!✓✓✓!!✓✓!!✓✓✓✓!!!✓✓✓!!N20pax-repeated-key!!!!!!!!!!!✓!!!!✓!!!!!✓!!N21pax-global-path!✓!!!!!!!!!!!!!!✓!!!!!✓!!N22pax-path-empty!!✓!✓✓✓!✓!!✓!!!✓✓!✓!✓✓✓!!N23extended-gnu-long-then-pax!!!!!!!!!!!!!!!!✓!!!!!✓✓✓N24pax-hdrcharset-binary!!!!!!!!!!!!!!!!✓!!!!!✓!!N25symlink-empty-target✓✓!!!!!✓✓!!✓!✓✓✓✓✓!✓✓✓✓✓!N26pax-global-path-then-empty!✓!!✓✓✓!!!!!!!!!✓!!!!✓✓!!N29extended-pax-path-before-gnu-long-name!!!!!!!!!!!✓!!!✓✓!!!✓!✓✓✓N30name-drive-letter!!!!!!!!✓!!!!!!!✓!!!!!✓!!N31pax-linkpath-not-utf8!✓!!!!!!!!!!!!!!✓!!!!!✓!!N32linkname-not-utf8!!!!!!!!!!!!!!!!✓!!!!!✓✓✓N33type-solaris-extended!!✓!!!!!!✓!✓!✓!!✓!✓!!✓✓!!N34pax-linkpath-empty✓!✓!!!!!✓!!✓!!✓✓✓!✓!✓✓✓!!N36pax-gnu-sparse!!!!!!!!!!!!!!!!✓!!!!!✓!!N37extended-two-gnu-long-names!✓!!!!!!!!!✓!!✓✓✓!!!✓!✓✓✓N38gnu-long-name-empty✓!✓!✓✓✓!!✓✓!✓!!!✓!!✓✓!✓✓✓N39gnu-long-name-size-without-nul!!!!!!!!!!!!!!!!✓!!!!✓✓✓✓N40pax-global-linkpath!✓!!!!!!!!!!!!!!✓!!!!!✓!!N41pax-gnu-sparse-name!!!!!!!!!!!!!!!✓✓!!!!!✓!!N51linkname-bytes-after-nul!!!!!!!!!!!!!!!!!✓!!!!✓!!N52extended-name-dotdot!!!!!!!!!!!!!!!!!✓!!✓!!↑↑N53name-dotdot-inside✓✓!!!!!!✓!!!!!!!✓!✓✓!✓✓!!to reject: kindsF60trailing-slash-file-with-size!!!!!!!!!✓!✓!!!!✓!!!✓✓✓!!K01kind-trailing-slash-file!!!!!!!!!✓!✓!!!!✓!!!✓✓✓!!K03symlink-trailing-slash!!!!!!!!!✓!✓!!!!✓!!✓✓✓✓✓!K04name-empty-with-prefix!!!!!!!!!✓!✓!!!!✓!!✓!✓✓!!K05hardlink-trailing-slash!!!!!!!!!✓!✓!!!!✓!!✓✓✓✓✓!K06symlink-named-dot✓✓✓!✓✓!!!✓✓✓✓!!!✓✓✓✓✓✓✓✓!K08type-fifo!!!!✓!!!✓✓!!!!!!✓!!!!✓✓✓!K11pax-mode!!!!!!!!!!!!!!!!✓!!!!!✓!!K12pax-acl!!!!!!!!!!!!!!!!!!!!!!✓!!K13number-mode-base256!!!✓!!!!!!!!!!!!✓✓✓!!✓✓✓✓K14file-named-dot✓✓✓!✓✓✓!!✓✓✓✓!!!✓✓✓✓✓✓✓!!K15file-trailing-dot✓!✓!✓✓✓!!!!!!!!!✓!✓✓✓✓✓!!to reject: order and stateS03hardlink-missing-target✓✓✓✓✓✓✓!✓✓!✓✓✓✓✓✓!!✓✓✓✓✓!S04hardlink-to-itself!✓!✓!!!!✓✓!✓!✓✓✓✓!!!!!✓✓!S05hardlink-to-later-member✓✓!!✓✓✓!✓✓!✓✓✓✓✓✓!!!!✓✓✓!S06hardlink-to-symlink!!!✓!!!!✓!!!!!!!✓!!!✓✓✓✓!S07tree-duplicate-file-differs!!!!!!!!!!!✓!!!!!!!!!!✓!!S08tree-duplicate-file-dir!!!✓✓✓✓!!✓✓✓!!✓✓!✓!✓✓!✓!!S09tree-duplicate-file-identical!!!!!!!!!!!✓!!!!!!!!!!✓!!S10tree-symlink-then-file!!!✓!!!!!!!✓!!!!!!!!✓!✓!!S11tree-through-symlink✓✓✓✓✓✓↑!✓✓✓✓✓!✓✓✓✓✓✓✓✓✓↑↑S12tree-under-file✓✓✓✓✓✓✓!✓✓✓✓✓✓✓✓✓✓✓✓✓!✓!!S13hardlink-empty-target✓✓!!!!!!✓!!✓✓✓✓✓✓!!✓✓!✓✓!S14tree-symlink-then-dir!!!✓!!!!!!✓!!!✓✓!✓!✓✓!✓!!S15tree-file-then-hardlink!!!!!!!!!!!✓!!✓✓!!!!!!✓✓!S17hardlink-then-file-again!!!!!!!!!!!✓!!!!!!!!!!✓✓!S18hardlink-absolute!!!!✓!!!✓!!!✓!✓✓✓!!✓✓!✓✓!S19tree-through-symlink-inside✓✓✓✓!!!!✓✓✓✓✓!✓✓✓✓✓✓✓✓✓!!S20tree-file-at-implied-dir✓✓✓✓✓✓✓!✓✓✓✓✓!✓✓✓✓✓✓✓!✓!!S21tree-duplicate-dir-file!!✓!✓✓✓!!✓✓✓!!✓✓!✓✓✓✓!✓!!S22tree-duplicate-dir-symlink!!✓!✓✓✓!!✓✓✓!!✓✓!✓!✓✓!✓✓!S23tree-duplicate-file-symlink!!!!!!!!!!!✓!!!!!✓!!✓!✓✓!S24tree-duplicate-symlink!!!✓!!!!!!!✓!!!!!✓!!✓!✓✓!S26hardlink-to-dir✓✓✓✓!!!!✓✓!✓!✓✓✓✓!!!!✓✓✓!S27hardlink-through-symlink!✓!✓!!!!✓!!!✓!!!✓!!✓✓✓✓✓!S28hardlink-target-trailing-slash✓✓✓✓!!!!!!!✓✓!✓✓!!!!✓!✓✓!S29hardlink-mode-differs!!!!!!!!!!!!!!!!!!!!!!!✓!✓follows the default policy: rejects a case to reject, extracts the expected tree of a case to accept+accepts a tolerated case and extracts its expected tree−rejects a tolerated case!accepts a case to reject, or crashes on it✗rejects a case to accept, or extracts another tree than the expected one, or crashes on it↑writes outside the destination

Each case has a permanent identifier, such as F15, whose letter is its category:

A case's page shows its archive block by block, what every implementation makes of it, and how common it is in release tarballs. An implementation's page, linked from its name above the matrix, lists the cases where it does not do as the policy says.

Policy

This section defines a working draft of the default policy1, which accepts, tolerates or rejects each case below, based on data from the 82,586 distinct release tarballs of Spack, nixpkgs, Guix and live-bootstrap, and samples of PyPI, crates.io and RubyGems.

The prevalence column is the share of these tarballs that have a case: a first-order approximation of how common it is in general.

1 A policy can be stricter and also reject the tolerated cases, at the cost of rejecting more published tarballs: some tolerated cases are common, such as numbers padded with spaces (F01), and others rare. That suits special-purpose tools, such as an extractor for a single ecosystem, where it can be checked against every tarball ever published there.

To accept

identifiernamewhat it isprevalence
F17pax-global-commentThe global pax header with only a comment, as git archive writes it.not measured
F28pax-newline-in-commentA newline in a pax comment, which split on lines leaves a size record.none
F31pax-xattr-not-utf8An xattr in a pax header whose value is not UTF-8, as libarchive and star write them.0.04%
F57pax-newline-in-comment-pathA newline in a pax comment, which split on lines leaves a path record.none
F58pax-newline-in-comment-then-sizeA newline in a pax comment, which split on lines leaves a size record before the last one.none
F59pax-nul-in-xattrA NUL in the value of a pax xattr, before a path record.0.04%
F65archive-without-membersAn archive with no members, containing only the two trailing zero blocks.not measured
F79number-uid-gid-emptyAll-NUL uid and gid fields, as written in most Rust crates.6.53%
F80number-uid-base256Base-256 uid and gid fields, as GNU tar writes for IDs over 2097151.0.28%
F81pax-unknown-keyA pax header with an unrecognized vendor key.not measured
F82pax-timesSubsecond mtime, atime and ctime records in a pax header, as written by GNU tar.not measured
K07dir-name-empty-with-prefixA directory with an empty name field and a prefix.7.65%
K09file-executableAn executable file.not measured
K10file-executable-group-otherFiles executable by group or others, but not by their owner.not measured
N01gnu-long-nameA name over 100 bytes, in a GNU long name.not measured
N02name-fills-fieldA name of exactly 100 bytes, which fills the name field without a NUL.9.53%
N03pax-long-nameA name over 100 bytes, in a pax path.not measured
N04ustar-prefixA long name split between the ustar prefix and name fields.7.65%
N27pax-long-symlinkA symlink with a long name and a long target, in a pax path and linkpath respectively.0.04%
N28pax-long-hardlinkA hardlink with a long name and a long target, in a pax path and linkpath respectively.0.04%
N42gnu-long-name-dirA directory with a long name in a GNU long name, then a file.not measured
N43pax-long-dirA directory with a long name in a pax path, then a file.not measured
N44pax-path-name-emptyA regular file with an empty name field and a pax path.not measured
N45gnu-long-name-field-slashA file with a GNU long name and typeflag NUL, whose name field ends in a slash.4.38%
N46pax-linkpath-linkname-emptyA symlink with an empty linkname field and a pax linkpath.not measured
N47gnu-long-linkA symlink with a long target, in a GNU long link name.0.04%
N54pax-path-not-asciiA non-ASCII UTF-8 pax path.0.96%
N55gnu-long-link-and-nameA symlink with both a GNU long link target (K) and a GNU long name (L).0.04%
N56pax-path-equals-signA pax path value containing an equals sign: a=b.not measured
N57ustar-prefix-fills-fieldA 155-byte ustar prefix that fills the entire field without a trailing NUL.7.65%
N58ustar-prefix-under-paxA ustar prefix and name under a pax header that has no path record.7.65%
N59symlink-target-dotdot-after-symlinkA symlink target with .. after a symlink component: s/../x.not measured
N60pax-global-name-directoryA global pax header whose ustar name contains a directory component.not measured
S01tree-dir-after-contentsA directory after its contents.1.22%
S02tree-duplicate-dirThe same directory twice, as tar cf x.tar d d/sub writes.0.19%
S25tree-dir-not-writableA read-only directory member followed by a file inside it.not measured

Tolerated

identifiernamewhat it isprevalence
F01number-leading-spaceNumeric fields padded with spaces rather than zeros, as old tars wrote them.0.99%
F02end-data-afterData after the end-of-archive marker that is not a header, which is ignored.0.03%
F04end-missingNo end-of-archive marker: the archive ends after a complete member.0.03%
F05magic-version-nulsThe POSIX magic with NULs for its version, "ustar\0\0\0", as some Java archivers write.0.07%
F14pax-size-disagreesA pax size that disagrees with the header's, so that a reader of the header's misses a member.none
F18pax-global-comment-after-membersA global pax header with only a comment, after the first member.0.10%
F32checksum-leading-spaceA checksum padded with spaces rather than zeros.0.99%
F42pax-comment-not-utf8A pax comment that is not UTF-8.none
F43pax-global-comment-not-utf8A global pax comment that is not UTF-8.none
F55type-contiguousA contiguous file, typeflag 7.none
F56number-size-base256A size of 512 in base-256.none
F66archive-no-bytesA zero-byte file: an empty archive, or not an archive?none
K02linkname-on-fileA regular file with a link target.<0.01%
K16pax-linkpath-on-fileA regular file with a linkpath record in its pax header.none
N05name-dotA member named ./, the root of the tree, as tar cf x.tar . writes first.0.08%
N06name-leading-dot-slashThe name ./a, which is the path a.0.30%
N07symlink-absoluteA symlink to an absolute path, created as it is.0.11%
N15name-control-characterA control character in a name, here a newline, created as it is.0.01%
N35symlink-escapesA relative symlink whose target leads out of the destination.<0.01%
N49name-double-slashA name with two consecutive slashes: a//b.<0.01%
N50name-dot-componentA name with an inner . component: c/./d.0.01%
S16hardlink-target-spelled-differentlyA hardlink to ./a, where the member is named a.none

To reject: framing

identifiernamewhat it isprevalence
F03end-lone-zero-blockAn end-of-archive marker of one zero block, not two.<0.01%
F06checksum-signedA checksum that only matches as the signed sum of the header.none
F07end-archive-afterAnother archive after the end-of-archive marker.<0.01%
F08end-truncated-in-memberAn archive that ends inside the data of a member.not measured
F09end-zero-block-then-memberA zero block, then another member: the end of the archive, or not?<0.01%
F10extended-pax-size-before-gnu-longA pax size followed by a GNU long name: which of them does the size apply to?none
F11magic-odd-versionThe POSIX magic with a version that is neither "00" nor NULs.none
F12number-size-gapA size with a space among its digits, which reads as two sizes.none
F13pax-newline-in-pathA newline in a pax path, which split on lines is another record.none
F15pax-size-on-dirA pax size on a directory, which takes the next header for its data.0.01%
F16type-unknownAn unknown typeflag with a size: data, or no data?none
F19pax-global-between-extended-and-memberA global pax header between an extended header and its member.none
F20pax-global-sizeA global pax header with a size, which frames every member after it, or none.none
F21pax-size-emptyAn empty pax size, which in POSIX removes the size rather than giving one.none
F22pax-size-negativeA negative pax size, which a member cannot have.none
F23pax-size-plusA pax size with a plus sign, +512, which conversions of strings to numbers accept.none
F24pax-size-leading-spaceA pax size with a leading space, 512, which conversions of strings to numbers skip.none
F25pax-size-not-ascii-digitsA pax size in Arabic-Indic digits, ٥١٢, which some conversions of strings read as 512.none
F26pax-size-leading-zeroA pax size with a leading zero, 0777: 777 in decimal, as POSIX says, or 511 in octal.none
F27pax-size-too-largeA pax size of 2^64 + 512, which wraps around to 512 in 64 bits.none
F29number-size-base256-negativeA negative base-256 size in the header, -512, which a member cannot have.none
F30number-size-base256-too-largeA base-256 size of 2^64 + 512 in the header, which wraps around to 512 in 64 bits.none
F33size-on-dirA size in the header of a directory, which takes the next header for its data.none
F34size-on-hardlinkA size in the header of a hardlink, in a pax archive, which takes the next header for its data.none
F35pax-size-on-hardlinkA pax size on a hardlink, which takes the next header for its data.none
F36pax-record-length-shortA pax record whose length is one byte short, so that it ends just before its newline.none
F37number-size-not-octalA size with the digit 9, which is not octal.none
F38size-on-hardlink-without-paxA size in the header of a hardlink, in an archive without pax headers: ustar or pax?none
F39format-pax-after-v7A v7 header first, then a member with a pax header: is the x header a header, or a file?none
F40number-size-no-terminatorA size of 12 octal digits, without a terminator.none
F41number-size-leading-nulA size with a NUL before its digits, which takes the next header for its data.none
F44pax-global-size-emptyAn empty size in a global pax header: does it delete the size of every later member, or set it?none
F45type-gnu-sparseAn old GNU sparse file, typeflag S: the data as stored, or the file it expands to?none
F46pax-size-on-symlinkA symlink with a pax size: data to skip, or none?none
F47checksum-wrong-after-first-memberA header with a wrong checksum after the first member: the end, a block to skip, or a header?not measured
F48pax-record-length-plusA pax record whose length has a plus sign, +17.none
F49pax-record-empty-lineAn empty line between two pax records.none
F50pax-size-underscoreA pax size with an underscore, 5_12, which some conversions of strings to numbers accept.none
F51number-size-plusA size with a plus sign, +0000001000.none
F52type-gnu-volume-labelA GNU volume label, typeflag V: a file, or skipped?none
F53type-gnu-old-long-nameA header of typeflag N, which some readers take for a long name: a name, or a file?none
F54format-pax-header-without-magicA pax extended header without magic: a header, or a file?none
F61number-uid-not-octalA uid with the digit 8, in a header after the first member.none
F62pax-schily-realsizeA SCHILY.realsize pax record on a non-sparse file.none
F63end-unpaddedAn archive that ends right after a file's data, without block padding.≤0.03%*
F64end-truncated-in-headerAn archive that ends inside a header.not measured
F67extended-without-memberA trailing pax extended header with no member after it.none
F68size-on-symlinkA non-zero size in a symlink header, covering the next member's header.none
F69number-size-octal-prefixA size field starting with the octal prefix 0o.none
F70number-size-minusA size field starting with a minus sign.none
F71number-size-base256-markerA size field starting with 0x81: base-256, or invalid?none
F72pax-record-length-wrapsA pax record length of 2^32 + 24, which wraps to 24 in 32-bit arithmetic.none
F73pax-record-without-equalsA pax record without =, before a path record.none
F74pax-size-twiceTwo size records in one pax header: first wins, or last wins?<0.01%
F75pax-size-decimal-pointA pax size with a decimal point: 512.0.none
F76checksum-byte-after-nulA non-space byte after a checksum's NUL terminator, after the first member.<0.01%*
F77checksum-leading-nulA checksum with a leading NUL before its digits, after the first member.none
F78pax-nul-in-keyA NUL byte inside a pax key, before a path record.≤0.01%*
F83size-on-fifoA non-zero size in a FIFO header, covering the next member's header.none
N48magic-gnu-version-00A prefix in a header with the magic "ustar " and the version "00": part of the name, or not?none

To reject: names

identifiernamewhat it isprevalence
N08extended-pax-path-and-gnu-long-nameA pax path and a GNU long name for one member, and a third name in its header.none
N09extended-two-pax-headersTwo pax extended headers for one member, with different paths.none
N10format-starA ustar prefix whose end reads as star's times, with star's tar\0 at offset 508.<0.01%
N11gnu-prefix-fieldThe prefix field of a header with GNU magic, which GNU tar uses for times in incremental archives.none
N12name-absoluteAn absolute name, which points outside the directory the archive is extracted to.<0.01%
N13name-backslashA backslash in a name: a character on Unix, a separator on Windows.<0.01%
N14name-bytes-after-nulBytes after the NUL that ends a name.none
N16name-dotdotA name with .., which climbs out of the directory the archive is extracted to.<0.01%
N17name-emptyA member with an empty name.none
N18name-not-utf8A name that is not UTF-8.<0.01%
N19pax-nul-in-pathA NUL inside a pax path.none
N20pax-repeated-keyOne pax key twice in one extended header.<0.01%
N21pax-global-pathA global pax header with a path.none
N22pax-path-emptyAn empty pax path, which in POSIX deletes a path: the pax one, or the header's name too?none
N23extended-gnu-long-then-paxA GNU long name, then a pax header, then the member: which of them does the long name apply to?none
N24pax-hdrcharset-binaryA pax path that is not UTF-8, declared as bytes with hdrcharset=BINARY.none
N25symlink-empty-targetA symlink with an empty target.none
N26pax-global-path-then-emptyA global path, then a global header that removes it with an empty value.none
N29extended-pax-path-before-gnu-long-nameA pax path, then a GNU long name, then the member: which name does it get?none
N30name-drive-letterA name that starts with a drive letter, C:/drive-letter.none
N31pax-linkpath-not-utf8A pax linkpath that is not UTF-8.none
N32linkname-not-utf8A symlink whose target in the header is not UTF-8.not measured
N33type-solaris-extendedA Solaris extended header, typeflag X: a pax header, or a file?none
N34pax-linkpath-emptyAn empty pax linkpath, which in POSIX deletes a target: the pax one, or the header's too?none
N36pax-gnu-sparseA sparse file in GNU's pax format 1.0: the data as stored, or the file it expands to?none
N37extended-two-gnu-long-namesTwo GNU long names for one member: the first, the last, or the header's?none
N38gnu-long-name-emptyAn empty GNU long name: the name in the header, or none?none
N39gnu-long-name-size-without-nulA GNU long name whose size leaves out its NUL, with bytes after it.none
N40pax-global-linkpathA global pax header with a linkpath.none
N41pax-gnu-sparse-nameA pax GNU.sparse.name on a file that is not sparse, after a path.none
N51linkname-bytes-after-nulTrailing bytes after the NUL terminator in a symlink target.none
N52extended-name-dotdotA pax header whose own ustar name escapes the destination directory.not measured
N53name-dotdot-insideA name with .. that stays inside the destination: a/../b.<0.01%

To reject: kinds

identifiernamewhat it isprevalence
F60trailing-slash-file-with-sizeA regular file a/ with a size: a directory without data, or a file with data?<0.01%
K01kind-trailing-slash-fileA regular file whose name ends in a slash: a file, or a directory?<0.01%
K03symlink-trailing-slashA symlink whose name ends in a slash.none
K04name-empty-with-prefixA regular file with an empty name and a prefix: dir/, or no name?<0.01%
K05hardlink-trailing-slashA hardlink whose name ends in a slash: a link, or a directory?none
K06symlink-named-dotA symlink .: dropped, renamed, or an error?≤0.08%*
K08type-fifoA FIFO member: created, extracted as an empty file, or skipped?<0.01%*
K11pax-modeA non-standard pax mode record on a file.≤0.01%*
K12pax-aclA pax ACL record that grants owner execute permission on a mode-644 file.≤0.05%*
K13number-mode-base256A file mode encoded in base-256.none
K14file-named-dotA regular file named .: skipped, renamed, or an error?≤0.08%*
K15file-trailing-dotA regular file named a/.: a file a, or a directory?≤0.01%*

To reject: order and state

identifiernamewhat it isprevalence
S03hardlink-missing-targetA hardlink to a member that is not in the archive.none
S04hardlink-to-itselfA hardlink to itself.0.03%
S05hardlink-to-later-memberA hardlink to a member that comes later.none
S06hardlink-to-symlinkA hardlink to a symlink: a link to the symlink, or to its target?<0.01%
S07tree-duplicate-file-differsThe same file twice, with different contents: the first copy, or the last?not measured
S08tree-duplicate-file-dirA file, then a directory of the same name.none
S09tree-duplicate-file-identicalThe same file twice, with the same contents.0.11%
S10tree-symlink-then-fileA symlink, then a file of the same name: replace the link, or write through it?none
S11tree-through-symlinkA member written through a symlink, which points out of the destination.none
S12tree-under-fileA member under a file.<0.01%
S13hardlink-empty-targetA hardlink with an empty target.none
S14tree-symlink-then-dirA symlink to a directory, then a directory of the same name.none
S15tree-file-then-hardlinkA file, then a hardlink of the same name to another file.0.03%
S17hardlink-then-file-againA file, a hardlink to it, then the file again: does the link keep the first contents?0.11%
S18hardlink-absoluteA hardlink to /etc/passwd, in an archive with a member etc/passwd.≤0.03%*
S19tree-through-symlink-insideA member written through a symlink that points inside the destination.none
S20tree-file-at-implied-dirA file inside an implicit directory, followed by a regular file at that directory's path.not measured
S21tree-duplicate-dir-fileAn empty directory followed by a regular file of the same name.not measured
S22tree-duplicate-dir-symlinkAn empty directory followed by a symlink of the same name: replaced, kept, or placed inside?not measured
S23tree-duplicate-file-symlinkA regular file followed by a symlink of the same name.none
S24tree-duplicate-symlinkTwo symlinks with the same name and different targets: first wins, or last wins?none
S26hardlink-to-dirA hardlink to a directory.none
S27hardlink-through-symlinkA hardlink whose target path traverses a symlink.none
S28hardlink-target-trailing-slashA hardlink to a/, where a is a regular file.<0.01%*
S29hardlink-mode-differsA hardlink with mode 755 to a file with mode 644.≤0.28%*

* An upper bound. The exact share is likely lower, and awaits a new scan of all tarballs.

Data to support the default policy

The default policy accepts 99.80% of the 82,586 distinct release tarballs of Spack, nixpkgs, Guix and live-bootstrap, and samples of PyPI, crates.io and RubyGems. See the list of the 168 it rejects, and why.

ecosystemtarballsrejectedshare
Spack37,553580.15%
nixpkgs18,990740.39%
Guix10,168280.28%
PyPI10,000170.17%
crates.io5,0000none
RubyGems5,00060.12%
live-bootstrap1710none
total (distinct)82,5861680.20%

The tarballs by the median mtime of their members, a rough check that the data spans enough years, leaving out the 14,361 whose mtimes are fixed for reproducibility or missing:

Tarballs by the median mtime of their members, in bins of two years05,00010,00015,0001981–1989: 1 tarball1990–1991: 2 tarballs19901992–1993: 4 tarballs1994–1995: 18 tarballs1996–1997: 10 tarballs1998–1999: 34 tarballs2000–2001: 64 tarballs20002002–2003: 148 tarballs2004–2005: 283 tarballs2006–2007: 286 tarballs2008–2009: 662 tarballs2010–2011: 956 tarballs20102012–2013: 1,751 tarballs2014–2015: 3,847 tarballs2016–2017: 6,008 tarballs2018–2019: 8,440 tarballs2020–2021: 10,896 tarballs20202022–2023: 12,704 tarballs2024–2025: 14,107 tarballs2026–2027: 7,966 tarballs

Motivating examples

casethe archivewhat implementations make of it
N09two pax headers for one file, with path=first and path=secondGNU tar, BusyBox, 7-Zip, node-tar, tar-fs, Go, R and Julia extract second; Python's tarfile and Java extract first; PHP, RubyGems, Perl and live-bootstrap extract header-name, the name in the ustar header; bsdtar, Rust, .NET and Haskell reject it
S10a symlink a to target, then a file amost replace the link with the file; Python's tarfile and live-bootstrap write through the link, to target; 7-Zip, .NET and Haskell reject it
K01a regular file named a/GNU tar, bsdtar, BusyBox, 7-Zip, node-tar, Java, Perl and live-bootstrap create a directory a; Python's tarfile, Go, Rust's tar and astral-tokio-tar, PHP's PharData, RubyGems and R an empty file a; tar-fs, .NET, Haskell, Julia and tar-codec reject it
F12a size field of 000000 1000, with a spaceGNU tar, BusyBox, 7-Zip, node-tar, tar-fs, Perl, Haskell, Julia and live-bootstrap read 0, and find a second file smuggled in the data; R reads 512, and extracts it as the data of a; bsdtar, Python, Go, Rust, Java, .NET, PHP and RubyGems reject it

Contributing

This project is looking for contributions from people who work on package managers, registries and tar implementations, in the form of discussions in issues or pull requests on GitHub or by email to harmen at stoppels dot ch, so that the working draft of the default policy can become a reference.

You can also contribute by testing other implementations, or by crafting a tarball that is particularly hard to parse. A case that shows a vulnerability that is not yet disclosed is reported privately first: see SECURITY.md.

Contributors: