From: SourceForge.net <no...@so...> - 2012-01-08 19:54:05
|
Bugs item #3445787, was opened at 2011-11-29 20:06 Message generated for change (Comment added) made by johannes-kuhn You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=3445787&group_id=10894 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: 20. [interp] Group: development: 8.6b2 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Ashok P. Nadkarni (apnadkarni) Assigned to: Don Porter (dgp) Summary: Exposed file command broken in safe interps Initial Comment: 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 ---------------------------------------------------------------------- Comment By: Johannes Kuhn (johannes-kuhn) Date: 2012-01-08 11:54 Message: 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.. ---------------------------------------------------------------------- Comment By: Johannes Kuhn (johannes-kuhn) Date: 2012-01-08 11:26 Message: 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 ---------------------------------------------------------------------- Comment By: Don Porter (dgp) Date: 2011-12-01 08:53 Message: 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. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=3445787&group_id=10894 |