This is the mail archive of the
cygwin-developers@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: duplicate inode number
- To: cygwin-developers@sourceware.cygnus.com
- Subject: Re: duplicate inode number
- From: Corinna Vinschen <corinna@vinschen.de>
- Date: Sat, 12 Jun 1999 22:28:11 +0200
- CC: Kazuhiro Fujieda <fujieda@jaist.ac.jp>
- References: <s1shfodthpp.fsf@jaist.ac.jp>
Kazuhiro Fujieda wrote:
>
> I reported this problem and the patch resolving it once, but there
> has been no response. So I try to explain it more concretely.
>
> As reported in the cygwin mailing list, `mv' sometime complains
> completely different files are the same file. Because these files
> have the same inode number.
>
> For example,
>
> $ touch 1 2 3 4 5
> $ mv 1 2
> mv: `1' and `2' are the same file
> $ ls -i
> 1447 1 1447 2 1445 3 1445 4 1447 5
>
> This can be observed on Win9x in the snapshots since 12 Feb when the
> following changes are made.
>
> Fri Feb 12 13:17:49 1999 Corinna Vinschen <corinna.vinschen@cityweb.de>
>
> * fhandler.cc (fhandler_disk_file::fstat): Handles directories,
> returns unique i-node number.
> * syscalls.cc (stat_worker): On WinNT, stat_worker calls
> fhandler_disk_file::fstat for directories, too.
Ok, I have patched it to old behaviour for 9X.
Thanks,
Corinna
ChangeLog:
==========
Sat Jun 12 22:22:00 1999 Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc (fhandler_disk_file::fstat): For 9X, i-node numbers
computed via `get_namehash' again.
Index: fhandler.cc
===================================================================
RCS file: /src/cvsroot/winsup-990602/fhandler.cc,v
retrieving revision 1.2
diff -u -p -r1.2 fhandler.cc
--- fhandler.cc 1999/06/12 20:07:08 1.2
+++ fhandler.cc 1999/06/12 20:20:34
@@ -882,7 +882,10 @@ fhandler_disk_file::fstat (struct stat *
buf->st_nlink = local.nNumberOfLinks;
buf->st_dev = local.dwVolumeSerialNumber;
buf->st_size = local.nFileSizeLow;
- buf->st_ino = local.nFileIndexHigh | local.nFileIndexLow;
+ if (os_being_run != winNT)
+ buf->st_ino = local.nFileIndexLow ^ get_namehash ();
+ else
+ buf->st_ino = local.nFileIndexHigh | local.nFileIndexLow;
buf->st_blksize = S_BLKSIZE;
buf->st_blocks = (buf->st_size + S_BLKSIZE-1) / S_BLKSIZE;
buf->st_uid = get_file_owner (get_win32_name ());