summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das>2007-04-23 20:35:55 (GMT)
committerdas <das>2007-04-23 20:35:55 (GMT)
commitc93886c791c9d180c4e5fe39020495c2220bc3e6 (patch)
tree2f952ac8a6f3a4fa8111ba107482dc69f22c830a
parentb2d416baafa945b216378335885f99238f38966e (diff)
downloadtcl-c93886c791c9d180c4e5fe39020495c2220bc3e6.zip
tcl-c93886c791c9d180c4e5fe39020495c2220bc3e6.tar.gz
tcl-c93886c791c9d180c4e5fe39020495c2220bc3e6.tar.bz2
* unix/tclUnixFCmd.c: add workaround for crashing bug in fts_open()
* unix/tclUnixInit.c: without FTS_NOSTAT on 64bit Darwin 8 or earlier.
-rw-r--r--changes8
-rw-r--r--unix/tclUnixFCmd.c47
-rw-r--r--unix/tclUnixInit.c6
3 files changed, 40 insertions, 21 deletions
diff --git a/changes b/changes
index 70c7b08..c1e076d 100644
--- a/changes
+++ b/changes
@@ -1,6 +1,6 @@
Recent user-visible changes to Tcl:
-RCS: @(#) $Id: changes,v 1.113 2007/04/22 07:04:07 hobbs Exp $
+RCS: @(#) $Id: changes,v 1.114 2007/04/23 20:35:55 das Exp $
1. No more [command1] [command2] construct for grouping multiple
commands on a single command line.
@@ -6893,9 +6893,9 @@ Tcl_TakeBignumFromObj.
2007-01-11 (configure change) Remove "-Wconversion" from default CFLAGS.
-2007-01-25 (configure change) ensre CPPFLAGS env var is used when set.
+2007-01-25 (configure change) Ensure CPPFLAGS env var is used when set.
-2007-02-19 (configure change) use SHLIB_SUFFIX=".so" on HP-UX IA64 (was
+2007-02-19 (configure change) Use SHLIB_SUFFIX=".so" on HP-UX IA64 (was
".sl").
2007-02-20 (bug fix)[1479814] Handle Windows NT \\?\... extended paths.
@@ -6915,4 +6915,6 @@ upvar and namespace upvar.
2007-04-20 (enhancement) Documented Tcl_SetNotifier and Tcl_ServiceModeHook.
+2007-04-23 (bug fix) Workaround crashing bug in fts_open() on 64bit Darawin.
+
--- Released 8.5a6, April 25, 2007 --- See ChangeLog for details ---
diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c
index 13a2a6e..aef6b5b 100644
--- a/unix/tclUnixFCmd.c
+++ b/unix/tclUnixFCmd.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixFCmd.c,v 1.60 2006/11/15 20:08:45 dgp Exp $
+ * RCS: @(#) $Id: tclUnixFCmd.c,v 1.61 2007/04/23 20:35:55 das Exp $
*
* Portions of this code were derived from NetBSD source code which has the
* following copyright notice:
@@ -234,6 +234,26 @@ MODULE_SCOPE long tclMacOSXDarwinRelease;
#define haveRealpath 1
#endif
#endif /* NO_REALPATH */
+
+#ifdef HAVE_FTS
+#ifdef HAVE_STRUCT_STAT64
+/* fts doesn't do stat64 */
+#define noFtsStat 1
+#elif defined(__APPLE__) && defined(__LP64__) && \
+ defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \
+ MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+/*
+ * prior to Darwin 9, 64bit fts_open() without FTS_NOSTAT may crash (due to a
+ * 64bit-unsafe ALIGN macro); if we could be running on pre-10.5 OSX, check
+ * Darwin release at runtime and do a separate stat() if necessary.
+ */
+MODULE_SCOPE long tclMacOSXDarwinRelease;
+#define noFtsStat (tclMacOSXDarwinRelease < 9)
+#else
+#define noFtsStat 0
+#endif
+#endif /* HAVE_FTS */
+
/*
*---------------------------------------------------------------------------
@@ -1020,13 +1040,8 @@ TraverseUnixTree(
}
#else /* HAVE_FTS */
paths[0] = source;
- fts = fts_open((char**)paths, FTS_PHYSICAL|FTS_NOCHDIR|
-#ifdef HAVE_STRUCT_STAT64
- FTS_NOSTAT, /* fts doesn't do stat64 */
-#else
- (doRewind ? FTS_NOSTAT : 0), /* no need to stat for delete */
-#endif
- NULL);
+ fts = fts_open((char**)paths, FTS_PHYSICAL | FTS_NOCHDIR |
+ (noFtsStat || doRewind ? FTS_NOSTAT : 0), NULL);
if (fts == NULL) {
errfile = source;
goto end;
@@ -1064,15 +1079,15 @@ TraverseUnixTree(
break;
}
if (!doRewind) { /* no need to stat for delete */
-#ifdef HAVE_STRUCT_STAT64
- statBufPtr = &statBuf;
- if (TclOSlstat(ent->fts_path, statBufPtr) != 0) {
- errfile = ent->fts_path;
- break;
+ if (noFtsStat) {
+ statBufPtr = &statBuf;
+ if (TclOSlstat(ent->fts_path, statBufPtr) != 0) {
+ errfile = ent->fts_path;
+ break;
+ }
+ } else {
+ statBufPtr = ent->fts_statp;
}
-#else
- statBufPtr = ent->fts_statp;
-#endif
}
result = (*traverseProc)(sourcePtr, targetPtr, statBufPtr, type,
errorPtr);
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index 854624f..d4f1003 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -7,7 +7,7 @@
* Copyright (c) 1999 by Scriptics Corporation.
* All rights reserved.
*
- * RCS: @(#) $Id: tclUnixInit.c,v 1.69 2007/04/17 14:49:53 dkf Exp $
+ * RCS: @(#) $Id: tclUnixInit.c,v 1.70 2007/04/23 20:35:55 das Exp $
*/
#include "tclInt.h"
@@ -332,7 +332,9 @@ static int MacOSXGetLibraryPath(Tcl_Interp *interp,
#endif /* HAVE_COREFOUNDATION */
#if defined(__APPLE__) && (defined(TCL_LOAD_FROM_MEMORY) || ( \
defined(TCL_THREADS) && defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \
- MAC_OS_X_VERSION_MIN_REQUIRED < 1030))
+ MAC_OS_X_VERSION_MIN_REQUIRED < 1030) || ( \
+ defined(__LP64__) && defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \
+ MAC_OS_X_VERSION_MIN_REQUIRED < 1050))
/*
* Need to check Darwin release at runtime in tclUnixFCmd.c and tclLoadDyld.c:
* initialize release global at startup from uname().