Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 5c52a88e7a777ec0db33d142addb6e61791ba111
Ticket: 731062ffffffffffffffffffffffffffffffffff
file copy reports "not owner" although rights suffice
User & Date: ferrieux on 2010-06-03 20:51:30
Changes

  1. icomment:
    Thanks Carlos for the files. Bug spotted :)
    
    What happens is that Tcl's [file copy] does the copy, which succeeds, then tries (twice!!) to alter the permission bits of the just created file with chmod(), which fails in this case:
    
    [pid 29862] open("/home/carlos/bookmarks.xml", O_RDONLY|O_LARGEFILE) = 5
    [pid 29862] open("/media/borat/Users/carlos/BackUps/bookmarks.xml", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0100644) = 6
    [pid 29862] read(5, "<?xml version=\"1.0\" encoding=\"UT"..., 4096) = 3528
    [pid 29862] write(6, "<?xml version=\"1.0\" encoding=\"UT"..., 3528) = 3528
    [pid 29862] read(5, "", 4096)           = 0
    [pid 29862] close(5)                    = 0
    [pid 29862] close(6)                    = 0
    [pid 29862] chmod("/media/borat/Users/carlos/BackUps/bookmarks.xml", 0644) = -1 EPERM (Operation not permitted)
    [pid 29862] chmod("/media/borat/Users/carlos/BackUps/bookmarks.xml", 0644) = -1 EPERM (Operation not permitted)
    [pid 29862] unlink("/media/borat/Users/carlos/BackUps/bookmarks.xml") = 0
    [pid 29862] write(2, "error copying \"/home/carlos/book"..., 106error copying "/home/carlos/bookmarks.xml" to "/media/borat/Users/c
    
    In contrast, /bin/cp trusts the perm bits passed to the initial open(), and does not try that strange chmod(), so it succeeds:
    
    open("/home/carlos/bookmarks.xml", O_RDONLY|O_LARGEFILE) = 3
    fstat64(3, {st_mode=S_IFREG|0644, st_size=3528, ...}) = 0
    open("/media/borat/Users/carlos/BackUps/bookmarks.xml", O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE, 0644) = 4
    fstat64(4, {st_mode=S_IFREG|0777, st_size=0, ...}) = 0
    read(3, "<?xml version=\"1.0\" encoding=\"UT"..., 32768) = 3528
    write(4, "<?xml version=\"1.0\" encoding=\"UT"..., 3528) = 3528
    read(3, "", 32768)                      = 0
    close(4)                                = 0
    close(3)                                = 0
    
    Jeff, any idea why we're insisting on chmod here ?
    
    
    
  2. login: "ferrieux"
  3. mimetype: "text/plain"
  4. username: "ferrieux"