This is the mail archive of the cygwin-developers@sourceware.cygnus.com 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]

winsup inode bug + patch


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.0.4b sharing an ext2 drive.


Regards,
Andrew Dalgleish

 

begin 600 winsup-inode.diff.gz
M'XL("-7H33@``W=I;G-U<"UI;F]D92YD:69F`(U7;7.B2!#^G/R*KKVZ6UTU
M\34O6+L7-^*%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