]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/blobdiff - parted/patches/parted-2.1-gpt-clobber-pmbr-rh563211.patch
parted: Update to 3.1.
[people/amarx/ipfire-3.x.git] / parted / patches / parted-2.1-gpt-clobber-pmbr-rh563211.patch
diff --git a/parted/patches/parted-2.1-gpt-clobber-pmbr-rh563211.patch b/parted/patches/parted-2.1-gpt-clobber-pmbr-rh563211.patch
deleted file mode 100644 (file)
index 2c3e030..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-From 28be933ce317f954be1e39a50d8f42197d6e3c15 Mon Sep 17 00:00:00 2001
-From: Jim Meyering <meyering@redhat.com>
-Date: Sun, 7 Feb 2010 20:31:11 +0100
-Subject: [PATCH parted 01/10] gpt: read-only operation could clobber MBR part of hybrid GPT+MBR table
-
-* libparted/labels/gpt.c (gpt_read): Fix a bug introduced by me in
-commit 7f753b1b, "gpt: rewrite GPT header-reading code".
-Set write_back=0 in one more code path.
-* tests/Makefile.am (TESTS): Add t0205-gpt-list-clobbers-pmbr.sh.
-* tests/t0205-gpt-list-clobbers-pmbr.sh: New test.
-Reported by aix27249 in
-http://parted.alioth.debian.org/cgi-bin/trac.cgi/ticket/250
----
- libparted/labels/gpt.c                |   10 ++++--
- tests/Makefile.am                     |    1 +
- tests/t0205-gpt-list-clobbers-pmbr.sh |   59 +++++++++++++++++++++++++++++++++
- 4 files changed, 72 insertions(+), 3 deletions(-)
- create mode 100644 tests/t0205-gpt-list-clobbers-pmbr.sh
-
-diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
-index 9d9876c..ea96a3b 100644
---- a/libparted/labels/gpt.c
-+++ b/libparted/labels/gpt.c
-@@ -4,7 +4,7 @@
-     original version by Matt Domsch <Matt_Domsch@dell.com>
-     Disclaimed into the Public Domain
--    Portions Copyright (C) 2001-2003, 2005-2009 Free Software Foundation, Inc.
-+    Portions Copyright (C) 2001-2003, 2005-2010 Free Software Foundation, Inc.
-     EFI GUID Partition Table handling
-     Per Intel EFI Specification v1.02
-@@ -932,9 +932,9 @@ gpt_read (PedDisk *disk)
-   if (primary_gpt && backup_gpt)
-     {
-       /* Both are valid.  */
-+#ifndef DISCOVER_ONLY
-       if (PED_LE64_TO_CPU (primary_gpt->AlternateLBA) < disk->dev->length - 1)
-         {
--#ifndef DISCOVER_ONLY
-           switch (ped_exception_throw
-                   (PED_EXCEPTION_ERROR,
-                    (PED_EXCEPTION_FIX | PED_EXCEPTION_CANCEL
-@@ -954,8 +954,12 @@ gpt_read (PedDisk *disk)
-               write_back = 0;
-               break;
-             }
--#endif /* !DISCOVER_ONLY */
-         }
-+      else
-+      {
-+        write_back = 0;
-+      }
-+#endif /* !DISCOVER_ONLY */
-       gpt = primary_gpt;
-       pth_free (backup_gpt);
-     }
-diff --git a/tests/Makefile.am b/tests/Makefile.am
-index 7bfb22e..38922f6 100644
---- a/tests/Makefile.in
-+++ b/tests/Makefile.in
-@@ -9,6 +9,7 @@ TESTS = \
-   t0200-gpt.sh \
-   t0201-gpt.sh \
-   t0202-gpt-pmbr.sh \
-+  t0205-gpt-list-clobbers-pmbr.sh \
-   t0220-gpt-msftres.sh \
-   t0250-gpt.sh \
-   t0280-gpt-corrupt.sh \
-@@ -1261,6 +1261,8 @@ t0201-gpt.sh.log: t0201-gpt.sh
-       @p='t0201-gpt.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
- t0202-gpt-pmbr.sh.log: t0202-gpt-pmbr.sh
-       @p='t0202-gpt-pmbr.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
-+t0205-gpt-list-clobbers-pmbr.sh.log: t0205-gpt-list-clobbers-pmbr.sh
-+      @p='t0205-gpt-list-clobbers-pmbr.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
- t0220-gpt-msftres.sh.log: t0220-gpt-msftres.sh
-       @p='t0220-gpt-msftres.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
- t0250-gpt.sh.log: t0250-gpt.sh
-diff --git a/tests/t0205-gpt-list-clobbers-pmbr.sh b/tests/t0205-gpt-list-clobbers-pmbr.sh
-new file mode 100644
-index 0000000..979a15e
---- /dev/null
-+++ b/tests/t0205-gpt-list-clobbers-pmbr.sh
-@@ -0,0 +1,59 @@
-+#!/bin/sh
-+# Ensure that printing a GPT partition table does not modify the pMBR.
-+# Due to a bug in parted-2.1, "parted /dev/... print" would do just that.
-+# Not a problem for most, but if you have a hybrid, e.g., gptsync'd
-+# GPT/MBR table, merely listing the table with Parted-2.1 would clobber
-+# the MBR part.
-+
-+# 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
-+
-+fail=0
-+
-+ss=$sector_size_
-+n_sectors=400
-+dev=dev-file
-+
-+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
-+parted -s $dev mklabel gpt                     || fail=1
-+parted -s $dev mkpart p1 101s 150s             || fail=1
-+parted -s $dev mkpart p2 151s 200s             || fail=1
-+parted -s $dev mkpart p3 201s 250s             || fail=1
-+
-+parted -m -s $dev u s p                        || fail=1
-+
-+# Write non-NUL bytes all over the MBR, so we're likely to see any change.
-+# However, be careful to leave the type of the first partition, 0xEE,
-+# as well as the final two magic bytes.
-+printf '%0450d\xee%059d\x55\xaa' 0 0 | dd of=$dev count=1 conv=notrunc || fail=1
-+
-+dd if=$dev of=before count=1 || fail=1
-+
-+chmod a-w $dev
-+parted -m -s $dev u s p || fail=1
-+
-+dd if=$dev of=after count=1 || fail=1
-+
-+cmp before after || fail=1
-+
-+Exit $fail
--- 
-1.6.6
-