Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 7efdb3b2c49245e60f7532e841ab22820569c5f72fee06fd17478c33727a813e
Ticket: 9e6b569963ea497e9e623a79d5a5f92c5681bfdb
file normalize ~user fails on Windows
User & Date: fvogel on 2018-05-24 20:59:37
Changes

  1. icomment:
    Great, thanks!
    
    Does this merge seamlessly with the present bugfix branch [https://core.tcl-lang.org/tcl/timeline?r=bug-9e6b569963|bug-9e6b569963] ?
    
    
    Besides, a comment about ashok's reply:
    <verbatim>
    > I don't think it is possible to pass DOMAIN\USER as a user name in Tcl's file
    > syntax. The moment Tcl sees the backslash when parsing a path beginning with
    > ~, it will interpret it as end of the user name.
    </verbatim>
    
    Well, (the relevant part of) the call chain is:
    
    ... -> Tcl_EvalObjEx -> TclEvalObjEx -> TclNRRunCallbacks -> Dispatch -> PathNormalizeCmd -> Tcl_FSGetNormalizedPath -> Tcl_FSConvertToPathType -> SetFsPathFromAny -> TclpGetUserHome
    
    The path string propagated through this chain is "~domain" from PathNormalizeCmd and downwards.
    
    I believe something happens in TclEvalObjEx:
    <verbatim>
    ...
        result = TclNREvalObjEx(interp, objPtr, flags, invoker, word);
        return TclNRRunCallbacks(interp, result, rootPtr);
    ...
    </verbatim>
    
    There objptr still has <code>file normalize ~domain\\user</code> as a value.
    
    TclNREvalObjEx calls TclCompileObj and something must be happening here that trims <code>~domain\\user</code> to simply <code>~domain</code>.
    
    Anyway this does not actually matter a lot. I have removed test filesystem-1.30.3 that I had added previously, which was attempting to check for this domain\user syntax.
    
    
    Regarding observations from sebres, I can't reproduce on the machine I'm sitting at right now, because it's not connected to a domain controller. In that case I get (and this is expected - I have just replaced the real domain name by xxxxxx in the output below):
    <verbatim>
    % set fn [file normalize ~$::tcl_platform(user)@$::env(USERDOMAIN)]
    user "francois@xxxxxxxx" doesn't exist
    % file normalize $fn
    can't read "fn": no such variable
    </verbatim>
    I'll try on a machine connected to a DC to confirm what's happening there, as soon as I can put my hands on such one.
    
  2. login: "fvogel"
  3. mimetype: "text/x-fossil-wiki"