tests: Fix expected extended partition flags with new parted and mdraid: Fix copy-paste error when checking return value

Related: rhbz#2109026
This commit is contained in:
Vojtech Trefny 2022-08-08 16:50:49 +02:00
parent abd838688e
commit 4e022d3ec0
3 changed files with 109 additions and 1 deletions

View File

@ -0,0 +1,53 @@
From 04a8baf87820d8a13926e0b8db5cfa55f9f04420 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Fri, 25 Sep 2020 14:26:57 +0200
Subject: [PATCH 1/2] mdraid: Fix copy-paste error when checking return value
---
src/plugins/mdraid.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/plugins/mdraid.c b/src/plugins/mdraid.c
index 67bdc1f9..48abb72f 100644
--- a/src/plugins/mdraid.c
+++ b/src/plugins/mdraid.c
@@ -995,7 +995,7 @@ BDMDExamineData* bd_md_examine (const gchar *device, GError **error) {
orig_data = ret->dev_uuid;
if (orig_data) {
ret->dev_uuid = bd_md_canonicalize_uuid (orig_data, error);
- if (!ret->uuid) {
+ if (!ret->dev_uuid) {
g_prefix_error (error, "Failed to canonicalize MD UUID '%s': ", orig_data);
g_free (orig_data);
bd_md_examine_data_free (ret);
--
2.37.1
From 16a34bc5ddb19bc6dd1a845d87e8b748cbaedd2c Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Fri, 25 Sep 2020 14:41:20 +0200
Subject: [PATCH 2/2] mdraid: Fix use after free
Another copy-paste error.
---
src/plugins/mdraid.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/plugins/mdraid.c b/src/plugins/mdraid.c
index 48abb72f..75143ea7 100644
--- a/src/plugins/mdraid.c
+++ b/src/plugins/mdraid.c
@@ -1028,8 +1028,7 @@ BDMDExamineData* bd_md_examine (const gchar *device, GError **error) {
value++;
ret->uuid = bd_md_canonicalize_uuid (value, error);
if (!ret->uuid) {
- g_prefix_error (error, "Failed to canonicalize MD UUID '%s': ", orig_data);
- g_free (orig_data);
+ g_prefix_error (error, "Failed to canonicalize MD UUID '%s': ", value);
bd_md_examine_data_free (ret);
g_strfreev (output_fields);
return NULL;
--
2.37.1

View File

@ -0,0 +1,45 @@
From 33b1cda56fdc76fdf96fe409f0308e1913965d16 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Thu, 26 May 2022 12:44:47 +0200
Subject: [PATCH] tests: Fix expected extended partition flags with new parted
Latest libparted now creates all extended partitions as
PARTITION_EXT_LBA with the lba flag enabled by default.
---
tests/part_test.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/part_test.py b/tests/part_test.py
index 7408b479..762dc534 100644
--- a/tests/part_test.py
+++ b/tests/part_test.py
@@ -356,7 +356,7 @@ class PartCreatePartFullCase(PartTestCase):
# as is the start of the first part from the start of the disk
self.assertTrue(abs(ps4.start - (ps3.start + ps3.size + 1)) < ps.start)
self.assertEqual(ps4.size, 10 * 1024**2)
- self.assertEqual(ps4.flags, 0) # no flags (combination of bit flags)
+ self.assertIn(ps4.flags, [0, 128]) # no flags or extended+lba (combination of bit flags)
# no more primary partitions allowed in the MSDOS table
with self.assertRaises(GLib.GError):
@@ -404,7 +404,7 @@ class PartCreatePartFullCase(PartTestCase):
# as is the start of the first part from the start of the disk
self.assertTrue(abs(ps3.start - (ps2.start + ps2.size + 1)) < ps.start)
self.assertEqual(ps3.size, 30 * 1024**2)
- self.assertEqual(ps3.flags, 0) # no flags (combination of bit flags)
+ self.assertIn(ps3.flags, [0, 128]) # no flags or extended+lba (combination of bit flags)
# the logical partition has number 5 even though the extended partition
# has number 3
@@ -871,7 +871,7 @@ class PartGetPartByPos(PartTestCase):
# as is the start of the first part from the start of the disk
self.assertTrue(abs(ps3.start - (ps2.start + ps2.size + 1)) < ps.start)
self.assertEqual(ps3.size, 35 * 1024**2)
- self.assertEqual(ps3.flags, 0) # no flags (combination of bit flags)
+ self.assertIn(ps3.flags, [0, 128]) # no flags or extended+lba (combination of bit flags)
# the logical partition has number 5 even though the extended partition
# has number 3
--
2.37.1

View File

@ -125,7 +125,7 @@
Name: libblockdev Name: libblockdev
Version: 2.25 Version: 2.25
Release: 13%{?dist} Release: 14%{?dist}
Summary: A library for low-level manipulation with block devices Summary: A library for low-level manipulation with block devices
License: LGPLv2+ License: LGPLv2+
URL: https://github.com/storaged-project/libblockdev URL: https://github.com/storaged-project/libblockdev
@ -144,6 +144,8 @@ Patch10: 0010-Add-support-for-creating-and-activating-integrity-de.patch
Patch11: 0011-tests-Wait-for-raid-and-mirrored-LVs-to-be-synced-be.patch Patch11: 0011-tests-Wait-for-raid-and-mirrored-LVs-to-be-synced-be.patch
Patch12: 0012-tests-Lower-expected-free-space-on-newly-created-Ext-filesystems.patch Patch12: 0012-tests-Lower-expected-free-space-on-newly-created-Ext-filesystems.patch
Patch13: 0013-ddf-mdadm-uuid-parse-fix.patch Patch13: 0013-ddf-mdadm-uuid-parse-fix.patch
Patch14: 0014-mdraid-Fix-copy-paste-error-when-checking-return-val.patch
Patch15: 0015-tests-Fix-expected-extended-partition-flags-with-new.patch
BuildRequires: make BuildRequires: make
BuildRequires: glib2-devel BuildRequires: glib2-devel
@ -709,6 +711,8 @@ A meta-package that pulls all the libblockdev plugins as dependencies.
%patch11 -p1 %patch11 -p1
%patch12 -p1 %patch12 -p1
%patch13 -p1 %patch13 -p1
%patch14 -p1
%patch15 -p1
%build %build
autoreconf -ivf autoreconf -ivf
@ -1012,6 +1016,12 @@ find %{buildroot} -type f -name "*.la" | xargs %{__rm}
%files plugins-all %files plugins-all
%changelog %changelog
* Mon Aug 08 2022 Vojtech Trefny <vtrefny@redhat.com> - 2.25-14
- tests: Fix expected extended partition flags with new parted
Related: rhbz#2109026
- mdraid: Fix copy-paste error when checking return value
Related: rhbz#2109026
* Mon Aug 08 2022 Vojtech Trefny <vtrefny@redhat.com> - 2.25-13 * Mon Aug 08 2022 Vojtech Trefny <vtrefny@redhat.com> - 2.25-13
- Fix getting UUID for DDF containers - Fix getting UUID for DDF containers
Resolves: rhbz#2109026 Resolves: rhbz#2109026