Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-03-11
09:44 • Pending ticket [8f5e7a2633]: Tk build for 9.1 failing in safe-1.2 testcase p... artifact: 2c279ec646 user: jan.nijtmans
2026-03-09
07:40 • Ticket [8f5e7a2633]: 3 changes artifact: 9b2e0ce911 user: jan.nijtmans
2025-11-27
21:07 • Ticket [8f5e7a2633]: 3 changes artifact: 27616f7ee6 user: jan.nijtmans
2025-11-14
17:32 • Ticket [8f5e7a2633]: 3 changes artifact: d3cf4f86d8 user: jan.nijtmans
15:53 • Ticket [8f5e7a2633]: 3 changes artifact: 5019d19700 user: dkf
15:41 • Ticket [8f5e7a2633]: 3 changes artifact: 1b660d27fd user: dkf
14:59 • Ticket [8f5e7a2633]: 3 changes artifact: f7e72cc8b7 user: dkf
14:28 • Ticket [8f5e7a2633]: 3 changes artifact: 90abf52fc7 user: jan.nijtmans
14:23
Starting to work on fixing [8f5e7a2633] check-in: 6071062b30 user: dkf tags: bug-8f5e7a2633
14:04 • Ticket [8f5e7a2633] Tk build for 9.1 failing in safe-1.2 testcase status sti... artifact: 39df2731a9 user: dkf
13:18 • Ticket [8f5e7a2633]: 3 changes artifact: 8ab5b6a0ec user: dkf
13:16 • Ticket [8f5e7a2633]: 3 changes artifact: 8314a45510 user: dkf
13:07 • Ticket [8f5e7a2633]: 3 changes artifact: f0fa2fef1a user: dkf
2025-11-13
19:34 • Ticket [8f5e7a2633]: 3 changes artifact: 7e07d8a73f user: jan.nijtmans
10:28 • Ticket [8f5e7a2633]: 3 changes artifact: 8f8226e55d user: jan.nijtmans
10:27 • New ticket [8f5e7a2633]. artifact: ac0dcde24c user: jan.nijtmans

Tk build for 9.1 failing in safe-1.2 testcase

Pending8f5e7a2633ca1b92a878c039ba12675cbc8f7e69Created 1 year agoUpdated 267 days ago
Descriptionwiki2025-11-13 10:27:13
This is what's happening in Tk 9.1 right now.

I suspect [this] commit is the coolpit.

safe.test

==== safe-1.2 Safe Tk loading into an interpreter FAILED ==== Contents of test case:

safe::interpCreate a safe::loadTk a lsort [interp hidden a]

---- Result was: bell cd clipboard clock encoding exec exit fconfigure file glob grab load menu open pwd selection send socket source tcl:clock:add tcl:clock:format tcl:clock:scan tcl:encoding:dirs tcl:encoding:system tcl:file:atime tcl:file:attributes tcl:file:copy tcl:file:delete tcl:file:dirname tcl:file:executable tcl:file:exists tcl:file:extension tcl:file:home tcl:file:isdirectory tcl:file:isfile tcl:file:link tcl:file:lstat tcl:file:mkdir tcl:file:mtime tcl:file:nativename tcl:file:normalize tcl:file:owned tcl:file:readable tcl:file:readlink tcl:file:rename tcl:file:rootname tcl:file:size tcl:file:stat tcl:file:tail tcl:file:tempdir tcl:file:tempfile tcl:file:tildeexpand tcl:file:type tcl:file:volumes tcl:file:writable tcl:info:cmdtype tcl:info:nameofexecutable tcl:process:autopurge tcl:process:list tcl:process:purge tcl:process:status tcl:unsupported:disassemble tcl:unsupported:getbytecode tcl:unsupported:loadIcu tcl:unsupported:representation tcl:zipfs:canonical tcl:zipfs:exists tcl:zipfs:info tcl:zipfs:list tcl:zipfs:lmkimg tcl:zipfs:lmkzip tcl:zipfs:mkimg tcl:zipfs:mkkey tcl:zipfs:mkzip tcl:zipfs:mount tcl:zipfs:mountdata tcl:zipfs:root tcl:zipfs:unmount tk_chooseColor tk_chooseDirectory tk_getOpenFile tk_getSaveFile tk_messageBox toplevel unload wm zipfs ---- Result should have been (exact matching): bell cd clipboard encoding exec exit fconfigure file glob grab load menu open pwd selection send socket source tcl:encoding:dirs tcl:encoding:system tcl:file:atime tcl:file:attributes tcl:file:copy tcl:file:delete tcl:file:dirname tcl:file:executable tcl:file:exists tcl:file:extension tcl:file:home tcl:file:isdirectory tcl:file:isfile tcl:file:link tcl:file:lstat tcl:file:mkdir tcl:file:mtime tcl:file:nativename tcl:file:normalize tcl:file:owned tcl:file:readable tcl:file:readlink tcl:file:rename tcl:file:rootname tcl:file:size tcl:file:stat tcl:file:tail tcl:file:tempdir tcl:file:tempfile tcl:file:tildeexpand tcl:file:type tcl:file:volumes tcl:file:writable tcl:info:cmdtype tcl:info:nameofexecutable tcl:process:autopurge tcl:process:list tcl:process:purge tcl:process:status tcl:zipfs:canonical tcl:zipfs:exists tcl:zipfs:info tcl:zipfs:list tcl:zipfs:lmkimg tcl:zipfs:lmkzip tcl:zipfs:mkimg tcl:zipfs:mkkey tcl:zipfs:mkzip tcl:zipfs:mount tcl:zipfs:mountdata tcl:zipfs:root tcl:zipfs:unmount tk_chooseColor tk_chooseDirectory tk_getOpenFile tk_getSaveFile tk_messageBox toplevel unload wm zipfs ==== safe-1.2 FAILED

Referenced by1
jan.nijtmans Ticket [8f5e7a2633]: 3 changes [History diff]2025-11-13 10:28:08
jan.nijtmanswiki2025-11-13 19:34:19

Let's analyse the difference.

Tcl 9.1 has the following unsafe commands, which Tcl 9.0 hasn't: clock, tcl:clock:add, tcl:clock:format, tcl:clock:scan, tcl:unsupported:disassemble, tcl:unsupported:getbytecode, tcl:unsupported:loadIcu, tcl:unsupported:representation.

I think 'clock' is a mistake in this list. It should be usable in safe interpreters. The tcl:unsupported:* commands are correct, they should be considered unsafe in Tcl 9.0 too (backport??)

So, what about tcl:clock:add, tcl:clock:format, tcl:clock:scan. @sebres, can you give advise?

dkfmarkdown2025-11-14 13:07:23

The clock implementation has unsafe pieces, but the API is safe. The overall command is only unsafe for legacy reasons, and we can probably just discharge those ourselves.

NB: there's a comment by the clock definition that says:

    // TODO: Sort out why setup of [clock] is so weird

I think this bug might be the time to do that!


The unsupported commands are generally not assessed for safety, but it wouldn't surprise me at all if they were problems. To whit, disassemble reports raw addresses, it and getbytecode allow probing of command types, and representation reports raw addresses.

loadIcu probably should never be used in a safe interpreter at all; it's purely an implementation feature. It's table declaration entry bears this comment:

 // TODO: Is this supposed to be callable from safe interps?

dkfmarkdown2025-11-14 13:16:17

Also, when it comes to ensembles they're all technically safe in themselves (their subcommands may not be). TclHideUnsafeCommands() in respect of this bears this comment in respect of ensembles not marked as safe:

    /*
     * Hide a main command (for compatibility).
     */

The problem is working out what to do about existing code that uses a safe interpreter.

dkfmarkdown2025-11-14 13:18:36

The most irritating part of this is that I missed this because I don't habitually test Tk (as it's annoying on this machine).

Sorry for the inconvenience.

dkf Ticket [8f5e7a2633]: 5 changes [History diff]2025-11-14 14:04:48
jan.nijtmanswiki2025-11-14 14:28:55

> Sorry for the inconvenience

No problem. Thanks for looking at it now.

For the "unsupported" commands, easiest is to backport those parts to 9.0, since I agree with your analysis: They shouldn't be in the safe set.

On the "clock"-related commands, maybe @sebres can provide help. He is the "clock" expert.

dkfmarkdown2025-11-14 14:59:11

With clock, we're really talking about a change of policy: it's regarded as being a safe command that happens to use unsafe features in its implementation, and only of some of its subcommands (they need a context that can pull message catalogs and timezone info, and they already check that the locale and TZ names are valid). That means it's best marked as safe and aliases installed for its technically unsafe subcommands, rather than aliasing the lot.

I've got a branch that does that (and fixes up the tests that fail because of it).

We need to do some work about sorting out Tk though. The issue there looks like the test is fragile in the face of changes to the list of hidden subcommands and/or aliases managed by Tcl, things that shouldn't really matter to Safe Tk. Perhaps the test needs to be rewritten to filter out the baseline stuff from Tcl instead?

dkfmarkdown2025-11-14 15:41:36

The original strangeness was that clock was a lazily-defined ensemble. Which was all very well to start with, but became really untenable when sebres added compilation of the timer readers (otherwise a good idea). That in turn left an overhang of weird hacks that were irrelevant; my reorg of the initialisation removed some of the sticking plasters but I missed some.

On the Tk side, we should adjust the tests to not care what Tcl has defined in its safe base; Tk shouldn't be testing Tcl.

dkfwiki2025-11-14 15:53:37

Try 29ca32 for what I think is the fix on the Tk side.

jan.nijtmanswiki2025-11-14 17:32:53

> Try 29ca32 for what I think is the fix on the Tk side.

Looks good to me. Thanks! +1 for core-9-0-branch and trunk (and 8.6, if you like, but not really necessary)

jan.nijtmanswiki2025-11-27 21:07:38

@dkf, you added the comment "Approach right, details not, source branch not right either" to the commit. What do you need to make progress?

jan.nijtmansplain2026-03-09 07:40:39
ping
jan.nijtmanswiki2026-03-11 09:44:31

@dkf, what's the status of the "bug-8f5e7a2633" branch?

I now re-enabled the testcase in Tk, the problem described in this ticket is gone. Thanks for your prototype doing this (which I finished)!

However, keeping it "Pending", in case you want to work further on improving the "clock" initialization.

Log in (anonymous is fine) to add a comment.