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

fread reading directories

From
KEKyle Evans <kevans@freebsd.org>
Date
Jun 6, 2020, 22:36 UTC
Message-ID
<CACNAnaG19QD1PbVS93nFm3XY70CZCrRosmVq-_3j+puAKSPj9Q@mail.gmail.com>
Hi,

I was looking at FREAD_READS_DIRECTORIES to measure some performance differences, then stumbled upon [0] that dropped fread() from the autoconf test that causes git to use its git_fopen shim [1] even on Linux.

I've read the commit message a couple of times, but I'm really not seeing the rationale for *why* git wants this knob to be set on Linux.

Unless I'm missing something, this would seem to regress the almost certainly much-more-common case of fopen() a file and fread() it with an unconditional fstat() from grep_fopen(), rather than just using two syscalls at all times (directories and non-directories) and letting it get rejected in fread().

Thoughts?
Thanks,
Kyle Evans

[0] https://github.com/git/git/commit/3adf9fdecfb0cd31a83ef3af1d8d631a1acd392b [1] https://github.com/git/git/blob/master/compat/fopen.c

Next: Junio C Hamano
Message 1 of 6 in “fread reading directories”
  1. Kyle EvansJun 6, 2020
  2. Junio C HamanoJun 7, 2020
  3. Kyle EvansJun 7, 2020
  4. Junio C HamanoJun 8, 2020
  5. Brandon CaseyJun 8, 2020
  6. Randall S. BeckerJun 8, 2020

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.