From 11fcad9b1df2c2cf7d5ada8feb565c97b9777fef Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 19 Jan 2012 21:22:56 +0000 Subject: [Bug-3474726] minGW Tcl_StatBuf not defined correctly in tcl.h --- ChangeLog | 9 +++++ generic/tcl.h | 2 +- generic/tclFCmd.c | 5 +++ generic/tclTest.c | 5 +++ win/configure | 100 ++++++++++++++++-------------------------------------- win/configure.in | 20 ----------- win/tclWinPort.h | 10 ++---- 7 files changed, 51 insertions(+), 100 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2c6e34a..e2b3d47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2012-01-19 Jan Nijtmans + + * generic/tcl.h: [Bug-3474726]: Eliminate detection of struct + * generic/tclWinPort.h: _stat32i64, just use _stati64 in combination + * generic/tclFCmd.c: with _USE_32BIT_TIME_T, which is the same then. + * generic/tclTest.c: Only keep _stat32i64 usage for cygwin, so it + * win/configure.in: will not conflict with cygwin's own struct stat. + * win/configure: + 2012-01-19 Don Porter * generic/tclCmdMZ.c: [Bug 3475667] Prevent buffer read overflow. diff --git a/generic/tcl.h b/generic/tcl.h index ec64cac..b9355da 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -381,7 +381,7 @@ typedef struct stati64 Tcl_StatBuf; # else /* __BORLANDC__ */ # if defined(_WIN64) typedef struct __stat64 Tcl_StatBuf; -# elif (defined(_MSC_VER) && (_MSC_VER < 1400)) +# elif (defined(_MSC_VER) && (_MSC_VER < 1400)) || defined(_USE_32BIT_TIME_T) typedef struct _stati64 Tcl_StatBuf; # else typedef struct _stat32i64 Tcl_StatBuf; diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c index 1f73cf3..6113cf7 100644 --- a/generic/tclFCmd.c +++ b/generic/tclFCmd.c @@ -10,6 +10,11 @@ * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ +#ifndef _WIN64 +/* See [Bug 2935503]: file mtime sets wrong time */ +# define _USE_32BIT_TIME_T +#endif + #include #include "tclInt.h" #include "tclPort.h" diff --git a/generic/tclTest.c b/generic/tclTest.c index e870236..194f110 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -15,6 +15,11 @@ * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ +#ifndef _WIN64 +/* See [Bug 2935503]: file mtime sets wrong time */ +# define _USE_32BIT_TIME_T +#endif + #define TCL_TEST #include #include "tclInt.h" diff --git a/win/configure b/win/configure index 1fe4dde..57bc8e6 100755 --- a/win/configure +++ b/win/configure @@ -1263,60 +1263,18 @@ EOF fi -# Check to see if struct _stat32i64 exists in mingw's sys/stat.h - -echo $ac_n "checking if struct _stat32i64 missing""... $ac_c" 1>&6 -echo "configure:1270: checking if struct _stat32i64 missing" >&5 -if eval "test \"`echo '$''{'tcl_struct_stat32i64'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#include - -int main() { - - struct _stat32i64 foo; - -; return 0; } -EOF -if { (eval echo configure:1287: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - tcl_struct_stat32i64=no -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - tcl_struct_stat32i64=yes -fi -rm -f conftest* - -fi - -echo "$ac_t""$tcl_struct_stat32i64" 1>&6 -if test "$tcl_struct_stat32i64" = "yes" ; then - cat >> confdefs.h <<\EOF -#define HAVE_NO_STRUCT_STAT32I64 1 -EOF - -fi - - #-------------------------------------------------------------------- # Determines the correct binary file extension (.o, .obj, .exe etc.) #-------------------------------------------------------------------- echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:1314: checking for object suffix" >&5 +echo "configure:1272: checking for object suffix" >&5 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftest* echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:1320: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1278: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then for ac_file in conftest.*; do case $ac_file in *.c) ;; @@ -1334,19 +1292,19 @@ OBJEXT=$ac_cv_objext ac_objext=$ac_cv_objext echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:1338: checking for mingw32 environment" >&5 +echo "configure:1296: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1308: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -1365,7 +1323,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1369: checking for executable suffix" >&5 +echo "configure:1327: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1375,7 +1333,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:1379: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:1337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj) ;; @@ -1402,7 +1360,7 @@ ac_exeext=$EXEEXT echo $ac_n "checking for building with threads""... $ac_c" 1>&6 -echo "configure:1406: checking for building with threads" >&5 +echo "configure:1364: checking for building with threads" >&5 # Check whether --enable-threads or --disable-threads was given. if test "${enable_threads+set}" = set; then enableval="$enable_threads" @@ -1439,7 +1397,7 @@ EOF echo $ac_n "checking how to build libraries""... $ac_c" 1>&6 -echo "configure:1443: checking how to build libraries" >&5 +echo "configure:1401: checking how to build libraries" >&5 # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" @@ -1480,7 +1438,7 @@ EOF # Step 0: Enable 64 bit support? echo $ac_n "checking if 64bit support is requested""... $ac_c" 1>&6 -echo "configure:1484: checking if 64bit support is requested" >&5 +echo "configure:1442: checking if 64bit support is requested" >&5 # Check whether --enable-64bit or --disable-64bit was given. if test "${enable_64bit+set}" = set; then enableval="$enable_64bit" @@ -1494,7 +1452,7 @@ fi # Cross-compiling options for Windows/CE builds echo $ac_n "checking if Windows/CE build is requested""... $ac_c" 1>&6 -echo "configure:1498: checking if Windows/CE build is requested" >&5 +echo "configure:1456: checking if Windows/CE build is requested" >&5 # Check whether --enable-wince or --disable-wince was given. if test "${enable_wince+set}" = set; then enableval="$enable_wince" @@ -1506,7 +1464,7 @@ fi echo "$ac_t""$doWince" 1>&6 echo $ac_n "checking for Windows/CE celib directory""... $ac_c" 1>&6 -echo "configure:1510: checking for Windows/CE celib directory" >&5 +echo "configure:1468: checking for Windows/CE celib directory" >&5 # Check whether --with-celib or --without-celib was given. if test "${with_celib+set}" = set; then withval="$with_celib" @@ -1523,7 +1481,7 @@ fi # Extract the first word of "cygpath", so it can be a program name with args. set dummy cygpath; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1527: checking for $ac_word" >&5 +echo "configure:1485: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CYGPATH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1571,9 +1529,9 @@ fi echo "END" >> $conftest echo $ac_n "checking for Windows native path bug in windres""... $ac_c" 1>&6 -echo "configure:1575: checking for Windows native path bug in windres" >&5 +echo "configure:1533: checking for Windows native path bug in windres" >&5 cyg_conftest=`$CYGPATH $conftest` - if { ac_try='$RC -o conftest.res.o $cyg_conftest'; { (eval echo configure:1577: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } ; then + if { ac_try='$RC -o conftest.res.o $cyg_conftest'; { (eval echo configure:1535: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } ; then echo "$ac_t""no" 1>&6 else echo "$ac_t""yes" 1>&6 @@ -1592,7 +1550,7 @@ echo "configure:1575: checking for Windows native path bug in windres" >&5 # set various compiler flags depending on whether we are using gcc or cl echo $ac_n "checking compiler flags""... $ac_c" 1>&6 -echo "configure:1596: checking compiler flags" >&5 +echo "configure:1554: checking compiler flags" >&5 if test "${GCC}" = "yes" ; then SHLIB_LD="" SHLIB_LD_LIBS="" @@ -1706,7 +1664,7 @@ echo "configure:1596: checking compiler flags" >&5 ;; *) cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1679: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_win_64bit=no else @@ -1970,7 +1928,7 @@ EOF echo $ac_n "checking for build with symbols""... $ac_c" 1>&6 -echo "configure:1974: checking for build with symbols" >&5 +echo "configure:1932: checking for build with symbols" >&5 # Check whether --enable-symbols or --disable-symbols was given. if test "${enable_symbols+set}" = set; then enableval="$enable_symbols" @@ -2030,7 +1988,7 @@ TCL_DBGX=${DBGX} #-------------------------------------------------------------------- echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2034: checking how to run the C preprocessor" >&5 +echo "configure:1992: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2045,13 +2003,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2055: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2013: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2062,13 +2020,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2072: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2030: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2079,13 +2037,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2089: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2047: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2111,17 +2069,17 @@ echo "$ac_t""$CPP" 1>&6 ac_safe=`echo "errno.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for errno.h""... $ac_c" 1>&6 -echo "configure:2115: checking for errno.h" >&5 +echo "configure:2073: checking for errno.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2125: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2083: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* diff --git a/win/configure.in b/win/configure.in index 47b6a4f..3ac39c3 100644 --- a/win/configure.in +++ b/win/configure.in @@ -240,26 +240,6 @@ if test "$tcl_cv_cast_to_union" = "yes"; then [Defined when compiler supports casting to union type.]) fi -# Check to see if struct _stat32i64 exists in mingw's sys/stat.h - -AC_CACHE_CHECK(if struct _stat32i64 missing, - tcl_struct_stat32i64, -AC_TRY_COMPILE([ -#include -#include -], -[ - struct _stat32i64 foo; -], - tcl_struct_stat32i64=no, - tcl_struct_stat32i64=yes) -) -if test "$tcl_struct_stat32i64" = "yes" ; then - AC_DEFINE(HAVE_NO_STRUCT_STAT32I64, 1, - [Defined when sys/stat.h is missing struct _stat32i64]) -fi - - #-------------------------------------------------------------------- # Determines the correct binary file extension (.o, .obj, .exe etc.) #-------------------------------------------------------------------- diff --git a/win/tclWinPort.h b/win/tclWinPort.h index 5f9e018..377aea3 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -93,9 +93,9 @@ #define ENOTSUP -1030507 /* - * Not all mingw32 versions have this struct. + * cygwin does not have this struct. */ -#if !defined(__BORLANDC__) && !defined(_MSC_VER) && !defined(_WIN64) && defined(HAVE_NO_STRUCT_STAT32I64) +#ifdef __CYGWIN__ struct _stat32i64 { dev_t st_dev; ino_t st_ino; @@ -105,15 +105,9 @@ short st_gid; dev_t st_rdev; __int64 st_size; -#ifdef __CYGWIN__ struct {long tv_sec;} st_atim; struct {long tv_sec;} st_mtim; struct {long tv_sec;} st_ctim; -#else - long st_atime; - long st_mtime; - long st_ctime; -#endif }; #endif -- cgit v0.12