Re: cp creates directory with different permissions -- then reverts them
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Thread-index: Acb8RP2kPG2v2Gg4EduJHgANk0QgEg== Thread-topic: cp creates directory with different permissions -- then reverts them User-agent: Microsoft-Entourage/11.2.5.060620 Hi, Mike-- Thanks very much ;) So here's the problem I'm having. In the app I'm doing, I use a call to cp to make the copy. But unlike when using cp in terminal, somehow the directory it's creating is a bit worse than normal. It has only System as owner, and no access for anyone else. drwx------ chmod 700. Of course, this changes when the copy is finished, but the user will be alerted as to the initial settings of the folder, as it appears with a great big "No Access" icon. Can you suggest what I might be doing to cause this? All My Best, Jeffrey on 10/30/06 5:20 AM, Michael Smith at drivers@mu.org wrote:
On Oct 29, 2006, at 11:06 PM, Jeffrey Ellis wrote:
I have just noticed that when doing a copy of a directory, the copy of the directory has different owner/group and permissions than the original, and when done, has reverted back to the original permissions.
This was my test directory. Here is my output during the initial stage, just after copying has begun:
drwxr-xr-x 4 root admin 136 Oct 29 22:56 Mixdown Project
And when the copy was complete:
drwxrwxrwx 8 jeffrey jeffrey 272 May 6 2005 Mixdown Project
I was sudo'd to do the cp.
Can someone tell me why cp is doing this?
There are several reasons.
Firstly, the mkdir(2) system call does not provide a way for the owner/group to be set on the destination (since that would only be useful to root, anyway).
Secondly, the directory has to be left as it was created until the copy is complete because the final mode for the directory may preclude creating files within it.
Those two cover most cases.
= Mike
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
Jeffrey Ellis