-- cgit v0.12 From e451e666af76a6917a4c5c054b87c4c6f39d9484 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 19 Apr 2012 08:05:50 +0000 Subject: [Bug 3519357] fCmd.test failed on unix by foreign files or directory in /tmp. --- tests/fCmd.test | 89 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 46 insertions(+), 43 deletions(-) diff --git a/tests/fCmd.test b/tests/fCmd.test index 37867f3..6c73dee 100644 --- a/tests/fCmd.test +++ b/tests/fCmd.test @@ -551,11 +551,11 @@ test fCmd-6.18 {CopyRenameOneFile: errno != EXDEV} -setup { } -returnCodes error -match glob -result \ [subst {error renaming "td2" to "[file join td1 td2]": file *}] test fCmd-6.19 {CopyRenameOneFile: errno == EXDEV} {unix notRoot} { - cleanup /tmp + file mkdir /tmp/tcltmptest; cleanup /tmp/tcltmptest createfile tf1 - file rename tf1 /tmp - glob -nocomplain tf* /tmp/tf1 -} {/tmp/tf1} + file rename tf1 /tmp/tcltmptest + glob -nocomplain tf* /tmp/tcltmptest/tf1 +} {/tmp/tcltmptest/tf1} test fCmd-6.20 {CopyRenameOneFile: errno == EXDEV} -constraints {win} -setup { catch {file delete -force c:/tcl8975@ d:/tcl8975@} } -body { @@ -570,27 +570,27 @@ test fCmd-6.20 {CopyRenameOneFile: errno == EXDEV} -constraints {win} -setup { } -result {d:/tcl8975@} test fCmd-6.21 {CopyRenameOneFile: copy/rename: S_ISDIR(source)} \ {unix notRoot} { - cleanup /tmp + file mkdir /tmp/tcltmptest; cleanup /tmp/tcltmptest file mkdir td1 - file rename td1 /tmp - glob -nocomplain td* /tmp/td* -} {/tmp/td1} + file rename td1 /tmp/tcltmptest + glob -nocomplain td* /tmp/tcltmptest/td* +} {/tmp/tcltmptest/td1} test fCmd-6.22 {CopyRenameOneFile: copy/rename: !S_ISDIR(source)} \ {unix notRoot} { - cleanup /tmp + file mkdir /tmp/tcltmptest; cleanup /tmp/tcltmptest createfile tf1 - file rename tf1 /tmp - glob -nocomplain tf* /tmp/tf* -} {/tmp/tf1} + file rename tf1 /tmp/tcltmptest + glob -nocomplain tf* /tmp/tcltmptest/tf* +} {/tmp/tcltmptest/tf1} test fCmd-6.23 {CopyRenameOneFile: TclpCopyDirectory failed} -setup { - cleanup /tmp + file mkdir /tmp/tcltmptest; cleanup /tmp/tcltmptest } -constraints {unix notRoot xdev} -body { file mkdir td1/td2/td3 file attributes td1 -permissions 0000 - file rename td1 /tmp + file rename td1 /tmp/tcltmptest } -returnCodes error -cleanup { file attributes td1 -permissions 0755 -} -match regexp -result {^error renaming "td1"( to "/tmp/td1")?: permission denied$} +} -match regexp -result {^error renaming "td1"( to "/tmp/tcltmptest/td1")?: permission denied$} test fCmd-6.24 {CopyRenameOneFile: error uses original name} -setup { cleanup } -constraints {unix notRoot} -body { @@ -626,54 +626,55 @@ test fCmd-6.26 {CopyRenameOneFile: doesn't use original name} -setup { file delete -force ~/td1 } -result "error copying \"~/td1\" to \"td1\": \"[file join $::env(HOME) td1 td2]\": permission denied" test fCmd-6.27 {CopyRenameOneFile: TclpCopyDirectory failed} -setup { - cleanup /tmp + file mkdir /tmp/tcltmptest; cleanup /tmp/tcltmptest } -constraints {unix notRoot xdev} -returnCodes error -body { file mkdir td1/td2/td3 - file mkdir /tmp/td1 - createfile /tmp/td1/tf1 - file rename -force td1 /tmp -} -result {error renaming "td1" to "/tmp/td1": file already exists} + file mkdir /tmp/tcltmptest/td1 + createfile /tmp/tcltmptest/td1/tf1 + file rename -force td1 /tmp/tcltmptest +} -result {error renaming "td1" to "/tmp/tcltmptest/td1": file already exists} test fCmd-6.28 {CopyRenameOneFile: TclpCopyDirectory failed} -setup { - cleanup /tmp + file mkdir /tmp/tcltmptest; cleanup /tmp/tcltmptest } -constraints {unix notRoot xdev} -body { file mkdir td1/td2/td3 file attributes td1/td2/td3 -permissions 0000 - file rename td1 /tmp + file rename td1 /tmp/tcltmptest } -returnCodes error -cleanup { file attributes td1/td2/td3 -permissions 0755 -} -result {error renaming "td1" to "/tmp/td1": "td1/td2/td3": permission denied} +} -result {error renaming "td1" to "/tmp/tcltmptest/td1": "td1/td2/td3": permission denied} test fCmd-6.29 {CopyRenameOneFile: TclpCopyDirectory passed} -setup { - cleanup /tmp + file mkdir /tmp/tcltmptest; cleanup /tmp/tcltmptest } -constraints {unix notRoot xdev} -body { file mkdir td1/td2/td3 - file rename td1 /tmp - glob td* /tmp/td1/t* -} -result {/tmp/td1/td2} + file rename td1 /tmp/tcltmptest + glob td* /tmp/tcltmptest/td1/t* +} -result {/tmp/tcltmptest/td1/td2} test fCmd-6.30 {CopyRenameOneFile: TclpRemoveDirectory failed} -setup { cleanup + file mkdir /tmp/tcltmptest; cleanup /tmp/tcltmptest } -constraints {unix notRoot} -body { file mkdir foo/bar file attr foo -perm 040555 - file rename foo/bar /tmp + file rename foo/bar /tmp/tcltmptest } -returnCodes error -cleanup { - catch {file delete /tmp/bar} + catch {file delete /tmp/tcltmptest/bar} catch {file attr foo -perm 040777} catch {file delete -force foo} } -match glob -result {*: permission denied} test fCmd-6.31 {CopyRenameOneFile: TclpDeleteFile passed} -setup { - catch {cleanup /tmp} + catch {cleanup /tmp/tcltmptest} } -constraints {unix notRoot xdev} -body { - file mkdir /tmp/td1 - createfile /tmp/td1/tf1 - file rename /tmp/td1/tf1 tf1 - list [file exists /tmp/td1/tf1] [file exists tf1] + file mkdir /tmp/tcltmptest/td1 + createfile /tmp/tcltmptest/td1/tf1 + file rename /tmp/tcltmptest/td1/tf1 tf1 + list [file exists /tmp/tcltmptest/td1/tf1] [file exists tf1] } -result {0 1} test fCmd-6.32 {CopyRenameOneFile: copy} -constraints {notRoot} -setup { cleanup } -returnCodes error -body { file copy tf1 tf2 } -result {error copying "tf1": no such file or directory} -catch {cleanup /tmp} +catch {file delete -force /tmp/tcltmptest} test fCmd-7.1 {FileForceOption: none} -constraints {notRoot} -setup { cleanup @@ -1305,23 +1306,25 @@ test fCmd-12.8 {renamefile: generic error} -setup { file delete -force tfa } -result {1} test fCmd-12.9 {renamefile: moving a file across volumes} -setup { - catch {file delete -force -- tfa /tmp/tfa} + file mkdir /tmp/tcltmptest + catch {file delete -force -- tfa /tmp/tcltmptest/tfa} } -constraints {unix notRoot} -body { set s [createfile tfa] - file rename tfa /tmp - list [checkcontent /tmp/tfa $s] [file exists tfa] + file rename tfa /tmp/tcltmptest + list [checkcontent /tmp/tcltmptest/tfa $s] [file exists tfa] } -cleanup { - file delete /tmp/tfa + file delete -force /tmp/tcltmptest } -result {1 0} test fCmd-12.10 {renamefile: moving a directory across volumes} -setup { - catch {file delete -force -- tfad /tmp/tfad} + file mkdir /tmp/tcltmptest + catch {file delete -force -- tfad /tmp/tcltmptest/tfad} } -constraints {unix notRoot} -body { file mkdir tfad set s [createfile tfad/a] - file rename tfad /tmp - list [checkcontent /tmp/tfad/a $s] [file exists tfad] + file rename tfad /tmp/tcltmptest + list [checkcontent /tmp/tcltmptest/tfad/a $s] [file exists tfad] } -cleanup { - file delete -force /tmp/tfad + file delete -force /tmp/tcltmptest } -result {1 0} # -- cgit v0.12 From 19090f685f5610f567baac9ded8a7495631ca63c Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 31 May 2012 09:04:03 +0000 Subject: Prevented intermittent test failure due to race condition. --- ChangeLog | 5 +++++ tests/socket.test | 1 + 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index ff6f2e7..69108c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-05-31 Donal K. Fellows + + * tests/socket.test (socket*-13.1): Prevented intermittent test + failure due to race condition. + 2012-05-29 Donal K. Fellows * doc/expr.n, doc/mathop.n: [Bug 2931407]: Clarified semantics of diff --git a/tests/socket.test b/tests/socket.test index d88eb65..9f1cc78 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -1696,6 +1696,7 @@ test socket_$af-13.1 {Testing use of shared socket between two threads} -body { set i 0 vwait x close $f + thread::wait }]] set port [thread::send $serverthread {set listen}] set s [socket $localhost $port] -- cgit v0.12 From 21dc9cfd81ea3a902c1d4934fc4966ec6b28bd39 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 31 May 2012 10:02:55 +0000 Subject: [Bug 1997845]: Corrected formatting so that generated HTML can link properly. --- ChangeLog | 5 +++++ doc/safe.n | 2 +- tools/tcltk-man2html.tcl | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 43c73c1..c70acbb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-05-31 Donal K. Fellows + + * doc/safe.n: [Bug 1997845]: Corrected formatting so that generated + * tools/tcltk-man2html.tcl (cross-reference): HTML can link properly. + 2012-05-29 Donal K. Fellows * doc/expr.n, doc/mathop.n: [Bug 2931407]: Clarified semantics of diff --git a/doc/safe.n b/doc/safe.n index 78fa6ad..590f2c6 100644 --- a/doc/safe.n +++ b/doc/safe.n @@ -67,7 +67,7 @@ The following commands are provided in the master interpreter: \fB::safe::interpCreate\fR ?\fIslave\fR? ?\fIoptions...\fR? Creates a safe interpreter, installs the aliases described in the section \fBALIASES\fR and initializes the auto-loading and package mechanism as -specified by the supplied \fBoptions\fR. +specified by the supplied \fIoptions\fR. See the \fBOPTIONS\fR section below for a description of the optional arguments. If the \fIslave\fR argument is omitted, a name will be generated. diff --git a/tools/tcltk-man2html.tcl b/tools/tcltk-man2html.tcl index c6932d0..59a2a63 100755 --- a/tools/tcltk-man2html.tcl +++ b/tools/tcltk-man2html.tcl @@ -947,6 +947,11 @@ proc cross-reference {ref} { return $ref } } + safe.n { + if {$lref in {options}} { + return $ref + } + } } ## ## return the cross reference -- cgit v0.12 From 88726e934130098aa10cde9b33859d45a8c87bdd Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 31 May 2012 14:20:29 +0000 Subject: fix subtle problem with safe [file] that caused Tk test failure --- ChangeLog | 4 ++++ library/safe.tcl | 18 +++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 22fe1f3..81bf5e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2012-05-31 Donal K. Fellows + * library/safe.tcl (safe::AliasFileSubcommand): Don't assume that + slaves have corresponding commands, as that is not true for + sub-subinterpreters (used in Tk's test suite). + * doc/safe.n: [Bug 1997845]: Corrected formatting so that generated HTML can link properly. diff --git a/library/safe.tcl b/library/safe.tcl index 4ad5c36..394aa97 100644 --- a/library/safe.tcl +++ b/library/safe.tcl @@ -494,16 +494,16 @@ proc ::safe::InterpInit { if {[catch {::interp eval $slave { source [file join $tcl_library init.tcl] - }} msg]} { + }} msg opt]} { Log $slave "can't source init.tcl ($msg)" - return -code error "can't source init.tcl into slave $slave ($msg)" + return -options $opt "can't source init.tcl into slave $slave ($msg)" } if {[catch {::interp eval $slave { source [file join $tcl_library tm.tcl] - }} msg]} { + }} msg opt]} { Log $slave "can't source tm.tcl ($msg)" - return -code error "can't source tm.tcl into slave $slave ($msg)" + return -options $opt "can't source tm.tcl into slave $slave ($msg)" } # Sync the paths used to search for Tcl modules. This can be done only @@ -684,7 +684,7 @@ proc ::safe::AliasFileSubcommand {slave subcommand name} { if {[string match ~* $name]} { set name ./$name } - tailcall $slave invokehidden tcl:file:$subcommand $name + tailcall ::interp invokehidden $slave tcl:file:$subcommand $name } # AliasGlob is the target of the "glob" alias in safe interpreters. @@ -882,6 +882,7 @@ proc ::safe::AliasSource {slave args} { # because we want to control [info script] in the slave so information # doesn't leak so much. [Bug 2913625] set old [::interp eval $slave {info script}] + set replacementMsg "script error" set code [catch { set f [open $realfile] fconfigure $f -eofchar \032 @@ -891,14 +892,17 @@ proc ::safe::AliasSource {slave args} { set contents [read $f] close $f ::interp eval $slave [list info script $file] - ::interp eval $slave $contents } msg opt] + if {$code == 0} { + set code [catch {::interp eval $slave $contents} msg opt] + set replacementMsg $msg + } catch {interp eval $slave [list info script $old]} # Note that all non-errors are fine result codes from [source], so we must # take a little care to do it properly. [Bug 2923613] if {$code == 1} { Log $slave $msg - return -code error "script error" + return -code error $replacementMsg } return -code $code -options $opt $msg } -- cgit v0.12 From d8dbcfab2c16c65a16daffe6aaa9ed531079dfad Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 31 May 2012 14:52:40 +0000 Subject: [Bug 3531089] Added test to stop this from happening again --- tests/safe.test | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/safe.test b/tests/safe.test index f270248..dcd5bfd 100644 --- a/tests/safe.test +++ b/tests/safe.test @@ -204,6 +204,11 @@ test safe-7.2 {tests specific path and interpFind/AddToAccessPath} -body { [safe::interpConfigure $i]\ [safe::interpDelete $i] } -match glob -result "{\$p(:0:)} {\$p(:*:)} 1 {can't find package http 1} {-accessPath {[list $tcl_library */dummy/unixlike/test/path]} -statics 0 -nested 1 -deleteHook {}} {}" +test safe-7.3 {check that safe subinterpreters work} { + set i [safe::interpCreate] + set j [safe::interpCreate [list $i x]] + list [interp eval $j {join {o k} ""}] [safe::interpDelete $i] [interp exists $j] +} {ok {} 0} # test source control on file name test safe-8.1 {safe source control on file} -setup { -- cgit v0.12 From 91726f2a230497571abc2e7b8b5857e394d91337 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 1 Jun 2012 21:09:13 +0000 Subject: bug-3530536 --- generic/tclZlib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 84a81f8..0ff8b50 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -537,6 +537,7 @@ Tcl_ZlibStreamInit( zshPtr->currentInput = NULL; zshPtr->streamEnd = 0; memset(&zshPtr->stream, 0, sizeof(z_stream)); + zshPtr->stream.adler = 1; /* * No output buffer available yet -- cgit v0.12 From ac7af4b977dbecc4a95d4335d152756824c6e62d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 1 Jun 2012 21:34:48 +0000 Subject: two more testcases, showing that only the "deflate" and "inflate" streams don't update the checksum, other streams do. --- tests/zlib.test | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/zlib.test b/tests/zlib.test index 4ed5b33..fb94c0a 100644 --- a/tests/zlib.test +++ b/tests/zlib.test @@ -103,6 +103,22 @@ test zlib-7.4 {zlib stream} zlib { $s close lappend result $data } {{} 1 abcdeEDCBA} +test zlib-7.5 {zlib stream} zlib { + set s [zlib stream gzip] + $s put -finalize abcdeEDCBA + set data [$s get] + set result [list [$s get] [format %x [$s checksum]]] + $s close + lappend result [zlib gunzip $data] +} {{} ffffffffe3b38816 abcdeEDCBA} +test zlib-7.6 {zlib stream} zlib { + set s [zlib stream gunzip] + $s put -finalize [zlib gzip abcdeEDCBA] + set data [$s get] + set result [list [$s get] [format %x [$s checksum]]] + $s close + lappend result $data +} {{} ffffffffe3b38816 abcdeEDCBA} test zlib-8.1 {zlib transformation} -constraints zlib -setup { set file [makeFile {} test.gz] -- cgit v0.12 From a0ca94afce1f63b761b2d168b5ceed5774425cfd Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 5 Jun 2012 13:04:59 +0000 Subject: 3530533 Add comments to failing tests. --- tests/io.test | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/io.test b/tests/io.test index beb5a30..68051d7 100644 --- a/tests/io.test +++ b/tests/io.test @@ -2086,6 +2086,8 @@ set path(pipe) [makeFile {} pipe] set path(output) [makeFile {} output] test io-27.6 {FlushChannel, async flushing, async close} \ {stdio asyncPipeClose openpipe} { + # 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) file delete $path(output) set f [open $path(pipe) w] @@ -2645,6 +2647,8 @@ test io-29.30 {Tcl_WriteChars, crlf mode} { file size $path(test1) } 25 test io-29.31 {Tcl_WriteChars, background flush} {stdio openpipe} { + # 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) file delete $path(output) set f [open $path(pipe) w] @@ -2686,6 +2690,8 @@ test io-29.31 {Tcl_WriteChars, background flush} {stdio openpipe} { } ok test io-29.32 {Tcl_WriteChars, background flush to slow reader} \ {stdio asyncPipeClose openpipe} { + # 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) file delete $path(output) set f [open $path(pipe) w] -- cgit v0.12 From 22bee8161ff83b967a50d1c853fc96598d6d48c6 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 5 Jun 2012 15:40:56 +0000 Subject: Remove unused variable mantDIGIT. --- generic/tclStrToD.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 5f59500..76adf75 100755 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -167,8 +167,6 @@ static int maxDigits; /* The maximum number of digits to the left of * the decimal point of a double. */ static int minDigits; /* The maximum number of digits to the right * of the decimal point in a double. */ -static int mantDIGIT; /* Number of mp_digit's needed to hold the - * significand of a double. */ static const double pow_10_2_n[] = { /* Inexact higher powers of ten. */ 1.0, 100.0, @@ -4405,7 +4403,6 @@ TclInitDoubleConversion(void) + 0.5 * log(10.)) / log(10.)); minDigits = (int) floor((DBL_MIN_EXP - DBL_MANT_DIG) * log((double) FLT_RADIX) / log(10.)); - mantDIGIT = (mantBits + DIGIT_BIT-1) / DIGIT_BIT; log10_DIGIT_MAX = (int) floor(DIGIT_BIT * log(2.) / log(10.)); /* -- cgit v0.12 From 7d602745337ea00ec3bd5cbb4efcd1c0e3379fbb Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 5 Jun 2012 15:59:34 +0000 Subject: Remove unused variable NULL_CONTEXT. --- generic/tclBasic.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index e09ea1e..b38558a 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -81,8 +81,6 @@ TCL_DECLARE_MUTEX(cancelLock) * are used to save the evaluation state between NR calls to each coro. */ -static const CorContext NULL_CONTEXT = {NULL, NULL, NULL, NULL}; - #define SAVE_CONTEXT(context) \ (context).framePtr = iPtr->framePtr; \ (context).varFramePtr = iPtr->varFramePtr; \ -- cgit v0.12