git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: About close() in commit_lock_file()

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 5, 2013, 16:56 UTC
Message-ID
<7vli4gkrf0.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CACsJy8By1cpPZ5QyVd6VhKSkd-y_E6pTYdDimK9P0wXia-uMqg@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
Show 5 quoted lines
> close() is added in commit_lock_file(), before rename(), by 4723ee9
> (Close files opened by lock_file() before unlinking. - 2007-11-13),
> which is needed by Windows. But doesn't that create a gap between
> close() and rename() on other platforms where another process can
> replace .lock file with something else before rename() is executed?
Interesting.
> Should we enclose close() in #ifdef __MINGW32__ (and maybe
> __CYGWIN__)?

Or just have "close and retry" code after seeing rename() fails with some known errno, without singling out a particular platform?

Previous: Duy NguyenNext: Johannes Sixt
Message 2 of 4 in “About close() in commit_lock_file()”
  1. Duy NguyenAug 5, 2013
  2. Junio C HamanoAug 5, 2013
  3. Johannes SixtAug 6, 2013
  4. Duy NguyenAug 6, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.