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

Christopher Jefferson caj21@st-andrews.ac.uk
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
0,0
0,-1
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 31490 bytes
Desc: cygcheck.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20190304/2f22697a/attachment.obj>
-------------- next part --------------

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


More information about the Cygwin mailing list