[Parted-maintainers] Bug#491797: NMU diff for parted 1.8.8.git.2008.03.24-11.1

Ben Hutchings ben at decadent.org.uk
Mon Nov 24 02:14:17 UTC 2008


I applied a slightly different patch from the one I previously posted to
this bug report.  My first patch changed the behaviour when rewriting
the partition table to write only the type field of empty/hidden
partitions.  This would effectively *create* hidden partitions when
partitions are removed, which is not what we want.  The patch I have
actually applied makes a smaller change, which is to leave partition
entries unchanged if they are not used and they were already marked
empty/hidden.

Ben.

diff -u parted-1.8.8.git.2008.03.24/debian/changelog parted-1.8.8.git.2008.03.24/debian/changelog
--- parted-1.8.8.git.2008.03.24/debian/changelog
+++ parted-1.8.8.git.2008.03.24/debian/changelog
@@ -1,3 +1,11 @@
+parted (1.8.8.git.2008.03.24-11.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Preserve hidden partitions in DOS-format partition tables if they are not
+    explicitly replaced. Closes: #491797
+
+ -- Ben Hutchings <ben at decadent.org.uk>  Mon, 24 Nov 2008 01:28:08 +0000
+
 parted (1.8.8.git.2008.03.24-11) unstable; urgency=low
 
   * Add patch to avoid using partition names for loop devices. Thanks to
diff -u parted-1.8.8.git.2008.03.24/debian/patches/00list parted-1.8.8.git.2008.03.24/debian/patches/00list
--- parted-1.8.8.git.2008.03.24/debian/patches/00list
+++ parted-1.8.8.git.2008.03.24/debian/patches/00list
@@ -7,6 +7,7 @@
 #kfreebsd-gnu
 parted-dmraid
 unpartitioned-disks
+preserve-hidden-parts
 
 # Will also stay debian specific, but depends on some of the above :/
 sparc-fix-raid
only in patch2:
unchanged:
--- parted-1.8.8.git.2008.03.24.orig/debian/patches/preserve-hidden-parts.dpatch
+++ parted-1.8.8.git.2008.03.24/debian/patches/preserve-hidden-parts.dpatch
@@ -0,0 +1,35 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## preserve-hidden-parts.dpatch by Ben Hutchings <ben at decadent.org.uk>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: This is a fix for bug #491797.  It changes the DOS partition
+## DP: rewriting code to avoid overwriting empty or hidden primary
+## DP: partitions so long as their entries aren't reused.  This makes
+## DP: fatresize and similar front-ends safe to use in the presence of
+## DP: hidden partitions.
+
+ at DPATCH@
+--- a/libparted/labels/dos.c
++++ b/libparted/labels/dos.c
+@@ -1148,13 +1148,18 @@
+ 	if (!table.mbr_signature)
+ 		table.mbr_signature = generate_random_id();
+ 
+-	memset (table.partitions, 0, sizeof (DosRawPartition) * 4);
+-	table.magic = PED_CPU_TO_LE16 (MSDOS_MAGIC);
++	if (table.magic != PED_CPU_TO_LE16 (MSDOS_MAGIC)) {
++		memset (table.partitions, 0, sizeof (DosRawPartition) * 4);
++		table.magic = PED_CPU_TO_LE16 (MSDOS_MAGIC);
++	}
+ 
+ 	for (i=1; i<=4; i++) {
+ 		part = ped_disk_get_partition (disk, i);
+-		if (!part)
++		if (!part) {
++			if (table.partitions [i - 1].type != PARTITION_EMPTY)
++				memset (&table.partitions [i - 1], 0, sizeof (DosRawPartition));
+ 			continue;
++		}
+ 
+ 		if (!fill_raw_part (&table.partitions [i - 1], part, 0))
+ 			return 0;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.alioth.debian.org/pipermail/parted-maintainers/attachments/20081124/eccb62d6/attachment.pgp 


More information about the Parted-maintainers mailing list