Skip to content
Tcl Source Code History Of Ticket b42a8514758d43c0
Login

History Of Ticket b42a8514758d43c0

Artifacts Associated With Ticket b42a8514758d43c0

  1. Ticket change [6bffa021f4] (rid 143408) by apnadkarni on 2015-10-06 03:00:39:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      % file normalize ~
      C:/Users/ashok/Documents
      % file normalize ~ashok
      C:/Users/Default
      
      I would expect both to return the same result.
      
      FWIW, 8.5.17 also has the same behaviour.
      
    5. foundin initialized to: "8.6.4"
    6. is_private initialized to: "0"
    7. login: "apnadkarni"
    8. priority initialized to: "5 Medium"
    9. resolution initialized to: "None"
    10. severity initialized to: "Minor"
    11. status initialized to: "Open"
    12. submitter initialized to: "apnadkarni"
    13. subsystem initialized to: "37. File System"
    14. title initialized to:
      file normalize ~user returns wrong directory on Windows
      
    15. type initialized to: "Bug"
  2. Ticket change [fbb0e79a57] (rid 143419) by apnadkarni on 2015-10-06 10:14:56:

    1. icomment:
      Some more information looking at the code in TclpGetUserHome in tclWinFile.c
      
      - file normalize ~ looks at the HOME environment variable whereas ~ashok looks at the NetUserGetInfo call. The latter only returns non-null directory information if administrator has explicitly set the home dir path. Under the normal (default) case an empty string is returned. 
      
      - When the home dir is "", the code then calls back to %SYSTEMDRIVE%:/users/default. This is broken for many reasons - the toplevel is "users" only on newer Windows versions and even that can be changed. Secondly the returned directory is not writable by the user without elevation. Third, it does not contain any files specific to the user.
      
      The correct solution would be to use GetUserProfileDirectory but that is unworkable because that call requires a security token with the appropriate access rights.
      
      A semi-workable solution would be to use GetProfilesDirectory and tack on the user name (essentially ~ashok -> GetProfilesDirectory/ashok) and return it if the corresponding directory exists. However, in this case ~ and ~ashok will not match. We cannot change semantics of ~ because current programs might be relying on it. Adding on a Documents part to the result of ~ashok is problematic because (I think) the folder is not called Documents on all Windows versions.
      
      My suggestion is to go with the semi-workable solution because it is better than what we do today.
      
    2. login: "apnadkarni"
    3. mimetype: "text/plain"
  3. Ticket change [45ad011fdb] (rid 143429) by jan.nijtmans on 2015-10-06 14:51:18:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2457302.1189613"
    3. closer changed to: "jan.nijtmans"
    4. icomment:
      Suggested 'semi-workable solution' implemented now in core-8-5-branch and trunk.
      
      Thanks for the report!
      
    5. login: "jan.nijtmans"
    6. mimetype: "text/x-fossil-wiki"
    7. resolution changed to: "Fixed"
    8. status changed to: "Closed"