Skip to content

Clarify std_register_cleanup_path batch registration semantics #82

Description

@codeforester

Context

std_register_cleanup_path validates all provided paths before registering any of them. If one path is unsafe, the function returns 1 immediately and none of the valid paths from that call are registered.

This all-or-nothing behavior may be intentional, but it is not explicit enough in the public contract and can surprise callers that pass mixed cleanup paths.

Failure Scenario

std_register_cleanup_path "$good_tmpdir" "/" "$also_good_tmpdir"

The function rejects / and returns 1. Neither valid temp path is registered for cleanup. The error names the unsafe path but does not make the batch semantics clear.

Scope

  • Decide whether cleanup path batch registration should be all-or-nothing or best-effort per path.
  • Implement the chosen behavior consistently.
  • Document the behavior in lib/bash/std/README.md and function comments.
  • Add BATS coverage for mixed valid and unsafe cleanup path arguments.

Acceptance Criteria

  • Mixed valid/unsafe cleanup path calls have documented behavior.
  • Tests prove whether valid paths are registered or skipped when the batch contains an unsafe path.
  • Existing dangerous-path protections remain intact.
  • ./tests/validate.sh passes.

Validation

  • ./tests/validate.sh

Metadata

Metadata

Assignees

Labels

enhancementNew feature or product improvement

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions