[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#62699: cdparanoia should check/create the /dev/sg* devices that it requires.

On 20 Apr 2000, Michael Alan Dorman wrote:

> "Alan W. Irwin" <irwin@beluga.phys.uvic.ca> writes:
> > This might be a good idea so long as you set ownership to root.cdrom
> > and permissions to ug+rw.
> Um, disk drives show up as /dev/sg devices as well, so you've just had
> / scribbled on by the guy playing with the cd-writer who's prone to
> typos. :-)
> In other words, while I think it entirely appropriate to ensure that
> /dev/sg* exist, let the administrator decide who has access to what.
> Mike.

I haven't tried out cdrecord yet (which I presume has the same warning) so I
did not realize this danger of overwriting scsi HD's existed.  Thanks for
pointing this out.  That would be a large concern to me as well.  However,
the guy installing cdparanoia is by definition the administrator so the
decision on ownership/permissions should ideally be made at or near
the install time for the package.

One solution I thought of is for the cdparanoia install to set the
ownership/permissions to root.cdrom ug+r only in the case where /dev/sg*
devices do not exist.

However, I just tested that by hand and cdparanoia demands write-access (!)
If I chmod go-w /dev/sg1, cdparanoia fails (when run from the cdrom
group as an ordinary user) with

cdparanoia -v -d /dev/sg1 1 test.wav
cdparanoia III release 9.7 (December 13, 1999)
(C) 1999 Monty <monty@xiph.org> and Xiphophorus

Report bugs to paranoia@xiph.org

Checking /dev/sg1 for cdrom...
        Testing /dev/sg1 for cooked ioctl() interface
                /dev/sg1 is not a cooked ioctl CDROM.
        Testing /dev/sg1 for SCSI interface
                Could not access device /dev/sg1: Permission denied
                generic device: /dev/sg1
                ioctl device: not found
                Could not open generic SCSI device /dev/sg1: Permission denied

If I chmod go+w /dev/sg1 then the identical command for the identical
ordinary user gives

Checking /dev/sg1 for cdrom...
        Testing /dev/sg1 for cooked ioctl() interface
                /dev/sg1 is not a cooked ioctl CDROM.
        Testing /dev/sg1 for SCSI interface
                generic device: /dev/sg1
                ioctl device: /dev/scd0
                CDROM sensed: YAMAHA CRW8424S 1.0d

Checking for SCSI emulation and transport revision...
        Drive is SCSI


At first I thought demanding write access was an upstream bug in the
cdparanoia package, but on second thought perhaps cdparanoia is writing
requests to the /dev/sg1 controller (in my case) to verify it is a CDROM
drive before it rips it?

Since cdparanoia evidentally requires write access then the only simple way
to automate making /dev/sg* devices that work right out of the box is to
make them all writeable.  I agree this is inherently dangerous. Thus, since
the /dev/sg* devices have to fiddled with in any case, perhaps the best
thing to do would be to add some documentation about exactly what to do by
hand to find out which /dev/sg* (usually either sg0 or sg1) corresponds to
the CDROM, and then by hand chown root.cdrom /dev/sg?; chmod ug+w /dev/sg?
*only* for that device.  There should also be some warnings about what the
dangers are of making the sg* device that corresponds to the HD writeable by
the cdrom group.

I suspect/hope that all this territory has already been covered by the
cdrecord package. If they have done the job right, perhaps their
documentation of this aspect and treatment of /dev/sg* creation could simply
be lifted for cdparanoia?


email: irwin@beluga.phys.uvic.ca
phone: 250-727-2902	FAX: 250-721-7715
Dr. Alan W. Irwin
Department of Physics and Astronomy,
University of Victoria, P.O. Box 3055,
Victoria, British Columbia, Canada, V8W 3P6 

Linux-powered astrophysics

Reply to: