public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: R.E.Wolff@BitWizard.nl (Rogier Wolff)
To: Andries Brouwer <aeb@veritas.com>
Cc: Rogier Wolff <R.E.Wolff@BitWizard.nl>,
	Peter Cordes <peter@llama.nslug.ns.ca>,
	linux-kernel@vger.kernel.org
Subject: Re: access() says EROFS even for device files if /dev is mounted RO
Date: Tue, 28 Nov 2000 15:04:31 +0100 (MET)	[thread overview]
Message-ID: <200011281404.PAA24567@cave.bitwizard.nl> (raw)
In-Reply-To: <20001128010942.A9133@veritas.com> from Andries Brouwer at "Nov 28, 2000 01:09:42 am"

Andries Brouwer wrote:
> On Mon, Nov 27, 2000 at 10:47:06PM +0100, Rogier Wolff wrote:
> > Andries Brouwer wrote:
> > > > access("/dev/tty2", R_OK|W_OK)          = -1 EROFS (Read-only file system)
> > 
> > > You misunderstand the function of access(). The standard says
> > > 
> > > [EROFS] write access shall fail if write access is requested
> > >         for a file on a read-only file system
> > 
> > The intent of the "access" call is to tell you if you will be able to
> > open the given pathname for the requested permissions. That this is
> > inherently racey is not the fault of the access system call.
> > 
> > The INTENT of this paragraph from the standard is to specify when to
> > return the error value EROFS. The "for a -=file=-" part to me
> > indicates that a valid interpretation is that this does not apply to
> > device nodes.
> 
> You optimist!
> A standard is not a text that should be read with the attitude
> "they write this but I know that they really meant that".
> A standard is precise.
> 
> In particular it defines the concepts used. For file it says:
> 
> File
> An object that can be written to, or read from, or both.
> A file has certain attributes, including access permissions and type.
> File types include regular file, character special file, block special
> file, FIFO special file, symbolic link, socket, and directory.
> Other types of files may be supported by the implementation.

Ok, so if you read the standard carefully you get a bogus result. 

Question: Was it meant this way, or did someone just make a mistake
(which happened to slip through and get approved into the standard)? 

I happen to think the second. 

- Is it desirable to have a write-open of a device on a read-only 
fail? I don't think so. You can't open the initial console etc etc. 

- Is it desirable to have access (W_OK) and "open-for-write" return
different results? I don't think so. 

- Are there other systems that adhere to the standard as written?

			Roger.

-- 
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
* There are old pilots, and there are bold pilots. 
* There are also old, bald pilots. 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  reply	other threads:[~2000-11-28 14:35 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-27  3:35 access() says EROFS even for device files if /dev is mounted RO Peter Cordes
2000-11-27 12:42 ` Andries Brouwer
2000-11-27 21:47   ` Rogier Wolff
2000-11-28  0:09     ` Andries Brouwer
2000-11-28 14:04       ` Rogier Wolff [this message]
2000-11-28 21:37         ` Andries Brouwer
2000-11-29 12:01           ` Hugh Dickins
2000-11-29 12:39             ` Alexander Viro
2000-11-29 15:46               ` Hugh Dickins
2000-11-29 16:18                 ` Alexander Viro
2000-11-29 16:40                   ` Tigran Aivazian
2000-11-29 16:52                     ` Alexander Viro
2000-12-01 17:12                     ` Olivier Galibert
2000-12-01 17:59                       ` Richard B. Johnson
2000-11-29 16:24                 ` Tigran Aivazian
2000-11-29 16:25                   ` Tigran Aivazian
2000-11-29 16:42                   ` Alexander Viro
2000-11-29 16:58                     ` Tigran Aivazian
2000-11-29 17:07                       ` Tigran Aivazian
2000-11-29 16:48                   ` Hugh Dickins
2000-11-29 14:24             ` Richard B. Johnson
2000-11-29 14:33               ` Broken NTFS Joseph K. Malek
2000-11-29 19:28                 ` Jeff V. Merkey
2000-11-28 22:56   ` access() says EROFS even for device files if /dev is mounted RO Peter Cordes
2000-11-28 23:23     ` Alexander Viro
  -- strict thread matches above, loose matches on Subject: below --
2000-11-29 17:17 Andries.Brouwer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200011281404.PAA24567@cave.bitwizard.nl \
    --to=r.e.wolff@bitwizard.nl \
    --cc=aeb@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter@llama.nslug.ns.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox