[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Info-mtools] operation not permitted while setting disk parameters
From: |
Frank Loeffler |
Subject: |
Re: [Info-mtools] operation not permitted while setting disk parameters in find_device |
Date: |
Thu, 20 May 2021 18:30:59 +0200 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
Hi Alain,
On Thu, May 20, 2021 at 01:18:54PM +0200, Alain Knaff wrote:
[ snipped ... minfo RDWR for ioctl ]
Now, off the top of my head, I can't see right now where minfo would
need to issue an ioctl that needs write access. Care to elaborate?
Sure. The long story can be found here: https://github.com/knarrff/mtools/pull/1
The short story is: drives have to be configured according to the floppy
parameters (number of sectors/cylinders) to be able to read the entire
floppy. The way this is usually handled (also in mtools) is to read the
boot sector (that you assume you can always read), from there extract
the necessary parameters, configure the drive accordingly and then go on
reading the rest of the floppy.
The issue at hand is that even when you only want to read a floppy, you
need to configure the device accordingly to do so, and configuring the
device needs write permissions on that device (which may be different
than the media itself). When opening the device only with RO permission
but trying to configure it according to the information in the boot
sector (as mtools does without this change), you get an error like
Can't set disk parameters for B: Operation not permitted
Cannot initialize 'B:'
Indeed, just making minfo require write access unconditionally is
certainly not a good idea, as it would make minfo inaccessible to users
which otherwise can't have write access (permissions, or simply
write-protected media).
I believe (but am not sure now) that I also tried write-protected media
with this change, and it worked. This would also make sense as you
_have_ to open the device in rw-mode in order to configure it and that
is necessary to read it in the first place.
Frank
signature.asc
Description: PGP signature