Add native byte comparison for build and storage recipes #11

Open
opened 2026-10-26 01:50:25 +01:00 by erikinkinen · 0 comments
Owner

Problem and motivation

Build, reproducibility and storage recipes need byte comparison. EriX has no
native cmp, so those recipes currently depend on an imported executable.

Proposed behavior and scope

Add cmp [-l | -s] [--] file1 file2 to Coreutils and the extended images.
Support stdin through -, first-difference reporting, octal byte listings and
silent comparison. Return 0 for equality, 1 for differences and 2 for errors.
Follow the checked POSIX comparison contract
for C-locale output. Compare incremental reads without loading complete files.
Package the command, its READ ceiling and cmp(1) together.

Authority, security and reliability

Use only the two exact operand READ grants or the authenticated original stdin.
Names and matching metadata cannot establish authority or equality. Preserve
unconsumed bytes across unequal short reads; equality requires genuine EOF from
both inputs. Keep acquisition, read and release owners through failure and
cancellation. Required closed streams cause operational errors; silent or equal
comparisons need no unused output stream. Uncertain cleanup retains custody.
A repeated stdin operand compares its one admitted original without consuming it.

Acceptance criteria

  • Default, list and silent modes handle binary data, prefixes, short reads,
    EOF and one-based byte/line positions with distinct 0/1/2 statuses.
  • Real command execution preserves exact READ grants, stdin identity,
    first errors and once-only cleanup through denial, output failure and unwind.
  • The catalog, installed command, sidecar and indexed manual agree while
    preserving existing utility entries and capability ceilings.
  • Guest workflows cover comparison, denial and subsequent allowed use;
    unit and guard cases cover malformed input and ownership failures.
  • Component documentation and the technical manual describe the command,
    supported syntax and explicit authority contract.

Alternatives and tradeoffs

Imported diffutils remains useful for diff and its extensions. A native cmp
removes that dependency from byte-comparison recipes. This scope does not add
GNU skip/count extensions or claim full locale support.

Tracking and rollout

Coordinate Coreutils PR 2,
Integration PR 12 and the
phase checklist.

## Problem and motivation Build, reproducibility and storage recipes need byte comparison. EriX has no native `cmp`, so those recipes currently depend on an imported executable. ## Proposed behavior and scope Add `cmp [-l | -s] [--] file1 file2` to Coreutils and the extended images. Support stdin through `-`, first-difference reporting, octal byte listings and silent comparison. Return 0 for equality, 1 for differences and 2 for errors. Follow the checked [POSIX comparison contract](https://man7.org/linux/man-pages/man1/cmp.1p.html) for C-locale output. Compare incremental reads without loading complete files. Package the command, its READ ceiling and `cmp(1)` together. ## Authority, security and reliability Use only the two exact operand READ grants or the authenticated original stdin. Names and matching metadata cannot establish authority or equality. Preserve unconsumed bytes across unequal short reads; equality requires genuine EOF from both inputs. Keep acquisition, read and release owners through failure and cancellation. Required closed streams cause operational errors; silent or equal comparisons need no unused output stream. Uncertain cleanup retains custody. A repeated stdin operand compares its one admitted original without consuming it. ## Acceptance criteria - [ ] Default, list and silent modes handle binary data, prefixes, short reads, EOF and one-based byte/line positions with distinct 0/1/2 statuses. - [ ] Real command execution preserves exact READ grants, stdin identity, first errors and once-only cleanup through denial, output failure and unwind. - [ ] The catalog, installed command, sidecar and indexed manual agree while preserving existing utility entries and capability ceilings. - [ ] Guest workflows cover comparison, denial and subsequent allowed use; unit and guard cases cover malformed input and ownership failures. - [ ] Component documentation and the technical manual describe the command, supported syntax and explicit authority contract. ## Alternatives and tradeoffs Imported diffutils remains useful for `diff` and its extensions. A native `cmp` removes that dependency from byte-comparison recipes. This scope does not add GNU skip/count extensions or claim full locale support. ## Tracking and rollout Coordinate [Coreutils PR 2](https://git.erikinkinen.fi/erix/coreutils/pulls/2), [Integration PR 12](https://git.erikinkinen.fi/erix/integration/pulls/12) and the [phase checklist](https://git.erikinkinen.fi/erix/integration/issues/65).
erikinkinen added this to the Alpha 1 milestone 2026-10-30 09:33:36 +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/coreutils#11
No description provided.