access permissions in 1003.1

Clive Feather clive at x.co.uk
Mon Jun 3 16:51:17 AEST 1991


Submitted-by: clive at x.co.uk (Clive Feather)

> The problem, phrased in 1003.1's terms, is what happens if i am both
> the owner and group of a file with mode 040; can I read it?

In 2.4 (file access permissions) it reads in part: "The file permission
bits of a file contain read, write, and execute/search permissions for
the file owner class, file group class, and file other class".

> There are actually two problems. One is that 1003.1 defines bits and
> mentions words like read permission and masks but never actually says
> what the meaning of S_IRUSR (for example) is when it is set (or not).

In 5.6.1.2: "S_IRUSR read permission bit for the file owner class" etc.

So, your file (040) has read permission for the file group class, but
not the file owner class. Now we go to the definitions in 2.3:

"file owner class: a process is in the file owner class of a file if the
effective user ID of the process matches the user ID of the file."

"file group class: a process is in the file owner class of a file if the
process is not in the file owner class and if the effective group ID ...
of the process matches the group ID associated with the file."

The owner of the file is never in the file's group class, and so only
the first 3 permission bits matter. Which is what you would expect.

Finally, B.2.3 says "Note that a process is in one and only one class,
so there is no ambiguity."

> But let us pass over that and assume the wording should have been
> something like:

Let us not. Let us RTFS instead.

--
Clive D.W. Feather     | IXI Limited         | If you lie to the compiler,
clive at x.co.uk          | 62-74 Burleigh St.  | it will get its revenge.
Phone: +44 223 462 131 | Cambridge   CB1 1OJ |   - Henry Spencer
(USA: 1 800 XDESK 57)  | United Kingdom      |


Volume-Number: Volume 23, Number 84



More information about the Comp.std.unix mailing list