Newsgroups: comp.std.unix Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!uunet.UU.NET!sef From: clive@x.co.uk (Clive Feather) Subject: Re: access permissions in 1003.1 Message-ID: <1991Jun3.192534.28089@uunet.uu.net> Originator: sef@uunet.UU.NET Sender: usenet@uunet.uu.net (UseNet News) Nntp-Posting-Host: uunet.uu.net X-Submissions: std-unix@uunet.uu.net Organization: UUNET Communications Services Date: Mon, 3 Jun 1991 06:51:17 GMT Approved: sef@uunet.uu.net (Moderator, Sean Eric Fagan - comp.std.unix) Submitted-by: clive@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@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