[Parted-commits] GNU Parted Official Repository: Changes to 'debian/master'
Otavio Salvador
otavio at alioth.debian.org
Mon Oct 1 16:48:56 UTC 2007
debian/changelog | 16 ++++++
debian/control.in | 8 +--
debian/rules | 4 +
libparted/disk.c | 17 +++---
libparted/tests/Makefile.am | 8 ++-
libparted/tests/disk.c | 111 ++++++++++++++++++++++++++++++++++++++++++
libparted/tests/t2000-disk.sh | 27 ++++++++++
7 files changed, 177 insertions(+), 14 deletions(-)
New commits:
commit c8d8bfa09f91f8eb57cf342039d5998496708fb3
Author: Otavio Salvador <otavio at ossystems.com.br>
Date: Mon Oct 1 13:48:57 2007 -0300
Annotate the fix for #294520
diff --git a/debian/changelog b/debian/changelog
index 528333a..3bd6200 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-parted (1.8.7.git.2007.07.30-2) experimental; urgency=low
+parted (1.8.7.git.2007.07.30-2) UNRELEASED; urgency=low
[ Cyril Brulebois ]
* debian/rules:
@@ -8,7 +8,11 @@ parted (1.8.7.git.2007.07.30-2) experimental; urgency=low
- make the packages binNMU-safe by using binary:Version and
source:Version instead of Source-Version.
- -- Cyril Brulebois <cyril.brulebois at enst-bretagne.fr> Mon, 01 Oct 2007 18:14:11 +0200
+ [ Otavio Salvador ]
+ * Really duplicate disks instead of readd each partition so it preserves
+ the ordering and like (Closes: #294520).
+
+ -- Otavio Salvador <otavio at ossystems.com.br> Mon, 01 Oct 2007 13:48:20 -0300
parted (1.8.7.git.2007.07.30-1) experimental; urgency=low
commit 043af9035385ca2669eb6dcb42d207ff07e6bcdd
Author: Otavio Salvador <otavio at ossystems.com.br>
Date: Thu Aug 30 09:52:03 2007 -0300
Really duplicate the disk instead of readd every partition
To avoid possible differences between the original disk layout and the
duplicated one, a raw copy is done. Has been identified a case[1]
where extended partitions had their positions changed due this.
1. http://bugs.debian.org/294520
The recipe[2] to reproduce the problem, on the provided URI, has been
used to produced a test and hence be sure it's not forgotten anymore.
2. http://bugs.debian.org/294520#34
The fix has been produced by Samuel Thibault <samuel.thibault at ens-lyon.org>
(cherry picked from commit 7baa9261b8648840b0d615ceaafcd473e9495dab)
diff --git a/libparted/disk.c b/libparted/disk.c
index 1582f26..52095d0 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -224,23 +224,24 @@ static int
_add_duplicate_part (PedDisk* disk, PedPartition* old_part)
{
PedPartition* new_part;
- PedConstraint* constraint_exact;
+ int ret;
new_part = disk->type->ops->partition_duplicate (old_part);
if (!new_part)
goto error;
new_part->disk = disk;
- constraint_exact = ped_constraint_exact (&new_part->geom);
- if (!constraint_exact)
+ _disk_push_update_mode (disk);
+ ret = _disk_raw_add (disk, new_part);
+ _disk_pop_update_mode (disk);
+ if (!ret)
goto error_destroy_new_part;
- if (!ped_disk_add_partition (disk, new_part, constraint_exact))
- goto error_destroy_constraint_exact;
- ped_constraint_destroy (constraint_exact);
+#ifdef DEBUG
+ if (!_disk_check_sanity (disk))
+ goto error_destroy_new_part;
+#endif
return 1;
-error_destroy_constraint_exact:
- ped_constraint_destroy (constraint_exact);
error_destroy_new_part:
ped_partition_destroy (new_part);
error:
diff --git a/libparted/tests/Makefile.am b/libparted/tests/Makefile.am
index 12ad29f..d526207 100644
--- a/libparted/tests/Makefile.am
+++ b/libparted/tests/Makefile.am
@@ -3,13 +3,17 @@
#
# This file may be modified and/or distributed without restriction.
-TESTS = t1000-label.sh
+TESTS = t1000-label.sh t2000-disk.sh
EXTRA_DIST = $(TESTS)
-bin_PROGRAMS = label
+bin_PROGRAMS = label disk
label_CFLAGS = $(CHECK_CFLAGS) -I$(top_srcdir)/include
label_LDADD = $(CHECK_LIBS) $(top_builddir)/libparted/libparted.la
label_SOURCES = common.h common.c label.c
+disk_CFLAGS = $(CHECK_CFLAGS) -I$(top_srcdir)/include
+disk_LDADD = $(CHECK_LIBS) $(top_builddir)/libparted/libparted.la
+disk_SOURCES = common.h common.c disk.c
+
MAINTAINERCLEANFILES = Makefile.in
CLEANFILES = init.sh
diff --git a/libparted/tests/disk.c b/libparted/tests/disk.c
new file mode 100644
index 0000000..295ec05
--- /dev/null
+++ b/libparted/tests/disk.c
@@ -0,0 +1,111 @@
+#include <config.h>
+#include <unistd.h>
+
+#include <check.h>
+
+#include <parted/parted.h>
+
+#include "common.h"
+
+static char* temporary_disk;
+
+static void
+create_disk (void)
+{
+ temporary_disk = _create_disk (20);
+ fail_if (temporary_disk == NULL, "Failed to create temporary disk");
+}
+
+static void
+destroy_disk (void)
+{
+ unlink (temporary_disk);
+ free (temporary_disk);
+}
+
+/* TEST: Create a disklabel on a simple disk image */
+START_TEST (test_duplicate)
+{
+ PedDevice* dev = ped_device_get (temporary_disk);
+ if (dev == NULL)
+ return;
+
+ PedDiskType* type;
+ PedDisk* disk;
+ PedDisk* disk_dup;
+ PedPartition *part;
+ PedPartition *part_dup;
+ PedConstraint *constraint;
+
+ int part_num[] = {1, 5, 6, 0};
+
+ disk = _create_disk_label (dev, ped_disk_type_get ("msdos"));
+
+ constraint = ped_constraint_any (dev);
+
+ /* Primary partition from 16,4kB to 15MB */
+ part = ped_partition_new (disk, PED_PARTITION_EXTENDED,
+ NULL,
+ 32, 29311);
+ ped_disk_add_partition (disk, part, constraint);
+
+ /* Logical partition from 10MB to 15MB */
+ part = ped_partition_new (disk, PED_PARTITION_LOGICAL,
+ ped_file_system_type_get ("ext2"),
+ 19584, 29311);
+ ped_disk_add_partition (disk, part, constraint);
+
+ /* Logical partition from 16,4kB to 4981kB */
+ part = ped_partition_new (disk, PED_PARTITION_LOGICAL,
+ ped_file_system_type_get ("ext2"),
+ 32, 9727);
+ ped_disk_add_partition (disk, part, constraint);
+
+ ped_disk_commit (disk);
+
+ ped_constraint_destroy (constraint);
+
+ disk_dup = ped_disk_duplicate (disk);
+
+ /* Checks if both partitions match */
+ for (int *i = part_num; *i != 0; i++) {
+ part = ped_disk_get_partition (disk, *i);
+ part_dup = ped_disk_get_partition (disk_dup, *i);
+
+ fail_if (part->geom.start != part_dup->geom.start ||
+ part->geom.end != part_dup->geom.end,
+ "Duplicated partition %d doesn't match. "
+ "Details are start: %d/%d end: %d/%d\n",
+ *i, part->geom.start, part_dup->geom.start,
+ part->geom.end, part_dup->geom.end);
+ }
+
+ ped_disk_destroy (disk);
+ ped_device_destroy (dev);
+}
+END_TEST
+
+int
+main (void)
+{
+ int number_failed;
+ Suite* suite = suite_create ("Disk");
+ TCase* tcase_duplicate = tcase_create ("Duplicate");
+
+ /* Fail when an exception is raised */
+ ped_exception_set_handler (_test_exception_handler);
+
+ tcase_add_checked_fixture (tcase_duplicate, create_disk, destroy_disk);
+ tcase_add_test (tcase_duplicate, test_duplicate);
+ /* Disable timeout for this test */
+ tcase_set_timeout (tcase_duplicate, 0);
+ suite_add_tcase (suite, tcase_duplicate);
+
+ SRunner* srunner = srunner_create (suite);
+ srunner_run_all (srunner, CK_VERBOSE);
+
+ number_failed = srunner_ntests_failed (srunner);
+ srunner_free (srunner);
+
+ return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
diff --git a/libparted/tests/t2000-disk.sh b/libparted/tests/t2000-disk.sh
new file mode 100755
index 0000000..7a85b98
--- /dev/null
+++ b/libparted/tests/t2000-disk.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# Copyright (C) 2007 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/>.
+
+test_description='run the disk unit tests in a directory supporting O_DIRECT'
+# This wrapper around the ./label binary is used to find a directory
+# in which one can open a file with the O_DIRECT flag.
+
+. ./init.sh
+
+test_expect_success \
+ 'run the actual tests' 'disk'
+
+test_done
commit 44d67c4035d6e48adc1c01916e3e4730e138a250
Author: Cyril Brulebois <cyril.brulebois at enst-bretagne.fr>
Date: Mon Oct 1 18:22:26 2007 +0200
Make the packages binNMU-safe by using (binary|source):Version instead of Source-Version
diff --git a/debian/changelog b/debian/changelog
index ad0fba3..528333a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,9 @@ parted (1.8.7.git.2007.07.30-2) experimental; urgency=low
* debian/rules:
- add â-fgnu89-inlineâ to âCFLAGSâ and âUDEB_CFLAGSâ to fix FTBFS
(Closes: #442308).
+ * debian/control.in:
+ - make the packages binNMU-safe by using binary:Version and
+ source:Version instead of Source-Version.
-- Cyril Brulebois <cyril.brulebois at enst-bretagne.fr> Mon, 01 Oct 2007 18:14:11 +0200
diff --git a/debian/control.in b/debian/control.in
index ea0f3c8..f74b765 100644
--- a/debian/control.in
+++ b/debian/control.in
@@ -66,7 +66,7 @@ Package: libparted at SHAREDLIBPKGVER@
Architecture: any
Section: libs
Depends: ${shlibs:Depends}
-Suggests: parted | nparted, libparted at LIBPKGVER@-dev, libparted at LIBPKGVER@-i18n (= ${Source-Version})
+Suggests: parted | nparted, libparted at LIBPKGVER@-dev, libparted at LIBPKGVER@-i18n (= ${source:Version})
Conflicts: parted (<< 1.4.13+14pre1), libparted0, libparted1, libparted2
Replaces: libparted0, libparted1, libparted2, libparted1.4 (<< 1.4.24-2)
Provides: libparted
@@ -174,8 +174,8 @@ Description: The GNU Parted disk partitioning library i18n support
Package: libparted at LIBPKGVER@-dev
Architecture: any
Section: libdevel
-Depends: libc6-dev, libparted at SHAREDLIBPKGVER@ (= ${Source-Version})
-Suggests: parted at BINPKGVER@ (= ${Source-Version}), parted-doc
+Depends: libc6-dev, libparted at SHAREDLIBPKGVER@ (= ${binary:Version})
+Suggests: parted at BINPKGVER@ (= ${binary:Version}), parted-doc
Conflicts: libparted-dev, parted (<< 1.2.11)
Replaces: libparted-dev, libparted0-dev, libparted2-dev
Provides: libparted-dev
@@ -213,7 +213,7 @@ Package: libparted at LIBPKGVER@-dbg
Architecture: any
Section: libdevel
Priority: extra
-Depends: libparted at SHAREDLIBPKGVER@ (= ${Source-Version}), libparted at LIBPKGVER@-dev (= ${Source-Version})
+Depends: libparted at SHAREDLIBPKGVER@ (= ${binary:Version}), libparted at LIBPKGVER@-dev (= ${binary:Version})
Conflicts: libparted-dbg
Replaces: libparted-dbg
Provides: libparted-dbg
commit 162783756c8e9fcfe0900d8fba5123d1de2eb590
Author: Cyril Brulebois <cyril.brulebois at enst-bretagne.fr>
Date: Mon Oct 1 18:19:01 2007 +0200
Add -fgnu89-inline to CFLAGS/UDEB_CFLAGS, closes: #442308
diff --git a/debian/changelog b/debian/changelog
index ea7d00e..ad0fba3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+parted (1.8.7.git.2007.07.30-2) experimental; urgency=low
+
+ [ Cyril Brulebois ]
+ * debian/rules:
+ - add â-fgnu89-inlineâ to âCFLAGSâ and âUDEB_CFLAGSâ to fix FTBFS
+ (Closes: #442308).
+
+ -- Cyril Brulebois <cyril.brulebois at enst-bretagne.fr> Mon, 01 Oct 2007 18:14:11 +0200
+
parted (1.8.7.git.2007.07.30-1) experimental; urgency=low
* New upstream release.
diff --git a/debian/rules b/debian/rules
index 16d6a48..1f29f98 100755
--- a/debian/rules
+++ b/debian/rules
@@ -114,6 +114,10 @@ ifeq (gnu, $(DEB_BUILD_GNU_SYSTEM))
CONFFLAGS += --disable-Werror
endif
+# Workaround/fix bug #442308
+CFLAGS += -fgnu89-inline
+UDEB_CFLAGS += -fgnu89-inline
+
# This builds a substitution list for sed based on the SUBSTS variable
# and the variables whose names SUBSTS contains ...
SUBSTLIST = $(foreach subst, $(SUBSTS), s/@$(subst)@/$($(subst))/g;)
More information about the Parted-commits
mailing list