On Wed, Jun 14, 2017 at 01:02:15AM -0400, Jeff King wrote:
> On Wed, Jun 14, 2017 at 04:17:40AM +0200, Øyvind A. Holm wrote:
>
> > > Interesting. I'm not able to reproduce it, but of course that doesn't
> > > mean much.
> >
> > I'll admit that I have a somewhat special build system, but it's been
> > working great since I created it 7 months ago, and I run the test suite
> > every time I install a new git. I'm using the Makefile located at
> >
> > https://gitlab.com/sunny256/src-other/blob/master/devel/git/Makefile
> >
> > It's only doing regular stuff like "make configure", "./configure", etc,
> > but I'm mentioning it in case the Makefile reveals something
> > interesting. The git installation is in a non-standard location, the
> > newest version of git I've installed is for example located under
> > /usr/src-other/pool/git.master.v2.13.1-394-g41dd4330a121/ .
>
> I couldn't reproduce either with my usual build, but I don't usually use
> autoconf. Running:
>
> make configure
> ./configure
> make
> (cd t && ./t1308-*)
>
> does fail for me. The problem is that the generated config.mak.autogen
> sets the wrong value for FREAD_READS_DIRECTORIES (and overrides the
> default entry for Linux from config.mak.uname. So the configure script
> needs to be fixed.
Actually, I'm not sure if configure.ac is wrong, or the new uses of
FREAD_READS_DIRECTORIES. Because the test configure.ac actually checks:
FILE *f = fopen(".", "r");
return f && fread(&c, 1, 1, f);
I.e., it sees that not only do we fopen() a directory, but we actually
read garbage from it. Whereas on Linux, we fopen the file and then the
read gets EISDIR.
So it's not true that FREAD_READS_DIRECTORIES; this is more like
FOPEN_OPENS_DIRECTORIES.
Just looking at how the macro is used, I think we want to handle both
cases the same (by doing an fstat check after fopen). So I think it
would be OK to continue to use FREAD_READS_DIRECTORIES for both cases,
and just fix the configure script. It may be worth updating the macro
name for clarity, though.
-Peff