Skip to content
Tcl Source Code View Ticket
Login

View Ticket

TclpInitLibraryPath fails for path containing ..

Closed / Fixed832657ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 23 years ago
Descriptionplain2003-10-29 20:46:01
When constructing paths from the 
executable name, the special meaning
of /../ in a path name is not honored.

For example, if you do a fresh build
of Tcl and Tk in their unix directories,
respectively, then cd to tk8.4.5/win
and run

$ ../unix/wish
Application initialization failed: Can't find a usable
init.tcl in the following directories: 
    /usr/local/lib/tcl8.4
/local/src/tk8.4/win/../lib/tcl8.4
/local/src/tk8.4/win/lib/tcl8.4
/local/src/tk8.4/win/../library
/local/src/tk8.4/win/library
/local/src/tk8.4/win/tcl8.4.5/library
/local/src/tk8.4/tcl8.4.5/library /usr/local/lib/tcl8.4



This probably means that Tcl wasn't installed properly.

Note that the third to last path in the search list is the
one that should succeed, if the original path were
normalized before processing.

Fixing this means either correcting all three
TclpInitLibraryPath routines, or normalizing the
path before calling (only one caller).
dgpplain2003-10-30 05:43:27
Logged In: YES 
user_id=80530


Here's a patch against core-8-4-branch that
corrects the problem and passes all existing
tests.  Needs review for potential problems.
dgpplain2003-10-30 05:43:28
File Added - 65872: 832657.patch
vincentdarleyplain2003-10-30 19:46:34
Logged In: YES 
user_id=32170

The patch (being quite simple) is clearly ok.  I don't have
time today, however, to be able to analyse what
repercussions this might have.  Overall I think it can only
be a good idea if the executable path is normalized.

On the other hand one could argue that the
TclpInitLibraryPath routines are clearly doing the "wrong
thing" here, and that ought to be fixed anyway.
dgp Ticket [832657ffff]: 1 change [History diff]2003-10-30 22:49:34
dgpplain2003-11-06 03:54:18
Logged In: YES 
user_id=80530

patch + new test applied for
Tcl 8.4.5.

Test only applied for HEAD,
pending better fix of the
individual TclpInitLibraryPath routines
(each should be updated to use
more modern Tcl_FS* routines
for manipulating paths)
hobbsplain2003-11-07 04:43:21
Logged In: YES 
user_id=72656

Patch removed from 8.4 as it broke Windows flat out.  You 
can't use the Tcl_FS functions at that point safely.  The init 
is a very fragile place for what requires what.
dgp Ticket [832657ffff]: 1 change [History diff]2003-11-07 06:10:24
dgpplain2003-11-10 23:54:30
Logged In: YES 
user_id=80530


Here's a unix-only patch using a
strategy that should be safe.
dgpplain2003-11-10 23:54:31
File Deleted - 65872: 



File Added - 67036: 832657.patch
dgpplain2003-11-11 00:47:33
Logged In: YES 
user_id=80530


Updated patch includes fix
for windows too.  Seems the
mac version needs no changes.

Note that the win and unix
code are largely the same; would
be a good idea to factor out the
common stuff into some generic routine.
dgpplain2003-11-11 00:47:34
File Deleted - 67036: 



File Added - 67041: 832657.patch
dgpplain2003-11-11 02:25:28
File Added - 67058: 832657.patch

Logged In: YES 
user_id=80530


Here's a simpler patch more
narrowly focused.
dgpplain2003-11-11 02:25:29
File Deleted - 67041:
dgpplain2003-11-11 03:34:32
Logged In: YES 
user_id=80530

latest patch committed to
HEAD and core-8-4-branch
for 8.4.5+.
Log in (anonymous is fine) to add a comment.

Attachments: