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

Bug#797213: wheezy-pu: package partconf/1.40+deb7u1



Package: release.debian.org
Severity: normal
Tags: wheezy
User: release.debian.org@packages.debian.org
Usertags: pu

[ cc: debian-boot@lists.debian.org, milan@physics.harvard.edu ]

Hi,

A fix for a very old bug was committed during the jessie release
cycle, but I had been initially reluctant to pushing it for a point
release as it had received little testing. It's been a very long time
now, and I'm not aware of related regressions, so let's go for it?

Changelog entry:
| partconf (1.40+deb7u1) wheezy; urgency=low
| 
|   [ Milan Kupcevic ]
|   * Exclude CD/DVD drives from partition search. (thanks, Frank Fegert)
|     Closes: #332227
| 
|  -- Cyril Brulebois <kibi@debian.org>  Fri, 28 Aug 2015 17:31:58 +0200

and patch attached.

Thanks for your time.

Mraw,
KiBi.
diff -Nru partconf-1.40/debian/changelog partconf-1.40+deb7u1/debian/changelog
--- partconf-1.40/debian/changelog	2012-10-20 18:12:50.000000000 +0200
+++ partconf-1.40+deb7u1/debian/changelog	2015-08-28 17:32:02.000000000 +0200
@@ -1,3 +1,11 @@
+partconf (1.40+deb7u1) wheezy; urgency=low
+
+  [ Milan Kupcevic ]
+  * Exclude CD/DVD drives from partition search. (thanks, Frank Fegert)
+    Closes: #332227
+
+ -- Cyril Brulebois <kibi@debian.org>  Fri, 28 Aug 2015 17:31:58 +0200
+
 partconf (1.40) unstable; urgency=low
 
   [ Updated translations ]
diff -Nru partconf-1.40/find-parts.c partconf-1.40+deb7u1/find-parts.c
--- partconf-1.40/find-parts.c	2011-01-19 05:53:21.000000000 +0100
+++ partconf-1.40+deb7u1/find-parts.c	2015-08-28 17:31:52.000000000 +0200
@@ -113,6 +113,60 @@
     fclose(fp);
 }
 
+/**
+ * Determine if a device is a CD-ROM/DVD based on major/minor device
+ * number. Based on information from Linux's Documentation/devices.txt.
+ */
+bool
+is_cdrom(const char * const device_name)
+{
+    struct stat st;
+
+    if (stat(device_name, &st) != 0)
+            return false;
+
+    switch (major(st.st_rdev)) {
+        case 11: /* SCSI CD-ROM devices */
+        case 113: /* Parallel port ATAPI CD-ROM devices */
+            return true;
+        default:
+            break;
+    }
+
+    if (minor(st.st_rdev) == 0) {
+        switch (major(st.st_rdev)) {
+            case 15: /* Sony CDU-31A/CDU-33A CD-ROM */
+            case 16: /* GoldStar CD-ROM */
+            case 17: /* Optics Storage CD-ROM */
+            case 18: /* Sanyo CD-ROM */
+            case 20: /* Hitachi CD-ROM */
+            case 23: /* Mitsumi proprietary CD-ROM */
+            case 24: /* Sony CDU-535 CD-ROM */
+            case 29: /* Aztech/Orchid/Okano/Wearnes CD-ROM */
+            case 30: /* Philips LMS CM-205 CD-ROM */
+            case 32: /* Philips LMS CM-206 CD-ROM */
+                return true;
+            default:
+                break;
+        }
+    }
+
+    if (minor(st.st_rdev) >= 0 && minor(st.st_rdev) <= 3) {
+        switch (major(st.st_rdev)) {
+            case 25: /* First Matsushita (Panasonic/SoundBlaster: CD-ROM */
+            case 26: /* Second Matsushita (Panasonic/SoundBlaster: CD-ROM */
+            case 27: /* Fourth Matsushita (Panasonic/SoundBlaster: CD-ROM */
+            case 28: /* Third Matsushita (Panasonic/SoundBlaster: CD-ROM */
+            case 46: /* Parallel port ATAPI CD-ROM devices */
+                return true;
+            default:
+                break;
+        }
+    }
+
+    return false;
+}
+
 #ifndef FIND_PARTS_MAIN
 int
 block_partition(const char *part)
@@ -182,6 +236,8 @@
             continue;
         if (strstr(dev->path, "/dev/mtd") == dev->path)
             continue;
+        if (is_cdrom(dev->path))
+            continue;
         if (!ped_disk_probe(dev))
             continue;
         disk = ped_disk_new(dev);

Reply to: