Artifacts Associated With Ticket 534026d188f9c0c9
Ticket change [6bb0b924b1] (rid 150519) by pooryorick on 2016-12-15 05:24:38:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- comment initialized to:
init.tcl contains the following: <code><verbatim> set Dir [file join [file dirname [file dirname \ [info nameofexecutable]]] lib] </verbatim></code> <code>[info nameofexecutable]</code> returns the full path of the executable but doesn't normalize symbolic links. If a symbolic link to the tclsh executable is made in some other directory , the interpreter invoked by the symbolic link, <code>$Dir</code> will contain a different value based on the location of the symbolic link. This could result in some surprises at runtime. If the script were changed to something like the following, the executable would always pick up the lib directory that actually resides next to the tclsh executable: <code><verbatim> set Dir [file join [file dirname [file dirname \ [file dirname [file normalize [info nameofexecutable]/...]]]] lib] </verbatim></code> - foundin initialized to: "8.6"
- is_private initialized to: "0"
- login: "pooryorick"
- priority initialized to: "5 Medium"
- private_contact initialized to: "e476148cded301ffff84bcdc432536dc0c949e88"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "pooryorick"
- subsystem initialized to: "38. Init - Library - Autoload"
- title initialized to:
interpreter initialization, auto_path, [info nameofexecutable], and symbolic links
- type initialized to: "Bug"
Ticket change [f7e67f5814] (rid 150520) by jan.nijtmans on 2016-12-15 10:16:30:
- assignee changed to: "jan.nijtmans"
- icomment:
Well, looking at the complete code [http://core.tcl.tk/tcl/artifact/13b6f382159e4d5b?ln=50-59], $auto_path is already initialized using the content of $tcl_library and its parent, which - if everything is OK - already contains something like /usr/lib/tcl8.? and /usr/lib. So, your proposal wouldn't make any change for Tcl startup, usually (it might make a difference in the search for additional packages). The place where $tcl_library is determined is here: [http://core.tcl.tk/tcl/artifact/1b7fac712ad43c21?ln=390-438], maybe you meant to make a change there. However, the Tcl initialization is tricky stuff (unfortunately), extra care is necessary for any change in that. Any change needs to be argumented and TIP'ed, otherwise it is asking for trouble. Therefor I am inclined to reject this issue .. ;-) Sorry.
- login: "jan.nijtmans"
- mimetype: "text/html"
- resolution changed to: "Rejected"
- status changed to: "Pending"
Ticket change [f989c0f96d] (rid 150549) by pooryorick on 2016-12-16 02:51:09:
- icomment:
Yes, the script hard-coded into Tcl_Init() is also fails to resolve symbolic links, and so has the same issue. Even though this issue has already been rejected, I'd like so summarize it: tclsh will potentially find a different set of libraries depending on which symbolic link it is invoked through. I argue that it's a bug that doesn't need to be TIP'ed, because on *nix systems it is common to create symbolic links for convenience, and it is not expected that simply creating a symbolic link to an executable will change the search path for dependencies. It's hard to imagine anyone legitimately relying on this behaviour. There are plenty of documented security vulnerabilities that arose from behaviour just like this.
- login: "pooryorick"
- mimetype: "text/x-fossil-wiki"
- username: "pooryorick"
- icomment:
Ticket change [bc8f281188] (rid 150554) by jan.nijtmans on 2016-12-16 10:24:30:
- closedate changed to: "2457738.93368861"
- closer changed to: "jan.nijtmans"
- icomment:
@pooryorick, Feel free to submit a patch (to both tclInterp.c and init.tcl, I assume) which fixes the 'bug'. I have no problem to adding additional paths to the search mechanism, that itself doesn't need a TIP. However, if this really is a security issue, then please point that out with a more concrete example! (and ... of course ... make sure that your patch fixes this 'bug'. Maybe for Tcl 9.0, the number of paths to be searched for init.tcl should be reduced for security reasons. Whether this is done through a TIP or not is not so important, I am prepared and happy to listen to arguments. However, this 'bug' report as it is now is not enough to convince me. ;-) You can always re-open this issue, whenever you have additional information.
- login: "jan.nijtmans"
- mimetype: "text/plain"
- status changed to: "Closed"