Hello,

For a few months, I've been working around an issue building ncurses with
clang targeting UCRT (https://github.com/msys2/CLANG-packages/issues/4),
and recently the same issue had to be worked around for GCC targeting
UCRT.  I finally got around to debugging it, and found that the call at
https://github.com/mirror/ncurses/blob/1f7a36f/ncurses/tinfo/access.c#L136
failed:
  result = ACCESS(head, R_OK | W_OK | X_OK);

With that knowledge, I created the following test program:

#include <io.h>
#include <stdio.h>
#include <stddef.h>

int main(int argc, char ** argv)
{
  int ret = mkdir("64");
  printf("mkdir: %d (%d)\n", ret, errno);
  ret = access("64/", R_OK|W_OK);
  printf("access R_OK|W_OK: %d (%d)\n", ret, errno);
  ret = access("64/", R_OK|W_OK|X_OK);
  printf("access R_OK|W_OK|X_OK: %d (%d)\n", ret, errno);
  return 0;
}

With MSVCRT all calls return 0, but with UCRT the last call returns -1 and
sets errno to EINVAL.  (That is, assuming a directory '64' can be created
in the current directory when run).  It seems that, to UCRT, X_OK is an
invalid parameter.

I don't know if this can or should be worked around here, or if all
callers need to be taught not to check the execute bit on Windows.


_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to