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

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

Previous: Junio C HamanoNext: Johannes Schindelin
Message 3 of 5 in “help: correct behavior for is_executable on Windows”
  1. help: correct behavior for is_executable on WindowsJohannes Schindelin, Jan 27, 2017
  2. Junio C HamanoJan 27, 2017
  3. Johannes SchindelinJan 30, 2017
  4. help: improve is_executable() on WindowsJohannes Schindelin, Jan 30, 2017
  5. Junio C HamanoJan 30, 2017

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.