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

Bug#295246: partconf-find-partitions: /dev/discs symlink handling breaks with udev



Package: partconf-find-partitions
Version: 1.07
Severity: normal
Tags: patch

The /dev/discs symlink handling in find-parts.c:get_all_partitions() is
partly broken. In particular, it breaks when using udev. On my test
system, neither /dev/discs nor /dev/discs/disc0 is a symlink, and
/dev/discs/disc0/ looks like this:

  lrwxrwxrwx    1 root     root           39 Feb 14 17:22 disc -> ../../scsi/host0/bus0/target0/lun0/disc
  lrwxrwxrwx    1 root     root           40 Feb 14 17:22 part1 -> ../../scsi/host0/bus0/target0/lun0/part1
  lrwxrwxrwx    1 root     root           40 Feb 14 17:22 part2 -> ../../scsi/host0/bus0/target0/lun0/part2
  lrwxrwxrwx    1 root     root           40 Feb 14 17:22 part5 -> ../../scsi/host0/bus0/target0/lun0/part5
  lrwxrwxrwx    1 root     root           40 Feb 14 17:22 part6 -> ../../scsi/host0/bus0/target0/lun0/part6
  lrwxrwxrwx    1 root     root           40 Feb 14 17:22 part7 -> ../../scsi/host0/bus0/target0/lun0/part7

get_all_partitions() decides to look at
/dev/../../scsi/host0/bus0/target0/lun0/disc/disc for this, which
obviously doesn't work too well.

I initially started to produce a small patch to fix the existing symlink
handling code, but it didn't really seem worth the effort. Instead,
noting that find-parts.c is already _GNU_SOURCE, I decided to replace it
with use of canonicalize_file_name(), which makes the code a lot more
readable. If somebody objects to the GNUism, there's a
canonicalize_file_name() implementation in the gnulib package which
could be used conditionally.

Note that I've only tested this patch in Ubuntu's installer, which uses
udev, not in Debian's devfs installer.

  http://patches.ubuntulinux.org/patches/partconf.canonicalize.diff

Cheers,

-- 
Colin Watson                                       [cjwatson@debian.org]



Reply to: