Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: c6f7400b3fc8366789eacc14639ae7afe8f40a97
Ticket: cdd157d4849df09ab1d594938aa0d2f4694d643f
file copy -force does an invalid call to open
User & Date: Tomo on 2016-07-18 14:52:40
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    The following TCL command:
    
    file copy -force in.txt out.txt
    
    will produce this call to "open" syscall:
    
    open("out.txt", O_WRONLY|O_CREAT|O_TRUNC, 0100664) = 6
    
    We can see that beside the mode ("664") there is the S_IFREG flag (0100000, regular flag) which is set. According to open man page, there shouldn't be any other bit in "mode" than the permission bits (see http://man7.org/linux/man-pages/man2/open.2.html "According to POSIX, the effect when other bits are set in mode is unspecified...")
    
    I found that some filesystem doesn't like this bit to be set.
    
    I see that "file copy -force" do a stat on the file before doing the open and I suspect TCL to blindly reuse the flag gained by the stat command but it should only use the lower bits.
    
  5. foundin changed to: "8.6"
  6. is_private changed to: "0"
  7. login: "Tomo"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "22f396e0a6e1333adf623bf097fc096e9dc12cdd"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "Tomo"
  14. subsystem changed to: "37. File System"
  15. title changed to: "file copy -force does an invalid call to open"
  16. type changed to: "Bug"