Hi Kenneth,

Kenneth Gober wrote on Thu, May 28, 2015 at 09:19:59AM -0400:
> On Thu, May 28, 2015 at 8:40 AM,  <n.reu...@hxgn.net> wrote:

>> i just discovered that on BSD, a file inherits the group permissions from
>> the directory it is created in (contrary to Linux, which uses the default
>> group of the user).
>>
>> But i failed to find more information on that topic in the man pages
>> (chmod, chgrp, chown, touch, chflags) or the FAQ, just Otto@ replying on
>> misc [1].
>>
>> Is this expected to be known, or does this information exist somewhere in
>> the documentation?

> more specifically, BSD treats directories as if they always have the setgid
> bit set.  I think this is expected to be known, although it does exist in the
> documentation (but I had to consult wikipedia to find out where):
> 
> "man 2 open" says:
> 
> When a new file is created it is given the group of the directory
> which contains it.

Actually, i consider that the logical place to document it.
It would be misplaced in section 1 manuals because it doesn't
depend on which user-level utility creates the file.  It would
be misplaced in section 7 because there is no section 7 manual
about file ownership (ever though there is one about symbolic links).

In general, if a manual seems to be lacking information (like, you
are creating a file with cat(1) or vi(1) but the manuals don't tell
you what the group will be) try to ask your question in a precise
and general form, here:  When i create a new file, which group will
it have?  Then ask yourself: Which library function or system call
implements that functionality?  Here:  Which library function is
used to create new files?  apropos(1) may help with that, for example:

   $ man -s 3 -k '~create.*file'
  creat(3) - create a new file
  CURLOPT_NEW_FILE_PERMS(3) - permissions for remotely created files
  FcStrCopyFilename(3) - create a complete path from a filename
  posix_spawn_file_actions_destroy, posix_spawn_file_actions_init(3) -
    create and destroy posix_spawn file actions objects

And then creat(3) will point you to open(2), even if you didn't
know that open(2) is the POSIX standard method for creating new
files.

So i wouldn't know how to improve the documentation.

Yours,
  Ingo

Reply via email to