[BUG] Utility cleanup can hide the original operation error #8

Closed
opened 2026-10-24 01:46:01 +02:00 by erikinkinen · 1 comment
Owner

Summary

The shared utility lease wrapper and copy/listing retirement paths can replace an
original operation or acquisition error with a later cleanup error. Multiple
failed releases also retain the last error rather than the first. Inherited
stream teardown also stops at its first failed close, skipping later owned
directions.

Reproduction

At Coreutils 0e7ad3017c, arrange a failing copy
read followed by a failing destination release, or fail the second acquisition
and then the held source release. The code uses release(...)? before returning
the original Result. Inspect src/runtime/execute/authority.rs and copy.rs.

Expected and actual behavior

Preserve the original operation/acquisition/validation error, attempt every
already-owned release once, and retain the first cleanup failure separately.
A later execution or acquisition must refuse after uncertain cleanup. Successful
stream teardown must also permanently end admission; each already-owned dynamic
direction is attempted once, including after an earlier close failure.
The original code instead returns the later release error; its shared release
loop overwrites earlier cleanup errors and does not retain the stream-level latch.

Environment and identity

  • Component: Coreutils 0e7ad3017c.
  • Affected routes: shared utility grants, cp destination and ls metadata cleanup.
  • The native man path already has the intended first-error rule.
  • This report records source-confirmed control flow, not an executed old-source failure or an exploit.

Evidence and prior checks

The shared repair
uses one retirement helper across these paths and man. It also handles malformed
returned grants and acquisition cleanup uncertainty. Eight original lease controls and seven dynamic-stream lifecycle controls
execute in 7bbe1f2d.
The fresh supported-profile matrix passes 215 default and 216 all-feature Rust
cases plus hosted/freestanding strict checks without build warnings. Original
failed checks remain retained; no old-source failure or exploit is inferred.

Tracking

Related to Coreutils PR2.

  • Use one first-error/retirement rule across the affected drivers.
  • Add acquisition/effect plus cleanup, first-of-two and blocked-reuse controls.
  • Retire inherited dynamic stream directions once and refuse reuse after teardown.
  • Execute the affected controls and strict supported-profile checks.
## Summary The shared utility lease wrapper and copy/listing retirement paths can replace an original operation or acquisition error with a later cleanup error. Multiple failed releases also retain the last error rather than the first. Inherited stream teardown also stops at its first failed close, skipping later owned directions. ## Reproduction At Coreutils 0e7ad3017c8a385fb71722dafe83ac898ae55b6b, arrange a failing copy read followed by a failing destination release, or fail the second acquisition and then the held source release. The code uses release(...)? before returning the original Result. Inspect src/runtime/execute/authority.rs and copy.rs. ## Expected and actual behavior Preserve the original operation/acquisition/validation error, attempt every already-owned release once, and retain the first cleanup failure separately. A later execution or acquisition must refuse after uncertain cleanup. Successful stream teardown must also permanently end admission; each already-owned dynamic direction is attempted once, including after an earlier close failure. The original code instead returns the later release error; its shared release loop overwrites earlier cleanup errors and does not retain the stream-level latch. ## Environment and identity - Component: Coreutils 0e7ad3017c8a385fb71722dafe83ac898ae55b6b. - Affected routes: shared utility grants, cp destination and ls metadata cleanup. - The native man path already has the intended first-error rule. - This report records source-confirmed control flow, not an executed old-source failure or an exploit. ## Evidence and prior checks The [shared repair](https://git.erikinkinen.fi/erix/coreutils/commit/893aae4fef5da21304134e094a4990f335032697) uses one retirement helper across these paths and man. It also handles malformed returned grants and acquisition cleanup uncertainty. Eight original lease controls and seven dynamic-stream lifecycle controls execute in [7bbe1f2d](https://git.erikinkinen.fi/erix/coreutils/commit/7bbe1f2d641eb125b6d0a2da710515d9f925d4ee). The fresh supported-profile matrix passes 215 default and 216 all-feature Rust cases plus hosted/freestanding strict checks without build warnings. Original failed checks remain retained; no old-source failure or exploit is inferred. ## Tracking Related to [Coreutils PR2](https://git.erikinkinen.fi/erix/coreutils/pulls/2). - [x] Use one first-error/retirement rule across the affected drivers. - [x] Add acquisition/effect plus cleanup, first-of-two and blocked-reuse controls. - [x] Retire inherited dynamic stream directions once and refuse reuse after teardown. - [x] Execute the affected controls and strict supported-profile checks.
Author
Owner

7bbe1f2d completes dynamic stream retirement: every owned direction is attempted once, the first typed cleanup error is retained, and both successful and uncertain teardown end admission. The affected controls execute in both configurations; 215 default and 216 all-feature Rust cases and strict host/native checks pass without build warnings. This closes the reported cleanup scope.

[7bbe1f2d](https://git.erikinkinen.fi/erix/coreutils/commit/7bbe1f2d641eb125b6d0a2da710515d9f925d4ee) completes dynamic stream retirement: every owned direction is attempted once, the first typed cleanup error is retained, and both successful and uncertain teardown end admission. The affected controls execute in both configurations; 215 default and 216 all-feature Rust cases and strict host/native checks pass without build warnings. This closes the reported cleanup scope.
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#8
No description provided.