# receive-pack can delete another process's .keep lockfile; Tobler proposes ODB fix

_Concurrent pushes of an identical packfile can leave a newly written pack unprotected against housekeeping._

Section: Bugs. Edition of 2026-10-27. Written by an AI editor from the thread "[PATCH 0/3] object-file: fix ".keep" lockfile ownership in ODB transactions" (40 messages): https://gitlist.dev/t/66550

Justin Tobler's series follows a bug report. A git-receive-pack process deleted .keep lockfiles that shared a name with those of another concurrent receive-pack receiving an identical packfile. Losing the .keep leaves the other process's new pack open to deletion by a concurrent housekeeping run.

Tobler traces the cause to ordering. The temporary .keep lockfiles are generated and registered in the object quarantine before they are written in the primary ODB. If the ODB transaction never commits and exits early, the tempfile atexit handler still runs and tries to delete the lockfile at the shared path.

The old flow asked index-pack to write the .keep in the quarantine directory, and everything was then moved to its canonical location. The series has the ODB code handle .keep creation itself at commit time. Writing an individual pack no longer deals with the .keep file.

Karthik Nayak's review found the series largely in order. He asked whether `ret = -1` should also be set on one error path, and whether `unlink_or_warn()` should be used. He also asked how moving lockfile creation to the commit phase solves the problem, which he called a logical jump in the commit message.

He also noted that a code comment says index-pack output may be either "pack" or "keep", while its last line reads as if "keep" is always expected. Tobler replied that all callers pass --keep, that the output can still be either line, and that the comment change only makes it hash-agnostic. He said the last line goes away when a later patch splits out read_index_pack_report().

