Unix ar Archive (.a)

Static library and Debian package container.

Overview

An ar file begins with !<arch>\n followed by 60-byte member headers (name, mtime, uid, gid, mode, size and the terminator `\n). Data is padded to even length. BSD and GNU variants store long names differently.

Where it is used

  • Static libraries (.a) and Debian packages (.deb).

History

  • Part of Unix since the early 1970s.

Status today

  • Universal in toolchains and package formats.

Structures read by the implementation

Offsets are in bytes from the start of the buffer named in each heading. Field names are taken from the implementation and are not an official specification. Fixed-width integers are shown as u/i (unsigned/signed) followed by bit width and byte order.

No fixed-offset structures were found in the implementation.

Constants

General ArCarver

NameValueTypeNotes
Magic“!<arch>\n”u8.ToArray()byte[]

Implementation limits reader

ClassNameValueNotes
ArCarverMaxMembers2_000_000
ArArchiveModuleMaxMembers2_000_000

Signatures and magic strings referenced

TextWhereContext
!<arch>\nArCarverprivate static readonly byte[] Magic = “!<arch>\n”u8.ToArray();
Structures and constants were extracted from: Carving/Plugins/Ar/ArCarver.cs, Modules/FileSystems/ArArchiveModule.cs. Prose sections are a summary from public sources; verify details before relying on them.