Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com Message-ID: <00F8D6E8AB0DD3118F1A006008186C9607C7CA@server1.axonet.com.au> From: Andrew Dalgleish To: cygwin-developers AT sourceware DOT cygnus DOT com Subject: winsup inode bug + patch Date: Wed, 8 Dec 1999 16:46:57 +1100 X-Priority: 3 X-Mailer: Internet Mail Service (5.0.1458.49) There is a bug in the current handling of a file's inode. I first noticed this when a "mv" failed on a remote drive. This is most easily verified by doing an "ls -i". The listed inodes are not unique, and are not always the same for a given file even when you execute "ls -i foo && ls -i foo". Using nFileIndexHigh and nFileIndexLow for an inode number is taking a leap of faith. Here is the relevant section from the VC6 help (my line wrapping): nFileIndexLow Specifies the low-order word of a unique identifier associated with the file. This identifier and the volume serial number uniquely identify a file. This number may change when the system is restarted or when the file is opened. After a process opens a file, the identifier is constant until the file is closed. An application can use this identifier and the volume serial number to determine whether two handles refer to the same file. Note the phrase "the identifier is constant until the file is closed". The current code in stat() opens and closes the file. From what I have observed, the file index *does* change, and is *not* unique on network drives. The file index seems ok for local drives with ACLs so it is probably still worth using it where possible, reverting to the hashed file name (*without* XORing nFileIndexLow) if it is not. The patch below adds a HASINODE flag to path_conv and fhandler_base. This flag is set in path_conv::path_conv() by calling GetDriveType() after checking whether the volume supports ACLs. I have no idea how this affects other classes derived from fhandler_base, but I have successfully rebuilt cygwin-src-19991201.tar.gz + winsup-src-19991204.tar.gz + this patch for several generations. I'm having troubles with sub-shells with winsup-src-19991205.tar.gz, so the patch is relative to 19991204. From a PC running NT4sp5 workstation, I have tested this works for the following remote drives: NT4sp5 server sharing an NTFS drive NT4sp5 workstation sharing an NTFS drive. NT4sp5 workstation sharing a FAT32 drive (using the Winternals driver). Win95 sharing a FAT16 drive. Win95 sharing a FAT32 drive. Debian 2.0 + Samba 2.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