| Ticket UUID: | 3288345 | ||
| Title: | Wrong Tcl_StatBuf used on MinGW | ||
| Type: | Bug | Created on: | 2011-04-17 02:45:09 |
| Submitter: | andygoth | Assigned to: | nijtmans |
| Subsystem: | 37. File System | Severity: | |
| Priority: | 5 Medium | Last modified: | 2012-03-27 19:22:52 |
| Status: | Closed | Closed by: | nijtmans |
| Resolution: | Fixed | Closed on: | 2012-03-27 12:22:52 |
| Version: | obsolete: 8.6b1.1 | ||
| Description: | ||||
On MinGW, tcl.h typedefs Tcl_StatBuf to be struct stat, which contains a 32-bit st_size. A 64-bit st_size is assumed by tclWinFile.c. This results in incorrect [file size], etc., for 2+ gigabyte files. struct _stati64 should be used instead. I made this change in my local Tcl source tree and recompiled, and [file size] now works correctly. See /mingw/include/sys/stat.h for the family of stat structs and the circumstances under which each is available. This is on a 32-bit Windows XP machine. | ||||
| User Comments: | ||||
nijtmans added on 2011-04-17 23:16:24:
I'll have a look nijtmans added on 2011-04-18 15:44:17:
Fixed on all open branches. nijtmans added on 2011-04-21 17:18:43:
_stati64 uses either a 32-bit time_t, either a 64-bit time_t depending on _USE_32BIT_TIME_T, while MSVC6 always uses a 32-bit time_t. So, in order to keep binary compatibility on all platforms, we should use _stat32i64 whenever this is available (VS2005+) Problem: not all mingw versions have already taken this over from VS2005, so in case encountering an old mingw version, we should provide our own version in tclWinPort.h. For VS2005+, this means a binary API change, because starting with this version the time_t type suddenly starts to be 64-bit, unless we define _USE_32BIT_TIME_T. Pat Thoyts, Any remarks? dgp added on 2011-04-21 18:03:28:
I think these are new warnings from tclTest.c building Tcl 8.4 tip . Related to these changes? /home/dgp/fossil/tcl8.4/unix/../generic/tclTest.c: In function ‘TeststatprocCmd’: /home/dgp/fossil/tcl8.4/unix/../generic/tclTest.c:4660: warning: assignment from incompatible pointer type /home/dgp/fossil/tcl8.4/unix/../generic/tclTest.c:4662: warning: assignment from incompatible pointer type /home/dgp/fossil/tcl8.4/unix/../generic/tclTest.c:4664: warning: assignment from incompatible pointer type /home/dgp/fossil/tcl8.4/unix/../generic/tclTest.c:4666: warning: assignment from incompatible pointer type /home/dgp/fossil/tcl8.4/unix/../generic/tclTest.c:4676: warning: comparison of distinct pointer types lacks a cast nijtmans added on 2011-04-21 19:08:12:
>I think these are new warnings from tclTest.c >building Tcl 8.4 tip . Related to these changes? Yes, it was related. Should be fixed now. nijtmans added on 2011-10-13 21:31:11:
allow_comments - 1 nijtmans added on 2012-03-14 15:10:38:
allow_comments - 0 Re-opening. Reason: cygwin switched from using the /win directory for its build to the /unix directory, but then also starts to use the unix stat64 structure. cygwin tclsh can load and run Tcl extensions compiled with mingw, but those use a different struct for Tcl_StatBuf. So the problem described here re-appeard for cygwin ;-( Solution: make a special Tcl_StatBuf for cygwin's unix build only, which has exactly the same structure as _stat32i64 (copy this from tclWinPort.h to tcl.h) nijtmans added on 2012-03-27 19:22:37:
Should finally be fixed now for all branches | ||||
