Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 21664a6f1a0e020ca527c8f88f2b686f0791f783
Ticket: 972c35d41d10fa76718dfd67bf8db3ef10b85789
file copy "permission denied" for Windows symlinks
User & Date: twylite on 2015-11-23 09:50:11
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    The documented behavior of 'file copy' is "When copying within a single filesystem, file copy will copy soft links (i.e. the links themselves are copied, not the things they point to)."  On Windows 'file copy' fails to copy symlink directories, and copies the content (not the link) of symlink files.
    
    Note: I am talking about Symbolic Links (https://msdn.microsoft.com/en-us/library/windows/desktop/aa365680(v=vs.85).aspx); not Hard Links, Junctions, or Shortcuts (.lnk).
    
    Summary:
    - file copy file-symlink dest -> copies content
    - file copy dir-symlink dest -> illegal operation on a directory
    - file copy dir-containing-file-symlink dest -> permission denied
    - file copy dir-containing-dir-symlink dest -> permission denied
    
    Expected behavior:
    - Copy symlinks as documented in the man page
    
    Environment:
    - Windows 7 Enterprise, 64-bit on Intel
    - NTFS ('fsutil fsinfo ntfsinfo c:' identifies version 3.1)
    - tcl_patchLevel = 8.6.2
    
    Steps to reproduce:
    
    1. Open a command prompt using "Run As Administrator" (elevated privileges are required to create a symlink)
    2. In a new folder:
      2.a. Create a folder 'res' : mkdir res
      2.b. In 'res' create a file 'foo.txt' : echo Hello > res\foo.txt
      2.c. Create a file symlink 'bar.txt' -> 'res\foo.txt' : mklink bar.txt res\foo.txt
      2.d. Create a folder 'src' : mkdir src
      2.e. Create a directory symlink 'src/myres' -> 'res' : mklink /D src\myres ..\res
      2.f. You should have the layout given by the 'dir /s' command below
    3. Run wish/tclsh using "Run As Administrator"
      3.a. exec fsutil dirty query -> Should get a 'Usage' message if you have elevated permissions
      3.b. file copy bar.txt baz.txt -> succeeds, copies content not link
      3.c. file copy src/myres dest -> ERROR: error copying "src/myres" to "dest": illegal operation on a directory 
      3.d. file copy src dest -> ERROR: error copying "src" to "dest": "C:/Temp/tcllink/dest\myres": permission denied
      3.e. file copy src/myres dest -> ERROR: error copying "src/myres" to "dest/myres": illegal operation on a directory
    "C:/Temp/tcllink/dest\myres": permission denied
    4. Run wish/tclsh *not as Administrator* (so not from your open command prompt!)
      4.a. exec fsutil dirty query -> "The FSUTIL utility requires that you have administrative privileges"
      4.b. file copy bar.txt baz.txt -> succeeds, copies content not link
      4.c. file copy src/myres dest -> ERROR: error copying "src/myres" to "dest": illegal operation on a directory
      4.d. file copy src dest -> ERROR: error copying "src" to "dest/src": "C:/Temp/tcllink/dest/src\myres": permission denied
      4.e. file copy src/myres dest -> ERROR: error copying "src/myres" to "dest/myres": illegal operation on a directory
    
    
    ----- dir /s --------------------------------------------------
     Volume in drive C has no label.
     Volume Serial Number is EA57-23EF
    
     Directory of C:\Temp\tcllink
    
    2015/11/23  11:27 AM    <DIR>          .
    2015/11/23  11:27 AM    <DIR>          ..
    2015/11/23  11:27 AM    <SYMLINK>      bar.txt [res\foo.txt]
    2015/11/23  11:27 AM    <DIR>          res
    2015/11/23  11:28 AM    <DIR>          src
                   1 File(s)              0 bytes
    
     Directory of C:\Temp\tcllink\res
    
    2015/11/23  11:27 AM    <DIR>          .
    2015/11/23  11:27 AM    <DIR>          ..
    2015/11/23  11:27 AM                 8 foo.txt
                   1 File(s)              8 bytes
    
     Directory of C:\Temp\tcllink\src
    
    2015/11/23  11:28 AM    <DIR>          .
    2015/11/23  11:28 AM    <DIR>          ..
    2015/11/23  11:28 AM    <SYMLINKD>     myres [..\res]
                   0 File(s)              0 bytes
    
     Directory of C:\Temp\tcllink\src\myres
    
    2015/11/23  11:27 AM    <DIR>          .
    2015/11/23  11:27 AM    <DIR>          ..
    2015/11/23  11:27 AM                 8 foo.txt
                   1 File(s)              8 bytes
    
  5. foundin changed to: "8.6.2"
  6. is_private changed to: "0"
  7. login: "twylite"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "668a819fc68ae3df87285ba92d1fd8ef824e2d2b"
  10. resolution changed to: "None"
  11. severity changed to: "Important"
  12. status changed to: "Open"
  13. submitter changed to: "twylite"
  14. subsystem changed to: "37. File System"
  15. title changed to: "file copy "permission denied" for Windows symlinks"
  16. type changed to: "Bug"