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

Re: [PATCH] checkout files in-place

From
Edward Thomson <ethomson@edwardthomson.com>
Date
Jun 11, 2018, 20:35 UTC
Message-ID
<20180611203541.GA6@606faba9ba17>
In-Reply-To
<20180610194444.GA1913@Sonnenschein.localdomain>
On Sun, Jun 10, 2018 at 09:44:45PM +0200, Clemens Buchacher wrote:
Show 5 quoted lines
> 
> It is safe to do this on Linux file systems, even if open file handles
> still exist, because unlink only removes the directory reference to the
> file. On Windows, however, a file cannot be deleted until all handles to
> it are closed. If a file cannot be deleted, its name cannot be reused.

I'm nervous about this proposed change, since it feels like it's addressing an issue that only exists in QT Creator.

You've accurately described the default semantics in Win32. A file cannot be deleted until all handles to it are closed, unless it was opened with `FILE_SHARE_DELETE` as their sharing mode. This is not the default sharing mode in either Win32 or .NET.

However, for your patch to have an effect, all processes with a handle open must have specified `FILE_SHARE_WRITE`. This is rather uncommon, since it's also not included in the default Win32 or .NET sharing mode. This is because it's uncommon that you would want other processes to change the data underneath you in between ReadFile() calls.

So your patch will benefit people who have processes that have `FILE_SHARE_WRITE` set but not `FILE_SHARE_DELETE` set, which I think is generally an uncommon scenario to want to support.

Generally if you're willing to accept files changing underneath you, then you probably want to allow them to be deleted, too. So this feels like something that's very specific to QT Creator. Or are there other IDEs or development tools that use these open semantics that I'm not aware of?

Cheers- -ed

Previous: Ævar Arnfjörð BjarmasonNext: Clemens Buchacher
Message 7 of 13 in “checkout files in-place”
  1. checkout files in-placeClemens Buchacher, Jun 10, 2018
  2. brian m. carlsonJun 11, 2018
  3. Clemens BuchacherJun 11, 2018
  4. Junio C HamanoJun 11, 2018
  5. Clemens BuchacherJun 11, 2018
  6. Ævar Arnfjörð BjarmasonJun 11, 2018
  7. Edward ThomsonJun 11, 2018
  8. Clemens BuchacherJun 11, 2018
  9. checkout files in-placeClemens Buchacher, Jun 11, 2018
  10. Ævar Arnfjörð BjarmasonJun 11, 2018
  11. Junio C HamanoJun 11, 2018
  12. Edward ThomsonJun 12, 2018
  13. Orgad ShanehJun 13, 2018

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.