Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: fd5eb38bcd309aa5d9cb05b55a490d3d0a8e3222
Ticket: 931847ffffffffffffffffffffffffffffffffff
TclFSNormalizeToUniquePath - incomplete?
User & Date: vincentdarley on 2004-04-09 00:24:16
Changes

  1. icomment:
    Logged In: YES 
    user_id=32170
    
    Wow, you've been looking very closely!
    
    I didn't design the code to handle symlinks between
    filesystems, although I suppose I didn't actually document
    that anywhere.  I certainly agree that that would
    demonstrate bugs in the existing code.
    
    In particular, however, the basic code assumption is that
    the normalization can be achieved by (i) asking the native
    filesystem to normalize, then (ii) asking each other
    filesystem to normalize exactly once each.
    
    Clearly if filesystems can be nested arbitrarily (e.g.
    through your symlink approach), or more simply:
    
    C:/foo/bar.zip/ZIP/foo.kit/KIT/blah.zip/ZIP
    
    Assuming we have a separate .zip and .kit filesystem, each
    of which have decided they are case-insensitive and that all
    normalized paths should be lower case.  Then the above
    should be normalized first by the OS (C:/foo/bar.zip) then
    by the zipfs (/ZIP/foo.kit) then by the kitfs (KIT/blah.zip)
    then by the zipfs again (ZIP).
    
    In the current code structure this would not work.
    
    I guess the correct solution is to first ask the nativefs,
    and then, for the filesystem which accepts the path which
    has been normalized so far, ask it to normalize some more. 
    When no filesystem accepts the path, then just stop.  So,
    we'd have:
    
    Overall path accepted by native fs.
    C:/foo/bar.zip   normalized by native, leaving 'startAt' at
    following '/'
    
    C:/foo/bar.zip/ recognised by zipfs
    C:/foo/bar.zip/zip/foo.kit normalized by zipfs.
    
    C:/foo/bar.zip/zip/foo.kit/ recognized by kitfs
    etc.
    
    So (pseudo-code):
    
    while (1) {
        fs = PathInFilesystem(path, up to 'startAt');
        if (fs == null) break;
        startAt = fs->normalizePath(path, startAt);
    }
    
    with a bit of checking to avoid infinite loops.
    
    This would even solve your symlink issue, I think, although
    I haven't thought what it means for 'dir/..' handling.
    
    
    
  2. login: "vincentdarley"
  3. mimetype: "text/plain"
  4. username: "vincentdarley"