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

Re: [PATCH] Add a new lstat implementation based on Win32 API, and make stat use that implementation too.

From
RDReece Dunn <msclrhd@googlemail.com>
Date
Sep 2, 2007, 16:33 UTC
Message-ID
<3f4fd2640709020933sa2bdec0g532500ea49c179b5@mail.gmail.com>
In-Reply-To
<46DAE025.900@trolltech.com>
On 02/09/07, Marius Storm-Olsen <marius@trolltech.com> wrote:
Show 36 quoted lines
> Reece Dunn wrote:
> > On 02/09/07, Marius Storm-Olsen <marius@trolltech.com> wrote:
> >> This gives us a significant speedup when adding, committing and stat'ing files.
> >> (Also, since Windows doesn't really handle symlinks, it's fine that stat just uses lstat)
> >>
> >> +               if (ext && (!_stricmp(ext, ".exe") ||
> >> +                           !_stricmp(ext, ".com") ||
> >> +                           !_stricmp(ext, ".bat") ||
> >> +                           !_stricmp(ext, ".cmd")))
> >> +                       fMode |= S_IEXEC;
> >> +               }
> >
> > This breaks executable mode reporting for things like configure
> > scripts and other shell scripts that may, or may not, be executable.
> > Also, you may want to turn off the executable state for some of these
> > extensions (for example if com or cmd were not actually executable
> > files). This makes it impossible to manipulate git repositories
> > properly on the MinGW platform.
>
> Actually, you don't really need the EXEC bit for Git to work. I just
> added it for completeness. (We _could_ remove that too, since it's
> slowing us down slightly ;-)
>
> Remember that Git isn't using MSys for its builtins, so MinGW Git
> doesn't understand the MSys notion of executable files anyways.
> The MinGW port actually peeks at the beginning of a file (ignoring exe
> files), and sees if there's an interpreter there. If there is, it will
> expand
>     git-foo args...
> into
>     sh git-foo args...
> and execute the command. So, it's not really affected by this change.
>
> I haven't had any problems with this patch on my system, so could you
> explain what you mean with 'this makes it impossible to manipulate git
> repositories'?

You pull a repository that contains executable scripts that are required to work in order to build the system. You then make some modifications to the local repository and run the 'git add .' command. Since this patch is reporting executable bits differently, the mode change is stored as well as the local modifications. Now the changes are pushed upstream (along with the file mode changes).

Someone running a Linux machine, pulls your changes. When those files are checked out, the executable state of those scripts has now changed, preventing the Linux user from running those scripts. _That_ is what I meant. Or am I misunderstanding how git works in this case?

Show 14 quoted lines
> > Would it be possible to use the git tree to manage the executable
> > state? That way, all files would not have their executable state set
> > by default on Windows. The problem with this is how then to set the
> > executable state? Having a git version of chmod may not be a good
> > idea, but then how else are you going to reliably and efficiently
> > modify the files permissions on Windows?
>
> The file-state-in-git-tree belongs in a different discussion. Have a
> look at the '.gitignore, .gitattributes, .gitmodules, .gitprecious?,
> .gitacls? etc.' and 'tracking perms/ownership [was: empty directories]'
> threads. Permissions are not a trivial topic, since systems represent
> them differently. This patch just tries to reflect the read, write and
> execute permissions as normal Windows would; and it only cares about
> file extensions (and the PE header, if it exists).

I understand that this is not a trivial topic. I was thinking that this different behaviour w.r.t. the executable permission will break things when you have developers on both Linux and Windows, such as the cairo developers, for current git usage.

I have not really been tracking those threads, but I will take a look at them.
> Also note that my patch totally ignores the Group & Others part of the
> permission bits. Again, we're on Windows so we don't really care. We
> _could_ make it reflect the ACLs in Windows, but then we'd have to make
> it optional, since that's _really_ slow to 'stat'.

Sure. Cygwin does use ACLs to implement stat which is why it is slow. So anything that can speed git up here, without any breakage in functionality, is a good thing.

- Reece
Previous: Marius Storm-OlsenNext: Brian Gernhardt
Message 6 of 86 in “Stats in Git”
  1. Marius Storm-OlsenSep 2, 2007
  2. Add a new lstat implementation based on Win32 API, and make stat use that implementation too.Marius Storm-Olsen, Sep 2, 2007
  3. Marius Storm-OlsenSep 2, 2007
  4. Reece DunnSep 2, 2007
  5. Marius Storm-OlsenSep 2, 2007
  6. Reece DunnSep 2, 2007
  7. Brian GernhardtSep 2, 2007
  8. Reece DunnSep 2, 2007
  9. Marius Storm-OlsenSep 2, 2007
  10. Johannes SchindelinSep 2, 2007
  11. David KastrupSep 2, 2007
  12. Marius Storm-OlsenSep 2, 2007
  13. Johannes SixtSep 2, 2007
  14. Marius Storm-OlsenSep 2, 2007
  15. Johannes SixtSep 2, 2007
  16. Add a new lstat implementation based on Win32 API, and make stat use that implementation too.Marius Storm-Olsen, Sep 2, 2007
  17. Robin RosenbergSep 2, 2007
  18. Johannes SchindelinSep 2, 2007
  19. Robin RosenbergSep 2, 2007
  20. Johannes SchindelinSep 2, 2007
  21. Johannes SixtSep 3, 2007
  22. Miklos VajnaSep 3, 2007
  23. David KastrupSep 3, 2007
  24. Miklos VajnaSep 5, 2007
  25. David KastrupSep 5, 2007
  26. Miklos VajnaSep 6, 2007
  27. David KastrupSep 6, 2007
  28. Douglas StockwellSep 6, 2007
  29. David KastrupSep 7, 2007
  30. Alex RiesenSep 2, 2007
  31. Robin RosenbergSep 2, 2007
  32. Marius Storm-OlsenSep 3, 2007
  33. Johannes SchindelinSep 3, 2007
  34. David KastrupSep 3, 2007
  35. Marius Storm-OlsenSep 3, 2007
  36. Johannes SchindelinSep 3, 2007
  37. Alex RiesenSep 2, 2007
  38. Marius Storm-OlsenSep 3, 2007
  39. Johannes SixtSep 3, 2007
  40. Marius Storm-OlsenSep 3, 2007
  41. Alex RiesenSep 2, 2007
  42. Marius Storm-OlsenSep 2, 2007
  43. Matthieu MoySep 3, 2007
  44. Marius Storm-OlsenSep 3, 2007
  45. Johannes SchindelinSep 3, 2007
  46. Marius Storm-OlsenSep 3, 2007
  47. Johannes SchindelinSep 3, 2007
  48. Marius Storm-OlsenSep 3, 2007
  49. Johannes SchindelinSep 3, 2007
  50. Johannes SixtSep 3, 2007
  51. Johannes SchindelinSep 3, 2007
  52. Marius Storm-OlsenSep 3, 2007
  53. Johannes SchindelinSep 4, 2007
  54. Johannes SixtSep 4, 2007
  55. David KastrupSep 4, 2007
  56. Marius Storm-OlsenSep 4, 2007
  57. Johannes SixtSep 4, 2007
  58. Marius Storm-OlsenSep 4, 2007
  59. Johannes SixtSep 4, 2007
  60. David KastrupSep 4, 2007
  61. Johannes SchindelinSep 4, 2007
  62. Johannes SixtSep 4, 2007
  63. Marius Storm-OlsenSep 4, 2007
  64. Marius Storm-OlsenSep 4, 2007
  65. Johannes SixtSep 4, 2007
  66. Johannes SchindelinSep 4, 2007
  67. Johannes SixtSep 4, 2007
  68. Johannes SchindelinSep 4, 2007
  69. Johannes SchindelinSep 4, 2007
  70. Marius Storm-OlsenSep 4, 2007
  71. Johannes SchindelinSep 4, 2007
  72. David KastrupSep 4, 2007
  73. Marius Storm-OlsenSep 4, 2007
  74. Johannes SchindelinSep 4, 2007
  75. Johannes SchindelinSep 4, 2007
  76. Rutger NijlunsingSep 4, 2007
  77. Reece DunnSep 4, 2007
  78. Marius Storm-OlsenSep 5, 2007
  79. Johannes SchindelinSep 5, 2007
  80. Johannes SixtSep 4, 2007
  81. Johannes SixtSep 6, 2007
  82. Marius Storm-OlsenSep 6, 2007
  83. Johannes SixtSep 3, 2007
  84. Johannes SchindelinSep 3, 2007
  85. Marius Storm-OlsenSep 3, 2007
  86. Johannes SchindelinSep 3, 2007

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.