Re: access() says EROFS even for device files if /dev is mounted RO

2000-12-01 Thread Richard B. Johnson
On Fri, 1 Dec 2000, Olivier Galibert wrote: > On Wed, Nov 29, 2000 at 04:40:29PM +, Tigran Aivazian wrote: > > b) what should be the return of access(W_OK) (or, the same, open() for > > write with switched uid) for devices on a readonly-mounted filesystems? > > > > Should the majority win?

Re: access() says EROFS even for device files if /dev is mounted RO

2000-12-01 Thread Olivier Galibert
On Wed, Nov 29, 2000 at 04:40:29PM +, Tigran Aivazian wrote: > b) what should be the return of access(W_OK) (or, the same, open() for > write with switched uid) for devices on a readonly-mounted filesystems? > > Should the majority win? I.e. should we say OK, as we do now? My gut feeling

Re: access() says EROFS even for device files if /dev is mounted RO

2000-12-01 Thread Olivier Galibert
On Wed, Nov 29, 2000 at 04:40:29PM +, Tigran Aivazian wrote: b) what should be the return of access(W_OK) (or, the same, open() for write with switched uid) for devices on a readonly-mounted filesystems? Should the majority win? I.e. should we say OK, as we do now? My gut feeling on

Re: access() says EROFS even for device files if /dev is mounted RO

2000-12-01 Thread Richard B. Johnson
On Fri, 1 Dec 2000, Olivier Galibert wrote: On Wed, Nov 29, 2000 at 04:40:29PM +, Tigran Aivazian wrote: b) what should be the return of access(W_OK) (or, the same, open() for write with switched uid) for devices on a readonly-mounted filesystems? Should the majority win? I.e.

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Andries . Brouwer
From [EMAIL PROTECTED] Wed Nov 29 17:52:57 2000 > Should the majority win? I.e. should we say OK, as we do now? We should, but we don't. 2.4 does the right thing. 2.2 got the following change back in 2.2.6: res = PTR_ERR(dentry); if (!IS_ERR(dentry)) {

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Tigran Aivazian
On Wed, 29 Nov 2000, Tigran Aivazian wrote: > On Wed, 29 Nov 2000, Alexander Viro wrote: > > Considering your previous workplace... How does official SVR{4,5} behave? > > Under SCO UnixWare 7.1.1 you can happily write to devices in a readonly > mounted (vxfs) filesystem. You can also happily

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Tigran Aivazian
On Wed, 29 Nov 2000, Alexander Viro wrote: > Considering your previous workplace... How does official SVR{4,5} behave? Under SCO UnixWare 7.1.1 you can happily write to devices in a readonly mounted (vxfs) filesystem. You can also happily access(W_OK) them. Just tried, right now (ok, it should

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Alexander Viro
On Wed, 29 Nov 2000, Tigran Aivazian wrote: > That is precisely the point I was making in my previous email. But both > that email and yours asnwer only one question: > > a) should access(2) behave identical to open(2) (with switched uid)? The > answer is Yes. > > but the main question still

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Hugh Dickins
On Wed, 29 Nov 2000, Tigran Aivazian wrote: > > The classical interpretation of the access(2) system call is "do the same > type of permission check as open(2) would do but using real uid in the > credentials instead of effective (or on Linux fs) uid". > All I am saying is that if open on

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Alexander Viro
On Wed, 29 Nov 2000, Tigran Aivazian wrote: > All I am saying is that if open on HP/UX allows writing but access denies > it, it is definitely a bug (in HP/UX). Let's remember why access(2) was > invented at all -- to allow setuid-privileged programs to do permission > checks based on real uid

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Tigran Aivazian
On Wed, 29 Nov 2000, Alexander Viro wrote: > Historically, on systems that allow write access to devices > on r/o filesystems access() doesn't return EROFS for devices. Moreover, that's > what one might reasonably expect and there are programs relying on that. > Principle of minimal surprise and

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Tigran Aivazian
just to add (obvious!) -- whenever "uid" was mentioned I implied "uid and gid"... On Wed, 29 Nov 2000, Tigran Aivazian wrote: > On Wed, 29 Nov 2000, Hugh Dickins wrote: > > Sorry, I missed the point at issue here, and what changed when. > > Assuming (perhaps wrongly) it's independent of

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Alexander Viro
On Wed, 29 Nov 2000, Hugh Dickins wrote: > Sorry, I missed the point at issue here, and what changed when. > Assuming (perhaps wrongly) it's independent of filesystem type, > > Solaris yes ok ok > HP-UX yes EROFS ok > > I don't

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Tigran Aivazian
On Wed, 29 Nov 2000, Hugh Dickins wrote: > Sorry, I missed the point at issue here, and what changed when. > Assuming (perhaps wrongly) it's independent of filesystem type, > > Solaris yes ok ok > HP-UX yes EROFS ok > > I don't

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Hugh Dickins
On Wed, 29 Nov 2000, Alexander Viro wrote: > > On Wed, 29 Nov 2000, Hugh Dickins wrote: > > > Yes, and I think you'll have difficulty, Andries, finding > > any other Unices which interpret the standard as you and > > Linux do: Solaris, HP-UX, UnixWare and OpenServer all allow > > writing to a

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Richard B. Johnson
On Wed, 29 Nov 2000, Hugh Dickins wrote: > On Tue, 28 Nov 2000, Andries Brouwer wrote: > > On Tue, Nov 28, 2000 at 03:04:31PM +0100, Rogier Wolff wrote: > > > > > Ok, so if you read the standard carefully you get a bogus result. > > > > Why bogus? Things could have been otherwise, but the

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Alexander Viro
On Wed, 29 Nov 2000, Hugh Dickins wrote: > On Tue, 28 Nov 2000, Andries Brouwer wrote: > > On Tue, Nov 28, 2000 at 03:04:31PM +0100, Rogier Wolff wrote: > > > > > Ok, so if you read the standard carefully you get a bogus result. > > > > Why bogus? Things could have been otherwise, but the

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Hugh Dickins
On Tue, 28 Nov 2000, Andries Brouwer wrote: > On Tue, Nov 28, 2000 at 03:04:31PM +0100, Rogier Wolff wrote: > > > Ok, so if you read the standard carefully you get a bogus result. > > Why bogus? Things could have been otherwise, but the important > part is that all Unices do things the same

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Hugh Dickins
On Tue, 28 Nov 2000, Andries Brouwer wrote: On Tue, Nov 28, 2000 at 03:04:31PM +0100, Rogier Wolff wrote: Ok, so if you read the standard carefully you get a bogus result. Why bogus? Things could have been otherwise, but the important part is that all Unices do things the same way.

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Alexander Viro
On Wed, 29 Nov 2000, Hugh Dickins wrote: On Tue, 28 Nov 2000, Andries Brouwer wrote: On Tue, Nov 28, 2000 at 03:04:31PM +0100, Rogier Wolff wrote: Ok, so if you read the standard carefully you get a bogus result. Why bogus? Things could have been otherwise, but the important

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Richard B. Johnson
On Wed, 29 Nov 2000, Hugh Dickins wrote: On Tue, 28 Nov 2000, Andries Brouwer wrote: On Tue, Nov 28, 2000 at 03:04:31PM +0100, Rogier Wolff wrote: Ok, so if you read the standard carefully you get a bogus result. Why bogus? Things could have been otherwise, but the important

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Hugh Dickins
On Wed, 29 Nov 2000, Alexander Viro wrote: On Wed, 29 Nov 2000, Hugh Dickins wrote: Yes, and I think you'll have difficulty, Andries, finding any other Unices which interpret the standard as you and Linux do: Solaris, HP-UX, UnixWare and OpenServer all allow writing to a device node

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Alexander Viro
On Wed, 29 Nov 2000, Hugh Dickins wrote: Sorry, I missed the point at issue here, and what changed when. Assuming (perhaps wrongly) it's independent of filesystem type, Solaris yes ok ok HP-UX yes EROFS ok I don't have

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Tigran Aivazian
On Wed, 29 Nov 2000, Hugh Dickins wrote: Sorry, I missed the point at issue here, and what changed when. Assuming (perhaps wrongly) it's independent of filesystem type, Solaris yes ok ok HP-UX yes EROFS ok I don't have

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Tigran Aivazian
just to add (obvious!) -- whenever "uid" was mentioned I implied "uid and gid"... On Wed, 29 Nov 2000, Tigran Aivazian wrote: On Wed, 29 Nov 2000, Hugh Dickins wrote: Sorry, I missed the point at issue here, and what changed when. Assuming (perhaps wrongly) it's independent of filesystem

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Tigran Aivazian
On Wed, 29 Nov 2000, Alexander Viro wrote: Historically, on systems that allow write access to devices on r/o filesystems access() doesn't return EROFS for devices. Moreover, that's what one might reasonably expect and there are programs relying on that. Principle of minimal surprise and all

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Alexander Viro
On Wed, 29 Nov 2000, Tigran Aivazian wrote: All I am saying is that if open on HP/UX allows writing but access denies it, it is definitely a bug (in HP/UX). Let's remember why access(2) was invented at all -- to allow setuid-privileged programs to do permission checks based on real uid

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Hugh Dickins
On Wed, 29 Nov 2000, Tigran Aivazian wrote: The classical interpretation of the access(2) system call is "do the same type of permission check as open(2) would do but using real uid in the credentials instead of effective (or on Linux fs) uid". All I am saying is that if open on HP/UX

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Alexander Viro
On Wed, 29 Nov 2000, Tigran Aivazian wrote: That is precisely the point I was making in my previous email. But both that email and yours asnwer only one question: a) should access(2) behave identical to open(2) (with switched uid)? The answer is Yes. but the main question still

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Tigran Aivazian
On Wed, 29 Nov 2000, Alexander Viro wrote: Considering your previous workplace... How does official SVR{4,5} behave? Under SCO UnixWare 7.1.1 you can happily write to devices in a readonly mounted (vxfs) filesystem. You can also happily access(W_OK) them. Just tried, right now (ok, it should

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Tigran Aivazian
On Wed, 29 Nov 2000, Tigran Aivazian wrote: On Wed, 29 Nov 2000, Alexander Viro wrote: Considering your previous workplace... How does official SVR{4,5} behave? Under SCO UnixWare 7.1.1 you can happily write to devices in a readonly mounted (vxfs) filesystem. You can also happily

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-29 Thread Andries . Brouwer
From [EMAIL PROTECTED] Wed Nov 29 17:52:57 2000 Should the majority win? I.e. should we say OK, as we do now? We should, but we don't. 2.4 does the right thing. 2.2 got the following change back in 2.2.6: res = PTR_ERR(dentry); if (!IS_ERR(dentry)) {

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-28 Thread Alexander Viro
On Tue, 28 Nov 2000, Peter Cordes wrote: > I'm of the opinion that Linux should work in the way that is most useful, > as long as that doesn't stop us from running stuff written for other unices. > Unix is mostly good, but parts of it suck. There's no reason to keep the > parts that suck,

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-28 Thread Peter Cordes
On Mon, Nov 27, 2000 at 01:42:51PM +0100, Andries Brouwer wrote: > On Sun, Nov 26, 2000 at 11:35:22PM -0400, Peter Cordes wrote: > > > While doing some hdparm hacking, after booting with init=/bin/sh, I noticed > > that open(1) doesn't work when / is mounted read only. > > Already long ago

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-28 Thread Andries Brouwer
On Tue, Nov 28, 2000 at 03:04:31PM +0100, Rogier Wolff wrote: > Ok, so if you read the standard carefully you get a bogus result. Why bogus? Things could have been otherwise, but the important part is that all Unices do things the same way. > Question: Was it meant this way, or did someone

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-28 Thread Rogier Wolff
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

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-28 Thread Rogier Wolff
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

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-28 Thread Andries Brouwer
On Tue, Nov 28, 2000 at 03:04:31PM +0100, Rogier Wolff wrote: Ok, so if you read the standard carefully you get a bogus result. Why bogus? Things could have been otherwise, but the important part is that all Unices do things the same way. Question: Was it meant this way, or did someone just

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-28 Thread Peter Cordes
On Mon, Nov 27, 2000 at 01:42:51PM +0100, Andries Brouwer wrote: On Sun, Nov 26, 2000 at 11:35:22PM -0400, Peter Cordes wrote: While doing some hdparm hacking, after booting with init=/bin/sh, I noticed that open(1) doesn't work when / is mounted read only. Already long ago open(1) was

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-28 Thread Alexander Viro
On Tue, 28 Nov 2000, Peter Cordes wrote: I'm of the opinion that Linux should work in the way that is most useful, as long as that doesn't stop us from running stuff written for other unices. Unix is mostly good, but parts of it suck. There's no reason to keep the parts that suck, except

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-27 Thread Andries Brouwer
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

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-27 Thread Rogier Wolff
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

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-27 Thread Andries Brouwer
On Sun, Nov 26, 2000 at 11:35:22PM -0400, Peter Cordes wrote: > While doing some hdparm hacking, after booting with init=/bin/sh, I noticed > that open(1) doesn't work when / is mounted read only. Already long ago open(1) was renamed to openvt(1), so it may be that have a very old version. See

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-27 Thread Andries Brouwer
On Sun, Nov 26, 2000 at 11:35:22PM -0400, Peter Cordes wrote: While doing some hdparm hacking, after booting with init=/bin/sh, I noticed that open(1) doesn't work when / is mounted read only. Already long ago open(1) was renamed to openvt(1), so it may be that have a very old version. See a

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-27 Thread Rogier Wolff
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

Re: access() says EROFS even for device files if /dev is mounted RO

2000-11-27 Thread Andries Brouwer
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

access() says EROFS even for device files if /dev is mounted RO

2000-11-26 Thread Peter Cordes
While doing some hdparm hacking, after booting with init=/bin/sh, I noticed that open(1) doesn't work when / is mounted read only. It complains that it "Cannot open /dev/tty2 read/write"... I straced it: execve("/usr/bin/open", ["open"], [/* 13 vars */]) = 0 ... brk(0x804c000)

access() says EROFS even for device files if /dev is mounted RO

2000-11-26 Thread Peter Cordes
While doing some hdparm hacking, after booting with init=/bin/sh, I noticed that open(1) doesn't work when / is mounted read only. It complains that it "Cannot open /dev/tty2 read/write"... I straced it: execve("/usr/bin/open", ["open"], [/* 13 vars */]) = 0 ... brk(0x804c000)