Bug 261835

Summary: UDisksDevice::queryDeviceInterface has bogus implementation for Block device. Makes k3b not show dvd writers
Product: [Unmaintained] solid Reporter: cristi.posoiu
Component: libsolid-udisksAssignee: Lukáš Tinkl <lukas>
Status: RESOLVED DUPLICATE    
Severity: crash CC: andresbajotierra
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Mandriva RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description cristi.posoiu 2011-01-02 01:35:09 UTC
Version:           unspecified (using KDE 4.5.90) 
OS:                Linux

Started from k3b not showing my dvd drive anymore. Binary from rpm just had the list empty, a self compiled k3b (2.0.1) was segfaulting. Found out it was crashing due to do not receiving a pointer to a Solid::Block interface.

Looking at code, it looks like the UDisksDevice::queryDeviceInterface() is doing a strange check to see if the device is a block device or not: it checks the DeviceBlockSize property. Which seems to be set to 0 for the dvd writer device as long as it doesn't have a written (haven't checked w/ a blank) dvd in it.

Once I put a written dvd in the unit, k3b sees the dvd (DeviceBlockSize is set to something > 0).

Don't have a 'correct' patch to fix it, only 2 suggestions:
a) always return true. Based on the assumption that udisks devices are most probably always block devices
b) do a fstat call on the path given by property DeviceFile and use S_ISBLK(xx)

Found also a report describing the same situation w/ k3b: http://bugs.gentoo.org/show_bug.cgi?id=339032 , see comment #11




Reproducible: Always

Steps to Reproduce:
a) with k3b from Mandriva package: no dvd writer is shown
b) with self compiled k3b - segfault in a call to dev...as<Solig::Block>()->device...




output from udisks --dump, related to the dvd writer:

Showing information for /org/freedesktop/UDisks/devices/sr0
  native-path:                 /sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0
  device:                      11:0
  device-file:                 /dev/sr0
    presentation:              /dev/sr0
    by-path:                   /dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:0:0
  detected at:                 Sat 01 Jan 2011 06:27:19 PM EET
  system internal:             0
  removable:                   1
  has media:                   0
    detects change:            1
    detection by polling:      1
    detection inhibitable:     1
    detection inhibited:       0
  is read only:                0
  is mounted:                  0
  mount paths:             
  mounted by uid:              0
  presentation hide:           0
  presentation nopolicy:       0
  presentation name:           
  presentation icon:           
  size:                        0
  block size:                  0
  job underway:                no
  usage:                       
  type:                        
  version:                     
  uuid:                        
  label:                       
  drive:
    vendor:                    HL-DT-ST
    model:                     DVDRAM GSA-T20L
    revision:                  NR02
    serial:                    
    WWN:                       
    detachable:                0
    can spindown:              0
    rotational media:          Yes, unknown rate
    write-cache:               unknown
    ejectable:                 1
    adapter:                   /org/freedesktop/UDisks/adapters/0000_3a00_3a1f_2e1
    ports:
      /org/freedesktop/UDisks/adapters/0000_3a00_3a1f_2e1/host4
    similar devices:
    media:                     
      compat:                  optical_cd optical_cd_r optical_cd_rw optical_dvd optical_dvd_r optical_dvd_ram
    interface:                 scsi
    if speed:                  (unknown)
    ATA SMART:                 not available
==========

output from solid-hardware (see there's no Block.* property):

udi = '/org/freedesktop/UDisks/devices/sr0'
  parent = '/org/freedesktop/UDisks'  (string)
  vendor = 'HL-DT-ST'  (string)
  product = 'DVDRAM GSA-T20L'  (string)
  description = 'CD-RW/DVD-RAM Drive'  (string)
  StorageDrive.bus = 'Scsi'  (0x3)  (enum)
  StorageDrive.driveType = 'CdromDrive'  (0x1)  (enum)
  StorageDrive.removable = true  (bool)
  StorageDrive.hotpluggable = false  (bool)
  StorageDrive.inUse = false  (bool)
  StorageDrive.size = 0  (0x0)  (qulonglong)
  OpticalDrive.supportedMedia = 'Cdr|Cdrw|Dvd|Dvdr|Dvdram'  (0x2f)  (flag)
  OpticalDrive.readSpeed = 4234  (0x108a)  (int)
  OpticalDrive.writeSpeed = 4234  (0x108a)  (int)
  OpticalDrive.writeSpeeds = {4234,2822,1764,706} (int list)
=====
solid-hardware output with a written dvd in it:

udi = '/org/freedesktop/UDisks/devices/sr0'
  parent = '/org/freedesktop/UDisks'  (string)
  vendor = 'HL-DT-ST'  (string)
  product = 'DVDRAM GSA-T20L'  (string)
  description = 'CD-RW/DVD±RW DL Drive'  (string)
  Block.major = 11  (0xb)  (int)
  Block.minor = 0  (0x0)  (int)
  Block.device = '/dev/sr0'  (string)
  StorageDrive.bus = 'Scsi'  (0x3)  (enum)
  StorageDrive.driveType = 'CdromDrive'  (0x1)  (enum)
  StorageDrive.removable = true  (bool)
  StorageDrive.hotpluggable = false  (bool)
  StorageDrive.inUse = true  (bool)
  StorageDrive.size = 1245184  (0x130000)  (qulonglong)
  OpticalDrive.supportedMedia = 'Cdr|Cdrw|Dvd|Dvdr|Dvdrw|Dvdram|Dvdplusr|Dvdplusrw|Dvdplusdl'  (0x1ff)  (flag)
  OpticalDrive.readSpeed = 11080  (0x2b48)  (int)
  OpticalDrive.writeSpeed = 11080  (0x2b48)  (int)
  OpticalDrive.writeSpeeds = {11080,5540} (int list)
Comment 1 cristi.posoiu 2011-01-02 10:32:36 UTC
Please close as duplicate of #261834. It is a double post - network worked slow at post time.
Comment 2 Dario Andres 2011-01-02 12:51:29 UTC
[Comment from a bug triager]
Closing.
Regards
Comment 3 Lukáš Tinkl 2011-01-03 12:53:48 UTC

*** This bug has been marked as a duplicate of bug 261834 ***