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

Re: git update-ref --stdin : too many open files

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 23, 2014, 15:57 UTC
Message-ID
<xmqq38865pg0.fsf@gitster.dls.corp.google.com>
In-Reply-To
<5498D66B.5090807@gmail.com>
Stefan Beller <stefanbeller@gmail.com> writes:
> Sounds reasonable. Though by closing the file we're giving up again a
> bit of safety. If we close the file everyone could tamper with the lock
> file. (Sure they are not supposed to touch it, but they could)

There are locking primitives (SysV mandatory locking) that require you to keep the file you have lock on open for you to retain the ownership of the lock, and that kind of lock does prevent random other processes from simultaneously accessing the locked file.

But that is not what our locks are designed around; our locks rely only on "open(O_EXCL|O_CREAT) fails if it already exists". And between keeping a lockfile open and closing but not removing a lockfile, there is no difference how the lockfile that still exists prevents open(O_EXCL|O_CREAT) by other processes from succeeding.

So we are not giving up any safety at all, which is a good thing ;-).
Previous: Jonathan NiederNext: Stefan Beller
Message 5 of 8 in “git update-ref --stdin : too many open files”
  1. Loic DacharyDec 20, 2014
  2. Junio C HamanoDec 22, 2014
  3. Stefan BellerDec 23, 2014
  4. Jonathan NiederDec 23, 2014
  5. Junio C HamanoDec 23, 2014
  6. Stefan BellerDec 24, 2014
  7. Michael HaggertyDec 29, 2014
  8. Stefan BellerDec 29, 2014

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.