This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

mapping root directory to SystemDrive / CurrentDrive


Hi!

We use some Cygwin tools without Cygwin mounts. The reason for this is (was) 
that we use several Cygwin versions from different network shares in parallel 
(i.e. we have different \Cygwin trees on different drives on our Windows 
hosts).

With earlier Cygwin versions, this worked without any problem as Cygwin always 
mapped "/" to the CurrentDrive (not the SystemDrive, as it is documented in 
http://www.cygwin.com/cygwin-ug-net/using.html). With the current Cygwin 
version, this seems to be mixed: the open() call seems to map "/" to the 
SystemDrive while stat() maps "/" to the current drive.

I can certainly understand that it was our fault to rely on something which 
was not documented. Nevertheless, this was a real nice workaround for us to 
be able to use different Cygwin tools based on different Cygwin trees easily 
(it was even possible to let them run in parallel).

And anyway, I assume that it is a bug that both system calls behave different, 
right?

But - for us - even more important: is there any way to revert to the old 
behaviour (mapping / to CurrentDrive)? 

For the sake of completeness, here are our test cases for interested parties: 
save a.c and b.c to the root of any Windows drive, compile them to different 
binaries. Place a file \test\test.cpp in this drive. Umount / and start both. 
a.c should output an error, b.c not.

----------------- a.c ------------------------------
#include <stdio.h>

int main(void)
{
        int fd;
        fd = open("/test/test.cpp", "rt");
        if (fd == -1) {
                perror("open");
                exit(2);
        }
        return 0;
}
----------------- /a.c ------------------------------


----------------- b.c ------------------------------
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>

int main(void)
{
        struct stat s;
        if (stat("/test/test.cpp", &s) == -1) {
                perror("stat");
                exit(2);
        }
        return 0;
}
----------------- /b.c ------------------------------

-- 
Bye,

Gernot Hillier
CT SE 2
Siemens AG, Mch P

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]