[236] in linux-scsi channel archive

home help back first fref pref prev next nref lref last post

Re: st driver open(O_WRONLY) of write-protected tape

daemon@ATHENA.MIT.EDU (Kai Makisara)
Fri Jun 9 11:12:40 1995

Date: Fri, 9 Jun 1995 17:14:38 +0300 (EET DST)
From: Kai Makisara <makisara@abies.metla.fi>
Reply-To: Kai.Makisara@metla.fi
To: Andreas Koppenhoefer <Andreas.Koppenhoefer@studbox.uni-stuttgart.de>
Cc: linux-scsi@vger.rutgers.edu,
        "Brandon S. Allbery KF8NH" <bsa@kf8nh.wariat.org>,
        Matthias Urlichs <urlichs@smurf.noris.de>
In-Reply-To: <199506061057.MAA01019@koppenas.informatik.uni-stuttgart.de>

On Tue, 6 Jun 1995, Andreas Koppenhoefer wrote:
...
> > On Sat, 3 Jun 1995, Brandon S. Allbery KF8NH wrote:
> > ...
> > > and got a write error "Permission denied" and an aborted backup instead of a 
> > > re-prompt for the device as GNU tar normally does.  This led me to look at 
> > > st.c, where I found that opening a write-protected tape actuallty opens the 
> > > tape read-only but causes writes to return -EPERM.
> > > 
...
> > The quick patch at the end of this message changes the behaviour so that 
> > the tar problem disappears. Returning EPERM if a write-protected tape is 
> > opened O_WRONLY is certainly sensible but should we do that also for O_RDWR?
> 
This is "academic" since tar seems to use only O_RDONLY and O_RDWR.

> Yes! That's the way other OS are handling this (like Solaris/SunOS).
> Please send your quick patch to Linus making it permanent.
>
All other OSs are not like Solaris/SunOS: DEC OSF/1 let's you open the tape 
with O_RDWR or O_WRONLY even if the tape is write protected. Trying to write 
returns EIO.

I tried this with CDROM and write protected floppy in Linux: in both 
cases open failed. The error code was EROFS (as Matthias pointed out). 
So, it seems that this is the Linux way. I have sent the patch to Linus.

	Kai


home help back first fref pref prev next nref lref last post