Comment 30 for bug 56484

Revision history for this message
Matt Zimmerman (mdz) wrote : Re: SRU proposal; #56484 hal does not detect non-ATAPI CD-ROM drives

On Tue, Sep 19, 2006 at 06:44:20PM +0200, Martin Pitt wrote:
> I propose to fix https://launchpad.net/bugs/56484 in dapper.
>
> Impact: hal does not detect drives whose device file name ends in
> numbers; this particularly affects non-ATAPI CD-ROM devices (/dev/sr0)
> and floppies (/dev/fd0). (Please look at the bug duplicates for
> confirmation that dapper is affected as well). Apparently this worked
> fine in breezy. We have a request from the support center to fix this
> in Dapper.
>
> Patch: http://librarian.launchpad.net/4313504/16-nonpartitions-ending-in-nums.patch
>
> While this is not a nice an general solution for future upstream
> versions, it is a very conservative and cautios solution. Hal's
> current logic is flawed: if a device ends in numbers, then the code
> assumes it's a partition on a drive and takes dirname(drive name) as
> the parent sysfs device. However, in the case of e. g. /dev/sr0 (which
> is a drive and not a partition), the parent of /sys/block/sr0 is
> /sys/block which is not a valid sysfs device, and thus the device is
> discarded with 'no parent'. According to Scott James Remnant, sysfs
> gurarantees that /sys/block/foo are drives and /sys/block/foo/bar are
> partitions, thus the patch just special-cases the flawed logic and
> re-sets the 'is_partition' flag if the device name is a direct entry
> in /sys/block (as opposed to a subdirectory of a /sys/block/ dir).
>
> Status: Applied in Edgy some weeks ago, tested with appropriate
> hardware, no reported regressions.

Looks fine, please upload to dapper-proposed.

--
 - mdz