Date: Tue, 5 May 1998 11:20:49 +0300 (IDT) From: Eli Zaretskii To: Thomas Demmer 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: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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.