Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 56788edbacf25bbacbb64cca26de211eb0dceedb173d24a938314e2f2a1d15c9
Ticket: d8f12171564f57c9ed3ca098d9498b9d76dfb3f7
windows dos device paths inconsistencies and missing functionality
User & Date: juliannoble2 on 2024-08-11 14:56:59
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-plain"
  4. comment changed to:
    Tcl seems only to support the //?/ dos device syntax for paths referencing a local file volume. 
    
    Use of //?/ on non-volume paths will give erroneous 'file exists' results (possibly due to file pathtype reporting them as 'relative')
    
    It Partially supports //./ syntax 
    
    I know this is a longstanding issue in a curly part of the code - but I'd like to document some of the effects here.
    
    e.g
    
        %file exists //?/c:/test
        1
        %file exists //./c:/test
        0 (ideally should work - especially given the examples below where //./ syntax is required for any access)
    
    Anomalously the reverse type of must be used for other situations:
    
        %file exists //?/BootPartition/test
        0 (Not ok)
        %file exists //./BootPartition/test
        1 (OK - but then one would reasonably expect //./c:/test to work too)
        %file exists //?/UNC/LOCALHOST/c$/test
        0 (Not ok)
        %file exists //./UNC/LOCALHOST/c$/test
        1 (OK)
    
    The //?/ is (for me at least) generally the more useful form - as it is the 'non normalizing' version which allows access to otherwise illegal file names for windows (e.g path segment ending in dot or space)
    ie it passes otherwise illegal paths through.
    
    As it stands - paths such as "c:/test/illegal." cannot be accessed by UNC or non-volume based dos device paths.
    
    These so called 'illegal' paths can exist quite happily on windows NTFS - either on remote UNC paths or locally for example if a unix directory is copied over/imported.
    To test create one on the local machine it can be done from Tcl via for example:
    file mkdir //?/c:/test/illegal.
    
        %file exists c:/test/illegal. 
        0 (ok - not expected to access it via plain path)
        %file exists //?/c:/test/illegal.
        1  (ok - as expected)
        %file exists //./c:/test/illegal.
        0  (ok - dot is the 'normalizing' version of dos device path so it's actually testing c:/test/illegal without the dot)
        %file exists //./c:/test
        0 (Not really ok - if the path exists and is not 'illegal' we should be able to use the //./ path too)
    
        %file exists //LOCALHOST/c$/test/illegal.
        0 (OK)
        %file exists //?/UNC/LOCALHOST/c$/test/illegal.
        0 (Not ok)
        %file exists //./UNC/LOCALHOST/c$/test/illegal.
        0 (OK)
        %file exists //?/UNC/LOCALHOST/c$/test
        0 (Not ok)
    
    Even without the requirement to access so called 'illegal' windows paths; this makes for a confusing situation regarding handling of existing dos device paths (which sometimes crop up) requiring knowledge of what Tcl can/can't handle, in order for the programmer to translate before passing to Tcl's file functions)
    
    In Powershell - the following example shows how to compare some of this behaviour  (tolerates forward slashes without issue)
    
        >test-path -literalPath "//?/UNC/LOCALHOST/C$/test/illegal."
        True
    
  5. foundin changed to: "8.6+"
  6. is_private changed to: "0"
  7. login: "juliannoble2"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "957fdfcd8744611e3fe1f4896c7538b1d9bf47b2"
  10. resolution changed to: "None"
  11. severity changed to: "Important"
  12. status changed to: "Open"
  13. submitter changed to: "juliannoble2"
  14. subsystem changed to: "37. File System"
  15. title changed to:
    windows dos device paths inconsistencies and missing functionality
    
  16. type changed to: "Bug"