Tcl Source Code

View Ticket
Login
Ticket UUID: 3c26dec71e1908160a329296b471a7f3bf662661
Title: TCLX_y_TM_PATH - unspecified behaviour - change with 90b1rc
Type: Bug Created on: 2023-11-18 20:03:25
Submitter: juliannoble2 Assigned to: jan.nijtmans
Subsystem: 39. Package Manager Severity: Minor
Priority: 5 Medium Last modified: 2024-05-05 20:54:07
Status: Closed Closed by: jan.nijtmans
Resolution: Fixed Closed on: 2024-05-05 20:54:07
Version: 90b1rc
Description:
There is a minor behaviour change between previous versions 9 & 8.x  compared to 90b1rc relating to extra semicolons in the TCLX_y_TM_PATH.  (tested only on windows)
If the user has specified c:/path;   previous interps added an empty string to the tcl::tm::list - which doesn't seem to have provided any utility - but didn't seem to break anything.
In  90b1rc - the extra entry causes the first package load in any interp to fail with an error:

  % package require platform
   is ancestor of existing module path //zipfs:/lib/tcl/tcl9/site-tcl.
  % set ::errorInfo
   is ancestor of existing module path //zipfs:/lib/tcl/tcl9/site-tcl.
      while executing
  "path add $expanded_path"
      (procedure "::tcl::tm::Defaults" line 22)
      invoked from within
  "::tcl::tm::Defaults"
      (file "//zipfs:/lib/tcl/tcl_library/tm.tcl" line 383)
      invoked from within
  "::source -nopkg //zipfs:/lib/tcl/tcl_library/tm.tcl"
      ("uplevel" body line 1)
      invoked from within
  "uplevel 1 [list ::source -nopkg $filename]"
      (procedure "::tcl::Pkg::source" line 5)
      invoked from within
  "::tcl::Pkg::source //zipfs:/lib/tcl/tcl_library/tm.tcl"
      (in namespace eval "::" script line 1)
      invoked from within
  "namespace eval :: $auto_index($name)"
      (procedure "auto_load" line 13)
      invoked from within
  "auto_load $name [uplevel 1 {::namespace current}]"
      (autoloading "::tcl::tm::UnknownHandler")
      (procedure "::unknown" line 22)
      invoked from within
  "::tcl::tm::UnknownHandler ::tclPkgUnknown platform 0-"
      ("package unknown" script)
      invoked from within
  "package require platform"

This more strict behaviour may well be reasonable - as a trailing or leading delimiter presumably shouldn't be present. 
I mention it only as a minor incompatibility that may cause confusion or hidden issues if the first package load is wrapped in a catch, so perhaps it's merely worth a note regarding upgrading to 9.0

As alternative possibility - I believe at least some linux distributions use an extra delimiter to represent the intention to add CWD to a list of paths specified.  We already have that capability with path;.  so I don't know if Tcl should interpret extraneous semicolons in some explicitly specified manner or if an error is the right behaviour in this instance anyway.
User Comments:
apnadkarni added on 2024-05-04 15:03:18:
I'm inclined to say all empty elements should be discarded. This includes the trailing ";" case but also the case of consecutive ";" elements.

jan.nijtmans added on 2024-05-04 18:55:32:

Possible solution [a966eb9902fd586c|here]


apnadkarni added on 2024-05-05 04:52:25:
The behaviour (ignoring all empty) and fix seems reasonable to me.

jan.nijtmans added on 2024-05-05 20:54:07:

Fixed [ba61f74630229cdf|here]