summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2008-07-21 14:42:54 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2008-07-21 14:42:54 (GMT)
commit884b6dff3c37ee13afd4737b75fd7c23ed011c5d (patch)
tree58049ea0b7ce2f0fcf53bf96753b509c317ee905
parent9247cfd4dd001327d0b13afb31bd9c53de78c61d (diff)
downloadtcl-884b6dff3c37ee13afd4737b75fd7c23ed011c5d.zip
tcl-884b6dff3c37ee13afd4737b75fd7c23ed011c5d.tar.gz
tcl-884b6dff3c37ee13afd4737b75fd7c23ed011c5d.tar.bz2
Inode numbers on Windows are not unique so avoid the inode check on this platform [Bug 2015723]
-rw-r--r--ChangeLog4
-rw-r--r--generic/tclFCmd.c12
2 files changed, 11 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 9466d26..7559188 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-07-21 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/tclFCmd.c: Inodes on windows are unreliable [Bug 2015723]
+
2008-07-21 Miguel Sofer <msofer@users.sf.net>
* generic/tclBasic.c: NRE: enabled calling NR commands
diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c
index 01eea62..dc13ef4 100644
--- a/generic/tclFCmd.c
+++ b/generic/tclFCmd.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclFCmd.c,v 1.45 2008/07/13 23:15:23 nijtmans Exp $
+ * RCS: @(#) $Id: tclFCmd.c,v 1.46 2008/07/21 14:42:57 patthoyts Exp $
*/
#include "tclInt.h"
@@ -522,12 +522,13 @@ CopyRenameOneFile(
}
/*
- * Prevent copying or renaming a file onto itself. Under Windows, stat
- * always returns 0 for st_ino. However, the Windows-specific code
- * knows how to deal with copying or renaming a file on top of itself.
- * It might be a good idea to write a stat that worked.
+ * Prevent copying or renaming a file onto itself. On Windows since
+ * 8.5 we do get an inode number, however the unsigned short field is
+ * insufficient to accept the Win32 API file id so it is truncated to
+ * 16 bits and we get collisions. See bug #2015723.
*/
+#ifndef WIN32
if ((sourceStatBuf.st_ino != 0) && (targetStatBuf.st_ino != 0)) {
if ((sourceStatBuf.st_ino == targetStatBuf.st_ino) &&
(sourceStatBuf.st_dev == targetStatBuf.st_dev)) {
@@ -535,6 +536,7 @@ CopyRenameOneFile(
goto done;
}
}
+#endif
/*
* Prevent copying/renaming a file onto a directory and vice-versa.