summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--tests/unixInit.test4
-rw-r--r--unix/tclUnixInit.c23
-rw-r--r--win/tclWinInit.c25
4 files changed, 52 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 1fe8fa3..09e18cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2003-11-10 Don Porter <dgp@users.sourceforge.net>
+
+ * tests/unixInit.test (unixInit-2.10): re-enabled.
+ * unix/tclUnixInit.c (TclpInitLibraryPath): Alternative fix
+ * win/tclWinInit.c (TclpInitLibraryPath): for [Bug 832657]
+ that should not run afoul of startup constraints.
+
2003-11-06 Jeff Hobbs <jeffh@ActiveState.com>
* tests/unixInit.test (unixInit-2.10): mark as knownBug
diff --git a/tests/unixInit.test b/tests/unixInit.test
index cf2b1b2..f7b5a39 100644
--- a/tests/unixInit.test
+++ b/tests/unixInit.test
@@ -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: unixInit.test,v 1.30.2.2 2003/11/06 21:47:33 hobbs Exp $
+# RCS: @(#) $Id: unixInit.test,v 1.30.2.3 2003/11/10 20:32:34 dgp Exp $
package require tcltest 2
namespace import -force ::tcltest::*
@@ -268,7 +268,7 @@ test unixInit-2.9 {TclpInitLibraryPath: paths relative to executable} {unix noSp
/tmp/library /library /tcl[info patchlevel]/library]
test unixInit-2.10 {TclpInitLibraryPath: executable relative} -constraints {
- unixOnly stdio knownBug
+ unixOnly stdio
} -setup {
set tmpDir [makeDirectory tmp]
set sparklyDir [makeDirectory sparkly $tmpDir]
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index ae3d2a3..ff033ee 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.34.2.1 2003/05/13 08:41:26 das Exp $
+ * RCS: @(#) $Id: tclUnixInit.c,v 1.34.2.2 2003/11/10 20:32:34 dgp Exp $
*/
#if defined(HAVE_CFBUNDLE)
@@ -338,7 +338,25 @@ CONST char *path; /* Path to the executable in native
*/
if (path != NULL) {
- Tcl_SplitPath(path, &pathc, &pathv);
+ int i, origc;
+ CONST char **origv;
+
+ Tcl_SplitPath(path, &origc, &origv);
+ pathc = 0;
+ pathv = (CONST char **) ckalloc((unsigned int)(origc * sizeof(char *)));
+ for (i=0; i< origc; i++) {
+ if (origv[i][0] == '.') {
+ if (strcmp(origv[i], ".") == 0) {
+ /* do nothing */
+ } else if (strcmp(origv[i], "..") == 0) {
+ pathc--;
+ } else {
+ pathv[pathc++] = origv[i];
+ }
+ } else {
+ pathv[pathc++] = origv[i];
+ }
+ }
if (pathc > 2) {
str = pathv[pathc - 2];
pathv[pathc - 2] = installLib;
@@ -393,6 +411,7 @@ CONST char *path; /* Path to the executable in native
Tcl_ListObjAppendElement(NULL, pathPtr, objPtr);
Tcl_DStringFree(&ds);
}
+ ckfree((char *) origv);
ckfree((char *) pathv);
}
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index f3f0865..2a87937 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -7,7 +7,7 @@
* Copyright (c) 1998-1999 by Scriptics Corporation.
* All rights reserved.
*
- * RCS: @(#) $Id: tclWinInit.c,v 1.40.2.1 2003/08/06 23:50:06 hobbs Exp $
+ * RCS: @(#) $Id: tclWinInit.c,v 1.40.2.2 2003/11/10 20:32:34 dgp Exp $
*/
#include "tclWinInt.h"
@@ -197,7 +197,7 @@ TclpInitLibraryPath(path)
*/
sprintf(installLib, "lib/tcl%s", TCL_VERSION);
- sprintf(developLib, "../tcl%s/library", TCL_PATCH_LEVEL);
+ sprintf(developLib, "tcl%s/library", TCL_PATCH_LEVEL);
/*
* Look for the library relative to default encoding dir.
@@ -252,7 +252,25 @@ TclpInitLibraryPath(path)
*/
if (path != NULL) {
- Tcl_SplitPath(path, &pathc, &pathv);
+ int i, origc;
+ CONST char **origv;
+
+ Tcl_SplitPath(path, &origc, &origv);
+ pathc = 0;
+ pathv = (CONST char **) ckalloc((unsigned int)(origc * sizeof(char *)));
+ for (i=0; i< origc; i++) {
+ if (origv[i][0] == '.') {
+ if (strcmp(origv[i], ".") == 0) {
+ /* do nothing */
+ } else if (strcmp(origv[i], "..") == 0) {
+ pathc--;
+ } else {
+ pathv[pathc++] = origv[i];
+ }
+ } else {
+ pathv[pathc++] = origv[i];
+ }
+ }
if (pathc > 2) {
str = pathv[pathc - 2];
pathv[pathc - 2] = installLib;
@@ -307,6 +325,7 @@ TclpInitLibraryPath(path)
Tcl_ListObjAppendElement(NULL, pathPtr, objPtr);
Tcl_DStringFree(&ds);
}
+ ckfree((char *) origv);
ckfree((char *) pathv);
}