GNU bug report logs - #15354
[PATCH 05/19] tests: Make sure dm UUIDs are not erased

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: parted; Reported by: "Brian C. Lane" <bcl@HIDDEN>; Keywords: patch; dated Wed, 11 Sep 2013 20:18:01 UTC; Maintainer for parted is bug-parted@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 11 Sep 2013 20:17:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 11 16:17:16 2013
Received: from localhost ([127.0.0.1]:56518 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VJqqh-0004MS-Hd
	for submit <at> debbugs.gnu.org; Wed, 11 Sep 2013 16:17:15 -0400
Received: from eggs.gnu.org ([208.118.235.92]:46740)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <bcl@HIDDEN>) id 1VJqqf-0004MG-1u
 for submit <at> debbugs.gnu.org; Wed, 11 Sep 2013 16:17:13 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <bcl@HIDDEN>) id 1VJqqW-0002D3-5f
 for submit <at> debbugs.gnu.org; Wed, 11 Sep 2013 16:17:07 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:47111)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <bcl@HIDDEN>) id 1VJqqW-0002Cy-0b
 for submit <at> debbugs.gnu.org; Wed, 11 Sep 2013 16:17:04 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:48392)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <bcl@HIDDEN>) id 1VJqqQ-0003US-Pj
 for bug-parted@HIDDEN; Wed, 11 Sep 2013 16:17:03 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <bcl@HIDDEN>) id 1VJqqM-0002AS-UH
 for bug-parted@HIDDEN; Wed, 11 Sep 2013 16:16:58 -0400
Received: from neil.brianlane.com ([24.113.37.65]:44100
 helo=lister.brianlane.com) by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <bcl@HIDDEN>) id 1VJqqM-0000sS-Dr
 for bug-parted@HIDDEN; Wed, 11 Sep 2013 16:16:54 -0400
Received: from lister.brianlane.com (localhost [127.0.0.1])
 by lister.brianlane.com (8.14.7/8.14.7) with ESMTP id r8BJPGnU015294
 for <bug-parted@HIDDEN>; Wed, 11 Sep 2013 12:25:16 -0700
Received: (from bcl@localhost)
 by lister.brianlane.com (8.14.7/8.14.7/Submit) id r8BJPFH4015293
 for bug-parted@HIDDEN; Wed, 11 Sep 2013 12:25:15 -0700
From: "Brian C. Lane" <bcl@HIDDEN>
To: bug-parted@HIDDEN
Subject: [PATCH 05/19] tests: Make sure dm UUIDs are not erased
Date: Wed, 11 Sep 2013 12:24:55 -0700
Message-Id: <1378927509-15215-6-git-send-email-bcl@HIDDEN>
X-Mailer: git-send-email 1.8.3.1
In-Reply-To: <1378927509-15215-1-git-send-email-bcl@HIDDEN>
References: <1378927509-15215-1-git-send-email-bcl@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

From: "Brian C. Lane" <bcl@HIDDEN>

* tests/t6005-dm-uuid.sh: Make sure dm UUIDs are not erased
---
 tests/Makefile.am      |  1 +
 tests/t6005-dm-uuid.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100755 tests/t6005-dm-uuid.sh

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 923839d..57e8642 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -61,6 +61,7 @@ TESTS = \
   t6002-dm-busy.sh \
   t6003-dm-hide.sh \
   t6004-dm-many-partitions.sh \
+  t6005-dm-uuid.sh \
   t6100-mdraid-partitions.sh \
   t7000-scripting.sh \
   t8000-loop.sh \
diff --git a/tests/t6005-dm-uuid.sh b/tests/t6005-dm-uuid.sh
new file mode 100755
index 0000000..f58cb06
--- /dev/null
+++ b/tests/t6005-dm-uuid.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+# device-mapper: preserve uuid
+# The dm's partitions uuid would be removed when creating new partitions
+
+# Copyright (C) 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
+
+require_root_
+(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed"
+
+ss=$sector_size_
+ns=300
+n_partitions=3
+start_sector=34
+loop_file=loop-file-$$
+dm_name=dm-test-$$
+
+cleanup_() {
+    dmsetup remove $dm_name
+    test -n "$dev" && losetup -d "$dev"
+    rm -f $loop_file;
+}
+
+# create a file large enough to hold a GPT partition table
+dev=$(loop_setup_ $loop_file) || framework_failure
+dmsetup create $dm_name --table "0 $ns linear $dev 0" || framework_failure
+dmsetup rename $dm_name --setuuid f139317b-f98a-45d7-ab3b-9b4e0a336872 || framework_failure
+
+cmd=
+for ((i=1; i<=$n_partitions; i+=1)); do
+  s=$((start_sector + i - 1))
+  cmd="$cmd mkpart p$i ${s}s ${s}s"
+done
+parted -m -a min -s /dev/mapper/$dm_name mklabel gpt $cmd > /dev/null 2>&1 || fail=1
+
+# Make sure all the partitions have UUIDs
+for ((i=1; i<=$n_partitions; i+=1)); do
+    dmsetup info /dev/mapper/${dm_name}p$i | grep UUID || fail=1
+
+    # remove the partitions as we go, otherwise cleanup won't work.
+    dmsetup remove /dev/mapper/${dm_name}p$i
+done
+
+Exit $fail
-- 
1.8.3.1





Acknowledgement sent to "Brian C. Lane" <bcl@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-parted@HIDDEN. Full text available.
Report forwarded to bug-parted@HIDDEN:
bug#15354; Package parted. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.