Skip to content

Drop temporary ownership immediately after atomic publication #482

Closed

Description

@Anionix

Classification

  • Category: correctness / concurrency
  • Micro-category: stale temporary ownership after publication
  • Severity: P1

Source

Expected

After os.replace succeeds, the vacated temporary basename is no longer owned
by the writer. Cleanup must not unlink it, and every directory descriptor must
close even if cleanup itself fails.

Observed

The successful replace leaves temporary_name set. The finally block can
unlink an unrelated entry that concurrently reuses that basename. A cleanup
error is then reported after publication and skips closing the retained
directory descriptor.

Acceptance

  • Clear temporary ownership immediately after successful replacement.
  • Never report a cleanup failure for a name no longer owned by this call.
  • Close all descriptors through nested finally boundaries.
  • Add a deterministic basename-reuse regression test and descriptor-close
    assertion.

Primary source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions