D. A.
D. A.

Reputation: 3509

Where can I find the GNU ar file format specification?

I need to access an ar created file, but I cannot find a specification document defining the format. Can someone point me in the right direction?

Upvotes: 8

Views: 2559

Answers (3)

Iñigo González
Iñigo González

Reputation: 3945

Where to find information

It seems that GNU binutils does not have documentation for the file format.

I believe the best reference out there is in the ar(5) manual page from FreeBSD. The ar utility was removed in version 5.0 but the manpage for 4.11 is still available.

As usual, the header details can be found in the header files:

Also, the Wikipedia page for the AR file format has a nice diagram that describes the file format (it is from a .deb package which is also an ar file).

File format

This file has a very simple structure:

  • File signature (the one that identifies this as an ar file).
  • For every file in the archive we have:
    • A header that contains file name, owner, group, size, and permissions (see header file).
    • The file contents
    • And optionally padding (\n).

Upvotes: 2

Carl Norum
Carl Norum

Reputation: 224834

From Wikipedia:

The ar format has never been standardized; modern archives are based on a common format with two known variants, BSD and GNU.

More information is there, too.

Upvotes: 6

Related Questions