Re: [PATCH] help: correct behavior for is_executable on Windows
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jan 30, 2017, 12:44 UTC
- Message-ID
- <alpine.DEB.2.20.1701301341020.3469@virtualbox>
- In-Reply-To
- <xmqqd1f8z6lt.fsf@gitster.mtv.corp.google.com>
Hi Junio,
On Fri, 27 Jan 2017, Junio C Hamano wrote:
Show 28 quoted lines
> Johannes Schindelin <johannes.schindelin@gmx.de> writes: > > > From: Heiko Voigt <hvoigt@hvoigt.net> > > > > The previous implementation said that the filesystem information on > > Windows is not reliable to determine whether a file is executable. To > > gather this information it was peeking into the first two bytes of a > > file to see whether it looks executable. > > > > Apart from the fact that on Windows executables are defined as such by > > their extension (and Git has special code to support "executing" > > scripts when they have a she-bang line) it leads to serious > > performance problems: not only do we have to open many files now, it > > gets even slower when a virus scanner is running. > > Heiko, around here (before going into the details of how severe the > problem is and how wonderful the result applying of this change is) is > the best place to summarize the solution. E.g. > > Because the definition of "executable" on Windows is based > on the file extension, update the function to declare that a > file with ".exe" extension without opening and reading the > early bytes from it. This avoids serious performance issues. > > I paraphrased the rest only so that the description of the solution > (i.e. "instead of opening and peeking, we trust .exe suffix") fits well > in the surrounding text; the important part is to say what the change > does clearly.
I adjusted the commit message. It was tweaked a little differently from what you suggested, as I preferred to condense the information a bit more.
Show 5 quoted lines
> I agree with the reasoning and the execution of the patch, except > that > > - "correct behaviour" in the title makes it appear that this is a > correctness thing, but this is primarily a performance fix.
Primarily. But not only. The magic `MZ` without the file extension `.exe` is pretty useless, as the file could not be executed, still.
To avoid further turnaround, though, I also edited the contentious "correct" to read "improve" now.
> - It is a bit strange that "MZ" is dropped in the same patch > without any mention.
I fixed that in the commit message.
Ciao, Johannes