|
2024-06-13
| ||
| 15:35 | • Pending ticket [1095bf7f75]: ensembles seem to be not compiled in safe interp</i... artifact: 4d0f2f20af user: sebres | |
|
2013-08-22
| ||
| 09:43 | • Closed ticket [3445787fff]: Exposed file command broken in safe interps plus... artifact: 993587fae1 user: dkf | |
|
2012-05-16
| ||
| 21:16 | • Pending ticket [3445787fff]. artifact: 1cd0d2d258 user: dkf | |
| 16:16 | • Ticket [3445787fff]: 4 changes artifact: 77a0745b58 user: johannes-kuhn | |
| 15:28 | • Ticket [3445787fff]: 6 changes artifact: 612f3edb52 user: dkf | |
|
2012-01-09
| ||
| 02:54 | • Ticket [3445787fff]: 4 changes artifact: 9374a191dd user: johannes-kuhn | |
| 02:26 | • Ticket [3445787fff]: 4 changes artifact: 2f62b265e9 user: johannes-kuhn | |
|
2011-12-01
| ||
| 23:53 | • Ticket [3445787fff]: 6 changes artifact: 33c6e9d2f1 user: dgp | |
|
2011-11-30
| ||
| 04:06 | • New ticket [3445787fff]. artifact: 0d7ee96408 user: apnadkarni | |
Exposed file command broken in safe interps
Closed / Fixed3445787fffffffffffffffffffffffffffffffffCreated 15 years agoUpdated 13 years ago
Descriptionplain2011-11-30 04:06:33
Tcl as of fossil head on 11/29/2011. Follow on to bug 3211758 which was fixed post 8.6b2
The fix in that bug made file a hidden command as was the case in older Tcl releases. However, the fix still does not allow all subcommands of file to be called even after exposing the file command.
% interp create -safe
interp0
% interp expose interp0 file
% interp0 eval {file dirname c:/tcl}
invalid command name "::tcl::file::dirname"
Aside from whether this is a good idea or not, it is a backward compatibility issue as was the case with 3211758
dgpplain2011-12-01 23:53:30
I believe this is related to the old, difficult problem that [interp hide] and friends have never really been updated to work well with namespaces.
johannes-kuhnplain2012-01-09 02:26:42
The file command is now a namespace ensemble (see [namespace ensemble configure file]). All subcommands of file are now hidden with a name like tcl:file:atime. (Original name with all namespace seperators (::) replaced by a single colon(:)) This change does in fact break old scripts that uses [interp invokehidden $interp file]. The safe base uses the trused interp's file command, this is ok because the exposed command does not have any special treatment depending on the interp, unlike [file channels] witch displays all open channels that this interp has access to. This might probably only a small amout of scripts that actually 1) does not use the safe base and 2) use safe interps with (partialy) exposed file commands. My advise is: make [interp hide] namespace aware, and when a hidden namespace enseble is called (like [file]) it should _first_ check if the target command (e.g. [::tcl::file::atime]) is there and call that command. If there is no such hidden command it should check if there is an exposed command with that name. I think this is the only possible solution to have still backward compatibility and [file] a namespace ensemble
johannes-kuhnplain2012-01-09 02:54:03
Ok, just saw that ::tcl::file::channels is never hidden, so scripts could easily create the [file] command it if they need it, but because the safe base defines an own [file] command, this is going to be a little bit more complex. Ohh, and by the way you broke my code... and it will take some of my time to fix it..
dkfplain2012-05-16 15:28:07
This bug breaks tclhttpd. :-(
johannes-kuhnplain2012-05-16 16:16:50
Looks like there are more scripts and applications that actually uses [interp invokehidden file] than I thought. The problem why I don't rewrite my script to work with the newer Tcl 8.6 releases is that I expect that the names of the hidden commands will change again, this time with namespace, like tcl::file::atime, which would require to rewrite the script again. I still suggest allowing hidden commands with namespaces, and for backward compatibility, if the hidden command is a namespace ensemble ([file]) then invoke the resulting command ([tcl::file::atime]) hidden (if exist), if not, invoke it in the slave. This will not fix [interp expose file], but I don't know if exposing this command is a good idea.
dkfplain2012-05-16 21:16:08
OK, made a lot more compatible with older code (the hidden subcommands now have visible replacements that generate error messages) and enhanced/shortened the Safe Tcl code for doing the exposing (with help from many 8.6 features). I *think* that fixes things, but it needs independent testing...
dkf Closed ticket [3445787fff].
[History diff]2013-08-22 09:43:44
Log in (anonymous is fine) to add a comment.