[Parted-maintainers] Bug#281734: parted: doesn't calculate partition paths correctly when using udev with devfs rules
Sven Luther
Sven Luther <sven.luther@wanadoo.fr>, 281734@bugs.debian.org
Sun, 30 Jan 2005 14:34:07 +0100
--r5Pyd7+fXNt84Ff3
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
On Sun, Jan 30, 2005 at 12:42:04PM +0000, Colin Watson wrote:
> On Sun, Jan 30, 2005 at 07:35:03AM +0100, Sven Luther wrote:
> > On Wed, Nov 17, 2004 at 03:21:04PM +0000, Colin Watson wrote:
> > > On Wed, Nov 17, 2004 at 04:15:18PM +0100, Sven Luther wrote:
> > > > On Wed, Nov 17, 2004 at 03:00:04PM +0000, Colin Watson wrote:
> > > > > http://people.ubuntulinux.org/patches/parted-udev-devfs-rules.patch
> >
> > Arg, this patch has dissapeared from there, i suppose i could find it in the
> > ubuntu parted packages, but it is non-obvious to me yet how to find it.
>
> http://patches.ubuntulinux.org/patches/parted-udev-devfs-rules.patch
>
> Sorry about that.
And here is the real patch for completeness sake.
Friendly,
Sven Luther
--r5Pyd7+fXNt84Ff3
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: attachment; filename="parted-udev-devfs-rules.patch"
diff -u parted-1.6.11/debian/patches/00list parted-1.6.11/debian/patches/00list
--- parted-1.6.11/debian/patches/00list
+++ parted-1.6.11/debian/patches/00list
@@ -16,0 +17 @@
+udev-devfs-rules
diff -u parted-1.6.11/debian/changelog parted-1.6.11/debian/changelog
--- parted-1.6.11/debian/changelog
+++ parted-1.6.11/debian/changelog
@@ -1,3 +1,10 @@
+parted (1.6.11-8ubuntu1) hoary; urgency=low
+
+ * Calculate partition paths correctly on systems where udev is being used
+ with devfs rules.
+
+ -- Colin Watson <cjwatson@canonical.com> Wed, 17 Nov 2004 13:51:40 +0000
+
parted (1.6.11-8) unstable; urgency=low
* Now build depends on libreadline4-dev | libreadline-dev, to work around
only in patch2:
unchanged:
--- parted-1.6.11.orig/debian/patches/udev-devfs-rules.dpatch
+++ parted-1.6.11/debian/patches/udev-devfs-rules.dpatch
@@ -0,0 +1,34 @@
+#! /bin/sh -e
+## udev-devfs-rules.dpatch by Colin Watson <cjwatson@canonical.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Calculate partition paths correctly on systems where udev is being
+## DP: used with devfs rules.
+
+. $(dirname $0)/DPATCH
+
+@DPATCH@
+diff -ru parted-1.6.11.orig/libparted/linux.c parted-1.6.11/libparted/linux.c
+--- parted-1.6.11.orig/libparted/linux.c 2004-04-25 04:52:29.000000000 +0100
++++ parted-1.6.11/libparted/linux.c 2004-11-17 13:47:18.941933008 +0000
+@@ -1443,7 +1443,8 @@
+ static char*
+ _device_get_part_path (PedDevice* dev, int num)
+ {
+- int result_len = strlen (dev->path) + 16;
++ int len = strlen (dev->path);
++ int result_len = len + 16;
+ char* result;
+
+ result = (char*) ped_malloc (result_len);
+@@ -1451,9 +1452,7 @@
+ return NULL;
+
+ /* FIXME: how do we know if a device is devfs or not? */
+- if (_have_devfs()) {
+- int len = strlen (dev->path);
+-
++ if (_have_devfs() || !strcmp (dev->path + len - 5, "/disc")) {
+ strcpy (result, dev->path);
+
+ /* strip "/disc" from the end */
--r5Pyd7+fXNt84Ff3--