Artifacts Associated With Ticket 731062ffff
Ticket change [df073494a9] (rid 114951) by nobody on 2003-05-01 23:06:55:
- assignee initialized to: "dkf"
- cmimetype initialized to: "text/plain"
- comment initialized to:
I cannot copy a file to a directory I do not own, although I am a member of a group having the necessary rights to do so. Even using the option "-force" of "file copy" does not help. The error reportes is "not owner", which corresponds to EPERM. Copying from the command line using cp works fine. I use Tcl/Tk 8.4.1 on Linux (version 8.3.3 behaves same way) Maybe this report belongs in the category "file system", but since it shows when using the command "file", I put it here. [email protected]
- foundin initialized to: "None"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "16. Commands A-H"
- title initialized to:
file copy reports "not owner" although rights suffice
- type initialized to: "Bug"
Ticket change [d15cc46281] (rid 113333) by dkf on 2003-05-02 15:12:59:
- assignee changed to: "vincentdarley"
- foundin changed to: "obsolete: 8.4.1"
- subsystem changed to: "37. File System"
Ticket change [cabffdecce] (rid 95414) by vincentdarley on 2003-05-02 15:23:08:
- assignee changed to: "nobody"
- icomment:
Logged In: YES user_id=32170 I'm afraid I'm not really in a position to debug this. A few notes though: "-force" won't help --- that's to do with files already existing If you are able to do some debugging, the function you should look at is DoCopyFile in tclUnixFCmd.c. Maybe you could give a bit more info about the actual permissions of the file and directory in question.
- login: "vincentdarley"
- mimetype: "text/plain"
- username: "vincentdarley"
Ticket change [f6cfc27925] (rid 130365) by nobody on 2003-10-24 23:27:06:
- icomment:
Logged In: NO I am user hj, primary group membership in group 100, users. Proof: hj > who am i hj pts/0 Oct 24 17:54 hj > grep hj /etc/passwd hj:x:500:100:Holger:/home/hj:/bin/bash hj > grep 100 /etc/group users:x:100: The current directory is open open for writing for members of group users. Proof: hj > ll -d . drwxrwx--- 44 nobody users 12288 Okt 24 18:22 . Now, let's copy a file to the current directory. Works fine. hj > cp /tmp/x . hj > ll x -rwxrwx--- 1 nobody users 4344 Okt 24 18:22 x Yes, the file is there! Remove the file and try the same with Tcl. hj > rm x hj > tclsh % file copy /tmp/x . error copying "/tmp/x" to "./x": not owner % Oops, Tcl doesn't allow this, although the rights suffice. - login: "nobody"
- mimetype: "text/plain"
- username: "nobody"
- icomment:
Ticket change [035ad64f16] (rid 119815) by dgp on 2003-11-13 05:23:30:
- assignee changed to: "vincentdarley"
- icomment:
Logged In: YES user_id=80530 pass on to someone else if not sutiable for you, but don't leave it assigned to "nobody"
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
Ticket change [755f0cfe17] (rid 105379) by vincentdarley on 2003-11-13 05:45:44:
- assignee changed to: "hobbs"
- foundin changed to: "obsolete: 8.4.4"
Ticket change [e1cae3ecd2] (rid 87515) by holgerjakobs on 2003-11-16 21:40:45:
- icomment:
Logged In: YES user_id=110058 The directory where no file could be copied to happens to be an FAT drive mounted under Linux. /dev/hda8 on /d type vfat (rw,nosuid,nodev,umask=007,uid=65534,gid=100) It only gives trouble with Tcl, not with normal Unix-cp. Does this give a hint for the programmers how to get rid of this error? vincentdarley asked: >Maybe you could give a bit more info about the actual >permissions of the file and directory in question. Actually, my description written 2003-10-24 18:27 includes all information I could think of. If you believe there is anything missing I would like to know what you are looking for. Holger
- login: "holgerjakobs"
- mimetype: "text/plain"
- username: "holgerjakobs"
- icomment:
Ticket change [1009df0e68] (rid 94897) by holgerjakobs on 2003-11-16 21:43:58:
- icomment:
Logged In: YES user_id=110058 The directory where no file could be copied to happens to be an FAT drive mounted under Linux. /dev/hda8 on /d type vfat (rw,nosuid,nodev,umask=007,uid=65534,gid=100) It only gives trouble with Tcl, not with normal Unix-cp. Does this give a hint for the programmers how to get rid of this error? vincentdarley asked: >Maybe you could give a bit more info about the actual >permissions of the file and directory in question. Actually, my description written 2003-10-24 18:27 includes all information I could think of. If you believe there is anything missing I would like to know what you are looking for. Holger
- login: "holgerjakobs"
- mimetype: "text/plain"
- username: "holgerjakobs"
- icomment:
Ticket change [435cd765e0] (rid 116546) by ctasada on 2010-06-01 17:33:56:
- icomment:
Hi guys, I just got the same error using Tcl/Tk 8.5.4 and Ubuntu 10.04 As already said in the case the replication steps are: have a destination path with writing permissions (in fact I have 777) but owned by a different user (in my case root) Do: file copy $from_file $to_file Results: error: "not owner" Workaround: Right now I'm doing an "exec cp" but then I need to have specific code for every OS :( Cheers.
- login: "ctasada"
- mimetype: "text/plain"
- username: "ctasada"
- icomment:
Ticket change [79ea62094b] (rid 90212) by ferrieux on 2010-06-01 18:32:19:
- icomment:
Cannot repro in Fedora 12, with any of the three branches 8.[456] HEAD. Is upgrading to 8.5.8 an option for you ?
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [2a80c3b4d8] (rid 118587) by ctasada on 2010-06-01 19:30:55:
- icomment:
I have just tested with 8.5.8 from ActiveState and I've the same problem carlos@carlos-desktop:~/ActiveTcl-8.5/bin$ ./base-tcl8.5-thread-linux-ix86 % file copy /home/carlos/bookmarks.xml /media/borat/Users/carlos/BackUps/bookmarks.xml error copying "/home/carlos/bookmarks.xml" to "/media/borat/Users/carlos/BackUps/bookmarks.xml": not owner % puts $tcl_version 8.5 % puts $tcl_patchLevel 8.5.8 % file owned /media/borat/Users/carlos/BackUps 0 % file writable /media/borat/Users/carlos/BackUps 1 The /media/borat is mounted from a Windows computer with the next fstab line: //borat/fileserver/media/boratcifsnounix,rw,file_mode=0777,dir_mode=0777,username=Administrator,password=********00 Is there any other info that can help fixing this problem? Thanks.
- login: "ctasada"
- mimetype: "text/plain"
- username: "ctasada"
- icomment:
Ticket change [7140422edc] (rid 100638) by ferrieux on 2010-06-01 19:48:18:
- icomment:
Ah, a Windows share.... It would have been cool to mention that earlier.
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [e10ff629a9] (rid 87383) by flatworm on 2010-06-01 19:57:14:
- icomment:
ctasada, note that "writable" on a directory in Unix means that you have rights to manipulate directory contents which is a list of its entries, that is, you can delete and create files and directories; this does not mean you can, say, truncate an existing file and replace its contents with another data as this means modifying the file's data and this is controlled by the access rights set for that specific file. In other words, it would be cool if you posted the output of `id` command run as the user executing the script being discussed as well as the output of `stat /media/borat/Users/carlos/BackUps/` and `stat /media/borat/Users/carlos/BackUps/bookmarks.xml`.
- login: "flatworm"
- mimetype: "text/plain"
- username: "flatworm"
- icomment:
Ticket change [7c2481166f] (rid 97028) by ctasada on 2010-06-01 20:32:18:
- icomment:
Hi Konstantin, The requested results are: carlos@carlos-desktop:~$ stat /media/borat/Users/carlos/BackUps/ File: `/media/borat/Users/carlos/BackUps/' Size: 0 Blocks: 0 IO Block: 16384 directory Device: 15h/21dInode: 1970324837205476 Links: 1 Access: (0777/drwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2010-06-01 14:26:58.124250000 +0200 Modify: 2010-06-01 14:26:58.124250000 +0200 Change: 2010-06-01 14:26:58.124250000 +0200 carlos@carlos-desktop:~$ stat /media/borat/Users/carlos/BackUps/bookmarks.xml stat: cannot stat `/media/borat/Users/carlos/BackUps/bookmarks.xml': No such file or directory So as you can see there's no file with this name in the destination path. If I'm understanding you properly, that means that should work, right?
- login: "ctasada"
- mimetype: "text/plain"
- username: "ctasada"
- icomment:
Ticket change [006a5ee763] (rid 119318) by holgerjakobs on 2010-06-01 22:37:10:
- icomment:
Hi, its me, the original creator of this bug report. I cannot confirm this error any more, because I don't have Tcl 8.4.4 at hand. This bug may be closed, it was solved by the passing of time. Regards Holger Jakobs
- login: "holgerjakobs"
- mimetype: "text/plain"
- username: "holgerjakobs"
- icomment:
Ticket change [04df52e423] (rid 88949) by flatworm on 2010-06-02 05:05:48:
- icomment:
Carlos, from the point of view of Unix permissions, all is OK. But you know that mount.cifs is actually lying to you about these permissions as the Windows part has no idea about them. So let's try to change file copy $from_file $to_file in your script to exec cp $from_file $to_file and see it it errors out. If it doesn't, we really have a bug.
- login: "flatworm"
- mimetype: "text/plain"
- username: "flatworm"
- icomment:
Ticket change [0e0d481c27] (rid 94542) by flatworm on 2010-06-02 05:28:42:
- icomment:
And to not make you think I'm trolling you with my questions, Carlos, I should say that I'm using CIFS from one of my scripts. That machine has Tcl 8.5.3 (Debian Lenny). All works OK with the only difference that my script uses [open $filename w] instead of [file copy]. Of course, [file copy] might have a different execution path when creating the target file, so [open] works in this case but [file copy] is not. So we should check this. The relevant bit of my script (for reference) is at http://pastebin.com/46Vzxbaw
- login: "flatworm"
- mimetype: "text/plain"
- username: "flatworm"
- icomment:
Ticket change [2313da3e30] (rid 130855) by ferrieux on 2010-06-02 14:26:42:
- icomment:
Konstantin, he already said he was doing [exec cp] as a workaround... Carlos, can you do an 'strace -f' of the tclsh for both the [file copy] and [exec cp] cases ? I'd like to see the difference in syscalls between the working and nonworking cases.
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [b7d3ebef66] (rid 128863) by ctasada on 2010-06-03 18:37:23:
- icomment:
Ummm, I've the requested result from "strace -f", but I don't see how to attach files :( What's the best option to attach those results here? simply copy & paste? Thanks.
- login: "ctasada"
- mimetype: "text/plain"
- username: "ctasada"
- icomment:
Ticket change [a62940d548] (rid 98549) by ferrieux on 2010-06-03 19:38:19:
- icomment:
Yes, I wish SF allowed logged-in, non-submitter users to attach files too :} In the meantime, please send it to ferrieux at users dot sourceforge dot net.
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [5c52a88e7a] (rid 115280) by ferrieux on 2010-06-03 20:51:30:
- 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 ? - login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [fb8a999a36] (rid 259628) by serhiy.storchaka on 2026-10-20 21:33:41:
- icomment:
Still present in 8.6, 9.0 and 9.1, as ferrieux's strace showed: the data is copied, but <tt>chmod()</tt> or <tt>utime()</tt> of the new file fails with EPERM when the filesystem has a fixed owner (vfat mounted with uid=, CIFS), and then the copy is removed. Proposed fix in branch [/timeline?r=copy-eperm-attrs|copy-eperm-attrs], together with [1523045fff]: ignore EPERM there and keep the copy, as cp does.
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [afa69cfb9d] (rid 261434) by jan.nijtmans on 2026-11-11 14:34:40:
- assignee changed to: "jan.nijtmans"
- closedate changed to: "2461356.1074174885"
- closer changed to: "jan.nijtmans"
- comment changed to:
I cannot copy a file to a directory I do not own, although I am a member of a group having the necessary rights to do so. Even using the option "-force" of "file copy" does not help. The error reportes is "not owner", which corresponds to EPERM. Copying from the command line using cp works fine. I use Tcl/Tk 8.4.1 on Linux (version 8.3.3 behaves same way) Maybe this report belongs in the category "file system", but since it shows when using the command "file", I put it here. [email protected]
- icomment:
So, mark this as duplicate to [1523045] Thanks for the analysis and fix!
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Duplicate"
- severity changed to: "Minor"
- status changed to: "Closed"