[BUG] Support GNU long member names in runtime archives #6

Closed
opened 2026-10-14 07:24:21 +02:00 by erikinkinen · 1 comment
Owner

Summary

The runtime archive checker rejects valid GNU long member names. A producer can successfully create an archive whose object name exceeds the fixed header field, but checking it fails with archive contains an unexpected member.

Reproduction

From a LibCstd checkout, this small archive-format fixture reproduces the parser failure without executing an object:

from scripts.runtime_object_contract import archive_member

def member(name, data):
    header = (name.ljust(16, b" ") + b"0".ljust(12, b" ")
              + b"0".ljust(6, b" ") + b"0".ljust(6, b" ")
              + b"644".ljust(8, b" ")
              + str(len(data)).encode().ljust(10, b" ") + b"`\n")
    return header + data + (b"\n" if len(data) % 2 else b"")

name = b"erix-c-conversion.o"
payload = b"original object bytes"
archive = (b"!<arch>\n" + member(b"//", name + b"/\n")
           + member(b"/0", payload))
assert archive_member(archive, name) == payload

The same refusal occurred with a genuine archive produced by llvm-ar rcsD from an object named erix-c-conversion.o. Its GNU name table is //, and the selected object's header uses /0.

Expected and actual behavior

Expected: resolve the GNU long-name reference and return the exact bytes of the single selected object. Keep unexpected names, malformed tables, invalid offsets, truncated members and duplicate selected objects rejected.

Actual: archive_member accepts short names and the symbol table but treats the valid // name table as an unexpected member. The checker exits 1 after assembly and archive production have completed successfully.

Environment and identity

  • Component: LibCstd b9adbd8a, archive_member; the same short-name logic exists at 2dc319a1.
  • Configuration: GNU archive framing, Linux x86_64 host tooling; no boot image or VM execution.
  • Input: an explicitly selected archive and expected member name. Parsing acquires no endpoint, mapping or filesystem authority.
  • Working comparison: the existing short runtime object names pass. Long names have no known passing revision.

Evidence and prior checks

The observed archive is 2,100 bytes with SHA256 a8eef191682515e1e23b2756a284624618940e5d322b8a33657e44a947829b3f; its selected object is 1,728 bytes. Original assembly and archive commands exit 0 with confirmed cleanup. The subsequent checker preserves its exit 1 and exact diagnostic. These are host tooling observations, not runtime or guest acceptance. The // and /0 framing is observed in those original produced bytes. The LLVM ar documentation separately documents GNU archive support and preservation of long filenames.

Tracking

Related: C runtime implementation and review.

  • Support GNU long names while preserving the exact single-object contract.
  • Cover genuine producer output and independent malformed framing, offset, padding, name and duplicate-member cases.
  • Publish the parser repair with the affected producer and consumer documentation.
## Summary The runtime archive checker rejects valid GNU long member names. A producer can successfully create an archive whose object name exceeds the fixed header field, but checking it fails with `archive contains an unexpected member`. ## Reproduction From a LibCstd checkout, this small archive-format fixture reproduces the parser failure without executing an object: ```python from scripts.runtime_object_contract import archive_member def member(name, data): header = (name.ljust(16, b" ") + b"0".ljust(12, b" ") + b"0".ljust(6, b" ") + b"0".ljust(6, b" ") + b"644".ljust(8, b" ") + str(len(data)).encode().ljust(10, b" ") + b"`\n") return header + data + (b"\n" if len(data) % 2 else b"") name = b"erix-c-conversion.o" payload = b"original object bytes" archive = (b"!<arch>\n" + member(b"//", name + b"/\n") + member(b"/0", payload)) assert archive_member(archive, name) == payload ``` The same refusal occurred with a genuine archive produced by `llvm-ar rcsD` from an object named `erix-c-conversion.o`. Its GNU name table is `//`, and the selected object's header uses `/0`. ## Expected and actual behavior Expected: resolve the GNU long-name reference and return the exact bytes of the single selected object. Keep unexpected names, malformed tables, invalid offsets, truncated members and duplicate selected objects rejected. Actual: `archive_member` accepts short names and the symbol table but treats the valid `//` name table as an unexpected member. The checker exits 1 after assembly and archive production have completed successfully. ## Environment and identity - Component: [LibCstd b9adbd8a](https://git.erikinkinen.fi/erix/lib-cstd/src/commit/b9adbd8abbeb18bc016842bfa410c259f88cf4df/scripts/runtime_object_contract.py), `archive_member`; the same short-name logic exists at `2dc319a1`. - Configuration: GNU archive framing, Linux x86_64 host tooling; no boot image or VM execution. - Input: an explicitly selected archive and expected member name. Parsing acquires no endpoint, mapping or filesystem authority. - Working comparison: the existing short runtime object names pass. Long names have no known passing revision. ## Evidence and prior checks The observed archive is 2,100 bytes with SHA256 `a8eef191682515e1e23b2756a284624618940e5d322b8a33657e44a947829b3f`; its selected object is 1,728 bytes. Original assembly and archive commands exit 0 with confirmed cleanup. The subsequent checker preserves its exit 1 and exact diagnostic. These are host tooling observations, not runtime or guest acceptance. The `//` and `/0` framing is observed in those original produced bytes. The [LLVM ar documentation](https://llvm.org/docs/CommandGuide/llvm-ar.html) separately documents GNU archive support and preservation of long filenames. ## Tracking Related: [C runtime implementation](https://git.erikinkinen.fi/erix/lib-cstd/issues/1) and [review](https://git.erikinkinen.fi/erix/lib-cstd/pulls/3). - [x] Support GNU long names while preserving the exact single-object contract. - [x] Cover genuine producer output and independent malformed framing, offset, padding, name and duplicate-member cases. - [x] Publish the parser repair with the affected producer and consumer documentation.
Author
Owner

Fixed in b15c0452. The inspector accepts complete GNU long-name table entries and offsets while retaining the exact one-object comparison. Nine archive controls cover valid offsets, malformed tables, truncation, padding and duplicate members. The genuine conversion archive is accepted, and all 18 preceding standalone products remain byte-identical.

Fixed in [b15c0452](https://git.erikinkinen.fi/erix/lib-cstd/commit/b15c045255a3030bb9d36e82d9b2a4da2ef2fb4a). The inspector accepts complete GNU long-name table entries and offsets while retaining the exact one-object comparison. Nine archive controls cover valid offsets, malformed tables, truncation, padding and duplicate members. The genuine conversion archive is accepted, and all 18 preceding standalone products remain byte-identical.
erikinkinen added this to the Alpha 1 milestone 2026-10-30 09:34:40 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
erix/lib-cstd#6
No description provided.