- Fix off-by-one bug in parted(8) when displaying disk label (#235901)

This commit is contained in:
David Cantrell 2007-04-11 16:33:52 +00:00
parent e13022c01a
commit cb95a1496c
2 changed files with 45 additions and 13 deletions

View File

@ -0,0 +1,25 @@
--- parted-1.8.6/parted/parted.c.offbyone 2007-04-11 12:13:06.000000000 -0400
+++ parted-1.8.6/parted/parted.c 2007-04-11 12:13:21.000000000 -0400
@@ -1217,6 +1217,7 @@
static int
do_print (PedDevice** dev)
{
+ PedUnit default_unit;
PedDisk* disk;
Table* table;
StrList* row;
@@ -1303,11 +1304,12 @@
}
start = ped_unit_format (*dev, 0);
+ default_unit = ped_unit_get_default ();
end = ped_unit_format_byte (*dev, (*dev)->length * (*dev)->sector_size
- - 1 );
+ - (default_unit == PED_UNIT_CHS || default_unit == PED_UNIT_CYLINDER));
if (opt_machine_mode) {
- switch (ped_unit_get_default ()) {
+ switch (default_unit) {
case PED_UNIT_CHS: puts ("CHS;");
break;
case PED_UNIT_CYLINDER: puts ("CYL;");

View File

@ -4,20 +4,24 @@
Summary: The GNU disk partition manipulation program Summary: The GNU disk partition manipulation program
Name: parted Name: parted
Version: 1.8.6 Version: 1.8.6
Release: 2%{?dist} Release: 3%{?dist}
Source: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.bz2
Patch0: %{name}-%{version}-warnings.patch
Patch1: %{name}-%{version}-notransname.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
License: GPL License: GPL
Group: Applications/System Group: Applications/System
Source: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.bz2
Patch0: %{name}-1.8.6-warnings.patch
Patch1: %{name}-1.8.6-notransname.patch
Patch2: %{name}-1.8.6-off-by-one.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: e2fsprogs-devel readline-devel ncurses-devel BuildRequires: e2fsprogs-devel readline-devel ncurses-devel
BuildRequires: automake libtool gettext-devel texinfo BuildRequires: automake libtool gettext-devel texinfo
BuildRequires: device-mapper-devel, libselinux-devel libsepol-devel BuildRequires: device-mapper-devel, libselinux-devel libsepol-devel
Prereq: /sbin/install-info Requires(post): /sbin/ldconfig
Requires(post): /sbin/install-info
Requires(preun): /sbin/install-info
Requires(postun): /sbin/ldconfig
%description %description
The GNU Parted program allows you to create, destroy, resize, move, The GNU Parted program allows you to create, destroy, resize, move,
@ -39,6 +43,7 @@ Parted library, you need to install this package.
%setup -q %setup -q
%patch0 -p1 -b .warnings %patch0 -p1 -b .warnings
%patch1 -p1 -b .notransname %patch1 -p1 -b .notransname
%patch2 -p1 -b .offbyone
%build %build
%configure --enable-device-mapper --enable-selinux %configure --enable-device-mapper --enable-selinux
@ -60,10 +65,9 @@ Parted library, you need to install this package.
/sbin/install-info %{_infodir}/parted.info.gz %{_infodir}/dir || : /sbin/install-info %{_infodir}/parted.info.gz %{_infodir}/dir || :
%preun %preun
if [ "$1" = 0 ]; then if [ $1 = 0 ]; then
/sbin/install-info --delete %{_infodir}/parted.info.gz %{_infodir}/dir /sbin/install-info --delete %{_infodir}/parted.info.gz %{_infodir}/dir >/dev/null 2>&1 || :
fi fi
exit 0
%postun -p /sbin/ldconfig %postun -p /sbin/ldconfig
@ -86,6 +90,9 @@ exit 0
%{_libdir}/pkgconfig/libparted.pc %{_libdir}/pkgconfig/libparted.pc
%changelog %changelog
* Wed Apr 11 2007 David Cantrell <dcantrell@redhat.com> - 1.8.6-3
- Fix off-by-one bug in parted(8) when displaying disk label (#235901)
* Wed Mar 21 2007 David Cantrell <dcantrell@redhat.com> - 1.8.6-2 * Wed Mar 21 2007 David Cantrell <dcantrell@redhat.com> - 1.8.6-2
- Do not translate partition name from disk label (#224182) - Do not translate partition name from disk label (#224182)