bug-parted
[Top][All Lists]
Advanced

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

Re: [PATCH parted 2/2] dos: Fix prep / palo flag handling


From: Jim Meyering
Subject: Re: [PATCH parted 2/2] dos: Fix prep / palo flag handling
Date: Tue, 20 Apr 2010 20:36:59 +0200

Hans de Goede wrote:
> Setting the prep flag was not clearing the palo flag and vica versa
> * libparted/labels/dos.c(msdos_partition_set_flag): Fix prep / palo
> flag handling.
> ---
>  libparted/labels/dos.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
> index 17209da..c0190a1 100644
> --- a/libparted/labels/dos.c
> +++ b/libparted/labels/dos.c
> @@ -1454,6 +1454,7 @@ msdos_partition_set_flag (PedPartition* part,
>                       dos_data->hidden = 0;
>                       dos_data->raid = 0;
>                       dos_data->lvm = 0;
> +                     dos_data->prep = 0;
>                       dos_data->diag = 0;
>               }
>               dos_data->palo = state;
> @@ -1464,6 +1465,7 @@ msdos_partition_set_flag (PedPartition* part,
>                       dos_data->hidden = 0;
>                       dos_data->raid = 0;
>                       dos_data->lvm = 0;
> +                     dos_data->palo = 0;

Thanks for the bug fix.
Here's a test to exercise it, along with a typo fix.

>From 5ee31fb42876c7a36f499908dcc36f701efa0b56 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 20 Apr 2010 18:21:40 +0200
Subject: [PATCH 1/2] tests: remove unnecessary (duplicate) local var assignment

* tests/t9021-maxima.sh: Remove duplicate ss=$sector_size_.
---
 tests/t9021-maxima.sh |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/tests/t9021-maxima.sh b/tests/t9021-maxima.sh
index f408810..eb44eea 100755
--- a/tests/t9021-maxima.sh
+++ b/tests/t9021-maxima.sh
@@ -26,7 +26,6 @@ fi
 ss=$sector_size_

 fail=0
-ss=$sector_size_
 dev=dev-file
 PATH="..:$PATH"
 export PATH
--
1.7.1.rc2.265.g8743f


>From d70803b5b5b26eb1da2d9a1404da10ba556c4a8e Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 20 Apr 2010 18:30:20 +0200
Subject: [PATCH 2/2] tests: test for palo and prep interaction

* tests/t3300-palo-prep.sh: New file.
* tests/Makefile.am (TESTS): Add it.
---
 tests/Makefile.am        |    1 +
 tests/t3300-palo-prep.sh |   51 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 0 deletions(-)
 create mode 100755 tests/t3300-palo-prep.sh

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 49829c5..c2d826c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -25,6 +25,7 @@ TESTS = \
   t2400-dos-hfs-partition-type.sh \
   t3000-resize-fs.sh \
   t3200-type-change.sh \
+  t3300-palo-prep.sh \
   t4000-sun-raid-type.sh \
   t4001-sun-vtoc.sh \
   t4100-msdos-partition-limits.sh \
diff --git a/tests/t3300-palo-prep.sh b/tests/t3300-palo-prep.sh
new file mode 100755
index 0000000..5ff40b3
--- /dev/null
+++ b/tests/t3300-palo-prep.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+# Ensure that palo and prep types work properly.
+
+# Copyright (C) 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+if test "$VERBOSE" = yes; then
+  set -x
+  parted --version
+fi
+
+: ${srcdir=.}
+. $srcdir/t-lib.sh
+ss=$sector_size_
+
+cat > exp <<EOF || framework_failure
+1:2048s:4095s:2048s:::palo;
+1:2048s:4095s:2048s:::prep;
+1:2048s:4095s:2048s:::palo;
+EOF
+
+fail=0
+dev=dev-file
+
+n_sectors=5000
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+
+parted -m -s $dev mklabel msdos \
+  mkpart pri ext2 $((1*2048))s $((2*2048-1))s \
+  set 1 palo on u s print \
+  set 1 prep on u s print \
+  set 1 palo on u s print \
+    > out 2> err || fail=1
+
+grep -E '^1:2048s:4095s:2048s:::p...;$' out > k; mv k out
+
+compare out exp || fail=1
+
+Exit $fail
--
1.7.1.rc2.265.g8743f




reply via email to

[Prev in Thread] Current Thread [Next in Thread]