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

Re: [PATCH/RFC] clone: report duplicate entries on case-insensitive filesystems

From
JHJeff Hostetler <git@jeffhostetler.com>
Date
Aug 3, 2018, 18:23 UTC
Message-ID
<5b17454b-7fa7-7a9c-92d9-214e6e697785@jeffhostetler.com>
In-Reply-To
<20180802212819.GA32538@sigill.intra.peff.net>
On 8/2/2018 5:28 PM, Jeff King wrote:
Show 19 quoted lines
> On Thu, Aug 02, 2018 at 02:14:30PM -0700, Junio C Hamano wrote:
> 
>> Jeff King <peff@peff.net> writes:
>>
>>> I also wonder if Windows could return some other file-unique identifier
>>> that would work in place of an inode here. That would be pretty easy to
>>> swap in via an #ifdef's helper function. I'd be OK shipping without that
>>> and letting Windows folks fill it in later (as long as we do not do
>>> anything too stupid until then, like claim all of the inode==0 files are
>>> the same).
>>
>> Yeah, but such a useful file-unique identifier would probably be
>> used in place of inum in their (l)stat emulation already, if exists,
>> no?
> 
> Maybe. It might not work as ino_t. Or it might be expensive to get.  Or
> maybe it's simply impossible. I don't know much about Windows. Some
> searching implies that NTFS does have a "file index" concept which is
> supposed to be unique.

This is hard and/or expensive on Windows. Yes, you can get the "file index" values for an open file handle with a cost similar to an fstat(). Unfortunately, the FindFirst/FindNext routines (equivalent to the opendir/readdir routines), don't give you that data. So we'd have to scan the directory and then open and stat each file. This is terribly expensive on Windows -- and the reason we have the fscache layer (in the GfW version) to intercept the lstat() calls whenever possible.

It might be possible to use the NTFS Master File Table to discover this (very big handwave), but I would need to do a little digging.

This would all be NTFS specific. FAT and other volume types would not be covered.

Another thing to keep in mind is that the collision could be because of case folding (or other such nonsense) on a directory in the path. I mean, if someone on Linux builds a commit containing:

     a/b/c/D/e/foo.txt
     a/b/c/d/e/foo.txt
we'll get a similar collision as if one of them were spelled "FOO.txt".

Also, do we need to worry about hard-links or symlinks here? If checkout populates symlinks, then you might have another collision opportunity. For example:

     a/b/c/D/e/foo.txt
     a/link -> ./b/c/d
     a/link/e/foo.txt

Also, some platforms (like the Mac) allow directory hard-links. Granted, Git doesn't create hard-links during checkout, but the user might.

I'm sure there are other edge cases here that make reporting difficult; these are just a few I thought of. I guess what I'm trying to say is that as a first step just report that you found a collision -- without trying to identify the set existing objects that it collided with.

Show 5 quoted lines
> 
> At any rate, until we have an actual plan for Windows, I think it would
> make sense only to split the cases into "has working inodes" and
> "other", and make sure "other" does something sensible in the meantime
> (like mention the conflict, but skip trying to list duplicates).

Yes, this should be split. Do the "easy" Linux version first. Keep in mind that there may also be a different solution for the Mac.

Show 6 quoted lines
> When somebody wants to work on Windows support, then we can figure out
> if it just needs to wrap the "get unique identifier" operation, or if it
> would use a totally different algorithm.
> 
> -Peff
> 
Jeff
Previous: Jeff KingNext: Junio C Hamano
Message 27 of 96 in “Git clone and case sensitivity”
  1. Paweł ParuzelJul 27, 2018
  2. brian m. carlsonJul 27, 2018
  3. Duy NguyenJul 28, 2018
  4. Duy NguyenJul 28, 2018
  5. Jeff KingJul 28, 2018
  6. Duy NguyenJul 28, 2018
  7. Simon RuderichJul 28, 2018
  8. Jeff KingJul 28, 2018
  9. brian m. carlsonJul 28, 2018
  10. Duy NguyenJul 29, 2018
  11. Jeff KingJul 29, 2018
  12. clone: report duplicate entries on case-insensitive filesystemsNguyễn Thái Ngọc Duy, Jul 30, 2018
  13. Torsten BögershausenJul 31, 2018
  14. Duy NguyenAug 1, 2018
  15. Elijah NewrenJul 31, 2018
  16. Junio C HamanoJul 31, 2018
  17. Jeff KingJul 31, 2018
  18. Junio C HamanoJul 31, 2018
  19. Jeff KingJul 31, 2018
  20. Junio C HamanoJul 31, 2018
  21. Junio C HamanoAug 1, 2018
  22. Duy NguyenAug 2, 2018
  23. Junio C HamanoAug 2, 2018
  24. Jeff KingAug 2, 2018
  25. Junio C HamanoAug 2, 2018
  26. Jeff KingAug 2, 2018
  27. Jeff HostetlerAug 3, 2018
  28. Junio C HamanoAug 3, 2018
  29. Jeff KingAug 3, 2018
  30. Jeff HostetlerAug 5, 2018
  31. Torsten BögershausenAug 3, 2018
  32. Duy NguyenAug 1, 2018
  33. Junio C HamanoJul 31, 2018
  34. Duy NguyenAug 1, 2018
  35. clone: report duplicate entries on case-insensitive filesystemsNguyễn Thái Ngọc Duy, Aug 7, 2018
  36. Junio C HamanoAug 7, 2018
  37. Jeff HostetlerAug 8, 2018
  38. Jeff KingAug 8, 2018
  39. Junio C HamanoAug 9, 2018
  40. Jeff KingAug 9, 2018
  41. Jeff HostetlerAug 9, 2018
  42. Jeff KingAug 9, 2018
  43. Elijah NewrenAug 9, 2018
  44. Jeff KingAug 9, 2018
  45. Elijah NewrenAug 9, 2018
  46. Jeff KingAug 9, 2018
  47. Elijah NewrenAug 9, 2018
  48. Junio C HamanoAug 9, 2018
  49. 0/1 clone: warn on colidding entries on checkoutNguyễn Thái Ngọc Duy, Aug 10, 2018
  50. 1/1 clone: report duplicate entries on case-insensitive filesystemsNguyễn Thái Ngọc Duy, Aug 10, 2018
  51. Junio C HamanoAug 10, 2018
  52. SZEDER GáborAug 11, 2018
  53. Duy NguyenAug 11, 2018
  54. Junio C HamanoAug 13, 2018
  55. Duy NguyenAug 13, 2018
  56. Junio C HamanoAug 10, 2018
  57. clone: report duplicate entries on case-insensitive filesystemsNguyễn Thái Ngọc Duy, Aug 12, 2018
  58. Jeff HostetlerAug 13, 2018
  59. Junio C HamanoAug 13, 2018
  60. Torsten BögershausenAug 15, 2018
  61. Duy NguyenAug 15, 2018
  62. config.txt: clarify core.checkStat = minimalNguyễn Thái Ngọc Duy, Aug 16, 2018
  63. Junio C HamanoAug 16, 2018
  64. Duy NguyenAug 16, 2018
  65. Junio C HamanoAug 16, 2018
  66. Junio C HamanoAug 17, 2018
  67. Duy NguyenAug 17, 2018
  68. Junio C HamanoAug 15, 2018
  69. Torsten BögershausenAug 16, 2018
  70. Duy NguyenAug 16, 2018
  71. Junio C HamanoAug 16, 2018
  72. clone: report duplicate entries on case-insensitive filesystemsNguyễn Thái Ngọc Duy, Aug 17, 2018
  73. Junio C HamanoAug 17, 2018
  74. Duy NguyenAug 17, 2018
  75. Torsten BögershausenAug 17, 2018
  76. clone: report duplicate entries on case-insensitive filesystemsCarlo Marcelo Arenas Belón, Nov 19, 2018
  77. Torsten BögershausenNov 19, 2018
  78. Carlo ArenasNov 19, 2018
  79. Duy NguyenNov 19, 2018
  80. Duy NguyenNov 19, 2018
  81. Duy NguyenNov 19, 2018
  82. Duy NguyenNov 19, 2018
  83. Ramsay JonesNov 19, 2018
  84. Ramsay JonesNov 19, 2018
  85. Carlo ArenasNov 20, 2018
  86. Junio C HamanoNov 20, 2018
  87. clone: fix colliding file detection on APFSNguyễn Thái Ngọc Duy, Nov 20, 2018
  88. Ramsay JonesNov 20, 2018
  89. Carlo ArenasNov 20, 2018
  90. Duy NguyenNov 20, 2018
  91. 1/1 t5601-99: Enable colliding file detection for MINGWtboegi@web.de, Nov 22, 2018
  92. 1/1 t5601-99: Enable colliding file detection for MINGWCarlo Marcelo Arenas Belón, Nov 22, 2018
  93. Johannes SchindelinNov 23, 2018
  94. Ramsay JonesNov 19, 2018
  95. Carlo ArenasNov 19, 2018
  96. Jeff HostetlerJul 31, 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.