delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/08/02/08:52:51

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: Gernot Hillier <gernot DOT hillier AT siemens DOT com>
Organization: Siemens AG
To: cygwin AT cygwin DOT com
Subject: mapping root directory to SystemDrive / CurrentDrive
Date: Mon, 2 Aug 2004 14:52:32 +0200
User-Agent: KMail/1.6.2
MIME-Version: 1.0
Message-Id: <200408021452.34000.gernot.hillier@siemens.com>
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id i72Cqo6b011918

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/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019