Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 9b7cee1311412c253a086ca9160c2103dda39bc2
Ticket: 858937ffffffffffffffffffffffffffffffffff
problems with file paths containing tilde character
User & Date: cjmcdonald on 2003-12-12 14:44:27
Changes

  1. assignee changed to: "vincentdarley"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    There are some problems with the processing of file paths
    containing a ~ tilde character.  Tcl 8.4.5 - Unix (Solaris)
    and Windows (NT4).
    
    
    -------------------------------------------
    
    1) "file normalize" crashes if an invalid user name is
    specified:
    
    $ tclsh
    % file normalize ~baduser/readme.txt
    Segmentation fault (core dumped)
    
    
    -------------------------------------------
    
    2) For file names which actually start with a tilde the
    "glob -tails" processing is inconsistent with "file tail":
    
    If I have a file /home/mcdonald/temp/~test.dat, then
    "file tail" produces "./~test.dat", which subsequently
    can be used correctly with "file join" in order to
    reconstruct a full file path:
    
    $ tclsh
    % set fname [file tail /home/mcdonald/temp/~test.dat]
    ./~test.dat
    % set fspec [file join /home/mcdonald/temp $fname]
    /home/mcdonald/temp/~test.dat
    
    But "glob -tails" returns a file list including
    "~test.dat",
    which is assumed to be an absolute file specification
    by "file join":
    
    $ tclsh
    % set dir /home/mcdonald/temp
    /home/mcdonald/temp
    % set fnames [glob -tails -directory $dir *.dat]
    ~test.dat xyzzy.dat
    % set fspec [file join $dir [lindex $fnames 0]]
    ~test.dat
    
    So the output from "glob -tails" cannot subsequently
    be used reliably to reconstruct full file paths with
    "file join".  I think that for files starting with a tilde
    character "glob -tails" should return
    ./~test.dat, the same as "file join".
    
    
    -------------------------------------------
    
    3) The filename.n manpage states in the
    "Tilde Substitution" section that "The Macintosh and
    Windows platforms do not support tilde substitution
    when a user name follows the tilde."  That has not
    been the case on Windows for several releases e.g. 
    ~mcdonald/readme.txt works on Windows.
    
    
  4. foundin changed to: "obsolete: 8.4.5"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "cjmcdonald"
  9. subsystem changed to: "36. Pathname Management"
  10. title changed to:
    problems with file paths containing tilde character
    
  11. type changed to: "Bug"