Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 111d5ff19d66b1acc3074d553cb687aa5435762a
Ticket: 8527d8becf29df06d2563a2abde5983043285f18
Commands cd, glob and normalize may fail on Windows if used with network locations containing NTFS junctions
User & Date: mfriedrich on 2016-03-02 21:29:24
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    On Windows, it seems if paths are used which point to network locations. and those network locations contain junctions, then Tcl resolves those junctions, but should not. Those junctions always point to drives on the server. Tcl treats them as local drives, which they are not.
    
    To test:
    On a Windows server (must not be the same as the below Windows client):
    * add a new drive/partition, format as NTFS and give it the letter P
    * create this folder structure: P:\Share\Bar\subdir
    * create a junction: P:\Share\Foo pointing to --> P:\Share\Bar
    * create a dummy file: P:\Share\Bar\subdir\dummy.txt
    * create local user "user" with password "password"
    * share the folder P:\Share as ShareOnDriveP for user "user" full access
    
    On the Windows client/workstation side with a Tcl installation:
    * mount the network share as drive M:
       net use m: \\server\ShareOnDriveP /user:server\user password
    * make sure you have no local drive with letter P
    * run this on tclsh.exe
    
    set result 0
    
    puts "M:/Foo/subdir=[file normalize M:/Foo/subdir]"
    puts "M:/Bar/subdir=[file normalize M:/Bar/subdir]"
    puts "\n"
    
    if {[catch {
        cd M:/Bar/subdir
        set dir [pwd]
        if {$dir ne "M:/Bar/subdir"} {
          puts stderr "test 1 failed"
          set result 1
        } else {
          puts stderr "test 1 passed"
        }
    } status]} {
        puts stderr "test 1 failed\n$errorInfo"
        set result 1
    }
    
    puts "\n"
    
    if {[catch {
        cd M:/Bar
        cd subdir
    
        set dir [pwd]
        if {$dir ne "M:/Bar/subdir"} {
          puts stderr "test 2 failed"
          set result 1
        } else {
          puts stderr "test 2 passed"
        }
    } status]} {
        puts stderr "test 2 failed\n$errorInfo"
        set result 1
    }
    
    puts "\n"
    
    if {[catch {
        cd C:/
    
        set list [glob -directory M:/Bar/subdir -tail *]
        if {$list ne {dummy.txt}} {
          puts stderr "test 3 failed"
          set result 1
        } else {
          puts stderr "test 3 passed"
        }
    } status]} {
        puts stderr "test 3 failed\n$errorInfo"
        set result 1
    }
    
    cd C:/
    file delete C:/test-link
    file delete -force C:/test-target
    exit $result
    
    
    
    It produces the output:
    M:/Foo/subdir=M:/Foo/subdir
    M:/Bar/subdir=/Bar/subdir
    
    
    test 1 failed
    couldn't change working directory to "M:/Bar/subdir": no such file or directory
        while executing
    "cd M:/Bar/subdir"
    
    
    test 2 passed
    
    
    test 3 failed
    couldn't read directory "/Bar/subdir/*": no such file or directory
        while executing
    "glob -directory M:/Bar/subdir -tail *"
    
  5. foundin changed to: "8.6.4.1"
  6. is_private changed to: "0"
  7. login: "mfriedrich"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "a3e196ae61223ed094178305110e4d1d8ccbac2b"
  10. resolution changed to: "None"
  11. severity changed to: "Important"
  12. status changed to: "Open"
  13. submitter changed to: "mfriedrich"
  14. subsystem changed to: "36. Pathname Management"
  15. title changed to:
    Commands cd, glob and normalize may fail on Windows if used with network locations containing NTFS junctions
    
  16. type changed to: "Bug"