Tcl Source Code

View Ticket
Login
Ticket UUID: b876737a0bc55f0efabb1c6082da375cac65cc7e
Title: tcl::tm::path doesn't handle tilde expand
Type: Bug Version: 9.0
Submitter: jan.nijtmans Created on: 2025-06-09 14:36:23
Subsystem: 38. Init - Library - Autoload Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2025-06-10 15:06:08
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2025-06-10 15:06:08
Description:

Example (MacOS):

$ tclsh9.0
% tcl::tm::path list
/Library/Tcl/tcl9/site-tcl /Library/Tcl/tcl9/9.0 /Users/jan/workspace/tcl9.0/macosx/~/Library/Tcl/tcl9/site-tcl /Users/jan/workspace/tcl9.0/macosx/~/Library/Tcl/tcl9/9.0 /usr/local/lib/tcl9/site-tcl /usr/local/lib/tcl9/9.0 /Library/Frameworks/Tcl.framework/Versions/9.0/Resources/tcl9/site-tcl /Library/Frameworks/Tcl.framework/Versions/9.0/Resources/tcl9/9.0

The 3th and 4th entries don't make sense.

User Comments: jan.nijtmans added on 2025-06-10 15:06:08:

Fixed [7ad80e3bed1cc1d3|here]

Thanks, Ashok! I moved the handling of "file tildeexpand" to the caller of tcl::tm::roots.


apnadkarni added on 2025-06-10 02:29:55:

I don't think this fix is correct. As TIP 602 explicitly says

Note that the commands tcl::tm::add and tcl::tm::roots will not themselves do any tilde expansion.

Tildes are not special characters in Tcl 9 with the exception in the TIP for initialization at startup from environment variables including TCL9_0_TM_PATH etc.

It is up to the caller of tm::add and tm::roots to do tilde expansion or not as they see fit.

In this case, I am not sure where the paths containing ~ are coming from. If from environment variables at startup, then that initialization code should do the expansion before calling tm::add.