From 861d8f512fd6d21d600999faa12dde6bd363bef0 Mon Sep 17 00:00:00 2001 From: oehhar Date: Sun, 25 Oct 2020 20:03:10 +0000 Subject: TIP586: C String Parsing Support for binary scan --- generic/tclBinary.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/generic/tclBinary.c b/generic/tclBinary.c index f53c707..8a3541b 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -1518,7 +1518,8 @@ BinaryScanCmd( } switch (cmd) { case 'a': - case 'A': { + case 'A': + case 'C': { unsigned char *src; if (arg >= objc) { @@ -1540,10 +1541,18 @@ BinaryScanCmd( size = count; /* - * Trim trailing nulls and spaces, if necessary. + * Apply C string semantics or trim trailing + * nulls and spaces, if necessary. */ - if (cmd == 'A') { + if (cmd == 'C') { + for (i = 0; i < size; i++) { + if (src[i] == '\0') { + size = i; + break; + } + } + } else if (cmd == 'A') { while (size > 0) { if (src[size - 1] != '\0' && src[size - 1] != ' ') { break; -- cgit v0.12 From 31145f178e965c316eb97dcb24fe34779c6bd50e Mon Sep 17 00:00:00 2001 From: oehhar Date: Mon, 26 Oct 2020 10:53:29 +0000 Subject: Copied man page and test from Androwish https://www.androwish.org/home/ci/bc8b7e8094b66169 --- doc/binary.n | 9 +++++++++ tests/binary.test | 11 ++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/binary.n b/doc/binary.n index 0e8b28e..3ba823b 100644 --- a/doc/binary.n +++ b/doc/binary.n @@ -762,6 +762,15 @@ high-to-low order within each byte. For example, will return \fB2\fR with \fB01110\fR stored in \fIvar1\fR and \fB1000011100000101\fR stored in \fIvar2\fR. .RE +.IP \fBC\fR 5 +This form is similar to \fBA\fR, except that it scans the data from start +and terminates at the first null (C string semantics). For example, +.RS +.CS +\fBbinary scan\fR "abc\e000efghi" A* var1 +.CE +will return \fB1\fR with \fBabc\fR stored in \fIvar1\fR. +.RE .IP \fBH\fR 5 The data is turned into a string of \fIcount\fR hexadecimal digits in high-to-low order represented as a sequence of characters in the set diff --git a/tests/binary.test b/tests/binary.test index cf3195f..501ec0d 100644 --- a/tests/binary.test +++ b/tests/binary.test @@ -759,7 +759,16 @@ test binary-21.12 {Tcl_BinaryObjCmd: scan} -setup { } -body { list [binary scan "abc def \x00ghi " A* arg1] $arg1 } -result [list 1 "abc def \x00ghi"] - +test binary-21.13 {Tcl_BinaryObjCmd: scan} -setup { + unset -nocomplain arg1 +} -body { + list [binary scan "abc def \x00 " C* arg1] $arg1 +} -result {1 {abc def }} +test binary-21.12 {Tcl_BinaryObjCmd: scan} -setup { + unset -nocomplain arg1 +} -body { + list [binary scan "abc def \x00ghi" C* arg1] $arg1 +} -result {1 {abc def }} test binary-22.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body { binary scan abc b } -result {not enough arguments for all format specifiers} -- cgit v0.12 From 577981fee9f598026571fd4d5c81821ef0d42e9f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 26 Oct 2020 14:45:47 +0000 Subject: re-trigger Travis build (and fix some eol-spacing) --- doc/binary.n | 2 +- tests/binary.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/binary.n b/doc/binary.n index 3ba823b..6b2c0eb 100644 --- a/doc/binary.n +++ b/doc/binary.n @@ -770,7 +770,7 @@ and terminates at the first null (C string semantics). For example, \fBbinary scan\fR "abc\e000efghi" A* var1 .CE will return \fB1\fR with \fBabc\fR stored in \fIvar1\fR. -.RE +.RE .IP \fBH\fR 5 The data is turned into a string of \fIcount\fR hexadecimal digits in high-to-low order represented as a sequence of characters in the set diff --git a/tests/binary.test b/tests/binary.test index 501ec0d..7433fe8 100644 --- a/tests/binary.test +++ b/tests/binary.test @@ -768,7 +768,7 @@ test binary-21.12 {Tcl_BinaryObjCmd: scan} -setup { unset -nocomplain arg1 } -body { list [binary scan "abc def \x00ghi" C* arg1] $arg1 -} -result {1 {abc def }} +} -result {1 {abc def }} test binary-22.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body { binary scan abc b } -result {not enough arguments for all format specifiers} -- cgit v0.12 From f145d5f091d380c580c0d4d6e662731d2b8bf1a2 Mon Sep 17 00:00:00 2001 From: oehhar Date: Wed, 28 Oct 2020 06:59:12 +0000 Subject: Corrected doc: modifier C instead A --- doc/binary.n | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/binary.n b/doc/binary.n index 6b2c0eb..9b8b106 100644 --- a/doc/binary.n +++ b/doc/binary.n @@ -767,7 +767,7 @@ This form is similar to \fBA\fR, except that it scans the data from start and terminates at the first null (C string semantics). For example, .RS .CS -\fBbinary scan\fR "abc\e000efghi" A* var1 +\fBbinary scan\fR "abc\e000efghi" C* var1 .CE will return \fB1\fR with \fBabc\fR stored in \fIvar1\fR. .RE -- cgit v0.12 From 20664f1fa1563c7ad9992f369427f1cd841faf6d Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 10 Nov 2020 09:26:10 +0000 Subject: Cleaning up the actions and trying to make them behave more usefully on Windows. --- .github/workflows/linux-build.yml | 11 ++++------- .github/workflows/win-build.yml | 7 ++++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index db46cfd..8bb0141 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -3,35 +3,32 @@ on: [push] jobs: build: runs-on: ubuntu-latest + defaults: + run: + shell: bash + working-directory: unix steps: - name: Checkout uses: actions/checkout@v2 - name: Configure - working-directory: unix run: | mkdir "${HOME}/install dir" ./configure ${CFGOPT} "--prefix=$HOME/install dir" || (cat config.log && exit 1) - name: Build - working-directory: unix run: | make all - name: Build Test Harness - working-directory: unix run: | make tcltest - name: Run Tests - working-directory: unix run: | make test - name: Test-Drive Installation - working-directory: unix run: | make install - name: Create Distribution Package - working-directory: unix run: | make dist - name: Convert Documentation to HTML - working-directory: unix run: | make html-tcl diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index 652b34a..9c4b6f5 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -3,20 +3,21 @@ on: [push] jobs: build: runs-on: windows-latest + defaults: + run: + shell: bash + working-directory: win steps: - name: Checkout uses: actions/checkout@v2 - name: Init MSVC uses: ilammy/msvc-dev-cmd@v1 - name: Build - working-directory: win run: | nmake -f makefile.vc all - name: Build Test Harness - working-directory: win run: | nmake -f makefile.vc tcltest - name: Run Tests - working-directory: win run: | nmake -f makefile.vc test -- cgit v0.12 From a376924771b18a3181c6ec57dc631fc357c3fdfe Mon Sep 17 00:00:00 2001 From: culler Date: Tue, 10 Nov 2020 17:50:09 +0000 Subject: Set a default DESTDIR in macosx/GNUmakefile --- macosx/GNUmakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macosx/GNUmakefile b/macosx/GNUmakefile index cdeb099..9c8b0e2 100644 --- a/macosx/GNUmakefile +++ b/macosx/GNUmakefile @@ -13,7 +13,7 @@ #------------------------------------------------------------------------------------------------------- # customizable settings -DESTDIR ?= +DESTDIR ?= ${CURDIR}/../../build INSTALL_ROOT ?= ${DESTDIR} BUILD_DIR ?= ${CURDIR}/../../build -- cgit v0.12 From c41e7ffff57b8aea49698caa04d8bedee8f92143 Mon Sep 17 00:00:00 2001 From: culler Date: Tue, 10 Nov 2020 18:47:47 +0000 Subject: backout e56a9f214a --- macosx/GNUmakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macosx/GNUmakefile b/macosx/GNUmakefile index 3d88729..93fd843 100644 --- a/macosx/GNUmakefile +++ b/macosx/GNUmakefile @@ -13,7 +13,7 @@ #------------------------------------------------------------------------------------------------------- # customizable settings -DESTDIR ?= ${CURDIR}/../../build +DESTDIR ?= INSTALL_ROOT ?= ${DESTDIR} BUILD_DIR ?= ${CURDIR}/../../build -- cgit v0.12 From 8e61a58c14167041d08246a34671480c02e8427e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 13 Nov 2020 16:55:36 +0000 Subject: Backport [fc1e203728]: backout e56a9f214a. If it was wrong in core-8-branch, it's wrong here too. --- macosx/GNUmakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macosx/GNUmakefile b/macosx/GNUmakefile index 9c8b0e2..cdeb099 100644 --- a/macosx/GNUmakefile +++ b/macosx/GNUmakefile @@ -13,7 +13,7 @@ #------------------------------------------------------------------------------------------------------- # customizable settings -DESTDIR ?= ${CURDIR}/../../build +DESTDIR ?= INSTALL_ROOT ?= ${DESTDIR} BUILD_DIR ?= ${CURDIR}/../../build -- cgit v0.12 From a22953bb77fe0c1b7c1ecaa9397dfc12cf5d0a54 Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 14 Nov 2020 09:31:49 +0000 Subject: Back to powershell --- .github/workflows/win-build.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index 9c4b6f5..f7d4ef1 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -5,8 +5,9 @@ jobs: runs-on: windows-latest defaults: run: - shell: bash + shell: powershell working-directory: win + # Using powershell means we need to explicitly stop on failure steps: - name: Checkout uses: actions/checkout@v2 @@ -14,10 +15,19 @@ jobs: uses: ilammy/msvc-dev-cmd@v1 - name: Build run: | - nmake -f makefile.vc all + &nmake -f makefile.vc all + if ($lastexitcode -ne 0) { + throw "nmake exit code: $lastexitcode" + } - name: Build Test Harness run: | - nmake -f makefile.vc tcltest + &nmake -f makefile.vc tcltest + if ($lastexitcode -ne 0) { + throw "nmake exit code: $lastexitcode" + } - name: Run Tests run: | - nmake -f makefile.vc test + &nmake -f makefile.vc test + if ($lastexitcode -ne 0) { + throw "nmake exit code: $lastexitcode" + } -- cgit v0.12 From b3e4fc2a04cb66d7fb0e7e2acd6c078f7489364b Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 14 Nov 2020 12:25:38 +0000 Subject: Fixed some tests, added trial macOS build --- .github/workflows/mac-build.yml | 55 +++++++++++++++++++++++++++++++++++++++++ tests/async.test | 4 +-- tests/chanio.test | 7 +++--- tests/exec.test | 7 ++++-- tests/fileSystem.test | 6 +++-- tests/format.test | 14 +++++++---- tests/io.test | 11 ++++++--- tests/socket.test | 4 ++- tests/winFCmd.test | 14 ++++++----- tests/winTime.test | 6 +++-- 10 files changed, 101 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/mac-build.yml diff --git a/.github/workflows/mac-build.yml b/.github/workflows/mac-build.yml new file mode 100644 index 0000000..bd45c89 --- /dev/null +++ b/.github/workflows/mac-build.yml @@ -0,0 +1,55 @@ +name: macOS Build and Test +on: [push] +jobs: + with-Xcode: + runs-on: macos-latest + defaults: + run: + shell: bash + working-directory: macosx + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Prepare + run: touch tclStubInit.c tclOOStubInit.c + working-directory: generic + - name: Build + run: make all + - name: Run Tests + run: make test styles=develop + env: + ERROR_ON_FAILURES: 1 + MAC_CI: 1 + Unix-like: + runs-on: macos-latest + strategy: + matrix: + config_options: [ "--enable-dtrace", "--enable-debug=mem" ] + defaults: + run: + shell: bash + working-directory: unix + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Prepare + run: | + touch tclStubInit.c tclOOStubInit.c + mkdir "$HOME/install dir" + working-directory: generic + - name: Configure + run: ./configure ${CFGOPT} "--prefix=$HOME/install dir" || (cat config.log && exit 1) + env: + CFGOPT: ${{ matrix.config_options }} + - name: Build + run: | + make all tcltest + - name: Run Tests + run: | + make test + env: + ERROR_ON_FAILURES: 1 + MAC_CI: 1 + - name: Trial Installation + run: | + make install diff --git a/tests/async.test b/tests/async.test index 1aef907..86527bf 100644 --- a/tests/async.test +++ b/tests/async.test @@ -21,7 +21,7 @@ catch [list package require -exact Tcltest [info patchlevel]] testConstraint testasync [llength [info commands testasync]] testConstraint threaded [::tcl::pkgconfig get threaded] -testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}] +testConstraint notWinCI [expr {$::tcl_platform(platform) != "windows" || ![info exists ::env(CI)]}] proc async1 {result code} { global aresult acode @@ -204,7 +204,7 @@ test async-4.2 {async interrupting straight bytecode sequence} -constraints { testasync delete $hm } test async-4.3 {async interrupting loop-less bytecode sequence} -constraints { - testasync threaded knownMsvcBug + testasync threaded notWinCI } -setup { set hm [testasync create async3] } -body { diff --git a/tests/chanio.test b/tests/chanio.test index 58116ba..1f9e19b 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -42,7 +42,8 @@ namespace eval ::tcl::test::io { testConstraint testchannelevent [llength [info commands testchannelevent]] testConstraint testmainthread [llength [info commands testmainthread]] testConstraint testservicemode [llength [info commands testservicemode]] - testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}] + testConstraint notWinCI [expr { + $::tcl_platform(platform) ne "windows" || ![info exists ::env(CI)]}] testConstraint notOSX [expr {$::tcl_platform(os) ne "Darwin"}] # You need a *very* special environment to do some tests. In particular, @@ -1881,7 +1882,7 @@ test chan-io-20.3 {Tcl_CreateChannel: initial settings} -constraints {unix} -bod } -result {{{} {}} {auto lf}} test chan-io-20.5 {Tcl_CreateChannel: install channel in empty slot} -setup { set path(stdout) [makeFile {} stdout] -} -constraints {stdio knownMsvcBug} -body { +} -constraints {stdio notWinCI} -body { set f [open $path(script) w] chan puts -nonewline $f { chan close stdout @@ -2791,7 +2792,7 @@ test chan-io-29.34 {Tcl_Chan Close, async flush on chan close, using sockets} -s chan puts $s $l } } -} -constraints {socket tempNotMac fileevent knownMsvcBug} -body { +} -constraints {socket tempNotMac fileevent notWinCI} -body { proc accept {s a p} { variable x chan event $s readable [namespace code [list readit $s]] diff --git a/tests/exec.test b/tests/exec.test index b07099b..af7aae5 100644 --- a/tests/exec.test +++ b/tests/exec.test @@ -24,7 +24,8 @@ package require tcltests # All tests require the "exec" command. # Skip them if exec is not defined. testConstraint exec [llength [info commands exec]] -testConstraint noosx [expr {![info exists ::env(TRAVIS_OSX_IMAGE)] || ![string match xcode* $::env(TRAVIS_OSX_IMAGE)]}] +# Some skips when running in a macOS CI environment +testConstraint noosxCI [expr {![info exists ::env(MAC_CI)]}] unset -nocomplain path @@ -671,7 +672,9 @@ test exec-18.2 {exec cat deals with weird file names} -body { # Note that this test cannot be adapted to work on Windows; that platform has # no kernel support for an analog of O_APPEND. OTOH, that means we can assume # that there is a POSIX shell... -test exec-19.1 {exec >> uses O_APPEND} -constraints {exec unix notValgrind noosx} -setup { +# +# This test also fails in some cases when building with macOS +test exec-19.1 {exec >> uses O_APPEND} -constraints {exec unix notValgrind noosxCI} -setup { set tmpfile [makeFile {0} tmpfile.exec-19.1] } -body { # Note that we have to allow for the current contents of the temporary diff --git a/tests/fileSystem.test b/tests/fileSystem.test index c1deb1b..0d7b183 100644 --- a/tests/fileSystem.test +++ b/tests/fileSystem.test @@ -38,7 +38,9 @@ catch { testConstraint testfilesystem [llength [info commands ::testfilesystem]] testConstraint testsetplatform [llength [info commands ::testsetplatform]] testConstraint testsimplefilesystem [llength [info commands ::testsimplefilesystem]] -testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}] +# Some things fail under all Continuous Integration systems for subtle reasons +# such as CI often running with elevated privileges in a container. +testConstraint notInCIenv [expr {![info exists ::env(CI)]}] cd [tcltest::temporaryDirectory] makeFile "test file" gorp.file @@ -317,7 +319,7 @@ test filesystem-1.37 {file normalisation with '/./'} -body { } -match regexp -result {^(?:[^/]|/(?:[^/]|$))+$} test filesystem-1.38 {file normalisation with volume relative} -setup { set dir [pwd] -} -constraints {win moreThanOneDrive knownMsvcBug} -body { +} -constraints {win moreThanOneDrive notInCIenv} -body { set path "[string range [lindex $drives 0] 0 1]foo" cd [lindex $drives 1] file norm $path diff --git a/tests/format.test b/tests/format.test index ea0e929..11cb4b7 100644 --- a/tests/format.test +++ b/tests/format.test @@ -18,10 +18,14 @@ if {"::tcltest" ni [namespace children]} { # %u output depends on word length, so this test is not portable. testConstraint longIs32bit [expr {int(0x80000000) < 0}] testConstraint longIs64bit [expr {int(0x8000000000000000) < 0}] -testConstraint wideIs64bit \ - [expr {(wide(0x80000000) > 0) && (wide(0x8000000000000000) < 0)}] +testConstraint wideIs64bit [expr { + (wide(0x80000000) > 0) && (wide(0x8000000000000000) < 0)}] testConstraint wideBiggerThanInt [expr {wide(0x80000000) != int(0x80000000)}] -testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}] +# MSVC uses a broken libc that gets sprintf("%g") wrong. This is a pain +# particularly in Continuous Integration, and there isn't anything much we can +# do about it. +testConstraint notWinCI [expr { + ($::tcl_platform(platform) ne "windows") || ![info exists ::env(CI)]}] test format-1.1 {integer formatting} { format "%*d %d %d %d" 6 34 16923 -12 -1 @@ -274,13 +278,13 @@ test format-6.1 {floating-point zeroes} {eformat} { test format-6.2 {floating-point zeroes} {eformat} { format "%.4e %.4f %.4g" 0.0 0.0 0.0 0.0 } {0.0000e+00 0.0000 0} -test format-6.3 {floating-point zeroes} {eformat knownMsvcBug} { +test format-6.3 {floating-point zeroes} {eformat notWinCI} { format "%#.4e %#.4f %#.4g" 0.0 0.0 0.0 0.0 } {0.0000e+00 0.0000 0.000} test format-6.4 {floating-point zeroes} {eformat} { format "%.0e %.0f %.0g" 0.0 0.0 0.0 0.0 } {0e+00 0 0} -test format-6.5 {floating-point zeroes} {eformat knownMsvcBug} { +test format-6.5 {floating-point zeroes} {eformat notWinCI} { format "%#.0e %#.0f %#.0g" 0.0 0.0 0.0 0.0 } {0.e+00 0. 0.} test format-6.6 {floating-point zeroes} { diff --git a/tests/io.test b/tests/io.test index baf9b1c..e45b5ef 100644 --- a/tests/io.test +++ b/tests/io.test @@ -43,7 +43,10 @@ testConstraint testchannelevent [llength [info commands testchannelevent]] testConstraint testmainthread [llength [info commands testmainthread]] testConstraint testobj [llength [info commands testobj]] testConstraint testservicemode [llength [info commands testservicemode]] -testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}] +# Some things fail under Windows in Continuous Integration systems for subtle +# reasons such as CI often running with elevated privileges in a container. +testConstraint notWinCI [expr { + $::tcl_platform(platform) ne "windows" || ![info exists ::env(CI)]}] testConstraint notOSX [expr {$::tcl_platform(os) ne "Darwin"}] # You need a *very* special environment to do some tests. In @@ -2230,7 +2233,7 @@ test io-27.5 {FlushChannel, implicit flush when buffer fills and on close} \ set path(pipe) [makeFile {} pipe] set path(output) [makeFile {} output] test io-27.6 {FlushChannel, async flushing, async close} \ - {stdio asyncPipeClose knownMsvcBug} { + {stdio asyncPipeClose notWinCI} { # This test may fail on old Unix systems (seen on IRIX64 6.5) with # obsolete gettimeofday() calls. See Tcl Bugs 3530533, 1942197. file delete $path(pipe) @@ -2834,7 +2837,7 @@ test io-29.31 {Tcl_WriteChars, background flush} stdio { set result } ok test io-29.32 {Tcl_WriteChars, background flush to slow reader} \ - {stdio asyncPipeClose knownMsvcBug} { + {stdio asyncPipeClose notWinCI} { # This test may fail on old Unix systems (seen on IRIX64 6.5) with # obsolete gettimeofday() calls. See Tcl Bugs 3530533, 1942197. file delete $path(pipe) @@ -8068,7 +8071,7 @@ test io-53.17 {[7c187a3773] MBWrite: proper inQueueTail handling} -setup { removeFile out } -result {line 100 line} -test io-54.1 {Recursive channel events} {socket fileevent knownMsvcBug} { +test io-54.1 {Recursive channel events} {socket fileevent notWinCI} { # This test checks to see if file events are delivered during recursive # event loops when there is buffered data on the channel. diff --git a/tests/socket.test b/tests/socket.test index 2060f35..d5f9c94 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -67,7 +67,9 @@ if {"::tcltest" ni [namespace children]} { ::tcltest::loadTestedCommands -if {[info exists ::env(TRAVIS_OSX_IMAGE)] && [string match xcode* $::env(TRAVIS_OSX_IMAGE)]} { +# A bad interaction between socket creation, macOS, and unattended CI +# environments make this whole file impractical to run; too many weird hangs. +if {[info exists ::env(MAC_CI)]} { return } diff --git a/tests/winFCmd.test b/tests/winFCmd.test index 7c81e81..04c4fd9 100644 --- a/tests/winFCmd.test +++ b/tests/winFCmd.test @@ -29,7 +29,9 @@ testConstraint testchmod [llength [info commands testchmod]] testConstraint cdrom 0 testConstraint exdev 0 testConstraint longFileNames 0 -testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}] +# Some things fail under all Continuous Integration systems for subtle reasons +# such as CI often running with elevated privileges in a container. +testConstraint notInCIenv [expr {![info exists ::env(CI)]}] proc createfile {file {string a}} { set f [open $file w] @@ -411,7 +413,7 @@ proc MakeFiles {dirname} { test winFCmd-1.38 {TclpRenameFile: check rename of conflicting inodes} -setup { cleanup -} -constraints {win winNonZeroInodes knownMsvcBug} -body { +} -constraints {win winNonZeroInodes notInCIenv} -body { file mkdir td1 foreach {a b} [MakeFiles td1] break file rename -force $a $b @@ -661,7 +663,7 @@ test winFCmd-5.1 {TclpCopyDirectory: calls TraverseWinTree} -setup { test winFCmd-6.1 {TclpRemoveDirectory: errno: EACCES} -setup { cleanup -} -constraints {winVista testfile testchmod knownMsvcBug} -body { +} -constraints {winVista testfile testchmod notInCIenv} -body { file mkdir td1 testchmod 0 td1 testfile rmdir td1 @@ -715,7 +717,7 @@ test winFCmd-6.8 {TclpRemoveDirectory: RemoveDirectory fails} -setup { } -result {1 {tf1 ENOTDIR}} test winFCmd-6.9 {TclpRemoveDirectory: errno == EACCES} -setup { cleanup -} -constraints {winVista testfile testchmod knownMsvcBug} -body { +} -constraints {winVista testfile testchmod notInCIenv} -body { file mkdir td1 testchmod 0 td1 testfile rmdir td1 @@ -733,7 +735,7 @@ test winFCmd-6.11 {TclpRemoveDirectory: attr == -1} -setup { } -returnCodes error -match regexp -result {^/ E(ACCES|EXIST)$} test winFCmd-6.13 {TclpRemoveDirectory: write-protected} -setup { cleanup -} -constraints {winVista testfile testchmod knownMsvcBug} -body { +} -constraints {winVista testfile testchmod notInCIenv} -body { file mkdir td1 testchmod 0 td1 testfile rmdir td1 @@ -962,7 +964,7 @@ test winFCmd-9.1 {TraversalDelete: DOTREE_F} -setup { } -result {} test winFCmd-9.3 {TraversalDelete: DOTREE_PRED} -setup { cleanup -} -constraints {winVista testfile testchmod knownMsvcBug} -body { +} -constraints {winVista testfile testchmod notInCIenv} -body { file mkdir td1/td2 testchmod 0 td1 testfile rmdir -force td1 diff --git a/tests/winTime.test b/tests/winTime.test index 19e4c58..68be966 100644 --- a/tests/winTime.test +++ b/tests/winTime.test @@ -19,7 +19,9 @@ if {"::tcltest" ni [namespace children]} { catch [list package require -exact Tcltest [info patchlevel]] testConstraint testwinclock [llength [info commands testwinclock]] -testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}] +# Some things fail under all Continuous Integration systems for subtle reasons +# such as CI often running with elevated privileges in a container. +testConstraint notInCIenv [expr {![info exists ::env(CI)]}] # The next two tests will crash on Windows if the check for negative # clock values is not done properly. @@ -41,7 +43,7 @@ test winTime-1.2 {TclpGetDate} {win} { # with the Windows clock. 30 sec really isn't enough, # but how much time does a tester have patience for? -test winTime-2.1 {Synchronization of Tcl and Windows clocks} {testwinclock knownMsvcBug} { +test winTime-2.1 {Synchronization of Tcl and Windows clocks} {testwinclock notInCIenv} { # May fail due to OS/hardware discrepancies. See: # http://support.microsoft.com/default.aspx?scid=kb;en-us;274323 set failed {} -- cgit v0.12 From 346721f3f06a873a372934d4764eb2533aaca105 Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 15 Nov 2020 08:35:49 +0000 Subject: Fix minor errors --- .github/workflows/linux-build.yml | 3 +++ .github/workflows/win-build.yml | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 8bb0141..04420dd 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -14,6 +14,9 @@ jobs: run: | mkdir "${HOME}/install dir" ./configure ${CFGOPT} "--prefix=$HOME/install dir" || (cat config.log && exit 1) + - name: Prepare + run: touch tclStubInit.c tclOOStubInit.c + working-directory: generic - name: Build run: | make all diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index f7d4ef1..809003b 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -17,17 +17,17 @@ jobs: run: | &nmake -f makefile.vc all if ($lastexitcode -ne 0) { - throw "nmake exit code: $lastexitcode" + throw "nmake exit code: $lastexitcode" } - name: Build Test Harness run: | &nmake -f makefile.vc tcltest if ($lastexitcode -ne 0) { - throw "nmake exit code: $lastexitcode" + throw "nmake exit code: $lastexitcode" } - name: Run Tests run: | &nmake -f makefile.vc test if ($lastexitcode -ne 0) { - throw "nmake exit code: $lastexitcode" + throw "nmake exit code: $lastexitcode" } -- cgit v0.12 From 3ef704b39c1f9ec4caf502f42325803d2e380f3a Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 15 Nov 2020 08:38:14 +0000 Subject: Updated README --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 25367ce..fd4ef2a 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,17 @@ site](https://sourceforge.net/projects/tcl/files/Tcl/). 8.6.10 [![Build Status](https://github.com/tcltk/tcl/workflows/Linux%20Build%20and%20Test/badge.svg?branch=core-8-6-branch)](https://github.com/tcltk/tcl/actions?query=workflow%3A%22Linux+Build+and+Test%22+branch%3Acore-8-6-branch) [![Build Status](https://github.com/tcltk/tcl/workflows/Windows%20Build%20and%20Test/badge.svg?branch=core-8-6-branch)](https://github.com/tcltk/tcl/actions?query=workflow%3A%22Windows+Build+and+Test%22+branch%3Acore-8-6-branch) +[![Build Status](https://github.com/tcltk/tcl/workflows/macOS%20Build%20and%20Test/badge.svg?branch=core-8-6-branch)](https://github.com/tcltk/tcl/actions?query=workflow%3A%22macOS+Build+and+Test%22+branch%3Acore-8-6-branch)
8.7a4 [![Build Status](https://github.com/tcltk/tcl/workflows/Linux%20Build%20and%20Test/badge.svg?branch=core-8-branch)](https://github.com/tcltk/tcl/actions?query=workflow%3A%22Linux+Build+and+Test%22+branch%3Acore-8-branch) [![Build Status](https://github.com/tcltk/tcl/workflows/Windows%20Build%20and%20Test/badge.svg?branch=core-8-branch)](https://github.com/tcltk/tcl/actions?query=workflow%3A%22Windows+Build+and+Test%22+branch%3Acore-8-branch) +[![Build Status](https://github.com/tcltk/tcl/workflows/macOS%20Build%20and%20Test/badge.svg?branch=core-8-branch)](https://github.com/tcltk/tcl/actions?query=workflow%3A%22macOS+Build+and+Test%22+branch%3Acore-8-branch)
9.0a2 [![Build Status](https://github.com/tcltk/tcl/workflows/Linux%20Build%20and%20Test/badge.svg?branch=main)](https://github.com/tcltk/tcl/actions?query=workflow%3A%22Linux+Build+and+Test%22+branch%3Amain) [![Build Status](https://github.com/tcltk/tcl/workflows/Windows%20Build%20and%20Test/badge.svg?branch=main)](https://github.com/tcltk/tcl/actions?query=workflow%3A%22Windows+Build+and+Test%22+branch%3Amain) +[![Build Status](https://github.com/tcltk/tcl/workflows/macOS%20Build%20and%20Test/badge.svg?branch=main)](https://github.com/tcltk/tcl/actions?query=workflow%3A%22macOS+Build+and+Test%22+branch%3Amain) ## Contents 1. [Introduction](#intro) -- cgit v0.12 From 807ed7b13c7dc61b771929a4abbcaa6818c8fae6 Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 15 Nov 2020 09:17:41 +0000 Subject: Added MSYS/gcc build for Windows, renamed Linux build step --- .github/workflows/linux-build.yml | 2 +- .github/workflows/win-build.yml | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 04420dd..a2b2a64 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -1,7 +1,7 @@ name: Linux Build and Test on: [push] jobs: - build: + gcc: runs-on: ubuntu-latest defaults: run: diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index 809003b..22d40be 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -1,7 +1,7 @@ name: Windows Build and Test on: [push] jobs: - build: + MSVC: runs-on: windows-latest defaults: run: @@ -31,3 +31,38 @@ jobs: if ($lastexitcode -ne 0) { throw "nmake exit code: $lastexitcode" } + env: + ERROR_ON_FAILURES: 1 + MSYS-gcc: + runs-on: windows-latest + defaults: + run: + shell: bash + working-directory: win + strategy: + matrix: + config_options: [ "--disable-debug", "--enable-debug=mem" ] + # Using powershell means we need to explicitly stop on failure + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install MSYS2 and Make + run: choco install msys2 make + - name: Prepare + run: | + touch tclStubInit.c tclOOStubInit.c + mkdir "${HOME}/install dir" + working-directory: generic + - name: Configure + run: | + ./configure ${CFGOPT} "--prefix=$HOME/install dir" || (cat config.log && exit 1) + env: + CFGOPT: --enable-64bit ${{ matrix.config_options }} + - name: Build + run: make all + - name: Build Test Harness + run: make tcltest + - name: Run Tests + run: make test + env: + ERROR_ON_FAILURES: 1 -- cgit v0.12 From eff08da703a7f85e7c2c34ee624d0b6ae0cea947 Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 15 Nov 2020 15:48:43 +0000 Subject: Rethinking how to do a build matrix on several platforms --- .github/workflows/linux-build.yml | 10 +++++++++- .github/workflows/mac-build.yml | 14 ++++++++++---- .github/workflows/win-build.yml | 9 ++++++--- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index a2b2a64..a4fd7b3 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -3,6 +3,12 @@ on: [push] jobs: gcc: runs-on: ubuntu-latest + strategy: + matrix: + symbols: + - "no" + - "mem" + - "all" defaults: run: shell: bash @@ -10,10 +16,12 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - name: Configure + - name: Configure (symbols=${{ matrix.symbols }}) run: | mkdir "${HOME}/install dir" ./configure ${CFGOPT} "--prefix=$HOME/install dir" || (cat config.log && exit 1) + env: + CFGOPT: --enable-symbols=${{ matrix.symbols }} - name: Prepare run: touch tclStubInit.c tclOOStubInit.c working-directory: generic diff --git a/.github/workflows/mac-build.yml b/.github/workflows/mac-build.yml index bd45c89..c78f882 100644 --- a/.github/workflows/mac-build.yml +++ b/.github/workflows/mac-build.yml @@ -24,7 +24,12 @@ jobs: runs-on: macos-latest strategy: matrix: - config_options: [ "--enable-dtrace", "--enable-debug=mem" ] + symbols: + - "no" + - "mem" + dtrace: + - "no" + - "yes" defaults: run: shell: bash @@ -37,10 +42,11 @@ jobs: touch tclStubInit.c tclOOStubInit.c mkdir "$HOME/install dir" working-directory: generic - - name: Configure - run: ./configure ${CFGOPT} "--prefix=$HOME/install dir" || (cat config.log && exit 1) + - name: Configure (symbols=${{ matrix.symbols }} dtrace=${{ matrix.dtrace }}) + # Note that macOS is always a 64 bit platform + run: ./configure --enable-64bit ${CFGOPT} "--prefix=$HOME/install dir" || (cat config.log && exit 1) env: - CFGOPT: ${{ matrix.config_options }} + CFGOPT: --enable-symbols=${{ matrix.symbols }} --enable-dtrace=${{ matrix.dtrace }} - name: Build run: | make all tcltest diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index 22d40be..e938609 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -41,7 +41,10 @@ jobs: working-directory: win strategy: matrix: - config_options: [ "--disable-debug", "--enable-debug=mem" ] + symbols: + - "no" + - "mem" + - "all" # Using powershell means we need to explicitly stop on failure steps: - name: Checkout @@ -53,11 +56,11 @@ jobs: touch tclStubInit.c tclOOStubInit.c mkdir "${HOME}/install dir" working-directory: generic - - name: Configure + - name: Configure (symbols=${{ matrix.symbols }}) run: | ./configure ${CFGOPT} "--prefix=$HOME/install dir" || (cat config.log && exit 1) env: - CFGOPT: --enable-64bit ${{ matrix.config_options }} + CFGOPT: --enable-64bit --enable-symbols=${{ matrix.symbols }} - name: Build run: make all - name: Build Test Harness -- cgit v0.12 From ffa8d1d461a8bbc533e6f978478165c2be425a4e Mon Sep 17 00:00:00 2001 From: dkf Date: Mon, 16 Nov 2020 09:24:33 +0000 Subject: Disable test that fails in CI environments --- tests/fCmd.test | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/fCmd.test b/tests/fCmd.test index bb8fb4a..09f91f7 100644 --- a/tests/fCmd.test +++ b/tests/fCmd.test @@ -80,6 +80,7 @@ testConstraint darwin9 [expr { && [package vsatisfies 1.$::tcl_platform(osVersion) 1.9] }] testConstraint notDarwin9 [expr {![testConstraint darwin9]}] +testConstraint notContinuousIntegration [expr {![info exists ::env(CI)]}] testConstraint fileSharing 0 testConstraint notFileSharing 1 @@ -2582,7 +2583,11 @@ test fCmd-30.2 {file readable on 'NTUSER.DAT'} -constraints {win} -body { && [file exists $env(USERPROFILE)/NTUSER.DAT] && [file readable $env(USERPROFILE)/NTUSER.DAT]} } -result {1} -test fCmd-30.3 {file readable on 'pagefile.sys'} -constraints {win} -body { +# At least one CI environment (GitHub Actions) is set up with the page file in +# an unusual location; skip the test if that is so. +test fCmd-30.3 {file readable on 'pagefile.sys'} -constraints { + win notContinuousIntegration +} -body { set r {} if {[info exists env(SystemDrive)]} { set path $env(SystemDrive)/pagefile.sys -- cgit v0.12 From 0943b7181074269ccea4e40288d91575ae211a0a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 16 Nov 2020 12:48:00 +0000 Subject: Enhance misleading test-case utf-6.23 with better diagnostics: Byte 0xE8 is the start of a 3-byte UTF-8 sequence, so Tcl_UtfNext is expected to read next byte and see if it is a continuation byte. Comment 4 testcases (utf-6.110/111/114/115) for being misleading too, because they don't even call Tcl_UtfNext(). No change to code, only testcases --- generic/tclTest.c | 6 ++++-- tests/utf.test | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/generic/tclTest.c b/generic/tclTest.c index f1e3fac..2c29cda 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -6825,8 +6825,10 @@ TestUtfNextCmd( /* Run Tcl_UtfNext with many more possible bytes at src[end], all should give the same result */ result = Tcl_UtfNext(buffer + 1); if (first != result) { - first = buffer; - break; + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "Tcl_UtfNext is not supposed to read src[end]\n" + "Different result when src[end] is %#x", UCHAR(p[-1]))); + return TCL_ERROR; } } diff --git a/tests/utf.test b/tests/utf.test index 6839860..f5b4da8 100644 --- a/tests/utf.test +++ b/tests/utf.test @@ -252,8 +252,8 @@ test utf-6.22 {Tcl_UtfNext} {testutfnext testbytestring} { testutfnext [testbytestring \xD0\xF8] } 1 test utf-6.23 {Tcl_UtfNext} {testutfnext testbytestring} { - testutfnext [testbytestring \xE8] -} -1 + testutfnext [testbytestring \xE8\x00] +} 1 test utf-6.24 {Tcl_UtfNext} {testutfnext testbytestring} { testutfnext [testbytestring \xE8]G } 1 @@ -545,9 +545,11 @@ test utf-6.108 {Tcl_UtfNext, read limits} {testutfnext testbytestring} { test utf-6.109 {Tcl_UtfNext, read limits} {testutfnext testbytestring} { testutfnext \u8820[testbytestring \xA0] 3 } 3 +# This testcase actually tests Tcl_UtfCharComplete, not Tcl_UtfNext test utf-6.110 {Tcl_UtfNext, read limits} {testutfnext testbytestring} { testutfnext [testbytestring \xF2\xA0\xA0\xA0]G 1 } 0 +# This testcase actually tests Tcl_UtfCharComplete, not Tcl_UtfNext test utf-6.111 {Tcl_UtfNext, read limits} {testutfnext testbytestring} { testutfnext [testbytestring \xF2\xA0\xA0\xA0]G 2 } 0 @@ -563,9 +565,11 @@ test utf-6.113.0 {Tcl_UtfNext, read limits} {testutfnext testbytestring ucs2} { test utf-6.113.1 {Tcl_UtfNext, read limits} {testutfnext testbytestring fullutf} { testutfnext [testbytestring \xF2\xA0\xA0\xA0]G 4 } 4 +# This testcase actually tests Tcl_UtfCharComplete, not Tcl_UtfNext test utf-6.114 {Tcl_UtfNext, read limits} {testutfnext testbytestring} { testutfnext [testbytestring \xF2\xA0\xA0\xA0\xA0] 1 } 0 +# This testcase actually tests Tcl_UtfCharComplete, not Tcl_UtfNext test utf-6.115 {Tcl_UtfNext, read limits} {testutfnext testbytestring} { testutfnext [testbytestring \xF2\xA0\xA0\xA0\xA0] 2 } 0 -- cgit v0.12 From 0589f3b799a755af312815888840a99a0733e725 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 16 Nov 2020 13:12:26 +0000 Subject: Fix 2 testcases which failed when compiled with TCL_UTF_MAX>3 --- tests/utf.test | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/utf.test b/tests/utf.test index f5b4da8..ab98294 100644 --- a/tests/utf.test +++ b/tests/utf.test @@ -276,8 +276,8 @@ test utf-6.30.0 {Tcl_UtfNext} {testutfnext testbytestring ucs2} { testutfnext [testbytestring \xF2] } 1 test utf-6.30.1 {Tcl_UtfNext} {testutfnext testbytestring fullutf} { - testutfnext [testbytestring \xF2] -} -1 + testutfnext [testbytestring \xF2\x00] +} 1 test utf-6.31 {Tcl_UtfNext} {testutfnext testbytestring} { testutfnext [testbytestring \xF2]G } 1 @@ -285,8 +285,8 @@ test utf-6.32.0 {Tcl_UtfNext} {testutfnext testbytestring ucs2} { testutfnext [testbytestring \xF2\xA0] } 1 test utf-6.32.1 {Tcl_UtfNext} {testutfnext testbytestring fullutf} { - testutfnext [testbytestring \xF2\xA0] -} -1 + testutfnext [testbytestring \xF2\xA0\x00] +} 1 test utf-6.33 {Tcl_UtfNext} {testutfnext testbytestring} { testutfnext [testbytestring \xF2\xD0] } 1 -- cgit v0.12 From 71a412b8daa48172c15652a8fb18a5bf2cc148c1 Mon Sep 17 00:00:00 2001 From: oehhar Date: Mon, 16 Nov 2020 13:55:33 +0000 Subject: Ticket [d8ae5d5f4c]: Documentation of dict filter script: script results, not returns a boolean --- doc/dict.n | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/dict.n b/doc/dict.n index cd7e94c..db4b656 100644 --- a/doc/dict.n +++ b/doc/dict.n @@ -58,7 +58,7 @@ of the given patterns (in the style of \fBstring match\fR.) . The script rule tests for matching by assigning the key to the \fIkeyVariable\fR and the value to the \fIvalueVariable\fR, and then evaluating -the given script which should return a boolean value (with the +the given script which should result in a boolean value (with the key/value pair only being included in the result of the \fBdict filter\fR when a true value is returned.) Note that the first argument after the rule selection word is a two-element list. If the -- cgit v0.12 From 413ce795e023b9fc40a39e3a0516bacc566292d7 Mon Sep 17 00:00:00 2001 From: oehhar Date: Mon, 16 Nov 2020 14:06:50 +0000 Subject: Ticket [93551c1230]: Document that http::geturl processes the event loop without -command --- doc/http.n | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/http.n b/doc/http.n index 26bf943..ae298b2 100644 --- a/doc/http.n +++ b/doc/http.n @@ -78,6 +78,9 @@ when the transaction completes. For this to work, the Tcl event loop must be active. In Tk applications this is always true. For pure-Tcl applications, the caller can use \fB::http::wait\fR after calling \fB::http::geturl\fR to start the event loop. +.PP +\fBNote:\fR The event queue is even used without the \fB-command\fR option. +As a side effect, arbitrary commands may be processed while \fBhttp::geturl\fR is running. .SH COMMANDS .TP \fB::http::config\fR ?\fIoptions\fR? -- cgit v0.12 From 7fa0505ae881f84ff691141af719e62e654a028e Mon Sep 17 00:00:00 2001 From: oehhar Date: Mon, 16 Nov 2020 14:14:36 +0000 Subject: Ticket [4f511270af7]: http documentation: -query data may be any data --- doc/http.n | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/http.n b/doc/http.n index ae298b2..cbef2ab 100644 --- a/doc/http.n +++ b/doc/http.n @@ -319,9 +319,11 @@ otherwise complain about HTTP/1.1. \fB\-query\fR \fIquery\fR . This flag causes \fB::http::geturl\fR to do a POST request that passes the -\fIquery\fR to the server. The \fIquery\fR must be an x-url-encoding -formatted query. The \fB::http::formatQuery\fR procedure can be used to -do the formatting. +\fIquery\fR as payload verbatim to the server. +The content format (and encoding) of \fIquery\fR is announced by the header +field \fBcontent-type\fR set by the option \fB-type\fR. +\fIquery\fR is an x-url-encoding formatted query, if used for html forms. +The \fB::http::formatQuery\fR procedure can be used to do the formatting. .TP \fB\-queryblocksize\fR \fIsize\fR . -- cgit v0.12 From 45aa98890539609f2fe97681d7bf1a9a8620ae04 Mon Sep 17 00:00:00 2001 From: oehhar Date: Mon, 16 Nov 2020 14:37:00 +0000 Subject: Ticket [361303]: http doc: status values incomplete --- doc/http.n | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/http.n b/doc/http.n index cbef2ab..aa852b3 100644 --- a/doc/http.n +++ b/doc/http.n @@ -547,6 +547,12 @@ is raised, but the status of the transaction will be \fBeof\fR. . The error message will also be stored in the \fBerror\fR status array element, accessible via \fB::http::error\fR. +.TP\fR +.\fBtimeout +A timeout occurred before the transaction could complete +.TP\fR +.\fBreset +user-reset .PP Another error possibility is that \fB::http::geturl\fR is unable to write all the post query data to the server before the server @@ -662,10 +668,9 @@ the post query data to the server. .TP \fBstatus\fR . -Either \fBok\fR, for successful completion, \fBreset\fR for -user-reset, \fBtimeout\fR if a timeout occurred before the transaction -could complete, or \fBerror\fR for an error condition. During the -transaction this value is the empty string. +See description in the chapter \fBERRORS\fR above for a +list and description of \fBstatus\fR. +During the transaction this value is the empty string. .TP \fBtotalsize\fR . -- cgit v0.12 From 969ef21225d3b195d58f9bb37d8b1f8f3c8b6d99 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 17 Nov 2020 08:39:19 +0000 Subject: Extend tcltk-man2html-utils.tcl, so it can handle the TIP #588 man-page. Also fix 2 (minor) syntax errors in man-pages --- doc/http.n | 10 +++--- doc/re_syntax.n | 6 ++-- tools/tcltk-man2html-utils.tcl | 70 ++++++++++++++++++++++++++++++++++-------- 3 files changed, 67 insertions(+), 19 deletions(-) diff --git a/doc/http.n b/doc/http.n index aa852b3..ce07d30 100644 --- a/doc/http.n +++ b/doc/http.n @@ -547,11 +547,13 @@ is raised, but the status of the transaction will be \fBeof\fR. . The error message will also be stored in the \fBerror\fR status array element, accessible via \fB::http::error\fR. -.TP\fR -.\fBtimeout +.TP +\fBtimeout\fR +. A timeout occurred before the transaction could complete -.TP\fR -.\fBreset +.TP +\fBreset\fR +. user-reset .PP Another error possibility is that \fB::http::geturl\fR is unable to diff --git a/doc/re_syntax.n b/doc/re_syntax.n index 7988071..8d732ed 100644 --- a/doc/re_syntax.n +++ b/doc/re_syntax.n @@ -293,12 +293,12 @@ treatment is as if the enclosing delimiters were .QW \fB[.\fR \& and .QW \fB.]\fR .) -For example, if \fBo\fR and \fB\*(qo\fR are the members of an +For example, if \fBo\fR and \fB\[^o]\fR are the members of an equivalence class, then .QW \fB[[=o=]]\fR , -.QW \fB[[=\*(qo=]]\fR , +.QW \fB[[=\[^o]=]]\fR , and -.QW \fB[o\*(qo]\fR \& +.QW \fB[o\[^o]]\fR \& are all synonymous. An equivalence class may not be an endpoint of a range. .RS .PP diff --git a/tools/tcltk-man2html-utils.tcl b/tools/tcltk-man2html-utils.tcl index 65d81de..0aa1d5c 100644 --- a/tools/tcltk-man2html-utils.tcl +++ b/tools/tcltk-man2html-utils.tcl @@ -130,8 +130,8 @@ proc htmlize-text {text {charmap {}}} { \" {"} \ {<} {<} \ {>} {>} \ - \u201c "“" \ - \u201d "”" + \u201c "“" \ + \u201d "”" return [string map $charmap $text] } @@ -144,20 +144,62 @@ proc process-text {text} { {\&} "\t" \ {\%} {} \ "\\\n" "\n" \ - {\(+-} "±" \ + {\(r!} "¡" \ + {\(ct} "¢" \ + {\(Po} "£" \ + {\(Cs} "¤" \ + {\(Ye} "¥" \ + {\(bb} "¦" \ + {\(sc} "§" \ + {\(ad} "¨" \ {\(co} "©" \ - {\(em} "—" \ - {\(en} "–" \ - {\(fm} "′" \ - {\(mc} "µ" \ - {\(mu} "×" \ - {\(mi} "−" \ - {\(->} "" \ + {\(Of} "ª" \ + {\(Fo} "«" \ + {\(no} "¬" \ + {\(rg} "®" \ + {\(a-} "¯" \ + {\(de} "°" \ + {\(+-} "±" \ + {\(S2} "²" \ + {\(S3} "³" \ + {\(aa} "´" \ + {\(mc} "µ" \ + {\(ps} "¶" \ + {\(pc} "·" \ + {\(ac} "¸" \ + {\(S1} "¹" \ + {\(Om} "º" \ + {\(Fc} "»" \ + {\(14} "¼" \ + {\(12} "½" \ + {\(34} "¾" \ + {\(r?} "¿" \ + {\(AE} "Æ" \ + {\(-D} "Ð" \ + {\(mu} "×" \ + {\(TP} "Þ" \ + {\(ss} "ß" \ + {\(ae} "æ" \ + {\(Sd} "ð" \ + {\(di} "÷" \ + {\(Tp} "þ" \ + {\(em} "—" \ + {\(en} "–" \ + {\(bu} "•" \ + {\(fm} "′" \ + {\(mi} "−" \ + {\(->} "" \ {\fP} {\fR} \ {\.} . \ - {\(bu} "•" \ - {\*(qo} "ô" \ ] + # This might make a few invalid mappings, but we don't use them + foreach c {a c e i n o u y A C E I N O U Y} { + foreach {prefix suffix} { + o ring / slash : uml ' acute ^ circ ` grave ~ tilde , cedilla + } { + lappend charmap "\\\[${prefix}${c}\]" "&${c}${suffix};" + } + } lappend charmap {\-\|\-} -- ; # two hyphens lappend charmap {\-} - ; # a hyphen @@ -1559,6 +1601,10 @@ proc make-manpage-section {outputDir sectionDescriptor} { puts stderr "" } + if {![llength $manual(wing-toc)]} { + fatal "not table of contents." + } + # # make the wing table of contents for the section # -- cgit v0.12 From ffda48d07b9324f64f02a34c0bdced10994cf6d2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 17 Nov 2020 08:45:22 +0000 Subject: Extend tcltk-man2html-utils.tcl: Add euro-sign too --- tools/tcltk-man2html-utils.tcl | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/tcltk-man2html-utils.tcl b/tools/tcltk-man2html-utils.tcl index 0aa1d5c..1f49d8c 100644 --- a/tools/tcltk-man2html-utils.tcl +++ b/tools/tcltk-man2html-utils.tcl @@ -189,6 +189,7 @@ proc process-text {text} { {\(fm} "′" \ {\(mi} "−" \ {\(->} "" \ + {\(eu} "€" \ {\fP} {\fR} \ {\.} . \ ] -- cgit v0.12 From 4929dd61e1e28ba20ab70508d4d3421d8747a9ea Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 17 Nov 2020 09:11:09 +0000 Subject: Generated html still not 100% correct .... --- tools/tcltk-man2html-utils.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tcltk-man2html-utils.tcl b/tools/tcltk-man2html-utils.tcl index 1f49d8c..e207434 100644 --- a/tools/tcltk-man2html-utils.tcl +++ b/tools/tcltk-man2html-utils.tcl @@ -196,7 +196,7 @@ proc process-text {text} { # This might make a few invalid mappings, but we don't use them foreach c {a c e i n o u y A C E I N O U Y} { foreach {prefix suffix} { - o ring / slash : uml ' acute ^ circ ` grave ~ tilde , cedilla + o ring / slash : uml ' acute ^ circ ` grave ~ tilde , cedil } { lappend charmap "\\\[${prefix}${c}\]" "&${c}${suffix};" } -- cgit v0.12 From 32e54c35045cd5fccf41c90ecee81be122e750a0 Mon Sep 17 00:00:00 2001 From: oehhar Date: Tue, 17 Nov 2020 10:11:24 +0000 Subject: Ticket [ac661a684d]: Tcl_NotifyChannel man page: "no writable callback on pending flush" missing --- doc/CrtChannel.3 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/CrtChannel.3 b/doc/CrtChannel.3 index 929b1b8..0092cfb 100644 --- a/doc/CrtChannel.3 +++ b/doc/CrtChannel.3 @@ -259,7 +259,8 @@ outside this range, \fBTcl_SetChannelBufferSize\fR sets the buffer size to the generic layer that the events specified by \fImask\fR have occurred on the channel. Channel drivers are responsible for invoking this function whenever the channel handlers need to be called for the -channel. See \fBWATCHPROC\fR below for more details. +channel (or other pending tasks like a write flush should be performed). +See \fBWATCHPROC\fR below for more details. .PP \fBTcl_BadChannelOption\fR is called from driver specific \fIsetOptionProc\fR or \fIgetOptionProc\fR to generate a complete -- cgit v0.12 From 60980407544983c6f254eaa2ca9fb18b3746e6cb Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 17 Nov 2020 12:36:59 +0000 Subject: Test fails with Windows in CI, not MSVC --- tests/socket.test | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/socket.test b/tests/socket.test index 9d2e5eb..e6f9c4f 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -80,6 +80,8 @@ testConstraint notWine [expr {![info exists ::env(CI_USING_WINE)]}] testConstraint thread [expr {0 == [catch {package require Thread 2.7-}]}] testConstraint exec [llength [info commands exec]] testConstraint knownMsvcBug [expr {![info exists ::env(CI_BUILD_WITH_MSVC)]}] +testConstraint notWinCI [expr { + $tcl_platform(platform) ne "windows" || ![info exists ::env(CI)]}] # Produce a random port number in the Dynamic/Private range # from 49152 through 65535. @@ -2392,7 +2394,7 @@ test socket-14.10.1 {pending [socket -async] and nonblocking [puts], server is I removeFile script } -result {{} ok} test socket-14.11.0 {pending [socket -async] and nonblocking [puts], no listener, no flush} \ - -constraints {socket knownMsvcBug} \ + -constraints {socket notWinCI} \ -body { set sock [socket -async localhost [randport]] fconfigure $sock -blocking 0 -- cgit v0.12 From f88225f6fb8117aa9462dc7975e9babf2dcf60c9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 17 Nov 2020 14:35:42 +0000 Subject: Extend tcltk-man2html-utils.tcl a little more: Allow original AT&T syntax for more accented characters, and add support for some ligatures. Use this in re_syntax.n --- doc/re_syntax.n | 6 +++--- tools/tcltk-man2html-utils.tcl | 13 +++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/doc/re_syntax.n b/doc/re_syntax.n index 8d732ed..4504a58 100644 --- a/doc/re_syntax.n +++ b/doc/re_syntax.n @@ -293,12 +293,12 @@ treatment is as if the enclosing delimiters were .QW \fB[.\fR \& and .QW \fB.]\fR .) -For example, if \fBo\fR and \fB\[^o]\fR are the members of an +For example, if \fBo\fR and \fB\(^o\fR are the members of an equivalence class, then .QW \fB[[=o=]]\fR , -.QW \fB[[=\[^o]=]]\fR , +.QW \fB[[=\(^o=]]\fR , and -.QW \fB[o\[^o]]\fR \& +.QW \fB[o\(^o]\fR \& are all synonymous. An equivalence class may not be an endpoint of a range. .RS .PP diff --git a/tools/tcltk-man2html-utils.tcl b/tools/tcltk-man2html-utils.tcl index e207434..5b2a831 100644 --- a/tools/tcltk-man2html-utils.tcl +++ b/tools/tcltk-man2html-utils.tcl @@ -188,17 +188,26 @@ proc process-text {text} { {\(bu} "•" \ {\(fm} "′" \ {\(mi} "−" \ + {\(.i} "ı" \ + {\(.j} "ȷ" \ + {\(Fn} "ƒ" \ + {\(OE} "Œ" \ + {\(oe} "œ" \ + {\(IJ} "IJ" \ + {\(ij} "ij" \ + {\(<-} "" \ {\(->} "" \ {\(eu} "€" \ {\fP} {\fR} \ {\.} . \ ] # This might make a few invalid mappings, but we don't use them - foreach c {a c e i n o u y A C E I N O U Y} { + foreach c {a c e g i l n o s t u y z A C E G I L N O S T U Y Z} { foreach {prefix suffix} { - o ring / slash : uml ' acute ^ circ ` grave ~ tilde , cedil + o ring / slash : uml ' acute ^ circ ` grave ~ tilde , cedil v caron } { lappend charmap "\\\[${prefix}${c}\]" "&${c}${suffix};" + lappend charmap "\\(${prefix}${c}" "&${c}${suffix};" } } lappend charmap {\-\|\-} -- ; # two hyphens -- cgit v0.12 From c4b8fd351a05b85eebddb6def0955884e6929e65 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 18 Nov 2020 09:15:31 +0000 Subject: Add github actions build. Use Titlecase in Tcl_StaticPackage --- .github/workflows/linux-build.yml | 45 +++++++++++++++++++++++++ .github/workflows/mac-build.yml | 61 +++++++++++++++++++++++++++++++++ .github/workflows/win-build.yml | 71 +++++++++++++++++++++++++++++++++++++++ README.md | 4 ++- library/dde/pkgIndex.tcl | 4 +-- library/reg/pkgIndex.tcl | 4 +-- tests/fileSystem.test | 2 +- tests/winDde.test | 18 +++++----- win/Makefile.in | 4 +-- win/makefile.vc | 4 +-- win/tclAppInit.c | 4 +-- 11 files changed, 200 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/linux-build.yml create mode 100644 .github/workflows/mac-build.yml create mode 100644 .github/workflows/win-build.yml diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml new file mode 100644 index 0000000..44a6332 --- /dev/null +++ b/.github/workflows/linux-build.yml @@ -0,0 +1,45 @@ +name: Linux +on: [push] +jobs: + gcc: + runs-on: ubuntu-latest + strategy: + matrix: + symbols: + - "no" + - "mem" + - "all" + defaults: + run: + shell: bash + working-directory: unix + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Configure (symbols=${{ matrix.symbols }}) + run: | + mkdir "${HOME}/install" + ./configure ${CFGOPT} "--prefix=$HOME/install" || (cat config.log && exit 1) + env: + CFGOPT: --enable-symbols=${{ matrix.symbols }} + - name: Prepare + run: touch tclStubInit.c + working-directory: generic + - name: Build + run: | + make all + - name: Build Test Harness + run: | + make tcltest + - name: Run Tests + run: | + make test + - name: Test-Drive Installation + run: | + make install + - name: Create Distribution Package + run: | + make dist + - name: Convert Documentation to HTML + run: | + make html-tcl diff --git a/.github/workflows/mac-build.yml b/.github/workflows/mac-build.yml new file mode 100644 index 0000000..c3748c0 --- /dev/null +++ b/.github/workflows/mac-build.yml @@ -0,0 +1,61 @@ +name: macOS +on: [push] +jobs: + with-Xcode: + runs-on: macos-latest + defaults: + run: + shell: bash + working-directory: macosx + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Prepare + run: touch tclStubInit.c + working-directory: generic + - name: Build + run: make all + - name: Run Tests + run: make test styles=develop + env: + ERROR_ON_FAILURES: 1 + MAC_CI: 1 + Unix-like: + runs-on: macos-latest + strategy: + matrix: + symbols: + - "no" + - "mem" + dtrace: + - "no" + - "yes" + defaults: + run: + shell: bash + working-directory: unix + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Prepare + run: | + touch tclStubInit.c tclOOStubInit.c + mkdir "$HOME/install" + working-directory: generic + - name: Configure (symbols=${{ matrix.symbols }} dtrace=${{ matrix.dtrace }}) + # Note that macOS is always a 64 bit platform + run: ./configure --enable-64bit ${CFGOPT} "--prefix=$HOME/install" || (cat config.log && exit 1) + env: + CFGOPT: --enable-symbols=${{ matrix.symbols }} --enable-dtrace=${{ matrix.dtrace }} + - name: Build + run: | + make all tcltest + - name: Run Tests + run: | + make test + env: + ERROR_ON_FAILURES: 1 + MAC_CI: 1 + - name: Trial Installation + run: | + make install diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml new file mode 100644 index 0000000..6232788 --- /dev/null +++ b/.github/workflows/win-build.yml @@ -0,0 +1,71 @@ +name: Windows +on: [push] +jobs: + MSVC: + runs-on: windows-latest + defaults: + run: + shell: powershell + working-directory: win + # Using powershell means we need to explicitly stop on failure + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Init MSVC + uses: ilammy/msvc-dev-cmd@v1 + - name: Build + run: | + &nmake -f makefile.vc all + if ($lastexitcode -ne 0) { + throw "nmake exit code: $lastexitcode" + } + - name: Build Test Harness + run: | + &nmake -f makefile.vc tcltest + if ($lastexitcode -ne 0) { + throw "nmake exit code: $lastexitcode" + } + - name: Run Tests + run: | + &nmake -f makefile.vc test + if ($lastexitcode -ne 0) { + throw "nmake exit code: $lastexitcode" + } + env: + ERROR_ON_FAILURES: 1 + MSYS-gcc: + runs-on: windows-latest + defaults: + run: + shell: bash + working-directory: win + strategy: + matrix: + symbols: + - "no" + - "mem" + - "all" + # Using powershell means we need to explicitly stop on failure + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install MSYS2 and Make + run: choco install msys2 make + - name: Prepare + run: | + touch tclStubInit.c + mkdir "${HOME}/install" + working-directory: generic + - name: Configure (symbols=${{ matrix.symbols }}) + run: | + ./configure ${CFGOPT} "--prefix=$HOME/install" || (cat config.log && exit 1) + env: + CFGOPT: --enable-64bit --enable-symbols=${{ matrix.symbols }} + - name: Build + run: make all + - name: Build Test Harness + run: make tcltest + - name: Run Tests + run: make test + env: + ERROR_ON_FAILURES: 1 diff --git a/README.md b/README.md index efad379..24871c0 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,9 @@ This is the **Tcl 8.5.19** source distribution. You can get any source release of Tcl from [our distribution site](https://sourceforge.net/projects/tcl/files/Tcl/). -[![Build Status](https://travis-ci.org/tcltk/tcl.svg?branch=core-8-5-branch)](https://travis-ci.org/tcltk/tcl) +[![Build Status](https://github.com/tcltk/tcl/workflows/Linux/badge.svg?branch=core-8-5-branch)](https://github.com/tcltk/tcl/actions?query=workflow%3A%22Linux%22+branch%3Acore-8-5-branch) +[![Build Status](https://github.com/tcltk/tcl/workflows/Windows/badge.svg?branch=core-8-5-branch)](https://github.com/tcltk/tcl/actions?query=workflow%3A%22Windows%22+branch%3Acore-8-5-branch) +[![Build Status](https://github.com/tcltk/tcl/workflows/macOS/badge.svg?branch=core-8-5-branch)](https://github.com/tcltk/tcl/actions?query=workflow%3A%22macOS%22+branch%3Acore-8-5-branch) ## Contents 1. [Introduction](#intro) diff --git a/library/dde/pkgIndex.tcl b/library/dde/pkgIndex.tcl index b7187c0..1ca9c5a 100644 --- a/library/dde/pkgIndex.tcl +++ b/library/dde/pkgIndex.tcl @@ -1,7 +1,7 @@ if {![package vsatisfies [package provide Tcl] 8.5]} return if {[info sharedlibextension] != ".dll"} return if {[::tcl::pkgconfig get debug]} { - package ifneeded dde 1.4.3 [list load [file join $dir tcldde14g.dll] dde] + package ifneeded dde 1.4.3 [list load [file join $dir tcldde14g.dll] Dde] } else { - package ifneeded dde 1.4.3 [list load [file join $dir tcldde14.dll] dde] + package ifneeded dde 1.4.3 [list load [file join $dir tcldde14.dll] Dde] } diff --git a/library/reg/pkgIndex.tcl b/library/reg/pkgIndex.tcl index f2fb3b7..6603e3e 100644 --- a/library/reg/pkgIndex.tcl +++ b/library/reg/pkgIndex.tcl @@ -2,8 +2,8 @@ if {![package vsatisfies [package provide Tcl] 8.5]} return if {[info sharedlibextension] != ".dll"} return if {[::tcl::pkgconfig get debug]} { package ifneeded registry 1.3.5 \ - [list load [file join $dir tclreg13g.dll] registry] + [list load [file join $dir tclreg13g.dll] Registry] } else { package ifneeded registry 1.3.5 \ - [list load [file join $dir tclreg13.dll] registry] + [list load [file join $dir tclreg13.dll] Registry] } diff --git a/tests/fileSystem.test b/tests/fileSystem.test index e6ac9c5..35f2717 100644 --- a/tests/fileSystem.test +++ b/tests/fileSystem.test @@ -760,7 +760,7 @@ test filesystem-7.1 {load from vfs} {win testsimplefilesystem haveDdeDll} { set dde [lindex [glob *dde*[info sharedlib]] 0] testsimplefilesystem 1 # This loads dde via a complex copy-to-temp operation - load simplefs:/$dde dde + load simplefs:/$dde Dde testsimplefilesystem 0 cd $dir set res "ok" diff --git a/tests/winDde.test b/tests/winDde.test index acba304..063edd0 100644 --- a/tests/winDde.test +++ b/tests/winDde.test @@ -10,7 +10,7 @@ # of this file, and for a DISCLAIMER OF ALL WARRANTIES. if {"::tcltest" ni [namespace children]} { - package require tcltest 2 + package require tcltest 2.5 #tcltest::configure -verbose {pass start} namespace import -force ::tcltest::* } @@ -21,7 +21,7 @@ if {[testConstraint win]} { if {![catch { ::tcltest::loadTestedCommands set ::ddever [package require dde 1.4.3] - set ::ddelib [lindex [package ifneeded dde $::ddever] 1]}]} { + set ::ddelib [info loaded "" Dde]}]} { testConstraint dde 1 } } @@ -38,12 +38,12 @@ proc createChildProcess {ddeServerName args} { set f [open $::scriptName w+] puts $f [list set ddeServerName $ddeServerName] - puts $f [list load $::ddelib dde] + puts $f [list load $::ddelib Dde] puts $f { # DDE child server - # if {"::tcltest" ni [namespace children]} { - package require tcltest + package require tcltest 2.5 namespace import -force ::tcltest::* } @@ -111,7 +111,7 @@ test winDde-1.1 {Settings the server's topic name} -constraints dde -body { } -result {foobar foobar self} test winDde-2.1 {Checking for other services} -constraints dde -body { - expr [llength [dde services {} {}]] >= 0 + expr {[llength [dde services {} {}]] >= 0} } -result 1 test winDde-2.2 {Checking for existence, with service and topic specified} \ -constraints dde -body { @@ -119,11 +119,11 @@ test winDde-2.2 {Checking for existence, with service and topic specified} \ } -result 1 test winDde-2.3 {Checking for existence, with only the service specified} \ -constraints dde -body { - expr [llength [dde services TclEval {}]] >= 1 + expr {[llength [dde services TclEval {}]] >= 1} } -result 1 test winDde-2.4 {Checking for existence, with only the topic specified} \ -constraints dde -body { - expr [llength [dde services {} self]] >= 1 + expr {[llength [dde services {} self]] >= 1} } -result 1 # ------------------------------------------------------------------------- @@ -154,8 +154,8 @@ test winDde-3.5 {DDE request locally} -constraints dde -body { dde request -binary TclEval self \xe1 } -result "foo\x00" # Set variable a to A with diaeresis (unicode C4) by relying on the fact -# that utf8 is sent (e.g. "c3 84" on the wire) -test winDde-3.6 {DDE request utf8} -constraints dde -body { +# that utf-8 is sent (e.g. "c3 84" on the wire) +test winDde-3.6 {DDE request utf-8} -constraints dde -body { set \xe1 "not set" dde execute TclEval self "set \xe1 \xc4" scan [set \xe1] %c diff --git a/win/Makefile.in b/win/Makefile.in index 324d917..8835232 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -148,8 +148,8 @@ REG_DLL_FILE = tclreg$(REGVER)${DLLSUFFIX} REG_LIB_FILE = @LIBPREFIX@tclreg$(REGVER)${DLLSUFFIX}${LIBSUFFIX} TEST_EXE_FILE = tcltest${EXESUFFIX} TEST_LIB_FILE = @LIBPREFIX@tcltest$(VER)${DLLSUFFIX}${LIBSUFFIX} -TEST_LOAD_PRMS = package ifneeded dde 1.4.3 [list load [file normalize ${DDE_DLL_FILE}] dde];\ - package ifneeded registry 1.3.5 [list load [file normalize ${REG_DLL_FILE}] registry] +TEST_LOAD_PRMS = package ifneeded dde 1.4.3 [list load [file normalize ${DDE_DLL_FILE}] Dde];\ + package ifneeded registry 1.3.5 [list load [file normalize ${REG_DLL_FILE}] Registry] TEST_LOAD_FACILITIES = $(TEST_LOAD_PRMS) SHARED_LIBRARIES = $(TCL_DLL_FILE) diff --git a/win/makefile.vc b/win/makefile.vc index 1924e33..f8ac7e2 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -540,8 +540,8 @@ test-core: setup $(TCLTEST) dlls $(CAT32) set TCL_LIBRARY=$(ROOT:\=/)/library !if "$(OS)" == "Windows_NT" || "$(MSVCDIR)" == "IDE" $(DEBUGGER) $(TCLTEST) "$(ROOT:\=/)/tests/all.tcl" $(TESTFLAGS) -loadfile << - package ifneeded dde 1.4.3 [list load "$(TCLDDELIB:\=/)" dde] - package ifneeded registry 1.3.5 [list load "$(TCLREGLIB:\=/)" registry] + package ifneeded dde 1.4.3 [list load "$(TCLDDELIB:\=/)" Dde] + package ifneeded registry 1.3.5 [list load "$(TCLREGLIB:\=/)" Registry] << !else @echo Please wait while the tests are collected... diff --git a/win/tclAppInit.c b/win/tclAppInit.c index 251a610..b63a405 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.c @@ -154,12 +154,12 @@ Tcl_AppInit( if (Registry_Init(interp) == TCL_ERROR) { return TCL_ERROR; } - Tcl_StaticPackage(interp, "registry", Registry_Init, NULL); + Tcl_StaticPackage(interp, "Registry", Registry_Init, NULL); if (Dde_Init(interp) == TCL_ERROR) { return TCL_ERROR; } - Tcl_StaticPackage(interp, "dde", Dde_Init, Dde_SafeInit); + Tcl_StaticPackage(interp, "Dde", Dde_Init, Dde_SafeInit); } #endif -- cgit v0.12 From f7b532246a185fd8f314fdf9969a4a58533f90bc Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 18 Nov 2020 09:49:08 +0000 Subject: Enhance misleading test-case utf-6.23 with better diagnostics: Byte 0xE8 is the start of a 3-byte UTF-8 sequence, so Tcl_UtfNext is expected to read next byte and see if it is a continuation byte --- generic/tclTest.c | 6 ++++-- tests/utf.test | 12 ++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/generic/tclTest.c b/generic/tclTest.c index 6923cd6..6408228 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -7184,8 +7184,10 @@ TestUtfNextCmd( /* Run Tcl_UtfNext with many more possible bytes at src[end], all should give the same result */ result = TclUtfNext(buffer + 1); if (first != result) { - first = buffer; - break; + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "Tcl_UtfNext is not supposed to read src[end]\n" + "Different result when src[end] is %#x", UCHAR(p[-1]))); + return TCL_ERROR; } } diff --git a/tests/utf.test b/tests/utf.test index a32b19e..c61082f 100644 --- a/tests/utf.test +++ b/tests/utf.test @@ -252,8 +252,8 @@ test utf-6.22 {Tcl_UtfNext} {testutfnext testbytestring} { testutfnext [testbytestring \xD0\xF8] } 1 test utf-6.23 {Tcl_UtfNext} {testutfnext testbytestring} { - testutfnext [testbytestring \xE8] -} -1 + testutfnext [testbytestring \xE8\x00] +} 1 test utf-6.24 {Tcl_UtfNext} {testutfnext testbytestring} { testutfnext [testbytestring \xE8]G } 1 @@ -276,8 +276,8 @@ test utf-6.30.0 {Tcl_UtfNext} {testutfnext testbytestring ucs2} { testutfnext [testbytestring \xF2] } 1 test utf-6.30.1 {Tcl_UtfNext} {testutfnext testbytestring fullutf} { - testutfnext [testbytestring \xF2] -} -1 + testutfnext [testbytestring \xF2\x00] +} 1 test utf-6.31 {Tcl_UtfNext} {testutfnext testbytestring} { testutfnext [testbytestring \xF2]G } 1 @@ -285,8 +285,8 @@ test utf-6.32.0 {Tcl_UtfNext} {testutfnext testbytestring ucs2} { testutfnext [testbytestring \xF2\xA0] } 1 test utf-6.32.1 {Tcl_UtfNext} {testutfnext testbytestring fullutf} { - testutfnext [testbytestring \xF2\xA0] -} -1 + testutfnext [testbytestring \xF2\xA0\x00] +} 1 test utf-6.33 {Tcl_UtfNext} {testutfnext testbytestring} { testutfnext [testbytestring \xF2\xD0] } 1 -- cgit v0.12 From 8e1f957a669b2f4b84dca7e8a27f2985c0625172 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 18 Nov 2020 13:51:02 +0000 Subject: More usage of TclUtfToUCS4/TclUniCharToUCS4 in stead of it's UniChar variants: This handles surrogate pairs better. --- generic/tclCmdMZ.c | 42 +++++++++++++++++++----------------------- generic/tclCompExpr.c | 10 +++++----- generic/tclInt.h | 6 ++++-- generic/tclParse.c | 10 +++++----- generic/tclUtf.c | 15 ++++++++++++++- 5 files changed, 47 insertions(+), 36 deletions(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index c47490a..0764c60 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -2500,8 +2500,8 @@ StringStartCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { int ch; - const char *p, *string; - int cur, index, length, numChars; + const Tcl_UniChar *p, *string; + int cur, index, length; Tcl_Obj *obj; if (objc != 3) { @@ -2509,32 +2509,30 @@ StringStartCmd( return TCL_ERROR; } - string = TclGetStringFromObj(objv[1], &length); - numChars = Tcl_NumUtfChars(string, length); - if (TclGetIntForIndexM(interp, objv[2], numChars-1, &index) != TCL_OK) { + string = Tcl_GetUnicodeFromObj(objv[1], &length); + if (TclGetIntForIndexM(interp, objv[2], length-1, &index) != TCL_OK) { return TCL_ERROR; } - string = TclGetStringFromObj(objv[1], &length); - if (index >= numChars) { - index = numChars - 1; + if (index >= length) { + index = length - 1; } cur = 0; if (index > 0) { - p = Tcl_UtfAtIndex(string, index); + p = &string[index]; - TclUtfToUCS4(p, &ch); + (void)TclUniCharToUCS4(p, &ch); for (cur = index; cur >= 0; cur--) { int delta = 0; - const char *next; + const Tcl_UniChar *next; if (!Tcl_UniCharIsWordChar(ch)) { break; } - next = TclUtfPrev(p, string); + next = TclUCS4Prev(p, string); do { next += delta; - delta = TclUtfToUCS4(next, &ch); + delta = TclUniCharToUCS4(next, &ch); } while (next + delta < p); p = next; } @@ -2572,8 +2570,8 @@ StringEndCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { int ch; - const char *p, *end, *string; - int cur, index, length, numChars; + const Tcl_UniChar *p, *end, *string; + int cur, index, length; Tcl_Obj *obj; if (objc != 3) { @@ -2581,20 +2579,18 @@ StringEndCmd( return TCL_ERROR; } - string = TclGetStringFromObj(objv[1], &length); - numChars = Tcl_NumUtfChars(string, length); - if (TclGetIntForIndexM(interp, objv[2], numChars-1, &index) != TCL_OK) { + string = Tcl_GetUnicodeFromObj(objv[1], &length); + if (TclGetIntForIndexM(interp, objv[2], length-1, &index) != TCL_OK) { return TCL_ERROR; } - string = TclGetStringFromObj(objv[1], &length); if (index < 0) { index = 0; } - if (index < numChars) { - p = Tcl_UtfAtIndex(string, index); + if (index < length) { + p = &string[index]; end = string+length; for (cur = index; p < end; cur++) { - p += TclUtfToUCS4(p, &ch); + p += TclUniCharToUCS4(p, &ch); if (!Tcl_UniCharIsWordChar(ch)) { break; } @@ -2603,7 +2599,7 @@ StringEndCmd( cur++; } } else { - cur = numChars; + cur = length; } TclNewIntObj(obj, cur); Tcl_SetObjResult(interp, obj); diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index 41938e3..fa15fba 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -1928,7 +1928,7 @@ ParseLexeme( { const char *end; int scanned, size; - Tcl_UniChar ch = 0; + int ch; Tcl_Obj *literal = NULL; unsigned char byte; @@ -2145,14 +2145,14 @@ ParseLexeme( */ if (!TclIsBareword(*start) || *start == '_') { - if (Tcl_UtfCharComplete(start, numBytes)) { - scanned = TclUtfToUniChar(start, &ch); + if (TclUCS4Complete(start, numBytes)) { + scanned = TclUtfToUCS4(start, &ch); } else { - char utfBytes[4]; + char utfBytes[8]; memcpy(utfBytes, start, numBytes); utfBytes[numBytes] = '\0'; - scanned = TclUtfToUniChar(utfBytes, &ch); + scanned = TclUtfToUCS4(utfBytes, &ch); } *lexemePtr = INVALID; Tcl_DecrRefCount(literal); diff --git a/generic/tclInt.h b/generic/tclInt.h index 9dde88b..8088d0e 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3252,12 +3252,14 @@ MODULE_SCOPE int TclUtfCount(int ch); #if TCL_UTF_MAX > 3 # define TclUtfToUCS4 Tcl_UtfToUniChar # define TclUniCharToUCS4(src, ptr) (*ptr = *(src),1) +# define TclUCS4Prev(src, ptr) (((src) > (ptr)) ? ((src) - 1) : (src)) # define TclUCS4Complete Tcl_UtfCharComplete # define TclChar16Complete(src, length) (((unsigned)((unsigned char)*(src) - 0xF0) < 5) \ ? ((length) >= 3) : Tcl_UtfCharComplete((src), (length))) #else - MODULE_SCOPE int TclUtfToUCS4(const char *src, int *ucs4Ptr); - MODULE_SCOPE int TclUniCharToUCS4(const Tcl_UniChar *src, int *ucs4Ptr); + MODULE_SCOPE int TclUtfToUCS4(const char *, int *); + MODULE_SCOPE int TclUniCharToUCS4(const Tcl_UniChar *, int *); + MODULE_SCOPE const Tcl_UniChar *TclUCS4Prev(const Tcl_UniChar *, const Tcl_UniChar *); # define TclUCS4Complete(src, length) (((unsigned)((unsigned char)*(src) - 0xF0) < 5) \ ? ((length) >= 4) : Tcl_UtfCharComplete((src), (length))) # define TclChar16Complete Tcl_UtfCharComplete diff --git a/generic/tclParse.c b/generic/tclParse.c index daad31d..b863ff2 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -789,7 +789,7 @@ TclParseBackslash( * written. At most 4 bytes will be written there. */ { const char *p = src+1; - Tcl_UniChar unichar = 0; + int unichar; int result; int count; char buf[4] = ""; @@ -935,14 +935,14 @@ TclParseBackslash( * #217987] test subst-3.2 */ - if (Tcl_UtfCharComplete(p, numBytes - 1)) { - count = TclUtfToUniChar(p, &unichar) + 1; /* +1 for '\' */ + if (TclUCS4Complete(p, numBytes - 1)) { + count = TclUtfToUCS4(p, &unichar) + 1; /* +1 for '\' */ } else { - char utfBytes[4]; + char utfBytes[8]; memcpy(utfBytes, p, numBytes - 1); utfBytes[numBytes - 1] = '\0'; - count = TclUtfToUniChar(utfBytes, &unichar) + 1; + count = TclUtfToUCS4(utfBytes, &unichar) + 1; } result = unichar; break; diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 11bde5c..525cd50 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -2629,12 +2629,25 @@ TclUniCharToUCS4( * by the Tcl_UniChar string. */ { if (((src[0] & 0xFC00) == 0xD800) && ((src[1] & 0xFC00) == 0xDC00)) { - *ucs4Ptr = (((src[0] & 0x3FF) << 10) | (src[01] & 0x3FF)) + 0x10000; + *ucs4Ptr = (((src[0] & 0x3FF) << 10) | (src[1] & 0x3FF)) + 0x10000; return 2; } *ucs4Ptr = src[0]; return 1; } + +const Tcl_UniChar *TclUCS4Prev(const Tcl_UniChar *src, const Tcl_UniChar *ptr) { + if (src <= ptr + 1) { + return ptr; + } + if (((src[-1] & 0xFC00) == 0xDC00) && ((src[-2] & 0xFC00) == 0xD800)) { + return src - 2; + } + return src - 1; +} + + + #endif /* -- cgit v0.12