From: "Brian C. Lane" <[email protected]> Make sure parted checks the PMBR before the GPT partition table.
* NEWS: Update with new GPT behavior * tests/Makefile.am: Add new test * tests/overwrite-gpt-pmbr.sh: new test --- NEWS | 4 +++ tests/Makefile.am | 1 + tests/t0301-overwrite-gpt-pmbr.sh | 45 +++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 0 deletions(-) create mode 100755 tests/t0301-overwrite-gpt-pmbr.sh diff --git a/NEWS b/NEWS index 3bef20e..3a27425 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ GNU parted NEWS -*- outline -*- * Noteworthy changes in release ?.? (????-??-??) [?] +** Bug Fixes + + libparted: Treat disks without a PMBR as msdos labeled disks + even if they have GPT partition tables. * Noteworthy changes in release 3.1 (2012-03-02) [stable] diff --git a/tests/Makefile.am b/tests/Makefile.am index 1b37fd9..1264812 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -28,6 +28,7 @@ TESTS = \ t0250-gpt.sh \ t0280-gpt-corrupt.sh \ t0300-dos-on-gpt.sh \ + t0301-overwrite-gpt-pmbr.sh \ t0400-loop-clobber-infloop.sh \ t0500-dup-clobber.sh \ t0501-duplicate.sh \ diff --git a/tests/t0301-overwrite-gpt-pmbr.sh b/tests/t0301-overwrite-gpt-pmbr.sh new file mode 100755 index 0000000..04d9ea6 --- /dev/null +++ b/tests/t0301-overwrite-gpt-pmbr.sh @@ -0,0 +1,45 @@ +#!/bin/sh +# Test creating a msdos partition over a GPT partition with +# fdisk which doesn't remove the GPT partitions, only the PMBR + +# Copyright (C) 2009-2012 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/>. + +. "${srcdir=.}/init.sh"; path_prepend_ ../parted + +PARTED_SECTOR_SIZE=4096 +export PARTED_SECTOR_SIZE + +dev=loop-file +# create a backing file large enough for a GPT partition table +dd if=/dev/null of=$dev seek=4001 2> /dev/null || framework_failure + +# create a GPT partition table +parted -s $dev mklabel gpt > out 2>&1 || fail=1 +# expect no output +compare /dev/null out || fail=1 + +# create a DOS partition table +fdisk $dev > out 2>&1 <<EOF +o +w +EOF + +# create a GPT partition table +parted -s $dev mklabel gpt > out 2>&1 || fail=1 +# expect no output +compare /dev/null out || fail=1 + +Exit $fail -- 1.7.7.6

