- 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
Name: parted
Version: 1.8.6
Release: 2%{?dist}
Release: 3%{?dist}
License: GPL
Group: Applications/System
Source: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.bz2
Patch0: %{name}-%{version}-warnings.patch
Patch1: %{name}-%{version}-notransname.patch
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)
License: GPL
Group: Applications/System
BuildRequires: e2fsprogs-devel readline-devel ncurses-devel
BuildRequires: automake libtool gettext-devel texinfo
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
The GNU Parted program allows you to create, destroy, resize, move,
@ -26,8 +30,8 @@ for new operating systems, reorganizing disk usage, and copying data
to new hard disks.
%package devel
Summary: Files for developing apps which will manipulate disk partitions.
Group: Development/Libraries
Summary: Files for developing apps which will manipulate disk partitions.
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
%description devel
The GNU Parted library is a set of routines for hard disk partition
@ -39,6 +43,7 @@ Parted library, you need to install this package.
%setup -q
%patch0 -p1 -b .warnings
%patch1 -p1 -b .notransname
%patch2 -p1 -b .offbyone
%build
%configure --enable-device-mapper --enable-selinux
@ -55,17 +60,16 @@ Parted library, you need to install this package.
%clean
%{__rm} -rf %{buildroot}
%post
%post
/sbin/ldconfig
/sbin/install-info %{_infodir}/parted.info.gz %{_infodir}/dir || :
%preun
if [ "$1" = 0 ]; then
/sbin/install-info --delete %{_infodir}/parted.info.gz %{_infodir}/dir
if [ $1 = 0 ]; then
/sbin/install-info --delete %{_infodir}/parted.info.gz %{_infodir}/dir >/dev/null 2>&1 || :
fi
exit 0
%postun -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files -f %{name}.lang
%defattr(-,root,root,-)
@ -86,6 +90,9 @@ exit 0
%{_libdir}/pkgconfig/libparted.pc
%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
- Do not translate partition name from disk label (#224182)