Subject: Re: bug#30350: Build breakage of master on MacOS 10.13

From: Mikhail Gusarov <[email-masked]>
Date: Tue, 06 Feb 2018 22:30:19 +0100

On Tue, 6 Feb 2018, at 22:26, Mikhail Gusarov wrote:

> I'm saying that on OS X stat'ing /bin/zsh and /bin/zsh/ (or /bin/zsh/.) 
> gives different results:

And here is a test program and its output:

#include <sys/stat.h>
#include <errno.h>
#include <stdio.h>

static void teststat(const char *filename)
{
    struct stat st;
    errno = 0;
    int res = stat(filename, &st);
    printf("%s stat->%d errno->%d\n", filename, res, errno);
}

int main()
{
    teststat("/bin/zsh");
    teststat("/bin/zsh/");
    teststat("/bin/zsh/.");
    return 0;
}

% ./a
/bin/zsh stat->0 errno->0
/bin/zsh/ stat->-1 errno->20
/bin/zsh/. stat->-1 errno->20
%

errno 20 is ENOTDIR.