Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a5eb6019b31b6d7bb709ae519c8716b817a50ed2084c551b6f5891955811f393
Ticket: 9c5a00c69df3018e4077b5ea19e235f62dbe0a67
Multiple issues with tilde expansion on Windows
User & Date: apnadkarni on 2023-03-04 03:06:38
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-markdown"
  4. comment changed to:
    Somewhere in the 8.6 development, probably with [this](https://core.tcl-lang.org/tcl/info/a2b0c733642efea7) commit, an inconsistency is introduced between Unix and Windows. To quote the manpages, 
    
    *If a file name starts with a tilde, then the file name will be interpreted as if the first element is replaced with the location of the home directory for the given user. If the tilde is followed immediately by a separator, then the $HOME environment variable is substituted. Otherwise the characters between the tilde and the next separator are taken as a user name, which is used to retrieve the user's home directory for substitution.*
    
    Unix conforms to the documented behavior.
    
    ```
    % set env(HOME) /tmp
    /tmp
    % file normalize ~
    /tmp
    % file normalize ~apnadkarni
    /home/apnadkarni
    ```
    
    However on Windows,
    
    ```
    % file norm ~
    C:/Users/apnad/Documents
    % file norm ~ashok
    C:/Users/apnad/Documents
    % set env(HOME) D:\\temp
    D:\temp
    % file norm ~
    D:/Temp
    % file norm ~ashok
    D:/Temp
    ```
    
    Note how `~ashok` also follows setting of `HOME`.
    
    One might find the behavior on Windows more natural but it is not what is documented.
    
    Will fix for 8.6/8.7/9.0 if there are no objections.
    
    /Ashok
    
  5. foundin changed to: "8.6"
  6. is_private changed to: "0"
  7. login: "apnadkarni"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "9546e9877f1a8899e25a89082561ee694e7fb402"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "apnadkarni"
  14. subsystem changed to: "- New Builtin Commands"
  15. title changed to:
    Tilde expansion on Windows does not conform to documented behavior
    
  16. type changed to: "Bug"