[parted] Apply patch which may fix Linux 3.0 problem.

Richard W.M. Jones rjones at fedoraproject.org
Sun Jun 5 19:05:14 UTC 2011


commit ec61764348987cb6af5d743fb6929c105b40f00e
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Sun Jun 5 19:49:47 2011 +0100

    Apply patch which may fix Linux 3.0 problem.

 0001-Problem-with-Linux-3.0.patch |   52 +++++++++++++++++++++++++++++++++++++
 parted.spec                       |    8 +++++-
 2 files changed, 59 insertions(+), 1 deletions(-)
---
diff --git a/0001-Problem-with-Linux-3.0.patch b/0001-Problem-with-Linux-3.0.patch
new file mode 100644
index 0000000..abe80a2
--- /dev/null
+++ b/0001-Problem-with-Linux-3.0.patch
@@ -0,0 +1,52 @@
+From eb5e5f9c57aa8a3f8502ea75b08e5c608f6cec2c Mon Sep 17 00:00:00 2001
+From: Jim Meyering <jim at meyering.net>
+Date: Sun, 5 Jun 2011 18:17:40 +0200
+Subject: [PATCH] Problem with Linux "3.0"
+
+Richard W.M. Jones wrote:
+> https://bugzilla.redhat.com/show_bug.cgi?id=710882
+>
+> I'm fairly sure that the problem is in _get_linux_version function in
+> libparted/arch/linux.c, which expects a 3 part string.  In Linux 3.0
+> the string is "3.0" so this fails.
+>
+> Sorry for not putting together a patch, but my dev machine is down at
+> the moment.  If no one else jumps in, I'll post a patch tomorrow.
+
+Hi Rich,
+Thanks for the report.
+Here's an untested patch:
+
+>From 2ad212ad414f96b34420ece1adc3db9f291d03c3 Mon Sep 17 00:00:00 2001
+From: Jim Meyering <meyering at redhat.com>
+Date: Sun, 5 Jun 2011 18:15:31 +0200
+Subject: [PATCH] libparted: accommodate two-component linux version number
+ like 3.0
+
+* libparted/arch/linux.c (_get_linux_version): Also accept 2-component
+version numbers.
+Reported by Richard W.M. Jones.
+---
+ libparted/arch/linux.c |    6 +++++-
+ 1 files changed, 5 insertions(+), 1 deletions(-)
+
+diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
+index aeaf98f..111816c 100644
+--- a/libparted/arch/linux.c
++++ b/libparted/arch/linux.c
+@@ -610,7 +610,11 @@ _get_linux_version ()
+ 
+         if (uname (&uts))
+                 return kver = 0;
+-        if (sscanf (uts.release, "%u.%u.%u", &major, &minor, &teeny) != 3)
++        if (sscanf (uts.release, "%u.%u.%u", &major, &minor, &teeny) == 3)
++                ; /* ok */
++        else if (sscanf (uts.release, "%u.%u", &major, &minor) == 2)
++                teeny = 0;
++        else
+                 return kver = 0;
+ 
+         return kver = KERNEL_VERSION (major, minor, teeny);
+-- 
+1.7.5.1
+
diff --git a/parted.spec b/parted.spec
index 9d4c03d..de62770 100644
--- a/parted.spec
+++ b/parted.spec
@@ -4,7 +4,7 @@
 Summary: The GNU disk partition manipulation program
 Name:    parted
 Version: 2.4
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: GPLv3+
 Group:   Applications/System
 URL:     http://www.gnu.org/software/parted
@@ -21,6 +21,9 @@ Patch1: parted-2.3-mac-logical-sector-size.patch
 # Document the align-check command
 Patch2: parted-2.3-Document-align-check-642476.patch
 
+# Patch that may fix Linux "3.0" problem.
+Patch3: 0001-Problem-with-Linux-3.0.patch
+
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: e2fsprogs-devel
 BuildRequires: readline-devel
@@ -145,6 +148,9 @@ fi
 
 
 %changelog
+* Sun Jun  5 2011 Richard W.M. Jones <rjones at redhat.com> - 2.4-2
+- Apply patch which may fix Linux "3.0" problem.
+
 * Thu May 26 2011 Brian C. Lane <bcl at redhat.com> - 2.4-1
 - Updating to latest upstream v2.4
 - Drop patches included in upstream


More information about the scm-commits mailing list