Skip to content

Commit cfae50e

Browse files
pks-tgitster
authored andcommitted
object-file: don't special-case missing source file in collision check
In 0ad3d65 (object-file: fix race in object collision check, 2024-12-30) we have started to ignore ENOENT when opening either the source or destination file of the collision check. This was done to handle races more gracefully in case either of the potentially-colliding disappears. The fix is overly broad though: while the destination file may indeed vanish racily, this shouldn't ever happen for the source file, which is a temporary object file (either loose or in packfile format) that we have just created. So if any concurrent process would have removed that temporary file it would indicate an actual issue. Stop treating ENOENT specially for the source file so that we always bubble up this error. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c1acf1a commit cfae50e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

object-file.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1982,8 +1982,7 @@ static int check_collision(const char *source, const char *dest)
19821982

19831983
fd_source = open(source, O_RDONLY);
19841984
if (fd_source < 0) {
1985-
if (errno != ENOENT)
1986-
ret = error_errno(_("unable to open %s"), source);
1985+
ret = error_errno(_("unable to open %s"), source);
19871986
goto out;
19881987
}
19891988

0 commit comments

Comments
 (0)