Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | fix subtle problem with safe [file] that caused Tk test failure |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
0eb7c399063eee55cceee65abc89b978 |
User & Date: | dkf 2012-05-31 14:20:29 |
Context
2012-05-31
| ||
14:52 | [Bug 3531089] Added test to stop this from happening again check-in: e35f4db709 user: dkf tags: trunk | |
14:20 | fix subtle problem with safe [file] that caused Tk test failure check-in: 0eb7c39906 user: dkf tags: trunk | |
10:09 | [Bug 1997845]: Corrected formatting so that generated HTML can link properly. check-in: cb03557b65 user: dkf tags: trunk | |
Changes
Changes to ChangeLog.
1 2 3 4 5 6 7 8 | 2012-05-31 Donal K. Fellows <[email protected]> * doc/safe.n: [Bug 1997845]: Corrected formatting so that generated HTML can link properly. * tests/socket.test (socket*-13.1): Prevented intermittent test failure due to race condition. | > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 | 2012-05-31 Donal K. Fellows <[email protected]> * 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. * tests/socket.test (socket*-13.1): Prevented intermittent test failure due to race condition. |
︙ | ︙ |
Changes to library/safe.tcl.
︙ | ︙ | |||
490 491 492 493 494 495 496 | # The allowed slave variables already have been set by Tcl_MakeSafe(3) # Source init.tcl and tm.tcl into the slave, to get auto_load and # other procedures defined: if {[catch {::interp eval $slave { source [file join $tcl_library init.tcl] | | | | | | 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | # The allowed slave variables already have been set by Tcl_MakeSafe(3) # Source init.tcl and tm.tcl into the slave, to get auto_load and # other procedures defined: if {[catch {::interp eval $slave { source [file join $tcl_library init.tcl] }} msg opt]} { Log $slave "can't source init.tcl ($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 opt]} { Log $slave "can't source tm.tcl ($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 # now, after tm.tcl was loaded. namespace upvar ::safe S$slave state if {[llength $state(tm_path_slave)] > 0} { ::interp eval $slave [list \ |
︙ | ︙ | |||
680 681 682 683 684 685 686 | # interpreters that are *almost* safe. In particular, it just acts to # prevent discovery of what home directories exist. proc ::safe::AliasFileSubcommand {slave subcommand name} { if {[string match ~* $name]} { set name ./$name } | | | 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | # interpreters that are *almost* safe. In particular, it just acts to # prevent discovery of what home directories exist. proc ::safe::AliasFileSubcommand {slave subcommand name} { if {[string match ~* $name]} { set name ./$name } tailcall ::interp invokehidden $slave tcl:file:$subcommand $name } # AliasGlob is the target of the "glob" alias in safe interpreters. proc ::safe::AliasGlob {slave args} { Log $slave "GLOB ! $args" NOTICE set cmd {} |
︙ | ︙ | |||
878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 | return -code error $msg } # Passed all the tests, lets source it. Note that we do this all manually # 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 code [catch { set f [open $realfile] fconfigure $f -eofchar \032 if {$encoding ne ""} { fconfigure $f -encoding $encoding } set contents [read $f] close $f ::interp eval $slave [list info script $file] | > < > > > > | | 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 | return -code error $msg } # Passed all the tests, lets source it. Note that we do this all manually # 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 if {$encoding ne ""} { fconfigure $f -encoding $encoding } set contents [read $f] close $f ::interp eval $slave [list info script $file] } 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 $replacementMsg } return -code $code -options $opt $msg } # AliasLoad is the target of the "load" alias in safe interpreters. proc ::safe::AliasLoad {slave file args} { |
︙ | ︙ |