inconsistency in 'access' function between /cygdrive/c and c:/

Christopher Jefferson
Mon Mar 4 15:01:00 GMT 2019

The following issue was reported to me. I've reproduced it on Cygwin 2 and 3, on a couple of machines.

When using paths beginning 'C:/' the 'access' function claims that directories are readable when they are not. The same problem does not arise when starting the same directory name with '/cygdrive/c/'. I attach a minimal example program showing the problem. When I run it it returns that both ways of naming 'System Volume Information' exist, but that 'C:/System Volume Information' can be Read (which is wrong), while '/cygdrive/c/System Volume Information' can't be Read.

#include <unistd.h>
#include <stdio.h>

int main(void) {
    int ok1 = access("C:/System Volume Information/", F_OK);
    int ok2 = access("/cygdrive/c/System Volume Information", F_OK);
    int read1 = access("C:/System Volume Information/", R_OK);
    int read2 = access("/cygdrive/c/System Volume Information", R_OK);

    printf("%d,%d\n%d,%d\n", ok1, read1, ok2, read2);

// Prints
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 31490 bytes
Desc: cygcheck.out
URL: <>
-------------- next part --------------

Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list