www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/05/04:22:18

Date: Tue, 5 May 1998 11:20:49 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Thomas Demmer <demmer AT LSTM DOT Ruhr-UNI-Bochum DOT De>
cc: djgpp AT delorie DOT com
Subject: Re: fixpath problem in Novell drives.
In-Reply-To: <354EB5E7.4E6C003E@LSTM.Ruhr-UNI-Bochum.De>
Message-ID: <Pine.SUN.3.91.980505111131.27724F-100000@is>
MIME-Version: 1.0

On Tue, 5 May 1998, Thomas Demmer wrote:

> Hmm, this can easily fail on a redirected network drive. 
> Under Novell, I can do nasty things as
> 
> MAP ROOT i:=usr:home/demmer/djgpp
> MAP ROOT k:=usr:home/demmer/djgpp/bin
> cp i:/bin/gcc.exe k:/gcc.exe
> 
> and end up with a nuked gcc.exe, because both names refer to the
> same file. stat() will happily report both of them being
> different files, when in fact they are the same. IIRC, stat()
> keeps track of filenames on a drive level to invent inodes.

Did you actually try this?  If so, I would like to hear the results.

As far as I know, on DOS and Windows 3.X, the above would correctly tell 
you that these files are the same, because `_truename' resolves both names 
to the same UNC, and thus both files get the same inode and the same 
st_dev number.  The same situation exists with SUBST and JOIN, and `stat' 
does handles those correctly.

The only place where this does break is on Windows 9X (surprise, 
surprise!).  It turns out that Windows doesn't care to return a UNC for 
drives mapped to other machines in the workgroup, so you get the same 
X:\foo back, even if X: is actually mapped to \\TOM_DEMMER\SHARE\LIB.  I 
had an experimental version of `stat' which tried to resolve this by 
fetching the network name of X:, but then I found out that in some cases 
this doesn't work either, so I abandoned the idea, for now.

> The concept of drive letters is so brain-dead that it hurts,
> but what can you do?

First, you can avoid mapping different drive letters to the same disk on 
the same machine.  (Remember that "don't do that" joke?)

And second, you could yell at Microsoft gods to return the UNC like we 
all expect.

- Raw text -


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