[FEATURE] Add native basename and dirname utilities #3

Open
opened 2026-10-23 23:43:39 +02:00 by erikinkinen · 1 comment
Owner

Problem and motivation

EriX build scripts use basename and dirname to locate helper scripts and
name checksum outputs. Native Coreutils currently provides neither applet.
Both operations can run entirely on their argument bytes.

Proposed behavior and scope

Add authenticated native entries for both utilities and support their POSIX
pathname rules, --, exact operand counts and basename's optional literal suffix.
Preserve non-UTF-8 bytes. Document the choices for empty input and slash-only
input, including //.

Use the same borrowed parser in buffered and freestanding execution. Extend the
Coreutils packaging catalog and Integration image consumers so each command has
its own authenticated identity.

Authority, security and reliability

Both applets have an empty object-authority ceiling. They receive argument data
and the already selected output/error streams; pathname bytes grant no lookup,
current-directory or environment authority. Output failures retain the existing
stream cleanup and error rules. No allocator or fixed pathname-size ceiling is
needed.

Acceptance criteria

  • Implement pathname, suffix, slash, empty-input and option behavior with raw bytes.
  • Register both authenticated entries with empty authority tables.
  • Use the shared parser in buffered and native stream execution.
  • Cover long operands, invalid input, output failure and authority refusal.
  • Package both command entries through the maintained catalog and add VM scenarios.
  • Document behavior and update the technical manual.

Alternatives and tradeoffs

Depending on an imported utility would leave these small lexical operations
unavailable in clean images. Keep path resolution in its existing mediated
owners; neither utility needs it.

Tracking and rollout

Part of native shell and build utilities.
Coordinate Coreutils PR 2 and
Integration PR 12.

## Problem and motivation EriX build scripts use `basename` and `dirname` to locate helper scripts and name checksum outputs. Native Coreutils currently provides neither applet. Both operations can run entirely on their argument bytes. ## Proposed behavior and scope Add authenticated native entries for both utilities and support their POSIX pathname rules, `--`, exact operand counts and basename's optional literal suffix. Preserve non-UTF-8 bytes. Document the choices for empty input and slash-only input, including `//`. Use the same borrowed parser in buffered and freestanding execution. Extend the Coreutils packaging catalog and Integration image consumers so each command has its own authenticated identity. ## Authority, security and reliability Both applets have an empty object-authority ceiling. They receive argument data and the already selected output/error streams; pathname bytes grant no lookup, current-directory or environment authority. Output failures retain the existing stream cleanup and error rules. No allocator or fixed pathname-size ceiling is needed. ## Acceptance criteria - [x] Implement pathname, suffix, slash, empty-input and option behavior with raw bytes. - [x] Register both authenticated entries with empty authority tables. - [x] Use the shared parser in buffered and native stream execution. - [x] Cover long operands, invalid input, output failure and authority refusal. - [ ] Package both command entries through the maintained catalog and add VM scenarios. - [ ] Document behavior and update the technical manual. ## Alternatives and tradeoffs Depending on an imported utility would leave these small lexical operations unavailable in clean images. Keep path resolution in its existing mediated owners; neither utility needs it. ## Tracking and rollout Part of [native shell and build utilities](https://git.erikinkinen.fi/erix/exsh/issues/1). Coordinate [Coreutils PR 2](https://git.erikinkinen.fi/erix/coreutils/pulls/2) and [Integration PR 12](https://git.erikinkinen.fi/erix/integration/pulls/12).
Author
Owner

e336cc59 adds basename and dirname. Both preserve raw argument bytes, share the same lexical parser and use empty object-authority tables. They support --, the documented empty/slash-only cases and basename’s literal suffix rule. Integration packaging and technical-manual updates are in progress.

[e336cc59](https://git.erikinkinen.fi/erix/coreutils/commit/e336cc596746d6598e426af5bdf3b11a5804a3b9) adds `basename` and `dirname`. Both preserve raw argument bytes, share the same lexical parser and use empty object-authority tables. They support `--`, the documented empty/slash-only cases and basename’s literal suffix rule. Integration packaging and technical-manual updates are in progress.
erikinkinen added this to the Alpha 1 milestone 2026-10-30 09:33:35 +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#3
No description provided.