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

Re: [PATCH] notes-merge: use O_EXCL to avoid overwriting existing files

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 7, 2016, 21:10 UTC
Message-ID
<xmqq1t35p32j.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20160707203822.GB11804@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 5 quoted lines
> Why do we care that the file exists? Should we instead be using the
> lockfile code to get exclusive access to it? That would also switch us
> to doing the write-to-tempfile-and-rename dance, but that seems like it
> would be a good thing. If we hit a write() error in the code now, we
> leave a partially-written file in the notes worktree.
Yeah, I had the same thought when I saw the change.
> I dunno. From my cursory reading of the code, it seems like we'd never
> really expect this file_exists() to trigger in the first place, so
> perhaps it's not worth thinking too hard about it.
Perhaps.
Previous: Jeff KingNext: Jeff King
Message 3 of 4 in “notes-merge: use O_EXCL to avoid overwriting existing files”
  1. notes-merge: use O_EXCL to avoid overwriting existing filesRené Scharfe, Jul 7, 2016
  2. Jeff KingJul 7, 2016
  3. Junio C HamanoJul 7, 2016
  4. Jeff KingJul 8, 2016

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.