From 76dad5485f7b5b964131405414ee63734e0b741d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 4 Mar 2024 09:40:28 +0000 Subject: Proposed fix for [1b8a893ded]: TCL_PACKAGE_PATH path is (wrongly) braced. --- unix/configure | 6 +++--- unix/configure.in | 6 +++--- unix/tclUnixInit.c | 61 +++++++++++++++++++++++------------------------------- win/configure | 4 ++-- win/configure.in | 4 ++-- 5 files changed, 36 insertions(+), 45 deletions(-) diff --git a/unix/configure b/unix/configure index 87dc84d..eb5ac67 100755 --- a/unix/configure +++ b/unix/configure @@ -19243,13 +19243,13 @@ VERSION=${TCL_VERSION} if test "$FRAMEWORK_BUILD" = "1" ; then test -z "$TCL_PACKAGE_PATH" && \ - TCL_PACKAGE_PATH="~/Library/Tcl /Library/Tcl ~/Library/Frameworks /Library/Frameworks" + TCL_PACKAGE_PATH="~/Library/Tcl:/Library/Tcl:~/Library/Frameworks:/Library/Frameworks" test -z "$TCL_MODULE_PATH" && \ TCL_MODULE_PATH="~/Library/Tcl /Library/Tcl" elif test "$prefix/lib" != "$libdir"; then - test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="{${libdir}} {${prefix}/lib} ${TCL_PACKAGE_PATH}" + test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${libdir}:${prefix}/lib:${TCL_PACKAGE_PATH}" else - test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="{${prefix}/lib} ${TCL_PACKAGE_PATH}" + test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${prefix}/lib:${TCL_PACKAGE_PATH}" fi #-------------------------------------------------------------------- diff --git a/unix/configure.in b/unix/configure.in index 4f62510..cc7d4df 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -864,13 +864,13 @@ VERSION=${TCL_VERSION} if test "$FRAMEWORK_BUILD" = "1" ; then test -z "$TCL_PACKAGE_PATH" && \ - TCL_PACKAGE_PATH="~/Library/Tcl /Library/Tcl ~/Library/Frameworks /Library/Frameworks" + TCL_PACKAGE_PATH="~/Library/Tcl:/Library/Tcl:~/Library/Frameworks:/Library/Frameworks" test -z "$TCL_MODULE_PATH" && \ TCL_MODULE_PATH="~/Library/Tcl /Library/Tcl" elif test "$prefix/lib" != "$libdir"; then - test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="{${libdir}} {${prefix}/lib} ${TCL_PACKAGE_PATH}" + test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${libdir}:${prefix}/lib:${TCL_PACKAGE_PATH}" else - test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="{${prefix}/lib} ${TCL_PACKAGE_PATH}" + test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${prefix}/lib:${TCL_PACKAGE_PATH}" fi #-------------------------------------------------------------------- diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index 2d17027..4e22e5b 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -110,7 +110,7 @@ static char defaultLibraryDir[sizeof(TCL_LIBRARY)+200] = TCL_LIBRARY; * Makefile. */ -static char pkgPath[sizeof(TCL_PACKAGE_PATH)+200] = TCL_PACKAGE_PATH; +static char pkgPath1[sizeof(TCL_PACKAGE_PATH)+200] = TCL_PACKAGE_PATH; /* * The following table is used to map from Unix locale strings to encoding @@ -792,7 +792,8 @@ TclpSetVariables( struct utsname name; #endif int unameOK; - Tcl_DString ds; + const char *p, *q; + Tcl_Obj *pkgListObj = Tcl_NewObj(); #ifdef HAVE_COREFOUNDATION char tclLibPath[MAXPATHLEN + 1]; @@ -808,29 +809,20 @@ TclpSetVariables( if (MacOSXGetLibraryPath(interp, MAXPATHLEN, tclLibPath) == TCL_OK) { const char *str; CFBundleRef bundleRef; + Tcl_DString ds; Tcl_SetVar2(interp, "tclDefaultLibrary", NULL, tclLibPath, TCL_GLOBAL_ONLY); - Tcl_SetVar2(interp, "tcl_pkgPath", NULL, tclLibPath, TCL_GLOBAL_ONLY); - Tcl_SetVar2(interp, "tcl_pkgPath", NULL, " ", - TCL_GLOBAL_ONLY | TCL_APPEND_VALUE); - + Tcl_ListObjAppendElement(NULL, pkgListObj, Tcl_NewStringObj(tclLibPath, -1)); str = TclGetEnv("DYLD_FRAMEWORK_PATH", &ds); if ((str != NULL) && (str[0] != '\0')) { - char *p = Tcl_DStringValue(&ds); - - /* - * Convert DYLD_FRAMEWORK_PATH from colon to space separated. - */ - - do { - if (*p == ':') { - *p = ' '; - } - } while (*p++); - Tcl_SetVar2(interp, "tcl_pkgPath", NULL, Tcl_DStringValue(&ds), - TCL_GLOBAL_ONLY | TCL_APPEND_VALUE); - Tcl_SetVar2(interp, "tcl_pkgPath", NULL, " ", - TCL_GLOBAL_ONLY | TCL_APPEND_VALUE); + p = Tcl_DStringValue(&ds); + while ((q = strchr(p, ':')) != NULL) { + Tcl_ListObjAppendElement(NULL, pkgListObj, Tcl_NewStringObj(p, q-p)); + p = q+1; + } + if (*p) { + Tcl_ListObjAppendElement(NULL, pkgListObj, Tcl_NewStringObj(p, -1)); + } Tcl_DStringFree(&ds); } bundleRef = CFBundleGetMainBundle(); @@ -844,10 +836,7 @@ TclpSetVariables( (unsigned char*) tclLibPath, MAXPATHLEN) && ! TclOSstat(tclLibPath, &statBuf) && S_ISDIR(statBuf.st_mode)) { - Tcl_SetVar2(interp, "tcl_pkgPath", NULL, tclLibPath, - TCL_GLOBAL_ONLY | TCL_APPEND_VALUE); - Tcl_SetVar2(interp, "tcl_pkgPath", NULL, " ", - TCL_GLOBAL_ONLY | TCL_APPEND_VALUE); + Tcl_ListObjAppendElement(NULL, pkgListObj, Tcl_NewStringObj(tclLibPath, -1)); } CFRelease(frameworksURL); } @@ -857,21 +846,22 @@ TclpSetVariables( (unsigned char*) tclLibPath, MAXPATHLEN) && ! TclOSstat(tclLibPath, &statBuf) && S_ISDIR(statBuf.st_mode)) { - Tcl_SetVar2(interp, "tcl_pkgPath", NULL, tclLibPath, - TCL_GLOBAL_ONLY | TCL_APPEND_VALUE); - Tcl_SetVar2(interp, "tcl_pkgPath", NULL, " ", - TCL_GLOBAL_ONLY | TCL_APPEND_VALUE); + Tcl_ListObjAppendElement(NULL, pkgListObj, Tcl_NewStringObj(tclLibPath, -1)); } CFRelease(frameworksURL); } } - Tcl_SetVar2(interp, "tcl_pkgPath", NULL, pkgPath, - TCL_GLOBAL_ONLY | TCL_APPEND_VALUE); - } else -#endif /* HAVE_COREFOUNDATION */ - { - Tcl_SetVar2(interp, "tcl_pkgPath", NULL, pkgPath, TCL_GLOBAL_ONLY); } +#endif /* HAVE_COREFOUNDATION */ + p = pkgPath1; + while ((q = strchr(p, ':')) != NULL) { + Tcl_ListObjAppendElement(NULL, pkgListObj, Tcl_NewStringObj(p, q-p)); + p = q+1; + } + if (*p) { + Tcl_ListObjAppendElement(NULL, pkgListObj, Tcl_NewStringObj(p, -1)); + } + Tcl_ObjSetVar2(interp, Tcl_NewStringObj("tcl_pkgPath", -1), NULL, pkgListObj, TCL_GLOBAL_ONLY); #ifdef DJGPP Tcl_SetVar2(interp, "tcl_platform", "platform", "dos", TCL_GLOBAL_ONLY); @@ -971,6 +961,7 @@ TclpSetVariables( { struct passwd *pwEnt = TclpGetPwUid(getuid()); const char *user; + Tcl_DString ds; if (pwEnt == NULL) { user = ""; diff --git a/win/configure b/win/configure index 1382854..3fc4815 100755 --- a/win/configure +++ b/win/configure @@ -5296,9 +5296,9 @@ fi #-------------------------------------------------------------------- if test "$prefix/lib" != "$libdir"; then - TCL_PACKAGE_PATH="{${libdir}} {${prefix}/lib}" + TCL_PACKAGE_PATH="${libdir}:${prefix}/lib" else - TCL_PACKAGE_PATH="{${prefix}/lib}" + TCL_PACKAGE_PATH="${prefix}/lib" fi # The tclsh.exe.manifest requires these diff --git a/win/configure.in b/win/configure.in index 737f046..02cc79b 100644 --- a/win/configure.in +++ b/win/configure.in @@ -372,9 +372,9 @@ fi #-------------------------------------------------------------------- if test "$prefix/lib" != "$libdir"; then - TCL_PACKAGE_PATH="{${libdir}} {${prefix}/lib}" + TCL_PACKAGE_PATH="${libdir}:${prefix}/lib" else - TCL_PACKAGE_PATH="{${prefix}/lib}" + TCL_PACKAGE_PATH="${prefix}/lib" fi # The tclsh.exe.manifest requires these -- cgit v0.12 From a3bbe06dd8737e09f394328e716d3dfa9d868465 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 4 Mar 2024 10:22:42 +0000 Subject: Small (related) fix to handling of TCL_MODULE_PATH: It's a Tcl list too, so it could contain '{'/'}' --- unix/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 7619afc..17057e4 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -979,7 +979,7 @@ install-libraries: libraries done @if [ -n "$(TCL_MODULE_PATH)" -a -f $(TOP_DIR)/library/tm.tcl ] ; then \ echo "Customizing tcl module path"; \ - echo "if {![interp issafe]} { ::tcl::tm::roots {$(TCL_MODULE_PATH)} }" >> \ + echo "if {![interp issafe]} { ::tcl::tm::roots [list $(TCL_MODULE_PATH)] }" >> \ "$(SCRIPT_INSTALL_DIR)/tm.tcl"; \ fi -- cgit v0.12 From a6835076ce05860e0d4e72d760da19d166b2661a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 4 Mar 2024 10:36:23 +0000 Subject: If TCL_PACKAGE_PATH is set explicitly, don't change it in "configure" --- unix/configure | 4 ++-- unix/configure.in | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/unix/configure b/unix/configure index eb5ac67..d890135 100755 --- a/unix/configure +++ b/unix/configure @@ -19247,9 +19247,9 @@ if test "$FRAMEWORK_BUILD" = "1" ; then test -z "$TCL_MODULE_PATH" && \ TCL_MODULE_PATH="~/Library/Tcl /Library/Tcl" elif test "$prefix/lib" != "$libdir"; then - test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${libdir}:${prefix}/lib:${TCL_PACKAGE_PATH}" + test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${libdir}:${prefix}/lib" else - test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${prefix}/lib:${TCL_PACKAGE_PATH}" + test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${prefix}/lib" fi #-------------------------------------------------------------------- diff --git a/unix/configure.in b/unix/configure.in index cc7d4df..ca4145a 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -868,9 +868,9 @@ if test "$FRAMEWORK_BUILD" = "1" ; then test -z "$TCL_MODULE_PATH" && \ TCL_MODULE_PATH="~/Library/Tcl /Library/Tcl" elif test "$prefix/lib" != "$libdir"; then - test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${libdir}:${prefix}/lib:${TCL_PACKAGE_PATH}" + test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${libdir}:${prefix}/lib" else - test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${prefix}/lib:${TCL_PACKAGE_PATH}" + test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${prefix}/lib" fi #-------------------------------------------------------------------- -- cgit v0.12 From 140c60456401d8ff840bc670f84b0d072cddd80f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 4 Mar 2024 15:47:31 +0000 Subject: Add akst/akdt (Alaska) time-zones to "clock" command. Also 'stolen' from "sebres-?-?-clock-speedup-cr2" branch --- library/clock.tcl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/clock.tcl b/library/clock.tcl index b9bbc2c..e578f4d 100644 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -31,7 +31,7 @@ uplevel \#0 { # library code can find message catalogs and time zone definition files. namespace eval ::tcl::clock \ - [list variable LibDir [file dirname [info script]]] + [list variable LibDir [info library]] #---------------------------------------------------------------------- # @@ -554,6 +554,8 @@ proc ::tcl::clock::Initialize {} { pdt -0700 \ yst -0900 \ ydt -0800 \ + akst -0900 \ + akdt -0800 \ hst -1000 \ hdt -0900 \ cat -1000 \ -- cgit v0.12