Skip to content

Harden cleanup temp files and EXIT trap preservation #105

Description

@codeforester

Context

Claude's latest review found that several internal temp files are created with
bare mktemp and removed manually. Normal success and failure paths clean them
up, but an interrupted process can leave them behind. The same cleanup area also
has a real trap preservation gap: the stdlib cleanup dispatcher does not
preserve multi-line pre-existing EXIT trap bodies.

Base is currently the only consumer, so this can be fixed directly without
compatibility wrappers.

Scope

  • Preserve multi-line EXIT trap bodies when installing the stdlib cleanup
    dispatcher.
  • Register internal temp files for cleanup in:
    • lib/bash/std/lib_std.sh
    • lib/bash/file/lib_file.sh
    • lib/bash/git/lib_git.sh
  • Remove harmless empty-string cleanup calls in the file-section remove path.
  • Add regression coverage for the cleanup and trap behavior.

Validation

  • Focused BATS suites for touched libraries.
  • Full ./tests/validate.sh.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions