Skip to content

Stale .find-replace-* temp files from crashed runs are not skipped on re-run #21

@dolph

Description

@dolph

Summary

If find-replace is killed (SIGKILL or hard process termination) mid-rewrite, any .find-replace-* temp file in the working tree survives because deferred cleanup does not run on os.Exit.

The walker on the next run will encounter these temp files, treat them as ordinary text files, and possibly rewrite/rename them — picking up garbage state.

Impact (Reliability: Low)

  • Defensive: in normal operation, the deferred cleanup handles this. Only relevant after a hard kill, OOM, or pulled-cord scenario.
  • Doesn't corrupt anything but leaves the tree dirty in a way the user has to clean up by hand.

Suggested Fix

In handleEntry, skip basenames matching .find-replace-*. Document that the prefix is reserved.

Optionally, on startup, scan for and remove orphan .find-replace-* temp files in the tree (with a --clean flag).

Files

  • find_replace.go:70-97 (handleEntry)
  • file_handling.go:105 (temp file pattern)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions