Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 99399b9906bc3bb020368b0b5e63225ceab8029b946580f94d78e0dfda1f44ab
Ticket: 596936dd2d55ba70dcdc980b9f58b3dccf248605
auto_execok uses cmd in preference to cmd.exe despite path order (windows)
User & Date: juliannoble2 on 2023-11-06 12:04:28
Changes

  1. icomment:
    Yes, I tested in cmd and pwsh shells and they find things in a different order to Tcl - this really needs to be fixed.
    
    There are other demons here.
    The paths retrieved by splitting on the PATH env var sometimes end with a slash.
    
    When you do a glob -dir $dir -tail on a dir ending in a slash - it can return /name instead of just name 
    
    Then the file join fails to work as it takes the name as an absolute path and doesn't add the dir.
    
     #with trailing slash in path
     % set path {C:\Program Files\PowerShell\7}
     C:\Program Files\PowerShell\7
     % tcl::unsupported::representation $path
     value is a pure string with a refcount of 4, object pointer at 0x1ea036f3270, string representation "C:\Program Fi..."
     % append path \\
     C:\Program Files\PowerShell\7\
     % tcl::unsupported::representation $path
    value is a utf32string with a refcount of 2, object pointer at 0x1ea036ef2e0, internal representation 0x1ea038c70b0:0x0, string representation "C:\Program Fi..."
     % glob -dir $path -tail pwsh.exe
     /pwsh.exe
    
    
     
     #without trailing slash 
     % set path {C:\Program Files\PowerShell\7}
     C:\Program Files\PowerShell\7
     % tcl::unsupported::representation $path
    value is a pure string with a refcount of 5, object pointer at 0x1ea036f3270, string representation "C:\Program Fi..."
     % glob -dir $path -tail pwsh.exe
     pwsh.exe
    
    
    Whether or not a trailing slash should strictly exist at the end of a path - I believe it to be fairly common on windows (some installers do it) and it should work.
    
    Tcl8.5 on the other hand does it correctly:
    
    % glob -dir "c:\\" -tail windows-version.txt
    windows-version.txt
    
    versus testing in 8.6, 8.7, 9.0
    % glob -dir "c:\\" -tail windows-version.txt
    /windows-version.txt
    
  2. login: "juliannoble2"
  3. mimetype: "text/plain"