On Thu, 2010-03-25 at 16:57 -0400, Jay Smith wrote:
> On *nix Create-file perms should be set by the creating program based on
> umask / directory perms.
> If the perms of the directory /somedir/images look like drwsrws---
> user me
> group mygroup
> then if files are created BY A MEMBER of the group "mygroup",
> files created in /somedir/images should look like rw-rw----
> (actually on my system they end up rw-rw-r-- for some reason).
You obviously did not quite understand how file permissions actually
work. The setgid bit which is set on your example directory says that
new files and subdirectories created within it should inherit the
groupID, rather than the primary groupID of the user who created the
file. It doesn't say anything about the permission bits of files created
in that directory. The permissions are determined by the mode that is
used with the call to open(2) modified by the process's umask.
The typical default value for the process umask is S_IWGRP | S_IWOTH
(octal 022). In the usual case where the mode argument to open(2) is
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH
(octal 0666) when creating a new file, the permissions on the resulting
file will be:
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
(because 0666 & ~022 = 0644; i.e., rw-r--r--).
Whether the directory has the setgrp bit set or not does not have an
effect on the permissions of the resulting file. It only affects the
groupID of the resulting file.
So please stop spreading misinformation like this. You claimed that the
described behavior was confirmed a bug. I doubt that it was confirmed by
someone who actually knew what he/she was talking about.
Gimp-user mailing list