Tcl Source Code

View Ticket
Login
Ticket UUID: 832657
Title: TclpInitLibraryPath fails for path containing ..
Type: Bug Version: obsolete: 8.4.5
Submitter: dgp Created on: 2003-10-29 20:46:01
Subsystem: 38. Init - Library - Autoload Assigned To: dgp
Priority: 8 Severity:
Status: Closed Last Modified: 2003-11-11 03:34:32
Resolution: Fixed Closed By: dgp
    Closed on: 2003-11-10 20:34:32
Description:
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).
User Comments: dgp added on 2003-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+.

dgp added on 2003-11-11 02:25:29:

File Deleted - 67041:

dgp added on 2003-11-11 02:25:28:

File Added - 67058: 832657.patch

Logged In: YES 
user_id=80530


Here's a simpler patch more
narrowly focused.

dgp added on 2003-11-11 00:47:34:

File Deleted - 67036: 



File Added - 67041: 832657.patch

dgp added on 2003-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.

dgp added on 2003-11-10 23:54:31:

File Deleted - 65872: 



File Added - 67036: 832657.patch

dgp added on 2003-11-10 23:54:30:
Logged In: YES 
user_id=80530


Here's a unix-only patch using a
strategy that should be safe.

hobbs added on 2003-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 added on 2003-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)

vincentdarley added on 2003-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 added on 2003-10-30 05:43:28:

File Added - 65872: 832657.patch

dgp added on 2003-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.

Attachments: