Introduction
This is the archive format of star, the tar program written by Jörg Schilling, now kept up in the schilytools collection of his tools. Its formats are described in full in star’s own manual page, star(5).
star(5) describes the xstar header, “defined in 1994”. It has the
POSIX magic ustar\0 and version 00, but cuts the 155-byte
ustar prefix to 131 bytes and uses the 24 bytes freed for the access and change times.
It ends with the signature tar at byte 508. Two later forms use the same
layout:
- xustar: “‘xstar’ format without "tar" signature at header offset 508”.
- exustar: “‘xustar’ format variant that always includes x-headers and g-headers”, the pax records of POSIX.1-2001.
star(5) itself says the tar signature “should be avoided in the future”.
star can also write plain ustar and pax archives; those belong to the
POSIX format. star(5) dates star’s first
header extensions to 1985, before it took up the POSIX layout; that older header is
not described there, and is not covered here.
Because bytes 476 to 499, which a ustar reader takes as the end of the prefix, hold two times, the format changes the size and meaning of an existing field and is a separate format. Go’s documentation calls it “Schily’s tar format, which is incompatible with USTAR.” In practice a ustar reader usually gets the right path, since star keeps the prefix to 130 characters and byte 475 is a NUL, where the reader stops.
A tar file dropped on any page of this site opens in the explorer, which shows its structure: each member’s header field by field, star’s times, pax records, the data, and the blocks that end the archive.
Structure
An archive is a sequence of 512-byte blocks. Each member is a header block, maybe led by pax extended headers, followed by its contents padded with zeros to a whole number of blocks. Two blocks of zeros end the archive.
0Extended header optional, always present in exustar: typex, then records512 bytes and more…Header as ustar to byte 344, then a 131-byte prefix, access and change times, and the signature512 bytes…File data padded with zeros to a multiple of 512size rounded up…Next member for each further filerepeated…End of archive two blocks of zeros1024 bytes or more
How it differs from ustar
| Bytes | ustar | star |
|---|---|---|
| 0 to 344 | the same: name to devminor, with the magic ustar\0 and version 00 | |
| 345 to 475 | prefix (155 bytes) | prefix (131 bytes) |
| 476 to 499 | atime and ctime, 12 bytes each | |
| 500 to 507 | unused | filler, zeros |
| 508 to 511 | tar\0 in xstar; zeros in xustar and exustar | |
Telling it apart
The explorer’s parser for this format checks the first header. Its checksum must be
right, bytes 257 to 264 must be the POSIX ustar\0 00, and
either:
- bytes 508 to 511 are
tar\0(74 61 72 00), the xstar signature; or - the header passes GNU tar’s test for star’s times: byte 475, the prefix’s last, is NUL; bytes 476 and 488 are octal digits; and bytes 487 and 499 are spaces.
star(5) as published online says byte 475 should be a space, while Go’s star test archive has a NUL there. The explorer follows GNU tar; that GNU tar tests for NUL is from memory of its source and is not confirmed. An xustar or exustar header passes the time test only if star filled in the times. A POSIX header that fails both tests is a ustar archive, and the explorer tries that parser instead.
Variants
- POSIX ustar and pax archive – the POSIX header with the “ustar” magic, owner names and a 155-byte prefix; pax adds records
- GNU tar archive – GNU tar’s own header, with times and sparse maps where ustar has the prefix
- Schily tar archive (star) – star’s header: a 131-byte prefix, with access and change times after it
Links
Software
Developers
- libarchive – library that reads every tar format (C)
- archive/tar – standard library package that reads star archives (Go)
Reference
- star(5) – star’s description of its header formats, base-256 numbers and SCHILY pax keys
- Basic Tar Format – the GNU tar manual, whose
tar.hincludes star’s header layouts - pax – the POSIX description of the ustar header and pax records that star builds on