From 2b73734be07786688a331c6458afb5610e4c75c9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 29 Aug 2019 07:42:50 +0000 Subject: Starting with Tcl 8.7, TCL_THREADS is 1 by default. Adapt rules.vc for that. --- win/rules.vc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index 4a1402a..ba59a96 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -994,7 +994,7 @@ VERSION = $(DOTVERSION:.=) # different compilers, build configurations etc., # # Naming convention (suffixes): -# t = full thread support. +# t = full thread support. (Not used for Tcl >= 8.7) # s = static library (as opposed to an import library) # g = linked to the debug enabled C run-time. # x = special static build when it links to the dynamic C run-time. @@ -1052,7 +1052,7 @@ SUFX = $(SUFX:x=) !endif !endif -!if !$(TCL_THREADS) +!if !$(TCL_THREADS) || $(TCL_VERSION) > 86 TMP_DIRFULL = $(TMP_DIRFULL:Threaded=) SUFX = $(SUFX:t=) !endif @@ -1293,7 +1293,7 @@ OPTDEFINES = $(OPTDEFINES) -DTCL_MEM_DEBUG !if $(TCL_COMPILE_DEBUG) OPTDEFINES = $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS !endif -!if $(TCL_THREADS) +!if $(TCL_THREADS) && $(TCL_VERSION) <= 86 OPTDEFINES = $(OPTDEFINES) -DTCL_THREADS=1 !if $(USE_THREAD_ALLOC) OPTDEFINES = $(OPTDEFINES) -DUSE_THREAD_ALLOC=1 @@ -1537,8 +1537,8 @@ RESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ -DDOTVERSION=\"$(DOTVERSION)\" \ -DVERSION=\"$(VERSION)\" \ -DSUFX=\"$(SUFX)\" \ - -DPROJECT=\"$(PROJECT)\" \ - -DPRJLIBNAME=\"$(PRJLIBNAME)\" + -DPROJECT=\"$(PROJECT)\" \ + -DPRJLIBNAME=\"$(PRJLIBNAME)\" !ifndef DEFAULT_BUILD_TARGET DEFAULT_BUILD_TARGET = $(PROJECT) -- cgit v0.12 From 1b753c8466656164d5c49f1565a6e29cd9039e84 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Thu, 29 Aug 2019 10:16:36 +0000 Subject: Bug fix 889065786b. Add stubs related flags when compiling extension stubs. --- win/rules.vc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index ba59a96..b1a0346 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -24,7 +24,7 @@ _RULES_VC = 1 # For modifications that are not backward-compatible, you *must* change # the major version. RULES_VERSION_MAJOR = 1 -RULES_VERSION_MINOR = 3 +RULES_VERSION_MINOR = 4 # The PROJECT macro must be defined by parent makefile. !if "$(PROJECT)" == "" @@ -1439,8 +1439,8 @@ cflags = -nologo -c $(COMPILERFLAGS) $(carch) $(cwarn) -Fp$(TMP_DIR)^\ $(cdebug) # BUILD_$(PROJECT) macro which should be defined only for the shared # library *implementation* and not for its caller interface -appcflags = $(cflags) $(crt) $(INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) $(USE_STUBS_DEFS) appcflags_nostubs = $(cflags) $(crt) $(INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) +appcflags = $(appcflags_nostubs) $(USE_STUBS_DEFS) pkgcflags = $(appcflags) $(PKGNAMEFLAGS) -DBUILD_$(PROJECT) pkgcflags_nostubs = $(appcflags_nostubs) $(PKGNAMEFLAGS) -DBUILD_$(PROJECT) @@ -1455,7 +1455,7 @@ pkgcflags_nostubs = $(appcflags_nostubs) $(PKGNAMEFLAGS) -DBUILD_$(PROJECT) # so we do not remove it from cflags. -GL may prevent extensions # compiled with one VC version to fail to link against stubs library # compiled with another VC version. Check for this and fix accordingly. -stubscflags = $(cflags) $(PKGNAMEFLAGS) $(PRJ_DEFINES) $(OPTDEFINES) -Zl -DSTATIC_BUILD $(INCLUDES) +stubscflags = $(cflags) $(PKGNAMEFLAGS) $(PRJ_DEFINES) $(OPTDEFINES) -Zl -DSTATIC_BUILD $(INCLUDES) $(USE_STUBS_DEFS) # Link flags -- cgit v0.12 From ee6b2e34559aa9915b480794418f1db489d723a8 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 29 Aug 2019 20:28:47 +0000 Subject: add test cases covering nested compilation bug [fec0c17d39] (8.5 is not affected at the moment by nested count under 2500) --- tests/compile.test | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/compile.test b/tests/compile.test index 7646c12..c9f1b71 100644 --- a/tests/compile.test +++ b/tests/compile.test @@ -422,6 +422,37 @@ test compile-13.1 {testing underestimate of maxStackSize in list cmd} {exec} { list [catch {exec [interpreter] << $script} msg] $msg } {0 OK} +# Tests of nested compile (body in body compilation), should not generate stack overflow +# (with abnormal program termination), bug [fec0c17d39]: +test compile-13.2 {TclCompileScript: testing nested scripts compilation} -setup { + set i [interp create] + interp recursionlimit $i [expr {10000+50}] + $i eval {proc gencode {nr {cmd eval} {nl 0}} { + set code "" + set e ""; if {$nl} {set e "\n"} + for {set i 0} {$i < $nr} {incr i} { + append code "$cmd \{$e" + } + append code "lappend result 1$e" + for {set i 0} {$i < $nr} {incr i} { + append code "\}$e" + } + #puts [format "%% %.40s ... %d bytes" $code [string length $code]] + return $code + }} +} -body { + # Test different compilation variants (instructions evalStk, invokeStk, etc), + # with 2000 nested scripts (bodies). If you get SO/SF exceptions on some low-stack + # boxes or systems, please don't decrease it (either provide a constraint) + $i eval {foreach cmd {eval "if 1" catch} { + set c [gencode 2000 $cmd] + if 1 $c + }} + $i eval {set result} +} -result {1 1 1} -cleanup { + interp delete $i +} + # Tests compile-14.* for [Bug 599788] [Bug 0c043a175a47da8c2342] test compile-14.1 {testing errors in element name; segfault?} {} { catch {set a([error])} msg1 -- cgit v0.12 From 87e3efddb07fb90ce44be9869ca883a896f1b122 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 29 Aug 2019 20:46:46 +0000 Subject: more variants in test (since 8.6 compiles "try" using evalStk instruction) --- tests/compile.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/compile.test b/tests/compile.test index c651804..ee95d25 100644 --- a/tests/compile.test +++ b/tests/compile.test @@ -488,12 +488,12 @@ test compile-13.2 {TclCompileScript: testing nested scripts compilation} -setup # Test different compilation variants (instructions evalStk, invokeStk, etc), # with 2000 nested scripts (bodies). If you get SO/SF exceptions on some low-stack # boxes or systems, please don't decrease it (either provide a constraint) - $i eval {foreach cmd {eval "if 1" catch} { + $i eval {foreach cmd {eval "if 1" try catch} { set c [gencode 2000 $cmd] if 1 $c }} $i eval {set result} -} -result {1 1 1} -cleanup { +} -result {1 1 1 1} -cleanup { interp delete $i } -- cgit v0.12 From 7efc804258d3dcc195a86386704ed09e7691d9fe Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 29 Aug 2019 20:50:31 +0000 Subject: closes [fec0c17d39]: fixed stack overflow (followed by SF) by compilation of too many nested bodies (don't use system stack, size of Tcl_Parse is ca. 400 bytes and compiler proc's of commands are reserving stack too) --- generic/tclCompile.c | 47 +++++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 6f90072..87f1bfc 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -2128,18 +2128,26 @@ TclCompileScript( /* Each iteration compiles one command from the script. */ - while (numBytes > 0) { - Tcl_Parse parse; + if (numBytes > 0) { + /* + * Don't use system stack (size of Tcl_Parse is ca. 400 bytes), so + * many nested compilations (body enclosed in body) can cause abnormal + * program termination with a stack overflow exception, bug [fec0c17d39]. + */ + Tcl_Parse *parsePtr = ckalloc(sizeof(Tcl_Parse)); + + do { const char *next; - if (TCL_OK != Tcl_ParseCommand(interp, p, numBytes, 0, &parse)) { + if (TCL_OK != Tcl_ParseCommand(interp, p, numBytes, 0, parsePtr)) { /* - * Compile bytecodes to report the parse error at runtime. + * Compile bytecodes to report the parsePtr error at runtime. */ - Tcl_LogCommandInfo(interp, script, parse.commandStart, - parse.term + 1 - parse.commandStart); + Tcl_LogCommandInfo(interp, script, parsePtr->commandStart, + parsePtr->term + 1 - parsePtr->commandStart); TclCompileSyntaxError(interp, envPtr); + ckfree(parsePtr); return; } @@ -2150,9 +2158,9 @@ TclCompileScript( */ if ((tclTraceCompile >= 1) && (envPtr->procPtr == NULL)) { - int commandLength = parse.term - parse.commandStart; + int commandLength = parsePtr->term - parsePtr->commandStart; fprintf(stdout, " Compiling: "); - TclPrintSource(stdout, parse.commandStart, + TclPrintSource(stdout, parsePtr->commandStart, TclMin(commandLength, 55)); fprintf(stdout, "\n"); } @@ -2163,48 +2171,51 @@ TclCompileScript( * (See test info-30.33). */ - TclAdvanceLines(&envPtr->line, p, parse.commandStart); + TclAdvanceLines(&envPtr->line, p, parsePtr->commandStart); TclAdvanceContinuations(&envPtr->line, &envPtr->clNext, - parse.commandStart - envPtr->source); + parsePtr->commandStart - envPtr->source); /* * Advance parser to the next command in the script. */ - next = parse.commandStart + parse.commandSize; + next = parsePtr->commandStart + parsePtr->commandSize; numBytes -= next - p; p = next; - if (parse.numWords == 0) { + if (parsePtr->numWords == 0) { /* * The "command" parsed has no words. In this case we can skip * the rest of the loop body. With no words, clearly * CompileCommandTokens() has nothing to do. Since the parser * aggressively sucks up leading comment and white space, - * including newlines, parse.commandStart must be pointing at + * including newlines, parsePtr->commandStart must be pointing at * either the end of script, or a command-terminating semi-colon. * In either case, the TclAdvance*() calls have nothing to do. * Finally, when no words are parsed, no tokens have been - * allocated at parse.tokenPtr so there's also nothing for + * allocated at parsePtr->tokenPtr so there's also nothing for * Tcl_FreeParse() to do. * * The advantage of this shortcut is that CompileCommandTokens() - * can be written with an assumption that parse.numWords > 0, with + * can be written with an assumption that parsePtr->numWords > 0, with * the implication the CCT() always generates bytecode. */ continue; } - lastCmdIdx = CompileCommandTokens(interp, &parse, envPtr); + lastCmdIdx = CompileCommandTokens(interp, parsePtr, envPtr); /* * TIP #280: Track lines in the just compiled command. */ - TclAdvanceLines(&envPtr->line, parse.commandStart, p); + TclAdvanceLines(&envPtr->line, parsePtr->commandStart, p); TclAdvanceContinuations(&envPtr->line, &envPtr->clNext, p - envPtr->source); - Tcl_FreeParse(&parse); + Tcl_FreeParse(parsePtr); + } while (numBytes > 0); + + ckfree(parsePtr); } if (lastCmdIdx == -1) { -- cgit v0.12 From 6e297fef1f383d6ca3c7bf090b0351ad9f30aabc Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 30 Aug 2019 16:33:33 +0000 Subject: compile.test: reduce count of nested scripts to 1000 in debug case (seems to be to heavy on some platforms within debug-build); (small amend to the fix of [fec0c17d39]) --- tests/compile.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/compile.test b/tests/compile.test index c9f1b71..c02acdb 100644 --- a/tests/compile.test +++ b/tests/compile.test @@ -442,10 +442,10 @@ test compile-13.2 {TclCompileScript: testing nested scripts compilation} -setup }} } -body { # Test different compilation variants (instructions evalStk, invokeStk, etc), - # with 2000 nested scripts (bodies). If you get SO/SF exceptions on some low-stack + # with 2000 (1000 in debug) nested scripts (bodies). If you get SO/SF exceptions on some low-stack # boxes or systems, please don't decrease it (either provide a constraint) $i eval {foreach cmd {eval "if 1" catch} { - set c [gencode 2000 $cmd] + set c [gencode [expr {![info exists ::tcl_platform(debug)] ? 2000 : 1000}] $cmd] if 1 $c }} $i eval {set result} -- cgit v0.12 From 7e14ee0b34c8b10709252eaf40b6201681bfb7f4 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 2 Sep 2019 08:28:39 +0000 Subject: Fix [5591e4a820]: @TCL_EXE@ not properly generated in 8.5 branch. Added @runstatedir@ in Makefile.in, not used yet (except if someone decides to re-generate "configure" with autconf-2.70). --- unix/configure | 2 +- win/Makefile.in | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/unix/configure b/unix/configure index 1e15a25..aedf8ff 100755 --- a/unix/configure +++ b/unix/configure @@ -18312,7 +18312,7 @@ echo "${ECHO_T}$tcl_ok" >&6 #------------------------------------------------------------------------ # Check whether the timezone data is supplied by the OS or has # to be installed by Tcl. The default is autodetection, but can -# be overriden on the configure command line either way. +# be overridden on the configure command line either way. #------------------------------------------------------------------------ echo "$as_me:$LINENO: checking for timezone data" >&5 diff --git a/win/Makefile.in b/win/Makefile.in index dbe8df2..6f2044f5 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -23,6 +23,7 @@ bindir = @bindir@ libdir = @libdir@ includedir = @includedir@ datarootdir = @datarootdir@ +runstatedir = @runstatedir@ mandir = @mandir@ # The following definition can be set to non-null for special systems like AFS @@ -163,7 +164,7 @@ MAN2TCL = man2tcl$(EXEEXT) # (make genstubs, make install) need it to be available on the PATH. This # executable should *NOT* be required just to do a normal build although # it can be required to run make dist. -TCL_EXE = @TCL_EXE@ +TCL_EXE = tclsh @SET_MAKE@ -- cgit v0.12 From 6f79cd18d73ff8505c57c11805d5476bc398e8ac Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 2 Sep 2019 11:07:46 +0000 Subject: Missing TCL_GLOBAL_ONLY flag in VwaitVarProc(): vwait always references global variables, this could lead to strange side-effects. --- generic/tclEvent.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 4db524c..0fed0a8 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -1379,7 +1379,8 @@ VwaitVarProc( int *donePtr = (int *) clientData; *donePtr = 1; - Tcl_UntraceVar(interp, name1, TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + Tcl_UntraceVar2(interp, name1, name2, + TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, VwaitVarProc, clientData); return NULL; } -- cgit v0.12 From dfb98f070561139ccf2d88b30fb134de3c3fcac4 Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 2 Sep 2019 13:48:52 +0000 Subject: windows (mingw build): fix debug recognition (::tcl_platform(debug)), no debug if NDEBUG is set --- win/nmakehlp.c | 2 +- win/tclWinInit.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/win/nmakehlp.c b/win/nmakehlp.c index c21de63..fac32ee 100644 --- a/win/nmakehlp.c +++ b/win/nmakehlp.c @@ -643,7 +643,7 @@ SubstituteFile( } /* debug: dump the list */ -#ifdef _DEBUG +#ifndef NDEBUG { int n = 0; list_item_t *p = NULL; diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 308d3f3..0574c37 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -602,7 +602,7 @@ TclpSetVariables( TCL_GLOBAL_ONLY); } -#ifdef _DEBUG +#ifndef NDEBUG /* * The existence of the "debug" element of the tcl_platform array * indicates that this particular Tcl shell has been compiled with debug -- cgit v0.12 From 07e8d24c838bb5f328de852deb361f3780d602fb Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 2 Sep 2019 14:13:33 +0000 Subject: Fix testing for debug build on UNIX too (on UNIX, ::tcl_platform(debug) is not set ....) --- tests/compile.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/compile.test b/tests/compile.test index 548454b..3b91a5c 100644 --- a/tests/compile.test +++ b/tests/compile.test @@ -489,7 +489,7 @@ test compile-13.2 {TclCompileScript: testing nested scripts compilation} -setup # with 2000 (1000 in debug) nested scripts (bodies). If you get SO/SF exceptions on some low-stack # boxes or systems, please don't decrease it (either provide a constraint) $i eval {foreach cmd {eval "if 1" try catch} { - set c [gencode [expr {![info exists ::tcl_platform(debug)] ? 2000 : 1000}] $cmd] + set c [gencode [expr {![::tcl::pkgconfig get debug] ? 2000 : 1000}] $cmd] if 1 $c }} $i eval {set result} -- cgit v0.12 From f39babb15ad4c4c1131eb731e61417c7b68ac8cd Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 3 Sep 2019 10:48:52 +0000 Subject: Backout last commit: Looks like it causes test-failures in event.test on Windows. --- generic/tclEvent.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 0fed0a8..4db524c 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -1379,8 +1379,7 @@ VwaitVarProc( int *donePtr = (int *) clientData; *donePtr = 1; - Tcl_UntraceVar2(interp, name1, name2, - TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + Tcl_UntraceVar(interp, name1, TCL_TRACE_WRITES|TCL_TRACE_UNSETS, VwaitVarProc, clientData); return NULL; } -- cgit v0.12 From a52cfae90040fcfebac8aef0c52731bd67864165 Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 3 Sep 2019 14:01:58 +0000 Subject: Docfix: \0 is special in nroff, so use \e0 instead --- doc/string.n | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/string.n b/doc/string.n index 7e666ea..8d8be3d 100644 --- a/doc/string.n +++ b/doc/string.n @@ -333,21 +333,21 @@ specified using the forms described in \fBSTRING INDICES\fR. Returns a value equal to \fIstring\fR except that any leading or trailing characters present in the string given by \fIchars\fR are removed. If \fIchars\fR is not specified then white space is removed (any character -for which \fBstring is space\fR returns 1, and "\0"). +for which \fBstring is space\fR returns 1, and "\e0"). .TP \fBstring trimleft \fIstring\fR ?\fIchars\fR? . Returns a value equal to \fIstring\fR except that any leading characters present in the string given by \fIchars\fR are removed. If \fIchars\fR is not specified then white space is removed (any character -for which \fBstring is space\fR returns 1, and "\0"). +for which \fBstring is space\fR returns 1, and "\e0"). .TP \fBstring trimright \fIstring\fR ?\fIchars\fR? . Returns a value equal to \fIstring\fR except that any trailing characters present in the string given by \fIchars\fR are removed. If \fIchars\fR is not specified then white space is removed (any character -for which \fBstring is space\fR returns 1, and "\0"). +for which \fBstring is space\fR returns 1, and "\e0"). .SS "OBSOLETE SUBCOMMANDS" .PP These subcommands are currently supported, but are likely to go away in a -- cgit v0.12 From e583aab8c93cf6a1c2bd747295996e83667b6bf8 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 4 Sep 2019 10:50:49 +0000 Subject: When using Tcl 8.7 headers, don't worry about threaded-allocator mismatch any more in rules.vc. --- win/rules.vc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index b1a0346..4662b00 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -1293,9 +1293,9 @@ OPTDEFINES = $(OPTDEFINES) -DTCL_MEM_DEBUG !if $(TCL_COMPILE_DEBUG) OPTDEFINES = $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS !endif -!if $(TCL_THREADS) && $(TCL_VERSION) <= 86 +!if $(TCL_THREADS) && $(TCL_VERSION) < 87 OPTDEFINES = $(OPTDEFINES) -DTCL_THREADS=1 -!if $(USE_THREAD_ALLOC) +!if $(USE_THREAD_ALLOC) && $(TCL_VERSION) < 87 OPTDEFINES = $(OPTDEFINES) -DUSE_THREAD_ALLOC=1 !endif !endif @@ -1775,7 +1775,7 @@ TCLNMAKECONFIG = "$(OUT_DIR)\tcl.nmake" !if defined(CORE_MACHINE) && "$(CORE_MACHINE)" != "$(MACHINE)" !error ERROR: Build target ($(MACHINE)) does not match the Tcl library architecture ($(CORE_MACHINE)). !endif -!if defined(CORE_USE_THREAD_ALLOC) && $(CORE_USE_THREAD_ALLOC) != $(USE_THREAD_ALLOC) +!if $(TCL_VERSION) < 87 && defined(CORE_USE_THREAD_ALLOC) && $(CORE_USE_THREAD_ALLOC) != $(USE_THREAD_ALLOC) !message WARNING: Value of USE_THREAD_ALLOC ($(USE_THREAD_ALLOC)) does not match its Tcl core value ($(CORE_USE_THREAD_ALLOC)). !endif !if defined(CORE_DEBUG) && $(CORE_DEBUG) != $(DEBUG) -- cgit v0.12 From f39b7c73e64487788f86dfb9ae11585767f284fc Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 4 Sep 2019 15:53:19 +0000 Subject: Don't build on travis with GCC on Windows, since it currently doesn't work in combination with autoconf-2.59-generated configure --- .travis.yml | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0504a45..294390a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ matrix: env: - CFGOPT=--disable-shared - BUILD_DIR=unix -# Debug build. Running test-cases disabled, because it is currently failing. +# Debug builds. Running test-cases disabled, because it is currently failing. - name: "Linux/GCC/Debug/no test" os: linux dist: xenial @@ -154,7 +154,7 @@ matrix: - wine env: - BUILD_DIR=win - - CFGOPT=--host=i686-w64-mingw32 + - CFGOPT="--host=i686-w64-mingw32" script: &crosstest - make all tcltest # Include a high visibility marker that tests are skipped outright @@ -246,33 +246,6 @@ matrix: script: - cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=symbols,msvcrt,threads -f makefile.vc all tcltest' - cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=symbols,msvcrt,threads -f makefile.vc test' - - name: "Windows/GCC/Shared" - os: windows - compiler: gcc - env: - - BUILD_DIR=win - - CFGOPT="--enable-64bit" - before_install: - - choco install make - - cd ${BUILD_DIR} - - name: "Windows/GCC/Static" - os: windows - compiler: gcc - env: - - BUILD_DIR=win - - CFGOPT="--enable-64bit --disable-shared" - before_install: - - choco install make - - cd ${BUILD_DIR} - - name: "Windows/GCC/Debug" - os: windows - compiler: gcc - env: - - BUILD_DIR=win - - CFGOPT="--enable-64bit --enable-symbols" - before_install: - - choco install make - - cd ${BUILD_DIR} before_install: - cd ${BUILD_DIR} install: -- cgit v0.12 From 7c8cdba292435979d0f9c588b6da62c0a994414a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 5 Sep 2019 06:56:49 +0000 Subject: Fix [4718b41c56]: windows x86 & x64: file mtime overflows in modification date (2038?, windows 32-bit time_t?) --- win/tclWinPort.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/tclWinPort.h b/win/tclWinPort.h index a88c6c8..fa699f0 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -19,7 +19,7 @@ #define __MINGW_USE_VC2005_COMPAT #endif -#if !defined(_WIN64) && !defined(__MINGW_USE_VC2005_COMPAT) && defined(BUILD_tcl) +#if !defined(_WIN64) && !defined(__MINGW_USE_VC2005_COMPAT) /* See [Bug 3354324]: file mtime sets wrong time */ # define _USE_32BIT_TIME_T #endif -- cgit v0.12 From 3de08d01700c288fa184c887feb45b3de5f3e515 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 5 Sep 2019 16:09:22 +0000 Subject: amend to [4718b41c56]: check size of st_mtime instead of time_t in constraint --- tests/cmdAH.test | 2 +- win/tclWinTest.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/cmdAH.test b/tests/cmdAH.test index e4205f1..c8318c0 100644 --- a/tests/cmdAH.test +++ b/tests/cmdAH.test @@ -20,7 +20,7 @@ testConstraint testsetplatform [llength [info commands testsetplatform]] testConstraint testvolumetype [llength [info commands testvolumetype]] testConstraint time64bit [expr { $::tcl_platform(pointerSize) >= 8 || - [llength [info command testsize]] && [testsize time_t] >= 8 + [llength [info command testsize]] && [testsize st_mtime] >= 8 }] testConstraint linkDirectory [expr { ![testConstraint win] || diff --git a/win/tclWinTest.c b/win/tclWinTest.c index dd5a60e..04878fe 100644 --- a/win/tclWinTest.c +++ b/win/tclWinTest.c @@ -326,9 +326,14 @@ TestSizeCmd( Tcl_SetObjResult(interp, Tcl_NewWideIntObj(sizeof(time_t))); return TCL_OK; } + if (strcmp(Tcl_GetString(objv[1]), "st_mtime") == 0) { + Tcl_StatBuf *statPtr; + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(sizeof(statPtr->st_mtime))); + return TCL_OK; + } syntax: - Tcl_WrongNumArgs(interp, 1, objv, "time_t"); + Tcl_WrongNumArgs(interp, 1, objv, "time_t|st_mtime"); return TCL_ERROR; } -- cgit v0.12 From 3179298819aa21980bfe9e77759c6e5f7291e77a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 6 Sep 2019 08:58:19 +0000 Subject: Don't let Tcl depend on USE_32BIT_TIME_T any more: If your compiler supports it, time_t will be 64-bit internally. But at API-level, time_t will still be restricted to 32-bit on Win32 (Not on Win64). This keeps Tcl_StatBuf the same (unless USE_64BIT_TIME_T is defined), so 64-bit times still cannot be used everywhere. --- generic/tcl.h | 2 +- generic/tclBasic.c | 14 ++++---------- win/tclWinPort.h | 6 +----- win/tclWinTime.c | 25 +++++++++++++++++++------ 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index bc4d9a6..bab5dd4 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -414,7 +414,7 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; #if defined(__WIN32__) # ifdef __BORLANDC__ typedef struct stati64 Tcl_StatBuf; -# elif defined(_WIN64) || defined(__MINGW_USE_VC2005_COMPAT) || defined(_USE_64BIT_TIME_T) +# elif defined(_WIN64) || defined(_USE_64BIT_TIME_T) typedef struct __stat64 Tcl_StatBuf; # elif (defined(_MSC_VER) && (_MSC_VER < 1400)) || defined(_USE_32BIT_TIME_T) typedef struct _stati64 Tcl_StatBuf; diff --git a/generic/tclBasic.c b/generic/tclBasic.c index f59c161..52e0ce5 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -413,19 +413,13 @@ Tcl_CreateInterp(void) Tcl_Panic("Tcl_CallFrame must not be smaller than CallFrame"); } -#if defined(_WIN32) && !defined(_WIN64) && !defined(_USE_64BIT_TIME_T) \ - && !defined(__MINGW_USE_VC2005_COMPAT) - /* If Tcl is compiled on Win32 using -D_USE_64BIT_TIME_T or - * -D__MINGW_USE_VC2005_COMPAT, the result is a binary incompatible - * with the 'standard' build of Tcl: All extensions using Tcl_StatBuf - * or interal functions like TclpGetDate() need to be recompiled in +#if defined(_WIN32) && !defined(_WIN64) && !defined(_USE_64BIT_TIME_T) + /* If Tcl is compiled on Win32 using -D_USE_64BIT_TIME_T + * the result is a binary incompatible with the 'standard' build of + * Tcl: All extensions using Tcl_StatBuf need to be recompiled in * the same way. Therefore, this is not officially supported. * In stead, it is recommended to use Win64 or Tcl 9.0 (not released yet) */ - if (sizeof(time_t) != 4) { - /*NOTREACHED*/ - Tcl_Panic(" is not compatible with MSVC"); - } if ((TclOffset(Tcl_StatBuf,st_atime) != 32) || (TclOffset(Tcl_StatBuf,st_ctime) != 40)) { /*NOTREACHED*/ diff --git a/win/tclWinPort.h b/win/tclWinPort.h index b14aa6b..c30d346 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -14,13 +14,9 @@ #ifndef _TCLWINPORT #define _TCLWINPORT -/* define _USE_64BIT_TIME_T (or make/configure option time64bit) to force 64-bit time_t */ -#if defined(_USE_64BIT_TIME_T) -#define __MINGW_USE_VC2005_COMPAT -#endif #if !defined(_WIN64) && !defined(__MINGW_USE_VC2005_COMPAT) /* See [Bug 3354324]: file mtime sets wrong time */ -# define _USE_32BIT_TIME_T +# define __MINGW_USE_VC2005_COMPAT #endif #define WIN32_LEAN_AND_MEAN diff --git a/win/tclWinTime.c b/win/tclWinTime.c index c3c22a4..1204ec7 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.c @@ -845,6 +845,11 @@ TclpGetDate( { struct tm *tmPtr; time_t time; +#if defined(_WIN64) || (defined(_USE_64BIT_TIME_T) || (defined(_MSC_VER) && _MSC_VER < 1400)) +# define t2 *t /* no need to cripple time to 32-bit */ +#else + time_t t2 = *(__time32_t *)t; +#endif if (!useGMT) { #if defined(_MSC_VER) && (_MSC_VER >= 1900) @@ -877,15 +882,15 @@ TclpGetDate( #define LOCALTIME_VALIDITY_BOUNDARY 0 #endif - if (*t >= LOCALTIME_VALIDITY_BOUNDARY) { - return TclpLocaltime(t); + if (t2 >= LOCALTIME_VALIDITY_BOUNDARY) { + return TclpLocaltime(&t2); } #if defined(_MSC_VER) && (_MSC_VER >= 1900) _get_timezone(&timezone); #endif - time = *t - timezone; + time = t2 - timezone; /* * If we aren't near to overflowing the long, just add the bias and @@ -893,10 +898,10 @@ TclpGetDate( * result at the end. */ - if (*t < (LONG_MAX - 2*SECSPERDAY) && *t > (LONG_MIN + 2*SECSPERDAY)) { + if (t2 < (LONG_MAX - 2*SECSPERDAY) && t2 > (LONG_MIN + 2*SECSPERDAY)) { tmPtr = ComputeGMT(&time); } else { - tmPtr = ComputeGMT(t); + tmPtr = ComputeGMT(&t2); tzset(); @@ -932,7 +937,7 @@ TclpGetDate( tmPtr->tm_wday = (tmPtr->tm_wday + (int)time) % 7; } } else { - tmPtr = ComputeGMT(t); + tmPtr = ComputeGMT(&t2); } return tmPtr; } @@ -1466,7 +1471,11 @@ TclpGmtime( * Posix gmtime_r function. */ +#if defined(_WIN64) || defined(_USE_64BIT_TIME_T) || (defined(_MSC_VER) && _MSC_VER < 1400) return gmtime(timePtr); +#else + return _gmtime32((CONST __time32_t *)timePtr); +#endif } /* @@ -1498,7 +1507,11 @@ TclpLocaltime( * provide a Posix localtime_r function. */ +#if defined(_WIN64) || defined(_USE_64BIT_TIME_T) || (defined(_MSC_VER) && _MSC_VER < 1400) return localtime(timePtr); +#else + return _localtime32((CONST __time32_t *)timePtr); +#endif } /* -- cgit v0.12 From dae5efd07d01ade231948d43f09364e4b8b580b5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 6 Sep 2019 11:16:43 +0000 Subject: Fix [579a05fb34] (partly): b) tcltest file has mismatched version number. --- unix/Makefile.in | 4 ++-- win/Makefile.in | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 25f034e..2d94bf9 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -856,8 +856,8 @@ install-libraries: libraries done; @echo "Installing package msgcat 1.6.1 as a Tcl Module"; @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/msgcat-1.6.1.tm; - @echo "Installing package tcltest 2.5.0 as a Tcl Module"; - @$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/tcltest-2.5.0.tm; + @echo "Installing package tcltest 2.5.1 as a Tcl Module"; + @$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/tcltest-2.5.1.tm; @echo "Installing package platform 1.0.14 as a Tcl Module"; @$(INSTALL_DATA) $(TOP_DIR)/library/platform/platform.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.4/platform-1.0.14.tm; diff --git a/win/Makefile.in b/win/Makefile.in index 14e12b9..fa68124 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -713,8 +713,8 @@ install-libraries: libraries install-tzdata install-msgs done; @echo "Installing package msgcat 1.6.1 as a Tcl Module"; @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.6.1.tm; - @echo "Installing package tcltest 2.5.0 as a Tcl Module"; - @$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/tcltest-2.5.0.tm; + @echo "Installing package tcltest 2.5.1 as a Tcl Module"; + @$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/tcltest-2.5.1.tm; @echo "Installing package platform 1.0.14 as a Tcl Module"; @$(COPY) $(ROOT_DIR)/library/platform/platform.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.4/platform-1.0.14.tm; @echo "Installing package platform::shell 1.1.4 as a Tcl Module"; -- cgit v0.12 From 779aba1c853be107103b3d87ac6db4bf9bd9c6e6 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 6 Sep 2019 12:28:15 +0000 Subject: Simplify searching for tcl86.lib (and related files): First search for the one without 't' suffix, then the 't' variant. (Without 't' = built with 'configure'/'make', with 't' = built with 'nmake') --- win/rules.vc | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index 4662b00..68e3b08 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -1085,7 +1085,7 @@ STUBPREFIX = $(PROJECT)stub # Set up paths to various Tcl executables and libraries needed by extensions !if $(DOING_TCL) -TCLSHNAME = $(PROJECT)sh$(TCL_VERSION)$(SUFX).exe +TCLSHNAME = $(PROJECT)sh$(VERSION)$(SUFX).exe TCLSH = $(OUT_DIR)\$(TCLSHNAME) TCLIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib TCLLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT) @@ -1102,20 +1102,17 @@ TCL_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" # When building extensions, we need to locate tclsh. Depending on version # of Tcl we are building against, this may or may not have a "t" suffix. # Try various possibilities in turn. -TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe -!if !exist("$(TCLSH)") && $(TCL_THREADS) -TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe -!endif +TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX:t=).exe !if !exist("$(TCLSH)") -TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX:t=).exe +TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX:t=).exe !endif TCLSTUBLIB = $(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib -TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib +TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX:t=).lib # When building extensions, may be linking against Tcl that does not add # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. !if !exist("$(TCLIMPLIB)") -TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX:t=).lib +TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)t$(SUFX:t=).lib !endif TCL_LIBRARY = $(_TCLDIR)\lib TCLREGLIB = $(_TCLDIR)\lib\tclreg13$(SUFX:t=).lib @@ -1125,19 +1122,16 @@ TCL_INCLUDES = -I"$(_TCLDIR)\include" !else # Building against Tcl sources -TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe -!if !exist($(TCLSH)) && $(TCL_THREADS) -TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX).exe -!endif -!if !exist($(TCLSH)) TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX:t=).exe +!if !exist($(TCLSH)) +TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX:t=).exe !endif TCLSTUBLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib -TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib +TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX:t=).lib # When building extensions, may be linking against Tcl that does not add # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. !if !exist("$(TCLIMPLIB)") -TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX:t=).lib +TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)t$(SUFX:t=).lib !endif TCL_LIBRARY = $(_TCLDIR)\library TCLREGLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg13$(SUFX:t=).lib -- cgit v0.12 From 2441daf9cda1891fce419e31caac43f44d62eeba Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 6 Sep 2019 15:32:19 +0000 Subject: Fix configure script (re-generated with a modified autoconf-2.59, in which the AC_PROG_MAKE_SET macro is replaced with the one from autoconf-2.69) :-) Re-enable native travis build on Windows, showing that the build now works. --- .travis.yml | 86 ++++++++++++++++++++++++++++++++++++++++------------------- win/configure | 22 ++++++++------- 2 files changed, 70 insertions(+), 38 deletions(-) diff --git a/.travis.yml b/.travis.yml index adf73ef..c68a350 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,19 +4,6 @@ language: c matrix: include: # Testing on Linux with various compilers - - name: "Linux/Clang/Shared" - os: linux - dist: xenial - compiler: clang - env: - - BUILD_DIR=unix - - name: "Linux/Clang/Static" - os: linux - dist: xenial - compiler: clang - env: - - CFGOPT=--disable-shared - - BUILD_DIR=unix - name: "Linux/GCC/Shared" os: linux dist: xenial @@ -30,16 +17,7 @@ matrix: env: - CFGOPT=--disable-shared - BUILD_DIR=unix -# Debug builds. Running test-cases disabled, because it is currently failing. - - name: "Linux/Clang/Debug/no test" - os: linux - dist: xenial - compiler: clang - env: - - BUILD_DIR=unix - - CFGOPT=--enable-symbols=all - script: - - make all tcltest +# Debug build. Running test-cases disabled, because it is currently failing. - name: "Linux/GCC/Debug/no test" os: linux dist: xenial @@ -98,13 +76,37 @@ matrix: - g++-4.9 env: - BUILD_DIR=unix +# Clang + - name: "Linux/Clang/Shared" + os: linux + dist: xenial + compiler: clang + env: + - BUILD_DIR=unix + - name: "Linux/Clang/Static" + os: linux + dist: xenial + compiler: clang + env: + - CFGOPT=--disable-shared + - BUILD_DIR=unix +# Debug build. Running test-cases disabled, because it is currently failing. + - name: "Linux/Clang/Debug/no test" + os: linux + dist: xenial + compiler: clang + env: + - BUILD_DIR=unix + - CFGOPT=--enable-symbols=all + script: + - make all tcltest # Testing on Mac, various styles - name: "macOS/Xcode 11/Shared/Unix-like" os: osx osx_image: xcode11 env: - BUILD_DIR=unix - - name: "macOS/Xcode 11/Shared/Mac-like" + - name: "macOS/Xcode 11/Shared" os: osx osx_image: xcode11 env: @@ -114,21 +116,21 @@ matrix: - make all # The styles=develop avoids some weird problems on OSX - make test styles=develop - - name: "macOS/Xcode 10/Shared/Mac-like" + - name: "macOS/Xcode 10/Shared" os: osx osx_image: xcode10.2 env: - BUILD_DIR=macosx install: [] script: *mactest - - name: "macOS/Xcode 9/Shared/Mac-like" + - name: "macOS/Xcode 9/Shared" os: osx osx_image: xcode9 env: - BUILD_DIR=macosx install: [] script: *mactest - - name: "macOS/Xcode 8/Shared/Mac-like" + - name: "macOS/Xcode 8/Shared" os: osx osx_image: xcode8 env: @@ -244,10 +246,38 @@ matrix: script: - cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=symbols,msvcrt,threads -f makefile.vc all tcltest' - cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=symbols,msvcrt,threads -f makefile.vc test' +# Test on Windows with GCC native + - name: "Windows/GCC/Shared" + os: windows + compiler: gcc + env: + - BUILD_DIR=win + - CFGOPT="--enable-64bit" + before_install: + - choco install make + - cd ${BUILD_DIR} + - name: "Windows/GCC/Static" + os: windows + compiler: gcc + env: + - BUILD_DIR=win + - CFGOPT="--enable-64bit --disable-shared" + before_install: + - choco install make + - cd ${BUILD_DIR} + - name: "Windows/GCC/Debug" + os: windows + compiler: gcc + env: + - BUILD_DIR=win + - CFGOPT="--enable-64bit --enable-symbols" + before_install: + - choco install make + - cd ${BUILD_DIR} before_install: - cd ${BUILD_DIR} install: - - ./configure ${CFGOPT} --prefix=$HOME + - ./configure ${CFGOPT} --prefix=$HOME || (cat config.log && exit 1) before_script: - export ERROR_ON_FAILURES=1 script: diff --git a/win/configure b/win/configure index b754717..d3708d8 100755 --- a/win/configure +++ b/win/configure @@ -3011,24 +3011,26 @@ fi echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` +set x ${MAKE-make} +ac_make=`AS_ECHO("$[2]") | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF +SHELL = /bin/sh all: - @echo 'ac_maketemp="$(MAKE)"' + @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac rm -f conftest.make fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= -- cgit v0.12 From 5b7c6db87d8609f207993339675d523d4ac59d51 Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 6 Sep 2019 17:23:05 +0000 Subject: cherry-pick [b87d2183ca]: test cases covering bug [775ee88560]: segfault in upvar at wrong level, wrong message of uplevel --- tests/uplevel.test | 10 ++++++++++ tests/upvar.test | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/tests/uplevel.test b/tests/uplevel.test index cfe4b72..51ffd34 100644 --- a/tests/uplevel.test +++ b/tests/uplevel.test @@ -83,6 +83,16 @@ test uplevel-3.4 {uplevel to same level} { a1 } 55 +test uplevel-4.0.1 {error: non-existent level} -body { + uplevel #0 { uplevel { set y 222 } } +} -returnCodes error -result {bad level "1"} +test uplevel-4.0.2 {error: non-existent level} -setup { + interp create i +} -body { + i eval { uplevel { set y 222 } } +} -returnCodes error -result {bad level "1"} -cleanup { + interp delete i +} test uplevel-4.1 {error: non-existent level} { list [catch c1 msg] $msg } {1 {bad level "#2"}} diff --git a/tests/upvar.test b/tests/upvar.test index d18fd3b..f41fe1b 100644 --- a/tests/upvar.test +++ b/tests/upvar.test @@ -298,6 +298,17 @@ test upvar-8.3 {errors in upvar command} { proc p1 {} {upvar a b c} list [catch p1 msg] $msg } {1 {wrong # args: should be "upvar ?level? otherVar localVar ?otherVar localVar ...?"}} +test upvar-8.3.1 {bad level for upvar (upvar at top-level, bug [775ee88560])} -body { + proc p1 {} { uplevel { upvar b b; lappend b UNEXPECTED } } + uplevel #0 { p1 } +} -returnCodes error -result {bad level "1"} +test upvar-8.3.2 {bad level for upvar (upvar at top-level, bug [775ee88560])} -setup { + interp create i +} -body { + i eval { upvar b b; lappend b UNEXPECTED } +} -returnCodes error -result {bad level "1"} -cleanup { + interp delete i +} test upvar-8.4 {errors in upvar command} { proc p1 {} {upvar 0 b b} list [catch p1 msg] $msg -- cgit v0.12 From 5ed9c57d7a6452cb9bb3ae0c72953cbbf7b81c24 Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 6 Sep 2019 17:23:58 +0000 Subject: fix bad level (if specified argument is not a level at all) --- generic/tclProc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/generic/tclProc.c b/generic/tclProc.c index d58e8da..f1e0148 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -849,6 +849,7 @@ TclObjGetFrame( level = curLevel - 1; result = 0; + name = "1"; } /* -- cgit v0.12 From d0f808008dd96dd8b4ba1988087dbb644ac63283 Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 6 Sep 2019 20:22:30 +0000 Subject: if frameName (actual level) does not contain a real level (#0 or 1) historically TclGetFrame and Tcl_UpVar2 uses current level - 1, so to put supplied name in case of bad level (error at top - 1) is wrong; be more consistent with TclObjGetFrame (at least in error case if relative level used). --- generic/tclProc.c | 11 ++++++++--- tests/upvar.test | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/generic/tclProc.c b/generic/tclProc.c index f1e0148..2ee2456 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -713,17 +713,22 @@ TclGetFrame( result = 1; curLevel = iPtr->varFramePtr->level; if (*name== '#') { - if (Tcl_GetInt(interp, name+1, &level) != TCL_OK || level < 0) { + if (Tcl_GetInt(NULL, name+1, &level) != TCL_OK || level < 0) { goto levelError; } } else if (isdigit(UCHAR(*name))) { /* INTL: digit */ - if (Tcl_GetInt(interp, name, &level) != TCL_OK) { + if (Tcl_GetInt(NULL, name, &level) != TCL_OK) { goto levelError; } level = curLevel - level; } else { + /* + * (historical, TODO) If name does not contain a level (#0 or 1), + * TclGetFrame and Tcl_UpVar2 uses current level - 1 + */ level = curLevel - 1; result = 0; + name = "1"; /* be more consistent with TclObjGetFrame (error at top - 1) */ } /* @@ -812,7 +817,7 @@ TclObjGetFrame( } level = curLevel - level; } else if (*name == '#') { - if (Tcl_GetInt(interp, name+1, &level) != TCL_OK || level < 0) { + if (Tcl_GetInt(NULL, name+1, &level) != TCL_OK || level < 0) { goto levelError; } diff --git a/tests/upvar.test b/tests/upvar.test index f41fe1b..cba2fb9 100644 --- a/tests/upvar.test +++ b/tests/upvar.test @@ -357,7 +357,7 @@ test upvar-8.11 {upvar will not create a variable that looks like an array} -bod test upvar-9.1 {Tcl_UpVar2 procedure} testupvar { list [catch {testupvar xyz a {} x global} msg] $msg -} {1 {bad level "xyz"}} +} {1 {bad level "1"}} test upvar-9.2 {Tcl_UpVar2 procedure} testupvar { catch {unset a} catch {unset x} -- cgit v0.12 From 5ea46c24a2d2e32cd25e06728a7b81f3a949f5a8 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 7 Sep 2019 08:53:43 +0000 Subject: Fix bug 9d10c37aa8 (in the Tk repository): Improperly converted link in HTML man page for ttk::style --- tools/tcltk-man2html-utils.tcl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/tcltk-man2html-utils.tcl b/tools/tcltk-man2html-utils.tcl index 250feeb..65d81de 100644 --- a/tools/tcltk-man2html-utils.tcl +++ b/tools/tcltk-man2html-utils.tcl @@ -869,7 +869,7 @@ proc insert-cross-references {text} { [expr {$offset(end-bold)-1}]] set text [string range $text[set text ""] \ [expr {$offset(end-bold)+4}] end] - regsub {http://[\w/.]+} $body {&} body + regsub {http://[\w/.-]+} $body {&} body append result [cross-reference $body] continue } @@ -905,7 +905,7 @@ proc insert-cross-references {text} { url { set off [lindex $offsets 0] append result [string range $text 0 [expr {$off-1}]] - regexp -indices -start $off {http://[\w/.]+} $text range + regexp -indices -start $off {http://[\w/.-]+} $text range set url [string range $text {*}$range] append result "$url" set text [string range $text[set text ""] \ -- cgit v0.12 From c4a716a51763edcf3c68dd8caf5359f20d430779 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sat, 7 Sep 2019 14:36:11 +0000 Subject: Add --enable-threads to Windows/GCC (native) builds. This is - most likely - the cause of the travis failure in compile.test. --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index c68a350..fd6f31a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -252,7 +252,7 @@ matrix: compiler: gcc env: - BUILD_DIR=win - - CFGOPT="--enable-64bit" + - CFGOPT="--enable-64bit --enable-threads" before_install: - choco install make - cd ${BUILD_DIR} @@ -261,7 +261,7 @@ matrix: compiler: gcc env: - BUILD_DIR=win - - CFGOPT="--enable-64bit --disable-shared" + - CFGOPT="--enable-64bit --enable-threads --disable-shared" before_install: - choco install make - cd ${BUILD_DIR} @@ -270,7 +270,7 @@ matrix: compiler: gcc env: - BUILD_DIR=win - - CFGOPT="--enable-64bit --enable-symbols" + - CFGOPT="--enable-64bit --enable-threads --enable-symbols" before_install: - choco install make - cd ${BUILD_DIR} -- cgit v0.12 From e092b29faa1269648eb8fcddc2527428c2e4876b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 8 Sep 2019 13:26:00 +0000 Subject: dde and registry extension should be compiled with -DUNICODE -D_UNICODE. Put 64-bit builds before 32-bit builds in travis --- .travis.yml | 72 ++++++++++++++++++++++++++++----------------------------- win/Makefile.in | 10 +++++++- 2 files changed, 45 insertions(+), 37 deletions(-) diff --git a/.travis.yml b/.travis.yml index fd6f31a..e1b8bd0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -137,6 +137,42 @@ matrix: - BUILD_DIR=macosx install: [] script: *mactest +# Test with mingw-w64 cross-compile +# Doesn't run tests because wine is only an imperfect Windows emulation + - name: "Linux-cross-Windows/GCC/Shared/no test" + os: linux + dist: xenial + compiler: x86_64-w64-mingw32-gcc + addons: &mingw64 + apt: + packages: + - gcc-mingw-w64-base + - binutils-mingw-w64-x86-64 + - gcc-mingw-w64-x86-64 + - gcc-mingw-w64 + - wine + env: + - BUILD_DIR=win + - CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit --enable-threads" + script: *crosstest + - name: "Linux-cross-Windows/GCC/Static/no test" + os: linux + dist: xenial + compiler: x86_64-w64-mingw32-gcc + addons: *mingw64 + env: + - BUILD_DIR=win + - CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit --enable-threads --disable-shared" + script: *crosstest + - name: "Linux-cross-Windows/GCC/Debug/no test" + os: linux + dist: xenial + compiler: x86_64-w64-mingw32-gcc + addons: *mingw64 + env: + - BUILD_DIR=win + - CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit --enable-threads --enable-symbols" + script: *crosstest # Test with mingw-w64 (32 bit) cross-compile # Doesn't run tests because wine is only an imperfect Windows emulation - name: "Linux-cross-Windows-32/GCC/Shared/no test" @@ -178,42 +214,6 @@ matrix: - BUILD_DIR=win - CFGOPT="--host=i686-w64-mingw32 --enable-threads --enable-symbols" script: *crosstest -# Test with mingw-w64 (64 bit) -# Doesn't run tests because wine is only an imperfect Windows emulation - - name: "Linux-cross-Windows-64/GCC/Shared/no test" - os: linux - dist: xenial - compiler: x86_64-w64-mingw32-gcc - addons: &mingw64 - apt: - packages: - - gcc-mingw-w64-base - - binutils-mingw-w64-x86-64 - - gcc-mingw-w64-x86-64 - - gcc-mingw-w64 - - wine - env: - - BUILD_DIR=win - - CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit --enable-threads" - script: *crosstest - - name: "Linux-cross-Windows-64/GCC/Static/no test" - os: linux - dist: xenial - compiler: x86_64-w64-mingw32-gcc - addons: *mingw64 - env: - - BUILD_DIR=win - - CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit --enable-threads --disable-shared" - script: *crosstest - - name: "Linux-cross-Windows-64/GCC/Debug/no test" - os: linux - dist: xenial - compiler: x86_64-w64-mingw32-gcc - addons: *mingw64 - env: - - BUILD_DIR=win - - CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit --enable-threads --enable-symbols" - script: *crosstest # Test on Windows with MSVC native - name: "Windows/MSVC/Shared" os: windows diff --git a/win/Makefile.in b/win/Makefile.in index 6f2044f5..49ee104 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -498,7 +498,15 @@ tclWinInit.${OBJEXT}: tclWinInit.c $(CC) -c $(CC_SWITCHES) -DBUILD_tcl $(EXTFLAGS) @DEPARG@ $(CC_OBJNAME) tclWinPipe.${OBJEXT}: tclWinPipe.c - $(CC) -c $(CC_SWITCHES) -DBUILD_tcl -DTCL_PIPE_DLL=\"$(PIPE_DLL_FILE)\" \ + $(CC) -c $(CC_SWITCHES) -D_BUILD_tcl -DTCL_PIPE_DLL=\"$(PIPE_DLL_FILE)\" \ + $(EXTFLAGS) @DEPARG@ $(CC_OBJNAME) + +tclWinReg.${OBJEXT}: tclWinReg.c + $(CC) -c $(CC_SWITCHES) -DUNICODE -D_UNICODE + $(EXTFLAGS) @DEPARG@ $(CC_OBJNAME) + +tclWinDde.${OBJEXT}: tclWinDde.c + $(CC) -c $(CC_SWITCHES) -DUNICODE -D_UNICODE $(EXTFLAGS) @DEPARG@ $(CC_OBJNAME) testMain.${OBJEXT}: tclAppInit.c -- cgit v0.12 From fcfecf0c0d902bcabce45b30db42a5d387ae774a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 9 Sep 2019 08:41:14 +0000 Subject: Final touch to make everything work for 8.5: - Don't use AS_ECHO macro, because autoconf-2.59 doesn't have it. - -D_BUILD_tcl should be -DBUILD_tcl - Missing back-slashes at the end of the line. --- win/Makefile.in | 6 +++--- win/configure | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/win/Makefile.in b/win/Makefile.in index 49ee104..8561bc2 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -498,15 +498,15 @@ tclWinInit.${OBJEXT}: tclWinInit.c $(CC) -c $(CC_SWITCHES) -DBUILD_tcl $(EXTFLAGS) @DEPARG@ $(CC_OBJNAME) tclWinPipe.${OBJEXT}: tclWinPipe.c - $(CC) -c $(CC_SWITCHES) -D_BUILD_tcl -DTCL_PIPE_DLL=\"$(PIPE_DLL_FILE)\" \ + $(CC) -c $(CC_SWITCHES) -DBUILD_tcl -DTCL_PIPE_DLL=\"$(PIPE_DLL_FILE)\" \ $(EXTFLAGS) @DEPARG@ $(CC_OBJNAME) tclWinReg.${OBJEXT}: tclWinReg.c - $(CC) -c $(CC_SWITCHES) -DUNICODE -D_UNICODE + $(CC) -c $(CC_SWITCHES) -DUNICODE -D_UNICODE \ $(EXTFLAGS) @DEPARG@ $(CC_OBJNAME) tclWinDde.${OBJEXT}: tclWinDde.c - $(CC) -c $(CC_SWITCHES) -DUNICODE -D_UNICODE + $(CC) -c $(CC_SWITCHES) -DUNICODE -D_UNICODE \ $(EXTFLAGS) @DEPARG@ $(CC_OBJNAME) testMain.${OBJEXT}: tclAppInit.c diff --git a/win/configure b/win/configure index d3708d8..7da12da 100755 --- a/win/configure +++ b/win/configure @@ -3012,7 +3012,7 @@ fi echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set x ${MAKE-make} -ac_make=`AS_ECHO("$[2]") | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +ac_make=`echo "" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else -- cgit v0.12 From 7f3d79834326c84f710028a5d603ee1a9896d8c7 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 9 Sep 2019 09:00:44 +0000 Subject: Move &crosstest up in .travis.yml --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index e1b8bd0..2a04faf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -154,7 +154,11 @@ matrix: env: - BUILD_DIR=win - CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit --enable-threads" - script: *crosstest + script: &crosstest + - make all tcltest + # Include a high visibility marker that tests are skipped outright + - > + echo "`tput setaf 3`SKIPPED TEST: CROSS COMPILING`tput sgr0`" - name: "Linux-cross-Windows/GCC/Static/no test" os: linux dist: xenial @@ -191,11 +195,7 @@ matrix: env: - BUILD_DIR=win - CFGOPT="--host=i686-w64-mingw32 --enable-threads" - script: &crosstest - - make all tcltest - # Include a high visibility marker that tests are skipped outright - - > - echo "`tput setaf 3`SKIPPED TEST: CROSS COMPILING`tput sgr0`" + script: *crosstest - name: "Linux-cross-Windows-32/GCC/Static/no test" os: linux dist: xenial -- cgit v0.12 From 4dc0eb331451143f9fac2621140d60c8073eb21d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 10 Sep 2019 12:03:40 +0000 Subject: Backport some improvements to tm.tcl (mostly comments). Don't use ::tcl_platform(debug) anymore, since it cannot be thrusted: Better use [::tcl::pkgconfig get debug] Reduce limits in tests/compile.test (13.2), since apparently it's still too much for some platforms. --- library/dde/pkgIndex.tcl | 4 +- library/reg/pkgIndex.tcl | 4 +- library/tm.tcl | 226 ++++++++++++++++++++++------------------------- tests/compile.test | 4 +- 4 files changed, 112 insertions(+), 126 deletions(-) diff --git a/library/dde/pkgIndex.tcl b/library/dde/pkgIndex.tcl index 065dc83..bcb5f9c 100644 --- a/library/dde/pkgIndex.tcl +++ b/library/dde/pkgIndex.tcl @@ -1,6 +1,6 @@ -if {![package vsatisfies [package provide Tcl] 8]} return +if {![package vsatisfies [package provide Tcl] 8.5]} return if {[info sharedlibextension] != ".dll"} return -if {[info exists ::tcl_platform(debug)]} { +if {[::tcl::pkgconfig get debug]} { package ifneeded dde 1.4.1 [list load [file join $dir tcldde14g.dll] dde] } else { package ifneeded dde 1.4.1 [list load [file join $dir tcldde14.dll] dde] diff --git a/library/reg/pkgIndex.tcl b/library/reg/pkgIndex.tcl index 12c7ea5..9a85944 100755 --- a/library/reg/pkgIndex.tcl +++ b/library/reg/pkgIndex.tcl @@ -1,6 +1,6 @@ -if {![package vsatisfies [package provide Tcl] 8]} return +if {![package vsatisfies [package provide Tcl] 8.5]} return if {[info sharedlibextension] != ".dll"} return -if {[info exists ::tcl_platform(debug)]} { +if {[::tcl::pkgconfig get debug]} { package ifneeded registry 1.3.3 \ [list load [file join $dir tclreg13g.dll] registry] } else { diff --git a/library/tm.tcl b/library/tm.tcl index 87db0df..40b8e40 100644 --- a/library/tm.tcl +++ b/library/tm.tcl @@ -1,48 +1,44 @@ # -*- tcl -*- # -# Searching for Tcl Modules. Defines a procedure, declares it as the -# primary command for finding packages, however also uses the former -# 'package unknown' command as a fallback. +# Searching for Tcl Modules. Defines a procedure, declares it as the primary +# command for finding packages, however also uses the former 'package unknown' +# command as a fallback. # -# Locates all possible packages in a directory via a less restricted -# glob. The targeted directory is derived from the name of the -# requested package. I.e. the TM scan will look only at directories -# which can contain the requested package. It will register all -# packages it found in the directory so that future requests have a -# higher chance of being fulfilled by the ifneeded database without -# having to come to us again. +# Locates all possible packages in a directory via a less restricted glob. The +# targeted directory is derived from the name of the requested package, i.e. +# the TM scan will look only at directories which can contain the requested +# package. It will register all packages it found in the directory so that +# future requests have a higher chance of being fulfilled by the ifneeded +# database without having to come to us again. # -# We do not remember where we have been and simply rescan targeted -# directories when invoked again. The reasoning is this: +# We do not remember where we have been and simply rescan targeted directories +# when invoked again. The reasoning is this: # -# - The only way we get back to the same directory is if someone is -# trying to [package require] something that wasn't there on the -# first scan. +# - The only way we get back to the same directory is if someone is trying to +# [package require] something that wasn't there on the first scan. # # Either # 1) It is there now: If we rescan, you get it; if not you don't. # -# This covers the possibility that the application asked for a -# package late, and the package was actually added to the -# installation after the application was started. It shoukld -# still be able to find it. +# This covers the possibility that the application asked for a package +# late, and the package was actually added to the installation after the +# application was started. It shoukld still be able to find it. # -# 2) It still is not there: Either way, you don't get it, but the -# rescan takes time. This is however an error case and we dont't -# care that much about it +# 2) It still is not there: Either way, you don't get it, but the rescan +# takes time. This is however an error case and we dont't care that much +# about it # -# 3) It was there the first time; but for some reason a "package -# forget" has been run, and "package" doesn't know about it -# anymore. +# 3) It was there the first time; but for some reason a "package forget" has +# been run, and "package" doesn't know about it anymore. # -# This can be an indication that the application wishes to reload -# some functionality. And should work as well. +# This can be an indication that the application wishes to reload some +# functionality. And should work as well. # -# Note that this also strikes a balance between doing a glob targeting -# a single package, and thus most likely requiring multiple globs of -# the same directory when the application is asking for many packages, -# and trying to glob for _everything_ in all subdirectories when -# looking for a package, which comes with a heavy startup cost. +# Note that this also strikes a balance between doing a glob targeting a +# single package, and thus most likely requiring multiple globs of the same +# directory when the application is asking for many packages, and trying to +# glob for _everything_ in all subdirectories when looking for a package, +# which comes with a heavy startup cost. # # We scan for regular packages only if no satisfying module was found. @@ -71,46 +67,43 @@ namespace eval ::tcl::tm { # path with 'list'. # # Results -# No result for subcommands 'add' and 'remove'. A list of paths -# for 'list'. +# No result for subcommands 'add' and 'remove'. A list of paths for +# 'list'. # # Sideeffects -# The subcommands 'add' and 'remove' manipulate the list of -# paths to search for Tcl Modules. The subcommand 'list' has no -# sideeffects. +# The subcommands 'add' and 'remove' manipulate the list of paths to +# search for Tcl Modules. The subcommand 'list' has no sideeffects. -proc ::tcl::tm::add {path args} { +proc ::tcl::tm::add {args} { # PART OF THE ::tcl::tm::path ENSEMBLE # # The path is added at the head to the list of module paths. # - # The command enforces the restriction that no path may be an - # ancestor directory of any other path on the list. If the new - # path violates this restriction an error wil be raised. + # The command enforces the restriction that no path may be an ancestor + # directory of any other path on the list. If the new path violates this + # restriction an error wil be raised. # - # If the path is already present as is no error will be raised and - # no action will be taken. + # If the path is already present as is no error will be raised and no + # action will be taken. variable paths - # We use a copy of the path as source during validation, and - # extend it as well. Because we not only have to detect if the new - # paths are bogus with respect to the existing paths, but also - # between themselves. Otherwise we can still add bogus paths, by - # specifying them in a single call. This makes the use of the new - # paths simpler as well, a trivial assignment of the collected - # paths to the official state var. + # We use a copy of the path as source during validation, and extend it as + # well. Because we not only have to detect if the new paths are bogus with + # respect to the existing paths, but also between themselves. Otherwise we + # can still add bogus paths, by specifying them in a single call. This + # makes the use of the new paths simpler as well, a trivial assignment of + # the collected paths to the official state var. set newpaths $paths - foreach p [linsert $args 0 $path] { + foreach p $args { if {$p in $newpaths} { # Ignore a path already on the list. continue } - # Search for paths which are subdirectories of the new one. If - # there are any then the new path violates the restriction - # about ancestors. + # Search for paths which are subdirectories of the new one. If there + # are any then the new path violates the restriction about ancestors. set pos [lsearch -glob $newpaths ${p}/*] # Cannot use "in", we need the position for the message. @@ -119,10 +112,9 @@ proc ::tcl::tm::add {path args} { "$p is ancestor of existing module path [lindex $newpaths $pos]." } - # Now look for existing paths which are ancestors of the new - # one. This reverse question forces us to loop over the - # existing paths, as each element is the pattern, not the new - # path :( + # Now look for existing paths which are ancestors of the new one. This + # reverse question forces us to loop over the existing paths, as each + # element is the pattern, not the new path :( foreach ep $newpaths { if {[string match ${ep}/* $p]} { @@ -134,24 +126,23 @@ proc ::tcl::tm::add {path args} { set newpaths [linsert $newpaths 0 $p] } - # The validation of the input is complete and successful, and - # everything in newpaths is either an old path, or added. We can - # now extend the official list of paths, a simple assignment is - # sufficient. + # The validation of the input is complete and successful, and everything + # in newpaths is either an old path, or added. We can now extend the + # official list of paths, a simple assignment is sufficient. set paths $newpaths return } -proc ::tcl::tm::remove {path args} { +proc ::tcl::tm::remove {args} { # PART OF THE ::tcl::tm::path ENSEMBLE # - # Removes the path from the list of module paths. The command is - # silently ignored if the path is not on the list. + # Removes the path from the list of module paths. The command is silently + # ignored if the path is not on the list. variable paths - foreach p [linsert $args 0 $path] { + foreach p $args { set pos [lsearch -exact $paths $p] if {$pos >= 0} { set paths [lreplace $paths $pos $pos] @@ -177,17 +168,16 @@ proc ::tcl::tm::list {} { # empty string. # exact - Either -exact or ommitted. # -# Name, version, and exact are used to determine -# satisfaction. The original is called iff no satisfaction was -# achieved. The name is also used to compute the directory to -# target in the search. +# Name, version, and exact are used to determine satisfaction. The +# original is called iff no satisfaction was achieved. The name is also +# used to compute the directory to target in the search. # # Results # None. # # Sideeffects -# May populate the package ifneeded database with additional -# provide scripts. +# May populate the package ifneeded database with additional provide +# scripts. proc ::tcl::tm::UnknownHandler {original name args} { # Import the list of paths to search for packages in module form. @@ -196,8 +186,8 @@ proc ::tcl::tm::UnknownHandler {original name args} { variable paths variable pkgpattern - # Without paths to search we can do nothing. (Except falling back - # to the regular search). + # Without paths to search we can do nothing. (Except falling back to the + # regular search). if {[llength $paths]} { set pkgpath [string map {:: /} $name] @@ -206,11 +196,10 @@ proc ::tcl::tm::UnknownHandler {original name args} { set pkgroot "" } - # We don't remember a copy of the paths while looping. Tcl - # Modules are unable to change the list while we are searching - # for them. This also simplifies the loop, as we cannot get - # additional directories while iterating over the list. A - # simple foreach is sufficient. + # We don't remember a copy of the paths while looping. Tcl Modules are + # unable to change the list while we are searching for them. This also + # simplifies the loop, as we cannot get additional directories while + # iterating over the list. A simple foreach is sufficient. set satisfied 0 foreach path $paths { @@ -223,12 +212,11 @@ proc ::tcl::tm::UnknownHandler {original name args} { } set strip [llength [file split $path]] - # We can't use glob in safe interps, so enclose the following - # in a catch statement, where we get the module files out - # of the subdirectories. In other words, Tcl Modules are - # not-functional in such an interpreter. This is the same - # as for the command "tclPkgUnknown", i.e. the search for - # regular packages. + # We can't use glob in safe interps, so enclose the following in a + # catch statement, where we get the module files out of the + # subdirectories. In other words, Tcl Modules are not-functional + # in such an interpreter. This is the same as for the command + # "tclPkgUnknown", i.e. the search for regular packages. catch { # We always look for _all_ possible modules in the current @@ -238,13 +226,13 @@ proc ::tcl::tm::UnknownHandler {original name args} { set pkgfilename [join [lrange [file split $file] $strip end] ::] if {![regexp -- $pkgpattern $pkgfilename --> pkgname pkgversion]} { - # Ignore everything not matching our pattern - # for package names. + # Ignore everything not matching our pattern for + # package names. continue } if {[catch {package vcompare $pkgversion 0}]} { - # Ignore everything where the version part is - # not acceptable to "package vcompare". + # Ignore everything where the version part is not + # acceptable to "package vcompare". continue } @@ -257,38 +245,36 @@ proc ::tcl::tm::UnknownHandler {original name args} { continue } - # We have found a candidate, generate a "provide - # script" for it, and remember it. Note that we - # are using ::list to do this; locally [list] - # means something else without the namespace - # specifier. - - # NOTE. When making changes to the format of the - # provide command generated below CHECK that the - # 'LOCATE' procedure in core file - # 'platform/shell.tcl' still understands it, or, - # if not, update its implementation appropriately. + # We have found a candidate, generate a "provide script" + # for it, and remember it. Note that we are using ::list + # to do this; locally [list] means something else without + # the namespace specifier. + + # NOTE. When making changes to the format of the provide + # command generated below CHECK that the 'LOCATE' + # procedure in core file 'platform/shell.tcl' still + # understands it, or, if not, update its implementation + # appropriately. # - # Right now LOCATE's implementation assumes that - # the path of the package file is the last element - # in the list. + # Right now LOCATE's implementation assumes that the path + # of the package file is the last element in the list. package ifneeded $pkgname $pkgversion \ "[::list package provide $pkgname $pkgversion];[::list source -encoding utf-8 $file]" - # We abort in this unknown handler only if we got - # a satisfying candidate for the requested - # package. Otherwise we still have to fallback to - # the regular package search to complete the - # processing. + # We abort in this unknown handler only if we got a + # satisfying candidate for the requested package. + # Otherwise we still have to fallback to the regular + # package search to complete the processing. if {($pkgname eq $name) && [package vsatisfies $pkgversion {*}$args]} { set satisfied 1 - # We do not abort the loop, and keep adding - # provide scripts for every candidate in the - # directory, just remember to not fall back to - # the regular search anymore. + + # We do not abort the loop, and keep adding provide + # scripts for every candidate in the directory, just + # remember to not fall back to the regular search + # anymore. } } } @@ -299,8 +285,8 @@ proc ::tcl::tm::UnknownHandler {original name args} { } } - # Fallback to previous command, if existing. See comment above - # about ::list... + # Fallback to previous command, if existing. See comment above about + # ::list... if {[llength $original]} { uplevel 1 $original [::linsert $args 0 $name] @@ -366,22 +352,22 @@ proc ::tcl::tm::Defaults {} { # Calls 'path add' to paths to the list of module search paths. proc ::tcl::tm::roots {paths} { - lassign [split [package present Tcl] .] major minor + regexp {^(\d+)\.(\d+)} [package present Tcl] - major minor foreach pa $paths { set p [file join $pa tcl$major] for {set n $minor} {$n >= 0} {incr n -1} { set px [file join $p ${major}.${n}] - if {![interp issafe]} { set px [file normalize $px] } + if {![interp issafe]} {set px [file normalize $px]} path add $px } set px [file join $p site-tcl] - if {![interp issafe]} { set px [file normalize $px] } + if {![interp issafe]} {set px [file normalize $px]} path add $px } return } -# Initialization. Set up the default paths, then insert the new -# handler into the chain. +# Initialization. Set up the default paths, then insert the new handler into +# the chain. -if {![interp issafe]} { ::tcl::tm::Defaults } +if {![interp issafe]} {::tcl::tm::Defaults} diff --git a/tests/compile.test b/tests/compile.test index cd26fdf..a66da22 100644 --- a/tests/compile.test +++ b/tests/compile.test @@ -442,10 +442,10 @@ test compile-13.2 {TclCompileScript: testing nested scripts compilation} -setup }} } -body { # Test different compilation variants (instructions evalStk, invokeStk, etc), - # with 2000 (1000 in debug) nested scripts (bodies). If you get SO/SF exceptions on some low-stack + # with 1500 (750 in debug) nested scripts (bodies). If you get SO/SF exceptions on some low-stack # boxes or systems, please don't decrease it (either provide a constraint) $i eval {foreach cmd {eval "if 1" catch} { - set c [gencode [expr {![::tcl::pkgconfig get debug] ? 2000 : 1000}] $cmd] + set c [gencode [expr {![::tcl::pkgconfig get debug] ? 1500 : 750}] $cmd] if 1 $c }} $i eval {set result} -- cgit v0.12 From 4d51f6b054999c72115751f3895158195e42b40d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 10 Sep 2019 12:05:54 +0000 Subject: Don't use constraints like unixOrPc anymore, use unixOrWin (for example) --- tests/chanio.test | 4 +- tests/cmdAH.test | 6 +-- tests/cmdMZ.test | 4 +- tests/fCmd.test | 17 +++++++-- tests/fileName.test | 46 +++++++++++----------- tests/interp.test | 64 +++++++++++++++---------------- tests/io.test | 4 +- tests/ioCmd.test | 10 ++--- tests/pid.test | 2 +- tests/registry.test | 8 ++-- tests/socket.test | 2 +- tests/tcltest.test | 108 ++++++++++++++++++++++++++-------------------------- 12 files changed, 142 insertions(+), 133 deletions(-) diff --git a/tests/chanio.test b/tests/chanio.test index 5d47e0b..a18bbbe 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -2069,7 +2069,7 @@ test chan-io-27.4 {FlushChannel, implicit flush when buffer fills} { set l } {0 60 72} test chan-io-27.5 {FlushChannel, implicit flush when buffer fills and on chan close} \ - {unixOrPc} { + {unixOrWin} { file delete $path(test1) set f [open $path(test1) w] chan configure $f -translation lf -buffersize 60 -eofchar {} @@ -7339,7 +7339,7 @@ test chan-io-57.2 {buffered data and file events, read} {fileevent} { set result } {1 readable 234567890 timer} -test chan-io-58.1 {Tcl_NotifyChannel and error when closing} {stdio unixOrPc openpipe fileevent} { +test chan-io-58.1 {Tcl_NotifyChannel and error when closing} {stdio unixOrWin openpipe fileevent} { set out [open $path(script) w] chan puts $out { chan puts "normal message from pipe" diff --git a/tests/cmdAH.test b/tests/cmdAH.test index c8318c0..03ec3df 100644 --- a/tests/cmdAH.test +++ b/tests/cmdAH.test @@ -372,7 +372,7 @@ test cmdAH-8.45 {Tcl_FileObjCmd: dirname} { -match regexp -setup { set temp $::env(HOME) - } + } -body { set ::env(HOME) "/homewontexist/test" testsetplatform windows @@ -878,7 +878,7 @@ test cmdAH-18.3 {Tcl_FileObjCmd: executable} {unix testchmod} { } 1 test cmdAH-18.5 {Tcl_FileObjCmd: executable} {win} { - # On pc, must be a .exe, .com, etc. + # On windows, must be a .exe, .com, etc. set x [file exe $gorpfile] set gorpexe [makeFile foo gorp.exe] @@ -887,7 +887,7 @@ test cmdAH-18.5 {Tcl_FileObjCmd: executable} {win} { set x } {0 1} test cmdAH-18.5.1 {Tcl_FileObjCmd: executable} {win} { - # On pc, must be a .exe, .com, etc. + # On windows, must be a .exe, .com, etc. set x [file exe $gorpfile] set gorpexe [makeFile foo gorp.exe] diff --git a/tests/cmdMZ.test b/tests/cmdMZ.test index 98cb0fb..5f94777 100644 --- a/tests/cmdMZ.test +++ b/tests/cmdMZ.test @@ -224,12 +224,12 @@ foreach script { # More tests of Tcl_SourceObjCmd are in source.test test cmdMZ-3.3 {Tcl_SourceObjCmd: error conditions} -constraints { - unixOrPc + unixOrWin } -body { list [catch {source} msg] $msg } -match glob -result {1 {wrong # args: should be "source*fileName"}} test cmdMZ-3.4 {Tcl_SourceObjCmd: error conditions} -constraints { - unixOrPc + unixOrWin } -body { list [catch {source a b} msg] $msg } -match glob -result {1 {wrong # args: should be "source*fileName"}} diff --git a/tests/fCmd.test b/tests/fCmd.test index f53128d..71bc186 100644 --- a/tests/fCmd.test +++ b/tests/fCmd.test @@ -26,6 +26,15 @@ testConstraint winOlderThan2000 0 testConstraint notNetworkFilesystem 0 testConstraint 95or98 [expr {[testConstraint 95] || [testConstraint 98]}] testConstraint 2000orNewer [expr {![testConstraint 95or98]}] +testConstraint reg 0 +if {[testConstraint win]} { + if {![catch { + ::tcltest::loadTestedCommands + set ::regver [package require registry 1.3.3] + }]} { + testConstraint reg 1 + } +} set tmpspace /tmp;# default value # Find a group that exists on this Unix system, or else skip tests that @@ -49,7 +58,7 @@ if {[testConstraint unix]} { } # Also used in winFCmd... -if {[testConstraint winOnly]} { +if {[testConstraint win]} { if {[testConstraint nt] && $::tcl_platform(osVersion) >= 5.0} { if {$::tcl_platform(osVersion) >= 6.0} { testConstraint winVista 1 @@ -259,7 +268,7 @@ test fCmd-3.14 {FileCopyRename: FileBasename fails} -setup { } -result {user "_totally_bogus_user" doesn't exist} test fCmd-3.15 {FileCopyRename: source[0] == '\0'} -setup { cleanup -} -constraints {notRoot unixOrPc} -returnCodes error -body { +} -constraints {notRoot unixOrWin} -returnCodes error -body { file mkdir td1 file rename / td1 } -result {error renaming "/" to "td1": file already exists} @@ -387,7 +396,7 @@ test fCmd-5.4 {TclFileDeleteCmd: multiple files} {notRoot} { file delete tf1 td1 tf2 lappend x [file exists tf1] [file exists tf2] [file exists tf3] } {1 1 1 0 0 0} -test fCmd-5.5 {TclFileDeleteCmd: stop at first error} {notRoot unixOrPc} { +test fCmd-5.5 {TclFileDeleteCmd: stop at first error} {notRoot unixOrWin} { cleanup createfile tf1 createfile tf2 @@ -1080,7 +1089,7 @@ test fCmd-10.5 {file copy: comprehensive: dir to empty dir} -setup { } -result [subst {{td1 td2 tdd1 tdd2 tdd3 tdd4 tds1 tds2 tds3 tds4} {1 {error copying "td1" to "[file join td2 td1]": file already exists}} {1 {error copying "tds1" to "[file join tdd1 tds1]": file already exists}} 1 1 1}] test fCmd-10.6 {file copy: comprehensive: dir to non-empty dir} -setup { cleanup -} -constraints {notRoot unixOrPc testchmod} -body { +} -constraints {notRoot unixOrWin testchmod} -body { file mkdir tds1 file mkdir tds2 file mkdir [file join tdd1 tds1 xxx] diff --git a/tests/fileName.test b/tests/fileName.test index a4c8efe..3747fc9 100644 --- a/tests/fileName.test +++ b/tests/fileName.test @@ -1116,13 +1116,13 @@ file delete -force $tildeglobname set globname globTest unset horribleglobname tildeglobname -test filename-12.1 {simple globbing} {unixOrPc} { +test filename-12.1 {simple globbing} {unixOrWin} { list [catch {glob {}} msg] $msg } {0 .} -test filename-12.1.1 {simple globbing} {unixOrPc} { +test filename-12.1.1 {simple globbing} {unixOrWin} { list [catch {glob -types f {}} msg] $msg } {1 {no files matched glob pattern ""}} -test filename-12.1.2 {simple globbing} {unixOrPc} { +test filename-12.1.2 {simple globbing} {unixOrWin} { list [catch {glob -types d {}} msg] $msg } {0 .} test filename-12.1.3 {simple globbing} {unix} { @@ -1144,7 +1144,7 @@ test filename-12.3 {simple globbing} { set globPreResult globTest/ set x1 x1.c set y1 y1.c -test filename-12.4 {simple globbing} {unixOrPc} { +test filename-12.4 {simple globbing} {unixOrWin} { lsort [glob globTest/x1.c globTest/y1.c globTest/foo] } "$globPreResult$x1 $globPreResult$y1" test filename-12.5 {simple globbing} { @@ -1231,32 +1231,32 @@ test filename-13.9 {globbing with brace substitution} { test filename-13.10 {globbing with brace substitution} { list [lsort [catch {glob globTest/\{x,,y\}1.c} msg]] $msg } [list 0 [list $globPreResult$x1 $globPreResult$y1]] -test filename-13.11 {globbing with brace substitution} {unixOrPc} { +test filename-13.11 {globbing with brace substitution} {unixOrWin} { list [lsort [catch {glob globTest/\{x,x\\,z,z\}1.c} msg]] $msg } {0 {globTest/x1.c globTest/x,z1.c globTest/z1.c}} test filename-13.13 {globbing with brace substitution} { lsort [glob globTest/{a,b,x,y}1.c] } [list $globPreResult$x1 $globPreResult$y1] -test filename-13.14 {globbing with brace substitution} {unixOrPc} { +test filename-13.14 {globbing with brace substitution} {unixOrWin} { lsort [glob {globTest/{x1,y2,weird name}.c}] } {{globTest/weird name.c} globTest/x1.c} -test filename-13.16 {globbing with brace substitution} {unixOrPc} { +test filename-13.16 {globbing with brace substitution} {unixOrWin} { lsort [glob globTest/{x1.c,a1/*}] } {globTest/a1/b1 globTest/a1/b2 globTest/x1.c} -test filename-13.18 {globbing with brace substitution} {unixOrPc} { +test filename-13.18 {globbing with brace substitution} {unixOrWin} { lsort [glob globTest/{x1.c,{a},a1/*}] } {globTest/a1/b1 globTest/a1/b2 globTest/x1.c} -test filename-13.20 {globbing with brace substitution} {unixOrPc} { +test filename-13.20 {globbing with brace substitution} {unixOrWin} { lsort [glob globTest/{a,x}1/*/{x,y}*] } {globTest/a1/b1/x2.c globTest/a1/b2/y2.c} test filename-13.22 {globbing with brace substitution} { list [catch {glob globTest/\{a,x\}1/*/\{} msg] $msg } {1 {unmatched open-brace in file name}} -test filename-14.1 {asterisks, question marks, and brackets} {unixOrPc} { +test filename-14.1 {asterisks, question marks, and brackets} {unixOrWin} { lsort [glob glo*/*.c] } {{globTest/weird name.c} globTest/x,z1.c globTest/x1.c globTest/y1.c globTest/z1.c} -test filename-14.3 {asterisks, question marks, and brackets} {unixOrPc} { +test filename-14.3 {asterisks, question marks, and brackets} {unixOrWin} { lsort [glob globTest/?1.c] } {globTest/x1.c globTest/y1.c globTest/z1.c} @@ -1266,7 +1266,7 @@ file rename globTest [file join globTestContext globTest] set savepwd [pwd] cd globTestContext -test filename-14.5 {asterisks, question marks, and brackets} {unixOrPc} { +test filename-14.5 {asterisks, question marks, and brackets} {unixOrWin} { lsort [glob */*/*/*.c] } {globTest/a1/b1/x2.c globTest/a1/b2/y2.c} @@ -1281,16 +1281,16 @@ test filename-14.7 {asterisks, question marks, and brackets} {unix} { test filename-14.7.1 {asterisks, question marks, and brackets} {win} { lsort [glob globTest/*] } {globTest/.1 globTest/a1 globTest/a2 globTest/a3 {globTest/weird name.c} globTest/x,z1.c globTest/x1.c globTest/y1.c globTest/z1.c} -test filename-14.9 {asterisks, question marks, and brackets} {unixOrPc} { +test filename-14.9 {asterisks, question marks, and brackets} {unixOrWin} { lsort [glob globTest/.*] } {globTest/. globTest/.. globTest/.1} -test filename-14.11 {asterisks, question marks, and brackets} {unixOrPc} { +test filename-14.11 {asterisks, question marks, and brackets} {unixOrWin} { lsort [glob globTest/*/*] } {globTest/a1/b1 globTest/a1/b2 globTest/a2/b3} -test filename-14.13 {asterisks, question marks, and brackets} {unixOrPc} { +test filename-14.13 {asterisks, question marks, and brackets} {unixOrWin} { lsort [glob {globTest/[xyab]1.*}] } {globTest/x1.c globTest/y1.c} -test filename-14.15 {asterisks, question marks, and brackets} {unixOrPc} { +test filename-14.15 {asterisks, question marks, and brackets} {unixOrWin} { lsort [glob globTest/*/] } {globTest/a1/ globTest/a2/ globTest/a3/} test filename-14.17 {asterisks, question marks, and brackets} { @@ -1301,7 +1301,7 @@ test filename-14.17 {asterisks, question marks, and brackets} { set env(HOME) $temp set result } [list 0 [list [file join $env(HOME) globTest z1.c]]] -test filename-14.18 {asterisks, question marks, and brackets} {unixOrPc} { +test filename-14.18 {asterisks, question marks, and brackets} {unixOrWin} { list [catch {lsort [glob globTest/*.c goo/*]} msg] $msg } {0 {{globTest/weird name.c} globTest/x,z1.c globTest/x1.c globTest/y1.c globTest/z1.c}} test filename-14.20 {asterisks, question marks, and brackets} { @@ -1340,16 +1340,16 @@ test filename-14.25.1 {type specific globbing} {win} { test filename-14.26 {type specific globbing} { list [catch {glob -nocomplain -dir globTest -types {readonly} *} msg] $msg } [list 0 {}] -test filename-14.27 {Bug 2710920} {unixOrPc} { +test filename-14.27 {Bug 2710920} {unixOrWin} { file tail [lindex [lsort [glob globTest/*/]] 0] } a1 -test filename-14.28 {Bug 2710920} {unixOrPc} { +test filename-14.28 {Bug 2710920} {unixOrWin} { file dirname [lindex [lsort [glob globTest/*/]] 0] } globTest -test filename-14.29 {Bug 2710920} {unixOrPc} { +test filename-14.29 {Bug 2710920} {unixOrWin} { file extension [lindex [lsort [glob globTest/*/]] 0] } {} -test filename-14.30 {Bug 2710920} {unixOrPc} { +test filename-14.30 {Bug 2710920} {unixOrWin} { file rootname [lindex [lsort [glob globTest/*/]] 0] } globTest/a1/ @@ -1406,7 +1406,7 @@ test filename-15.4.1 {no complain: errors, sequencing} { } {1 {user "wontexist" doesn't exist} 1 {user "blahxyz" doesn't exist}} test filename-15.4.2 {no complain: errors, sequencing} { # test used to fail because if an error occurs, the interp's result - # is reset... + # is reset... string equal \ [list [catch {glob -nocomplain ~wontexist *} res1] $res1] \ [list [catch {glob -nocomplain * ~wontexist} res2] $res2] @@ -1414,7 +1414,7 @@ test filename-15.4.2 {no complain: errors, sequencing} { test filename-15.5 {unix specific globbing} {unix nonPortable} { glob ~ouster/.csh* } "/home/ouster/.cshrc" -catch {close [open globTest/odd\\\[\]*?\{\}name w]} +catch {close [open globTest/odd\\\[\]*?\{\}name w]} test filename-15.6 {unix specific globbing} {unix} { global env set temp $env(HOME) diff --git a/tests/interp.test b/tests/interp.test index 510ab4a..b5632e1 100644 --- a/tests/interp.test +++ b/tests/interp.test @@ -53,7 +53,7 @@ test interp-1.8 {options for interp command} { } {1 {bad option "-froboz": must be alias, aliases, bgerror, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, slaves, share, target, or transfer}} test interp-1.9 {options for interp command} { list [catch {interp -froboz -safe} msg] $msg -} {1 {bad option "-froboz": must be alias, aliases, bgerror, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, slaves, share, target, or transfer}} +} {1 {bad option "-froboz": must be alias, aliases, bgerror, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, slaves, share, target, or transfer}} test interp-1.10 {options for interp command} { list [catch {interp target} msg] $msg } {1 {wrong # args: should be "interp target path alias"}} @@ -68,7 +68,7 @@ test interp-2.2 {basic interpreter creation} { } 0 test interp-2.3 {basic interpreter creation} { catch {interp create -safe} -} 0 +} 0 test interp-2.4 {basic interpreter creation} { list [catch {interp create a} msg] $msg } {1 {interpreter named "a" already exists, cannot create}} @@ -100,7 +100,7 @@ test interp-2.11 {anonymous interps vs existing procs} { set x [interp create] regexp "interp(\[0-9]+)" $x dummy anothernum expr $anothernum > $thenum -} 1 +} 1 test interp-2.12 {anonymous interps vs existing procs} { set x [interp create -safe] regexp "interp(\[0-9]+)" $x dummy thenum @@ -109,11 +109,11 @@ test interp-2.12 {anonymous interps vs existing procs} { set x [interp create -safe] regexp "interp(\[0-9]+)" $x dummy anothernum expr $anothernum - $thenum -} 1 +} 1 test interp-2.13 {correct default when no $path arg is given} -body { interp create -- } -match regexp -result {interp[0-9]+} - + foreach i [interp slaves] { interp delete $i } @@ -854,12 +854,12 @@ test interp-18.9 {eval in deleted interp, bug 495830} { interp create tst interp alias tst suicide {} interp delete tst list [catch {tst eval {suicide; set a 5}} msg] $msg -} {1 {attempt to call eval in deleted interpreter}} +} {1 {attempt to call eval in deleted interpreter}} test interp-18.10 {eval in deleted interp, bug 495830} { interp create tst interp alias tst suicide {} interp delete tst list [catch {tst eval {set set set; suicide; $set a 5}} msg] $msg -} {1 {attempt to call eval in deleted interpreter}} +} {1 {attempt to call eval in deleted interpreter}} # Test alias deletion @@ -949,7 +949,7 @@ test interp-19.9 {alias deletion, renaming} { set l [interp eval a foo] interp delete a set l -} 1156 +} 1156 test interp-20.1 {interp hide, interp expose and interp invokehidden} { set a [interp create] @@ -1170,7 +1170,7 @@ test interp-20.21 {interp hide vs safety} { catch {interp delete a} interp create a -safe set l "" - lappend l [catch {a hide list} msg] + lappend l [catch {a hide list} msg] lappend l $msg interp delete a set l @@ -1179,7 +1179,7 @@ test interp-20.22 {interp hide vs safety} { catch {interp delete a} interp create a -safe set l "" - lappend l [catch {interp hide a list} msg] + lappend l [catch {interp hide a list} msg] lappend l $msg interp delete a set l @@ -1188,7 +1188,7 @@ test interp-20.23 {interp hide vs safety} { catch {interp delete a} interp create a -safe set l "" - lappend l [catch {a eval {interp hide {} list}} msg] + lappend l [catch {a eval {interp hide {} list}} msg] lappend l $msg interp delete a set l @@ -1198,7 +1198,7 @@ test interp-20.24 {interp hide vs safety} { interp create a -safe interp create {a b} set l "" - lappend l [catch {a eval {interp hide b list}} msg] + lappend l [catch {a eval {interp hide b list}} msg] lappend l $msg interp delete a set l @@ -1217,7 +1217,7 @@ test interp-20.26 {interp expoose vs safety} { catch {interp delete a} interp create a -safe set l "" - lappend l [catch {a hide list} msg] + lappend l [catch {a hide list} msg] lappend l $msg lappend l [catch {a expose list} msg] lappend l $msg @@ -1228,9 +1228,9 @@ test interp-20.27 {interp expose vs safety} { catch {interp delete a} interp create a -safe set l "" - lappend l [catch {interp hide a list} msg] + lappend l [catch {interp hide a list} msg] lappend l $msg - lappend l [catch {interp expose a list} msg] + lappend l [catch {interp expose a list} msg] lappend l $msg interp delete a set l @@ -1239,7 +1239,7 @@ test interp-20.28 {interp expose vs safety} { catch {interp delete a} interp create a -safe set l "" - lappend l [catch {a hide list} msg] + lappend l [catch {a hide list} msg] lappend l $msg lappend l [catch {a eval {interp expose {} list}} msg] lappend l $msg @@ -1250,9 +1250,9 @@ test interp-20.29 {interp expose vs safety} { catch {interp delete a} interp create a -safe set l "" - lappend l [catch {interp hide a list} msg] + lappend l [catch {interp hide a list} msg] lappend l $msg - lappend l [catch {a eval {interp expose {} list}} msg] + lappend l [catch {a eval {interp expose {} list}} msg] lappend l $msg interp delete a set l @@ -1262,9 +1262,9 @@ test interp-20.30 {interp expose vs safety} { interp create a -safe interp create {a b} set l "" - lappend l [catch {interp hide {a b} list} msg] + lappend l [catch {interp hide {a b} list} msg] lappend l $msg - lappend l [catch {a eval {interp expose b list}} msg] + lappend l [catch {a eval {interp expose b list}} msg] lappend l $msg interp delete a set l @@ -1274,7 +1274,7 @@ test interp-20.31 {interp expose vs safety} { interp create a -safe interp create {a b} set l "" - lappend l [catch {interp hide {a b} list} msg] + lappend l [catch {interp hide {a b} list} msg] lappend l $msg lappend l [catch {interp expose {a b} list} msg] lappend l $msg @@ -1631,7 +1631,7 @@ test interp-21.5 {interp hidden} { set l [lsort [interp hidden a]] interp delete a set l -} $hidden_cmds +} $hidden_cmds test interp-21.6 {interp hidden vs interp hide, interp expose} { catch {interp delete a} interp create a @@ -1786,7 +1786,7 @@ test interp-23.1 {testing hiding vs aliases} { interp delete a set l } {{} bar {} bar bar {} {}} -test interp-23.2 {testing hiding vs aliases} {unixOrPc} { +test interp-23.2 {testing hiding vs aliases} {unixOrWin} { catch {interp delete a} interp create a -safe set l "" @@ -1802,7 +1802,7 @@ test interp-23.2 {testing hiding vs aliases} {unixOrPc} { lappend l [lsort [interp hidden a]] interp delete a set l -} {{cd encoding exec exit fconfigure file glob load open pwd socket source unload} {::tcl::mathfunc::max ::tcl::mathfunc::min bar clock} {cd encoding exec exit fconfigure file glob load open pwd socket source unload} {::tcl::mathfunc::max ::tcl::mathfunc::min bar clock} {bar cd encoding exec exit fconfigure file glob load open pwd socket source unload} {::tcl::mathfunc::max ::tcl::mathfunc::min clock} {cd encoding exec exit fconfigure file glob load open pwd socket source unload}} +} {{cd encoding exec exit fconfigure file glob load open pwd socket source unload} {::tcl::mathfunc::max ::tcl::mathfunc::min bar clock} {cd encoding exec exit fconfigure file glob load open pwd socket source unload} {::tcl::mathfunc::max ::tcl::mathfunc::min bar clock} {bar cd encoding exec exit fconfigure file glob load open pwd socket source unload} {::tcl::mathfunc::max ::tcl::mathfunc::min clock} {cd encoding exec exit fconfigure file glob load open pwd socket source unload}} test interp-24.1 {result resetting on error} { catch {interp delete a} @@ -2045,7 +2045,7 @@ test interp-26.1 {result code transmission : interp eval direct} { # Test that all the possibles error codes from Tcl get passed up # from the slave interp's context to the master, even though the # slave nominally thinks the command is running at the root level. - + catch {interp delete a} interp create a set res {} @@ -2076,7 +2076,7 @@ test interp-26.3 {result code transmission : aliases} { # Test that all the possibles error codes from Tcl get passed up # from the slave interp's context to the master, even though the # slave nominally thinks the command is running at the root level. - + catch {interp delete a} interp create a set res {} @@ -2193,7 +2193,7 @@ test interp-26.8 {errorInfo transmission: safe interps--bug 1637} {knownBug} { test interp-27.1 {interp aliases & namespaces} { set i [interp create]; set aliasTrace {}; - proc tstAlias {args} { + proc tstAlias {args} { global aliasTrace; lappend aliasTrace [list [namespace current] $args]; } @@ -2206,7 +2206,7 @@ test interp-27.1 {interp aliases & namespaces} { test interp-27.2 {interp aliases & namespaces} { set i [interp create]; set aliasTrace {}; - proc tstAlias {args} { + proc tstAlias {args} { global aliasTrace; lappend aliasTrace [list [namespace current] $args]; } @@ -2219,7 +2219,7 @@ test interp-27.2 {interp aliases & namespaces} { test interp-27.3 {interp aliases & namespaces} { set i [interp create]; set aliasTrace {}; - proc tstAlias {args} { + proc tstAlias {args} { global aliasTrace; lappend aliasTrace [list [namespace current] $args]; } @@ -2234,7 +2234,7 @@ test interp-27.4 {interp aliases & namespaces} { set i [interp create]; namespace eval foo2 { variable aliasTrace {}; - proc bar {args} { + proc bar {args} { variable aliasTrace; lappend aliasTrace [list [namespace current] $args]; } @@ -3206,7 +3206,7 @@ test interp-34.9 {time limits trigger in blocking after} { } msg] set t1 [clock seconds] interp delete $i - list $code $msg [expr {($t1-$t0) < 3 ? "OK" : $t1-$t0}] + list $code $msg [expr {($t1-$t0) < 3 ? "OK" : $t1-$t0}] } {1 {time limit exceeded} OK} test interp-34.10 {time limits trigger in vwaits: Bug 1221395} -body { set i [interp create] @@ -3440,7 +3440,7 @@ test interp-35.24 {interp time limits can't touch current interp} -body { test interp-36.1 {interp bgerror syntax} -body { interp bgerror } -returnCodes error -result {wrong # args: should be "interp bgerror path ?cmdPrefix?"} -test interp-36.2 {interp bgerror syntax} -body { +test interp-36.2 {interp bgerror syntax} -body { interp bgerror x y z } -returnCodes error -result {wrong # args: should be "interp bgerror path ?cmdPrefix?"} test interp-36.3 {interp bgerror syntax} -setup { diff --git a/tests/io.test b/tests/io.test index 13ff38c..4257d51 100644 --- a/tests/io.test +++ b/tests/io.test @@ -2208,7 +2208,7 @@ test io-27.4 {FlushChannel, implicit flush when buffer fills} { set l } {0 60 72} test io-27.5 {FlushChannel, implicit flush when buffer fills and on close} \ - {unixOrPc} { + {unixOrWin} { file delete $path(test1) set f [open $path(test1) w] fconfigure $f -translation lf -buffersize 60 -eofchar {} @@ -8102,7 +8102,7 @@ test io-57.2 {buffered data and file events, read} {fileevent} { set result } {1 readable 234567890 timer} -test io-58.1 {Tcl_NotifyChannel and error when closing} {stdio unixOrPc openpipe fileevent} { +test io-58.1 {Tcl_NotifyChannel and error when closing} {stdio unixOrWin openpipe fileevent} { set out [open $path(script) w] puts $out { puts "normal message from pipe" diff --git a/tests/ioCmd.test b/tests/ioCmd.test index 460299b..c3893bc 100644 --- a/tests/ioCmd.test +++ b/tests/ioCmd.test @@ -265,7 +265,7 @@ removeFile fconfigure.dummy test iocmd-8.14 {fconfigure command} { fconfigure stdin -buffers } 4096 -test iocmd-8.15.1 {fconfigure command / tcp channel} -constraints {socket unixOrPc} -setup { +test iocmd-8.15.1 {fconfigure command / tcp channel} -constraints {socket unixOrWin} -setup { set srv [socket -server iocmdSRV -myaddr 127.0.0.1 0] set port [lindex [fconfigure $srv -sockname] 2] proc iocmdSRV {sock ip port} {close $sock} @@ -367,18 +367,18 @@ test iocmd-10.5 {fblocked command} { set path(test4) [makeFile {} test4] set path(test5) [makeFile {} test5] -test iocmd-11.1 {I/O to command pipelines} {unixOrPc unixExecs} { +test iocmd-11.1 {I/O to command pipelines} {unixOrWin unixExecs} { set f [open $path(test4) w] close $f list [catch {open "| cat < \"$path(test4)\" > \"$path(test5)\"" w} msg] $msg $::errorCode } {1 {can't write input to command: standard input was redirected} NONE} -test iocmd-11.2 {I/O to command pipelines} {unixOrPc unixExecs} { +test iocmd-11.2 {I/O to command pipelines} {unixOrWin unixExecs} { list [catch {open "| echo > \"$path(test5)\"" r} msg] $msg $::errorCode } {1 {can't read output from command: standard output was redirected} NONE} -test iocmd-11.3 {I/O to command pipelines} {unixOrPc unixExecs} { +test iocmd-11.3 {I/O to command pipelines} {unixOrWin unixExecs} { list [catch {open "| echo > \"$path(test5)\"" r+} msg] $msg $::errorCode } {1 {can't read output from command: standard output was redirected} NONE} -test iocmd-11.4 {I/O to command pipelines} unixOrPc { +test iocmd-11.4 {I/O to command pipelines} unixOrWin { list [catch {open "| no_such_command_exists" rb} msg] $msg $::errorCode } {1 {couldn't execute "no_such_command_exists": no such file or directory} {POSIX ENOENT {no such file or directory}}} diff --git a/tests/pid.test b/tests/pid.test index d21dbaa..af21f30 100644 --- a/tests/pid.test +++ b/tests/pid.test @@ -21,7 +21,7 @@ testConstraint pidDefined [llength [info commands pid]] test pid-1.1 {pid command} pidDefined { regexp {(^[0-9]+$)|(^0x[0-9a-fA-F]+$)} [pid] } 1 -test pid-1.2 {pid command} -constraints {unixOrPc unixExecs pidDefined} -setup { +test pid-1.2 {pid command} -constraints {unixOrWin unixExecs pidDefined} -setup { set path(test1) [makeFile {} test1] file delete $path(test1) } -body { diff --git a/tests/registry.test b/tests/registry.test index 539ba2d..9691b3e 100644 --- a/tests/registry.test +++ b/tests/registry.test @@ -242,7 +242,7 @@ test registry-4.2 {GetKeyNames} {win reg} { registry delete HKEY_CURRENT_USER\\TclFoobar set result } {baz} -test registry-4.3 {GetKeyNames: remote key} {win reg nonPortable english} { +test registry-4.3 {GetKeyNames: remote key} {win reg english} { set hostname [info hostname] registry set \\\\$hostname\\HKEY_CURRENT_USER\\TclFoobar\\baz set result [registry keys \\\\gaspode\\HKEY_CURRENT_USER\\TclFoobar] @@ -535,7 +535,7 @@ test registry-7.3 {GetValueNames} -constraints {win reg} -setup { } -cleanup { registry delete HKEY_CURRENT_USER\\TclFoobar } -result {{} baz blat} -test registry-7.4 {GetValueNames: remote key} -constraints {win reg nonPortable english} -body { +test registry-7.4 {GetValueNames: remote key} -constraints {win reg english} -body { set hostname [info hostname] registry set \\\\$hostname\\HKEY_CURRENT_USER\\TclFoobar baz blat set result [registry values \\\\$hostname\\HKEY_CURRENT_USER\\TclFoobar] @@ -571,7 +571,7 @@ test registry-7.7 {GetValueNames: names with spaces} -constraints {win reg} -set registry delete HKEY_CURRENT_USER\\TclFoobar } -result {{baz bar} blat} -test registry-8.1 {OpenSubKey} -constraints {win reg nonPortable english} \ +test registry-8.1 {OpenSubKey} -constraints {win reg english} \ -body { # This test will only succeed if the current user does not have # registry access on the specified machine. @@ -657,7 +657,7 @@ test registry-11.2 {SetValue: modification} -constraints {win reg} \ set result [registry get HKEY_CURRENT_USER\\TclFoobar\\baz blat] } -result {frob} test registry-11.3 {SetValue: failure} \ - -constraints {win reg nonPortable english} \ + -constraints {win reg english} \ -body { # This test will only succeed if the current user does not have # registry access on the specified machine. diff --git a/tests/socket.test b/tests/socket.test index 2fb8988..3544dd9 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -949,7 +949,7 @@ test socket-7.4 {testing socket specific options} {socket} { set l "" lappend l [expr {[lindex $x 2] == $listen}] [llength $x] } {1 3} -test socket-7.5 {testing socket specific options} {socket unixOrPc} { +test socket-7.5 {testing socket specific options} {socket unixOrWin} { set s [socket -server accept 0] proc accept {s a p} { global x diff --git a/tests/tcltest.test b/tests/tcltest.test index ca720ee..c856209 100644 --- a/tests/tcltest.test +++ b/tests/tcltest.test @@ -98,44 +98,44 @@ proc slave {msgVar args} { } return $code } -test tcltest-2.0 {tcltest (verbose default - 'b')} {unixOrPc} { +test tcltest-2.0 {tcltest (verbose default - 'b')} {unixOrWin} { set result [slave msg test.tcl] list $result [regexp "Contents of test case" $msg] [regexp a-1.0 $msg] \ [regexp c-1.0 $msg] \ [regexp "Total.+4.+Passed.+1.+Skipped.+1.+Failed.+2" $msg] } {0 1 0 0 1} -test tcltest-2.1 {tcltest -verbose 'b'} {unixOrPc} { +test tcltest-2.1 {tcltest -verbose 'b'} {unixOrWin} { set result [slave msg test.tcl -verbose 'b'] list $result [regexp "Contents of test case" $msg] [regexp a-1.0 $msg] \ [regexp c-1.0 $msg] \ [regexp "Total.+4.+Passed.+1.+Skipped.+1.+Failed.+2" $msg] } {0 1 0 0 1} -test tcltest-2.2 {tcltest -verbose 'p'} {unixOrPc} { +test tcltest-2.2 {tcltest -verbose 'p'} {unixOrWin} { set result [slave msg test.tcl -verbose 'p'] list $result [regexp "Contents of test case" $msg] [regexp a-1.0 $msg] \ [regexp c-1.0 $msg] \ [regexp "Total.+4.+Passed.+1.+Skipped.+1.+Failed.+2" $msg] } {0 0 1 0 1} -test tcltest-2.3 {tcltest -verbose 's'} {unixOrPc} { +test tcltest-2.3 {tcltest -verbose 's'} {unixOrWin} { set result [slave msg test.tcl -verbose 's'] list $result [regexp "Contents of test case" $msg] [regexp a-1.0 $msg] \ [regexp c-1.0 $msg] \ [regexp "Total.+4.+Passed.+1.+Skipped.+1.+Failed.+2" $msg] } {0 0 0 1 1} -test tcltest-2.4 {tcltest -verbose 'ps'} {unixOrPc} { +test tcltest-2.4 {tcltest -verbose 'ps'} {unixOrWin} { set result [slave msg test.tcl -verbose 'ps'] list $result [regexp "Contents of test case" $msg] [regexp a-1.0 $msg] \ [regexp c-1.0 $msg] \ [regexp "Total.+4.+Passed.+1.+Skipped.+1.+Failed.+2" $msg] } {0 0 1 1 1} -test tcltest-2.5 {tcltest -verbose 'psb'} {unixOrPc} { +test tcltest-2.5 {tcltest -verbose 'psb'} {unixOrWin} { set result [slave msg test.tcl -verbose 'psb'] list $result [regexp "Contents of test case" $msg] [regexp a-1.0 $msg] \ [regexp c-1.0 $msg] \ [regexp "Total.+4.+Passed.+1.+Skipped.+1.+Failed.+2" $msg] } {0 1 1 1 1} -test tcltest-2.5a {tcltest -verbose 'pass skip body'} {unixOrPc} { +test tcltest-2.5a {tcltest -verbose 'pass skip body'} {unixOrWin} { set result [slave msg test.tcl -verbose "pass skip body"] list $result [regexp "Contents of test case" $msg] [regexp a-1.0 $msg] \ [regexp c-1.0 $msg] \ @@ -143,7 +143,7 @@ test tcltest-2.5a {tcltest -verbose 'pass skip body'} {unixOrPc} { } {0 1 1 1 1} test tcltest-2.6 {tcltest -verbose 't'} { - -constraints {unixOrPc} + -constraints {unixOrWin} -body { set result [slave msg test.tcl -verbose 't'] list $result $msg @@ -153,7 +153,7 @@ test tcltest-2.6 {tcltest -verbose 't'} { } test tcltest-2.6a {tcltest -verbose 'start'} { - -constraints {unixOrPc} + -constraints {unixOrWin} -body { set result [slave msg test.tcl -verbose start] list $result $msg @@ -176,7 +176,7 @@ test tcltest-2.7 {tcltest::verbose} { } test tcltest-2.8 {tcltest -verbose 'error'} { - -constraints {unixOrPc} + -constraints {unixOrWin} -body { set result [slave msg test.tcl -verbose error] list $result $msg @@ -185,22 +185,22 @@ test tcltest-2.8 {tcltest -verbose 'error'} { -match regexp } # -match, [match] -test tcltest-3.1 {tcltest -match 'a*'} {unixOrPc} { +test tcltest-3.1 {tcltest -match 'a*'} {unixOrWin} { set result [slave msg test.tcl -match a* -verbose 'ps'] list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \ [regexp "Total.+4.+Passed.+1.+Skipped.+3.+Failed.+0" $msg] } {0 1 0 0 1} -test tcltest-3.2 {tcltest -match 'b*'} {unixOrPc} { +test tcltest-3.2 {tcltest -match 'b*'} {unixOrWin} { set result [slave msg test.tcl -match b* -verbose 'ps'] list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \ [regexp "Total.+4.+Passed.+0.+Skipped.+3.+Failed.+1" $msg] } {0 0 1 0 1} -test tcltest-3.3 {tcltest -match 'c*'} {unixOrPc} { +test tcltest-3.3 {tcltest -match 'c*'} {unixOrWin} { set result [slave msg test.tcl -match c* -verbose 'ps'] list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \ [regexp "Total.+4.+Passed.+0.+Skipped.+4.+Failed.+0" $msg] } {0 0 0 1 1} -test tcltest-3.4 {tcltest -match 'a* b*'} {unixOrPc} { +test tcltest-3.4 {tcltest -match 'a* b*'} {unixOrWin} { set result [slave msg test.tcl -match {a* b*} -verbose 'ps'] list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \ [regexp "Total.+4.+Passed.+1.+Skipped.+2.+Failed.+1" $msg] @@ -220,27 +220,27 @@ test tcltest-3.5 {tcltest::match} { } # -skip, [skip] -test tcltest-4.1 {tcltest -skip 'a*'} {unixOrPc} { +test tcltest-4.1 {tcltest -skip 'a*'} {unixOrWin} { set result [slave msg test.tcl -skip a* -verbose 'ps'] list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \ [regexp "Total.+4.+Passed.+0.+Skipped.+2.+Failed.+1" $msg] } {0 0 1 1 1} -test tcltest-4.2 {tcltest -skip 'b*'} {unixOrPc} { +test tcltest-4.2 {tcltest -skip 'b*'} {unixOrWin} { set result [slave msg test.tcl -skip b* -verbose 'ps'] list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \ [regexp "Total.+4.+Passed.+1.+Skipped.+2.+Failed.+1" $msg] } {0 1 0 1 1} -test tcltest-4.3 {tcltest -skip 'c*'} {unixOrPc} { +test tcltest-4.3 {tcltest -skip 'c*'} {unixOrWin} { set result [slave msg test.tcl -skip c* -verbose 'ps'] list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \ [regexp "Total.+4.+Passed.+1.+Skipped.+1.+Failed.+2" $msg] } {0 1 1 0 1} -test tcltest-4.4 {tcltest -skip 'a* b*'} {unixOrPc} { +test tcltest-4.4 {tcltest -skip 'a* b*'} {unixOrWin} { set result [slave msg test.tcl -skip {a* b*} -verbose 'ps'] list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \ [regexp "Total.+4.+Passed.+0.+Skipped.+3.+Failed.+1" $msg] } {0 0 0 1 1} -test tcltest-4.5 {tcltest -match 'a* b*' -skip 'b*'} {unixOrPc} { +test tcltest-4.5 {tcltest -match 'a* b*' -skip 'b*'} {unixOrWin} { set result [slave msg test.tcl -match {a* b*} -skip b* -verbose 'ps'] list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \ [regexp "Total.+4.+Passed.+1.+Skipped.+3.+Failed.+0" $msg] @@ -261,12 +261,12 @@ test tcltest-4.6 {tcltest::skip} { # -constraints, -limitconstraints, [testConstraint], # $constraintsSpecified, [limitConstraints] -test tcltest-5.1 {tcltest -constraints 'knownBug'} {unixOrPc} { +test tcltest-5.1 {tcltest -constraints 'knownBug'} {unixOrWin} { set result [slave msg test.tcl -constraints knownBug -verbose 'ps'] list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \ [regexp "Total.+4.+Passed.+2.+Skipped.+0.+Failed.+2" $msg] } {0 1 1 1 1} -test tcltest-5.2 {tcltest -constraints 'knownBug' -limitconstraints 1} {unixOrPc} { +test tcltest-5.2 {tcltest -constraints 'knownBug' -limitconstraints 1} {unixOrWin} { set result [slave msg test.tcl -constraints knownBug -verbose 'p' -limitconstraints 1] list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \ [regexp "Total.+4.+Passed.+1.+Skipped.+3.+Failed.+0" $msg] @@ -355,7 +355,7 @@ set printerror [makeFile { } printerror.tcl] test tcltest-6.1 {tcltest -outfile, -errfile defaults} { - -constraints unixOrPc + -constraints unixOrWin -body { slave msg $printerror return $msg @@ -363,21 +363,21 @@ test tcltest-6.1 {tcltest -outfile, -errfile defaults} { -result {a test.*a really} -match regexp } -test tcltest-6.2 {tcltest -outfile a.tmp} {unixOrPc unixExecs} { +test tcltest-6.2 {tcltest -outfile a.tmp} {unixOrWin unixExecs} { slave msg $printerror -outfile a.tmp set result1 [catch {exec grep "a test" a.tmp}] set result2 [catch {exec grep "a really" a.tmp}] list [regexp "a test" $msg] [regexp "a really" $msg] \ $result1 $result2 [file exists a.tmp] [file delete a.tmp] } {0 1 0 1 1 {}} -test tcltest-6.3 {tcltest -errfile a.tmp} {unixOrPc unixExecs} { +test tcltest-6.3 {tcltest -errfile a.tmp} {unixOrWin unixExecs} { slave msg $printerror -errfile a.tmp set result1 [catch {exec grep "a test" a.tmp}] set result2 [catch {exec grep "a really" a.tmp}] list [regexp "a test" $msg] [regexp "a really" $msg] \ $result1 $result2 [file exists a.tmp] [file delete a.tmp] } {1 0 1 0 1 {}} -test tcltest-6.4 {tcltest -outfile a.tmp -errfile b.tmp} {unixOrPc unixExecs} { +test tcltest-6.4 {tcltest -outfile a.tmp -errfile b.tmp} {unixOrWin unixExecs} { slave msg $printerror -outfile a.tmp -errfile b.tmp set result1 [catch {exec grep "a test" a.tmp}] set result2 [catch {exec grep "a really" b.tmp}] @@ -464,25 +464,25 @@ test tcltest-6.8 {tcltest::outputFile (implicit outputFile)} { # Must use child processes to test -debug because it always writes # messages to stdout, and we have no way to capture stdout of a # slave interp -test tcltest-7.1 {tcltest test.tcl -debug 0} {unixOrPc} { +test tcltest-7.1 {tcltest test.tcl -debug 0} {unixOrWin} { catch {exec [interpreter] test.tcl -debug 0} msg regexp "Flags passed into tcltest" $msg } {0} -test tcltest-7.2 {tcltest test.tcl -debug 1} {unixOrPc} { +test tcltest-7.2 {tcltest test.tcl -debug 1} {unixOrWin} { catch {exec [interpreter] test.tcl -debug 1 -skip b*} msg list [regexp userSpecifiedSkip $msg] \ [regexp "Flags passed into tcltest" $msg] } {1 0} -test tcltest-7.3 {tcltest test.tcl -debug 1} {unixOrPc} { +test tcltest-7.3 {tcltest test.tcl -debug 1} {unixOrWin} { catch {exec [interpreter] test.tcl -debug 1 -match b*} msg list [regexp userSpecifiedNonMatch $msg] \ [regexp "Flags passed into tcltest" $msg] } {1 0} -test tcltest-7.4 {tcltest test.tcl -debug 2} {unixOrPc} { +test tcltest-7.4 {tcltest test.tcl -debug 2} {unixOrWin} { catch {exec [interpreter] test.tcl -debug 2} msg list [regexp "Flags passed into tcltest" $msg] [regexp "Running" $msg] } {1 0} -test tcltest-7.5 {tcltest test.tcl -debug 3} {unixOrPc} { +test tcltest-7.5 {tcltest test.tcl -debug 3} {unixOrWin} { catch {exec [interpreter] test.tcl -debug 3} msg list [regexp "Flags passed into tcltest" $msg] [regexp "Running" $msg] } {1 1} @@ -522,7 +522,7 @@ set normaldirectory [makeDirectory normaldirectory] normalizePath normaldirectory # -tmpdir, [temporaryDirectory] -test tcltest-8.1 {tcltest a.tcl -tmpdir a} -constraints unixOrPc -setup { +test tcltest-8.1 {tcltest a.tcl -tmpdir a} -constraints unixOrWin -setup { file delete -force thisdirectorydoesnotexist } -body { slave msg $a -tmpdir thisdirectorydoesnotexist @@ -531,7 +531,7 @@ test tcltest-8.1 {tcltest a.tcl -tmpdir a} -constraints unixOrPc -setup { file delete -force thisdirectorydoesnotexist } -result 1 test tcltest-8.2 {tcltest a.tcl -tmpdir thisdirectoryisafile} { - -constraints unixOrPc + -constraints unixOrWin -body { slave msg $a -tmpdir $tdiaf return $msg @@ -572,7 +572,7 @@ testConstraint notFAT [expr { }] # FAT/NTFS permissions are fairly hopeless; ignore this test if that FS is used test tcltest-8.4 {tcltest a.tcl -tmpdir notWriteableDir} { - -constraints {unixOrPc notRoot notFAT} + -constraints {unixOrWin notRoot notFAT} -body { slave msg $a -tmpdir $notWriteableDir return $msg @@ -581,7 +581,7 @@ test tcltest-8.4 {tcltest a.tcl -tmpdir notWriteableDir} { -match glob } test tcltest-8.5 {tcltest a.tcl -tmpdir normaldirectory} { - -constraints unixOrPc + -constraints unixOrWin -body { slave msg $a -tmpdir $normaldirectory # The join is necessary because the message can be split on multiple @@ -624,7 +624,7 @@ test tcltest-8.6a {temporaryDirectory - test format 2} -setup { cd [temporaryDirectory] # -testdir, [testsDirectory] test tcltest-8.10 {tcltest a.tcl -testdir thisdirectorydoesnotexist} { - -constraints unixOrPc + -constraints unixOrWin -setup { file delete -force thisdirectorydoesnotexist } @@ -636,7 +636,7 @@ test tcltest-8.10 {tcltest a.tcl -testdir thisdirectorydoesnotexist} { -result {*does not exist*} } test tcltest-8.11 {tcltest a.tcl -testdir thisdirectoryisafile} { - -constraints unixOrPc + -constraints unixOrWin -body { slave msg $a -testdir $tdiaf return $msg @@ -654,7 +654,7 @@ test tcltest-8.12 {tcltest a.tcl -testdir notReadableDir} { -result {*not readable*} } test tcltest-8.13 {tcltest a.tcl -testdir normaldirectory} { - -constraints unixOrPc + -constraints unixOrWin -body { slave msg $a -testdir $normaldirectory # The join is necessary because the message can be split on multiple @@ -731,7 +731,7 @@ removeFile thisdirectoryisafile removeDirectory normaldirectory # -file, -notfile, [matchFiles], [skipFiles] -test tcltest-9.1 {-file d*.tcl} -constraints {unixOrPc} -setup { +test tcltest-9.1 {-file d*.tcl} -constraints {unixOrWin} -setup { set old [testsDirectory] testsDirectory [file dirname [info script]] } -body { @@ -741,7 +741,7 @@ test tcltest-9.1 {-file d*.tcl} -constraints {unixOrPc} -setup { testsDirectory $old } -match regexp -result {dstring\.test} -test tcltest-9.2 {-file d*.tcl} -constraints {unixOrPc} -setup { +test tcltest-9.2 {-file d*.tcl} -constraints {unixOrWin} -setup { set old [testsDirectory] testsDirectory [file dirname [info script]] } -body { @@ -806,23 +806,23 @@ set mc [makeFile { } makecore.tcl] cd [temporaryDirectory] -test tcltest-10.1 {-preservecore 0} {unixOrPc} { +test tcltest-10.1 {-preservecore 0} {unixOrWin} { slave msg $mc -preservecore 0 file delete core regexp "Core file produced" $msg } {0} -test tcltest-10.2 {-preservecore 1} {unixOrPc} { +test tcltest-10.2 {-preservecore 1} {unixOrWin} { slave msg $mc -preservecore 1 file delete core regexp "Core file produced" $msg } {1} -test tcltest-10.3 {-preservecore 2} {unixOrPc} { +test tcltest-10.3 {-preservecore 2} {unixOrWin} { slave msg $mc -preservecore 2 file delete core list [regexp "Core file produced" $msg] [regexp "Moving file to" $msg] \ [regexp "core-" $msg] [file delete core-makecore] } {1 1 1 {}} -test tcltest-10.4 {-preservecore 3} {unixOrPc} { +test tcltest-10.4 {-preservecore 3} {unixOrWin} { slave msg $mc -preservecore 3 file delete core list [regexp "Core file produced" $msg] [regexp "Moving file to" $msg] \ @@ -853,13 +853,13 @@ set contents { } set loadfile [makeFile $contents load.tcl] -test tcltest-12.1 {-load xxx} {unixOrPc} { +test tcltest-12.1 {-load xxx} {unixOrWin} { slave msg $loadfile -load xxx return $msg } {xxx} # Using child process because of -debug usage. -test tcltest-12.2 {-loadfile load.tcl} {unixOrPc} { +test tcltest-12.2 {-loadfile load.tcl} {unixOrWin} { catch {exec [interpreter] $loadfile -debug 2 -loadfile $loadfile} msg list \ [regexp {tcltest} [join [list $msg] [split $msg \n]]] \ @@ -950,7 +950,7 @@ set allfile [makeFile { cd [workingDirectory] test tcltest-14.1 {-singleproc - single process} { - -constraints {unixOrPc} + -constraints {unixOrWin} -body { slave msg $allfile -singleproc 0 -tmpdir [temporaryDirectory] return $msg @@ -960,7 +960,7 @@ test tcltest-14.1 {-singleproc - single process} { } test tcltest-14.2 {-singleproc - multiple process} { - -constraints {unixOrPc} + -constraints {unixOrWin} -body { slave msg $allfile -singleproc 1 -tmpdir [temporaryDirectory] return $msg @@ -1024,7 +1024,7 @@ makeFile { } all.tcl $dtd3 test tcltest-15.1 {basic directory walking} { - -constraints {unixOrPc} + -constraints {unixOrWin} -body { if {[slave msg \ [file join $dtd all.tcl] \ @@ -1038,7 +1038,7 @@ test tcltest-15.1 {basic directory walking} { } test tcltest-15.2 {-asidefromdir} { - -constraints {unixOrPc} + -constraints {unixOrWin} -body { if {[slave msg \ [file join $dtd all.tcl] \ @@ -1056,7 +1056,7 @@ Error: No test files remain after applying your match and skip patterns!$} } test tcltest-15.3 {-relateddir, non-existent dir} { - -constraints {unixOrPc} + -constraints {unixOrWin} -body { if {[slave msg \ [file join $dtd all.tcl] \ @@ -1071,7 +1071,7 @@ test tcltest-15.3 {-relateddir, non-existent dir} { } test tcltest-15.4 {-relateddir, subdir} { - -constraints {unixOrPc} + -constraints {unixOrWin} -body { if {[slave msg \ [file join $dtd all.tcl] \ @@ -1084,7 +1084,7 @@ test tcltest-15.4 {-relateddir, subdir} { -result {Tests located in:.*dirtestdir2.[^23]} } test tcltest-15.5 {-relateddir, -asidefromdir} { - -constraints {unixOrPc} + -constraints {unixOrWin} -body { if {[slave msg \ [file join $dtd all.tcl] \ @@ -1173,7 +1173,7 @@ test tcltest-19.1 {TCLTEST_OPTIONS default} -setup { cd [temporaryDirectory] # PrintError -test tcltest-20.1 {PrintError} {unixOrPc} { +test tcltest-20.1 {PrintError} {unixOrWin} { set result [slave msg $printerror] list $result [regexp "Error: a really short string" $msg] \ [regexp " \"quotes\"" $msg] [regexp " \"Path" $msg] \ @@ -1409,7 +1409,7 @@ makeFile { # Must use a child process because stdout/stderr parsing can't be # duplicated in slave interp. test tcltest-22.1 {runAllTests} { - -constraints {unixOrPc} + -constraints {unixOrWin} -body { exec [interpreter] \ [file join $atd all.tcl] \ -- cgit v0.12 From 15b4eecc823345b12fb41a87076c06a93fffdebd Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 11 Sep 2019 11:10:47 +0000 Subject: Use "package provide Tcl" consistantly, in stead of either "package present Tcl" or "info tclversion"/"info patchlevel" --- library/http/http.tcl | 2 +- library/tm.tcl | 4 ++-- tests/tm.test | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/library/http/http.tcl b/library/http/http.tcl index ac3b6d5..75898c9 100644 --- a/library/http/http.tcl +++ b/library/http/http.tcl @@ -1286,7 +1286,7 @@ proc http::Eof {token {force 0}} { if {($state(coding) eq "gzip") && [string length $state(body)] > 0} { if {[catch { - if {[package vsatisfies [package present Tcl] 8.6]} { + if {[package vsatisfies [package provide Tcl] 8.6]} { # The zlib integration into 8.6 includes proper gzip support set state(body) [zlib gunzip $state(body)] } else { diff --git a/library/tm.tcl b/library/tm.tcl index 40b8e40..bab5485 100644 --- a/library/tm.tcl +++ b/library/tm.tcl @@ -309,7 +309,7 @@ proc ::tcl::tm::UnknownHandler {original name args} { proc ::tcl::tm::Defaults {} { global env tcl_platform - lassign [split [info tclversion] .] major minor + regexp {^(\d+)\.(\d+)} [package provide Tcl] - major minor set exe [file normalize [info nameofexecutable]] # Note that we're using [::list], not [list] because [list] means @@ -352,7 +352,7 @@ proc ::tcl::tm::Defaults {} { # Calls 'path add' to paths to the list of module search paths. proc ::tcl::tm::roots {paths} { - regexp {^(\d+)\.(\d+)} [package present Tcl] - major minor + regexp {^(\d+)\.(\d+)} [package provide Tcl] - major minor foreach pa $paths { set p [file join $pa tcl$major] for {set n $minor} {$n >= 0} {incr n -1} { diff --git a/tests/tm.test b/tests/tm.test index 3f93483..001b73e 100644 --- a/tests/tm.test +++ b/tests/tm.test @@ -6,7 +6,7 @@ # Copyright (c) 2004 by Donal K. Fellows. # All rights reserved. -package require Tcl 8.5 +package require Tcl 8.5- if {"::tcltest" ni [namespace children]} { package require tcltest 2 namespace import -force ::tcltest::* @@ -19,12 +19,12 @@ test tm-1.1 {tm: path command exists} { test tm-1.2 {tm: path command syntax} -returnCodes error -body { ::tcl::tm::path foo } -result {unknown or ambiguous subcommand "foo": must be add, list, or remove} -test tm-1.3 {tm: path command syntax} -returnCodes error -body { +test tm-1.3 {tm: path command syntax} { ::tcl::tm::path add -} -result "wrong # args: should be \"::tcl::tm::path add path ...\"" -test tm-1.4 {tm: path command syntax} -returnCodes error -body { +} {} +test tm-1.4 {tm: path command syntax} { ::tcl::tm::path remove -} -result "wrong # args: should be \"::tcl::tm::path remove path ...\"" +} {} test tm-1.5 {tm: path command syntax} -returnCodes error -body { ::tcl::tm::path list foobar } -result "wrong # args: should be \"::tcl::tm::path list\"" @@ -200,7 +200,7 @@ test tm-3.11 {tm: module path management, remove ignores unknown path} -setup { proc genpaths {base} { # Normalizing picks up drive letters on windows [Bug 1053568] set base [file normalize $base] - lassign [split [package present Tcl] .] major minor + regexp {^(\d+)\.(\d+)} [package provide Tcl] - major minor set results {} set base [file join $base tcl$major] lappend results [file join $base site-tcl] -- cgit v0.12 From 56f6e73e6f3bb4c7cf408f25e72f4818914dada3 Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 11 Sep 2019 11:49:59 +0000 Subject: windows, close [7de2d722bd]: prefer temp file to check owner and reown it before trying to check in order to avoid dependency on admin with UAC and the setting of "System objects: Default owner for objects created by members of the Administrators group" --- tests/cmdAH.test | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tests/cmdAH.test b/tests/cmdAH.test index 03ec3df..563a09e 100644 --- a/tests/cmdAH.test +++ b/tests/cmdAH.test @@ -1303,8 +1303,28 @@ test cmdAH-24.20.2 {Tcl_FileObjCmd: mtime 64-bit time_t, bug [4718b41c56]} -cons test cmdAH-25.1 {Tcl_FileObjCmd: owned} { list [catch {file owned a b} msg] $msg } {1 {wrong # args: should be "file owned name"}} -test cmdAH-25.2 {Tcl_FileObjCmd: owned} -constraints win -body { - file owned $gorpfile +test cmdAH-25.2 {Tcl_FileObjCmd: owned} -constraints win -setup { + set fn $gorpfile + # prefer temp file to check owner (try to avoid bug [7de2d722bd]): + if { + [info exists ::env(TEMP)] && [file isdirectory $::env(TEMP)] && + [file dirname $fn] ne [file normalize $::env(TEMP)] + } { + set fn [file join $::env(TEMP)/test-owner-from-tcl.txt] + set fn [makeFile "data" test-owner-from-tcl.txt $::env(TEMP)] + } + # be sure we have really owned this file before trying to check that + # (avoid dependency on admin with UAC and the setting "System objects: + # Default owner for objects created by members of the Administrators group"): + catch { + exec takeown /F [file nativename $fn] + } +} -body { + file owned $fn +} -cleanup { + if {$fn ne $gorpfile} { + removeFile $fn + } } -result 1 test cmdAH-25.2.1 {Tcl_FileObjCmd: owned} -constraints unix -setup { # Avoid problems with AFS -- cgit v0.12