Index | Thread | Search

From:
Sören Tempel <soeren@soeren-tempel.net>
Subject:
Documentation in ar(5) does not reflect ar(1) behavior
To:
tech@openbsd.org
Cc:
schwarze@usta.de
Date:
Mon, 05 Oct 2026 15:40:23 +0200

Download raw body.

Thread
Hi!

The other day, I was reading the ar(5) man page. Specifically with
respect to handling of file names with spaces in them, it states:

> If any file name is more than 16 characters in length or contains an
> embedded space, the string "#1/" followed by the ASCII length of the
> name is written in the name field. The file size (stored in the
> archive header) is incremented by the length of the name. The name is
> then written immediately following the archive header.

However, this is not actually what is implemented by ar(1) nowadays:

	$ printf 'C D' > 'A B'
	$ ar r test.ar A\ B
	$ vis test.ar
	!<arch>
	A B/            0           0     0     644     3         `
	C D

Note that there is no "#1/" in the created test.ar file.

Even with `ar --format=bsd …`, the format differs slightly as LLVM's
ar(1) implementation inserts null bytes after the name. The ar(5) man
page also explains the history of the different formats at great length.
Nonetheless, it is surprising that the documented "current format"
differs from the one that is implemented and used by default by ar(1).

Should ar(5) be removed, updated, and/or just refer to LLVM's ar(1)?

Cheers,
Sören