Tcl Source Code

Check-in [5567ed9fa5]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[Bug 3608360]: Incompatible behaviour of "file exists".
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5567ed9fa5e1e9ed50b2db078be7f1a18700d0ca
User & Date: jan.nijtmans 2013-03-19 13:57:30
Context
2013-03-19
14:39
3597000 Consistent [file copy] result. check-in: 64f4ffa382 user: dgp tags: trunk
13:57
[Bug 3608360]: Incompatible behaviour of "file exists". check-in: 5567ed9fa5 user: jan.nijtmans tags: trunk
13:48
[Bug 2893771]: file stat fails on locked files on win32. check-in: f5ff2ff965 user: jan.nijtmans tags: core-8-5-branch
13:13
Test independence in fCmd.test check-in: 207842b573 user: dgp tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to .fossil-settings/ignore-glob.

14
15
16
17
18
19
20


21
*/config.log
*/config.status
*/tclConfig.sh
*/tclsh*
*/tcltest*
*/versions.vc
unix/dltest.marker


win/tcl.hpj







>
>

14
15
16
17
18
19
20
21
22
23
*/config.log
*/config.status
*/tclConfig.sh
*/tclsh*
*/tcltest*
*/versions.vc
unix/dltest.marker
unix/pkgs/*
win/pkgs/*
win/tcl.hpj

Changes to ChangeLog.

1
2
3
4
5
6
7
8
9
10
11
2013-03-19  Jan Nijtmans  <[email protected]>

	* win/tclWinFile.c: [Bug 3608360]: Back out bug fix
	for [Bug 2893771], because it was the cause of the regression.

2013-03-18  Donal K. Fellows  <[email protected]>

	* tests/cmdAH.test (cmdAH-19.12): [Bug 3608360]: Added test to ensure
	that we never ever allow [file exists] to do globbing.

2013-03-12  Jan Nijtmans  <[email protected]>


|
|







1
2
3
4
5
6
7
8
9
10
11
2013-03-19  Jan Nijtmans  <[email protected]>

	* win/tclWinFile.c: [Bug 3608360]: Incompatible behaviour of "file
	exists".

2013-03-18  Donal K. Fellows  <[email protected]>

	* tests/cmdAH.test (cmdAH-19.12): [Bug 3608360]: Added test to ensure
	that we never ever allow [file exists] to do globbing.

2013-03-12  Jan Nijtmans  <[email protected]>

Changes to win/tclWinFile.c.

1530
1531
1532
1533
1534
1535
1536
1537
1538
1539


1540
1541

1542
1543
1544
1545
1546
1547
1548
{
    DWORD attr;

    attr = GetFileAttributes(nativePath);

    if (attr == INVALID_FILE_ATTRIBUTES) {
	/*
	 * File doesn't exist.
	 */



	TclWinConvertError(GetLastError());
	return -1;

    }

    if (mode == F_OK) {
	/*
	 * File exists, nothing else to check.
	 */








|


>
>
|
|
>







1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
{
    DWORD attr;

    attr = GetFileAttributes(nativePath);

    if (attr == INVALID_FILE_ATTRIBUTES) {
	/*
	 * File might not exist.
	 */

	DWORD lasterror = GetLastError();
	if (lasterror != ERROR_SHARING_VIOLATION) {
	    TclWinConvertError(lasterror);
	    return -1;
	}
    }

    if (mode == F_OK) {
	/*
	 * File exists, nothing else to check.
	 */

1990
1991
1992
1993
1994
1995
1996



1997


1998




1999
2000
2001
2002
2003
2004
2005
	 * Fall back on the less capable routines. This means no nlink or ino.
	 */

	WIN32_FILE_ATTRIBUTE_DATA data;

	if (GetFileAttributesEx(nativePath,
		GetFileExInfoStandard, &data) != TRUE) {



	    Tcl_SetErrno(ENOENT);


	    return -1;




	}

	attr = data.dwFileAttributes;

	statPtr->st_size = ((Tcl_WideInt) data.nFileSizeLow) |
		(((Tcl_WideInt) data.nFileSizeHigh) << 32);
	statPtr->st_atime = ToCTime(data.ftLastAccessTime);







>
>
>
|
>
>
|
>
>
>
>







1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
	 * Fall back on the less capable routines. This means no nlink or ino.
	 */

	WIN32_FILE_ATTRIBUTE_DATA data;

	if (GetFileAttributesEx(nativePath,
		GetFileExInfoStandard, &data) != TRUE) {
	    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;

	statPtr->st_size = ((Tcl_WideInt) data.nFileSizeLow) |
		(((Tcl_WideInt) data.nFileSizeHigh) << 32);
	statPtr->st_atime = ToCTime(data.ftLastAccessTime);