summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2013-03-19 13:57:30 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2013-03-19 13:57:30 (GMT)
commit23b102e5e8516ffc7195aaf14a008383ffbcb69d (patch)
treeae83c33f8dd3074761bc81544d8adb80ee00fae3
parent56302c00e29b36c778b66f1cb65380ab987c83cc (diff)
parent01ae22053af8cd618c105c63909fa6386f316bbc (diff)
downloadtcl-23b102e5e8516ffc7195aaf14a008383ffbcb69d.zip
tcl-23b102e5e8516ffc7195aaf14a008383ffbcb69d.tar.gz
tcl-23b102e5e8516ffc7195aaf14a008383ffbcb69d.tar.bz2
[Bug 3608360]: Incompatible behaviour of "file exists".
-rw-r--r--.fossil-settings/ignore-glob2
-rw-r--r--ChangeLog4
-rw-r--r--win/tclWinFile.c22
3 files changed, 21 insertions, 7 deletions
diff --git a/.fossil-settings/ignore-glob b/.fossil-settings/ignore-glob
index 16930f5..31c80a0 100644
--- a/.fossil-settings/ignore-glob
+++ b/.fossil-settings/ignore-glob
@@ -18,4 +18,6 @@
*/tcltest*
*/versions.vc
unix/dltest.marker
+unix/pkgs/*
+win/pkgs/*
win/tcl.hpj
diff --git a/ChangeLog b/ChangeLog
index 2d75b52..e01bc39 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,7 @@
2013-03-19 Jan Nijtmans <nijtmans@users.sf.net>
- * win/tclWinFile.c: [Bug 3608360]: Back out bug fix
- for [Bug 2893771], because it was the cause of the regression.
+ * win/tclWinFile.c: [Bug 3608360]: Incompatible behaviour of "file
+ exists".
2013-03-18 Donal K. Fellows <dkf@users.sf.net>
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 989836f..528b9e5 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -1534,11 +1534,14 @@ NativeAccess(
if (attr == INVALID_FILE_ATTRIBUTES) {
/*
- * File doesn't exist.
+ * File might not exist.
*/
- TclWinConvertError(GetLastError());
- return -1;
+ DWORD lasterror = GetLastError();
+ if (lasterror != ERROR_SHARING_VIOLATION) {
+ TclWinConvertError(lasterror);
+ return -1;
+ }
}
if (mode == F_OK) {
@@ -1994,8 +1997,17 @@ NativeStat(
if (GetFileAttributesEx(nativePath,
GetFileExInfoStandard, &data) != TRUE) {
- Tcl_SetErrno(ENOENT);
- return -1;
+ HANDLE hFind;
+ WIN32_FIND_DATA ffd;
+ DWORD lasterror = GetLastError();
+
+ if (lasterror != ERROR_SHARING_VIOLATION) {
+ TclWinConvertError(lasterror);
+ return -1;
+ }
+ hFind = FindFirstFile(nativePath, &ffd);
+ memcpy(&data, &ffd, sizeof(data));
+ FindClose(hFind);
}
attr = data.dwFileAttributes;