Working draft

F66 archive-no-bytes

A zero-byte file: an empty archive, or not an archive?

Tolerate(draft) A strict parser may reject this archive. If it accepts it, it must extract the expected tree below.

Category
framing
Default policy
accepts it: implementations that accept it extract the same empty tree
Files
F66-archive-no-bytes.tar test archive, 0 bytes sha256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
F66-archive-no-bytes.jsonexpected result
F66-archive-no-bytes.txtannotated blocks
F66-archive-no-bytes.pygenerator script

The case

The archive is 0 bytes long.

A POSIX archive ends with two zero blocks, which an empty file lacks. A zero-byte file can be left behind by a failed download. Some readers accept it as an archive with no members, while others reject it. The default policy tolerates it, as both extract the same empty tree, and whether a download is complete is known by other means, such as a published checksum.

The expected tree:

pathkindcontents

Decision point: whether a zero-byte file is a valid empty archive.

Seen in: none of the scanned tarballs.

The archive

Every block of 512 bytes, to scale, with its offset. Hover over a field for its bytes.

F66-archive-no-bytes: every block of the archive0x000000end of fileNULprintable ASCIIspacecontrol character, such as a newlinebyte over 0x7fwritten by the case itself
Every block, as text
F66-archive-no-bytes: tolerated: a strict parser may reject it; if it accepts it, it must extract its tree, and the default policy accepts it

A zero-byte file: an empty archive, or not an archive?

The archive is 0 bytes long.

A POSIX archive ends with two zero blocks, which an empty file lacks. A zero-byte file can
be left behind by a failed download. Some readers accept it as an archive with no members, while
others reject it. The default policy tolerates it, as both extract the same empty tree, and whether
a download is complete is known by other means, such as a published checksum.

Decision point: whether a zero-byte file is a valid empty archive.
Seen in: none of the scanned tarballs.
See also: F65, an empty archive of two zero blocks, and F04, an archive without an end-of-archive
marker.

0x000000  end of file
Every byte, as a hex dump

As xxd writes it: xxd -r makes the archive of it.


What implementations make of it

In the outcome column, ✅ means that the implementation follows the default policy.

implementationversionoutcomewhat it makes of it
GNU tartar (GNU tar) 1.35➖ rejectserror: tar: This does not look like a tar archive tar: Exiting with failure status due to previous errors
bsdtarbsdtar 3.8.11 - libarchive 3.8.11➕ acceptsthe expected tree
BusyBox tarBusyBox v1.38.0, defconfig➖ rejectserror: tar: short read
7-Zip7-Zip (z) 26.05 (x64)➖ rejectserror: ERROR: suite/archives/F66-archive-no-bytes.tar Cannot open the file as archive
Python tarfile, filter=data, as in pipCPython 3.15.2➖ rejectserror: ReadError: file could not be opened successfully: - method gz: ReadError('empty file') - method bz2: ReadError('not a bzip2 file') - method xz: ReadError('not an lzma file') - method zst: ReadError('…
Python tarfile, filter=tarCPython 3.15.2➖ rejectserror: ReadError: file could not be opened successfully: - method gz: ReadError('empty file') - method bz2: ReadError('not a bzip2 file') - method xz: ReadError('not an lzma file') - method zst: ReadError('…
Python tarfile, filter=fully_trustedCPython 3.15.2➖ rejectserror: ReadError: file could not be opened successfully: - method gz: ReadError('empty file') - method bz2: ReadError('not a bzip2 file') - method xz: ReadError('not an lzma file') - method zst: ReadError('…
node-tartar 7.5.22➖ rejectserror: Error: TAR_BAD_ARCHIVE: Unrecognized archive format
node-tar, stricttar 7.5.22➖ rejectserror: Error: TAR_BAD_ARCHIVE: Unrecognized archive format
tar-fstar-fs 3.1.3, on tar-stream 3.2.2➕ acceptsthe expected tree
Java Commons CompressCommons Compress 1.28.0, Expander, on Java 27.0.1.0.2➕ acceptsthe expected tree
.NET System.Formats.TarSystem.Formats.Tar of .NET 10.0.14, ExtractToDirectory➕ acceptsthe expected tree
PHP PharData, as in ComposerPharData of PHP 8.5.12, as Composer's TarDownloader calls it➖ rejectserror: UnexpectedValueException: internal corruption of phar "suite/archives/F66-archive-no-bytes.tar" (truncated entry)
Go containerd archive.Applycontainerd v2.4.2, archive.Apply, of go1.27.3➕ acceptsthe expected tree
Rust tartar 0.4.46, unpack➕ acceptsthe expected tree
Rust astral-tokio-tarastral-tokio-tar 0.7.1, unpack➕ acceptsthe expected tree
Rust tar-codec, as in uvtar-codec 0.0.16, with the policies of uv 0.13➖ rejectserror: at byte 0: missing two-block end-of-archive marker
RubyGemsRubyGems 4.0.20 of Ruby 4.0.9, extract_tar_gz➕ acceptsthe expected tree
R untar, internalutils::untar of R 4.6.2, tar = "internal"➕ acceptsthe expected tree
Perl Archive::TarArchive::Tar 3.12 of Perl v5.44.0➖ rejectserror: status 1
Haskell tartar 0.7.2.0, extract, of GHC 9.14➖ rejectserror: TruncatedArchive
Julia Tar.jlTar 1.10.0 of Julia 1.13.3➕ acceptsthe expected tree
untar (PyPI)untar 0.5.0, extract, on CPython 3.15.2➖ rejectserror: Error: Archive is empty
live-bootstrap untarmescc-tools-extra a151c245e512, as live-bootstrap pins it➖ rejectserror: Short read on suite/archives/F66-archive-no-bytes.tar: expected 512, got 0 The extraction of suite/archives/F66-archive-no-bytes.tar produced errors
live-bootstrap untar, --non-strictmescc-tools-extra a151c245e512, as live-bootstrap pins it➖ rejectserror: non-strict mode enabled, preparing for chaos Short read on suite/archives/F66-archive-no-bytes.tar: expected 512, got 0 The extraction of suite/archives/F66-archive-no-bytes.tar produced errors

Prevalence in release tarballs

The table below shows how many release tarballs have the features of this test case.

ecosystemtarballswith itshare
Spack37,5530none
nixpkgs18,9900none
Guix10,1680none
PyPI10,0000none
crates.io5,0000none
RubyGems5,0000none
live-bootstrap1710none
total (distinct)82,5860none

See also