Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 3104730a8255de4194a529eada4c64dadfff61fe
Ticket: 972c35d41d10fa76718dfd67bf8db3ef10b85789
file copy "permission denied" for Windows symlinks
User & Date: twylite on 2015-11-23 10:14:26
Changes

  1. icomment:
    Related bug [3c13c4ed3149202f546a874457823389ba484be9].  That bug reported that: 'file delete $file' on a symbolic link to a directory fails with: "illegal operation on a directory"...
    
    The bug was *incorrectly closed as invalid*. Steps to reproduce:
    
    <verbatim>
        1. Run As Administrator: command prompt
        1.a. mkdir res
        1.b. mklink /D src res
        2. tclsh
        2.a. exec fsutil dirty query -> Usage... (=> we have elevated permissions)
        2.b. file delete src -> error deleting "src": illegal operation on a directory
    </verbatim>
    
    I suspect that (part of) the problem is that Windows/NTFS distinguishes between a symlink to a file (<SYMLINK>) and a symlink to a directory (<SYMLINKD>) (see https://en.wikipedia.org/wiki/NTFS_symbolic_link).  
    
    I see that the MSDN page on '_stat' claims that "_wstat does not work with Windows Vista symbolic links. In these cases, _wstat will always report a file size of 0. _stat does work correctly with symbolic links." (https://msdn.microsoft.com/en-us/library/14h5k7ff.aspx).  The same page notes that st_mode is a bit mask, so it may be possible that a directory link sets both the ISDIR and ISLINK bits, but that's just a guess.
    
  2. login: "twylite"
  3. mimetype: "text/x-fossil-wiki"
  4. username: "Twylite"