RHEL 9.0.0 Alpha bootstrap

The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/libblockdev#5e985ab28c5d4b9ba6e67c31d9a5bf58f684e7c6
This commit is contained in:
Petr Šabata 2020-10-15 15:35:58 +02:00
parent 34a042e2cb
commit 9a038ef348
9 changed files with 2460 additions and 0 deletions

47
.gitignore vendored
View File

@ -0,0 +1,47 @@
/libblockdev-0.1.tar.gz
/libblockdev-0.2.tar.gz
/libblockdev-0.3.tar.gz
/libblockdev-0.4.tar.gz
/libblockdev-0.5.tar.gz
/libblockdev-0.6.tar.gz
/libblockdev-0.7.tar.gz
/libblockdev-0.8.tar.gz
/libblockdev-0.9.tar.gz
/libblockdev-0.10.tar.gz
/libblockdev-0.11.tar.gz
/libblockdev-0.12.tar.gz
/libblockdev-0.13.tar.gz
/libblockdev-1.0.tar.gz
/libblockdev-1.1.tar.gz
/libblockdev-1.2.tar.gz
/libblockdev-1.3.tar.gz
/libblockdev-1.4.tar.gz
/libblockdev-1.5.tar.gz
/libblockdev-1.6.tar.gz
/libblockdev-1.7.tar.gz
/libblockdev-1.8.tar.gz
/libblockdev-1.9.tar.gz
/libblockdev-2.1.tar.gz
/libblockdev-2.2.tar.gz
/libblockdev-2.3.tar.gz
/libblockdev-2.4.tar.gz
/libblockdev-2.5.tar.gz
/libblockdev-2.6.tar.gz
/libblockdev-2.7.tar.gz
/libblockdev-2.8.tar.gz
/libblockdev-2.9.tar.gz
/libblockdev-2.10.tar.gz
/libblockdev-2.11.tar.gz
/libblockdev-2.12.tar.gz
/libblockdev-2.13.tar.gz
/libblockdev-2.14.tar.gz
/libblockdev-2.15.tar.gz
/libblockdev-2.16.tar.gz
/libblockdev-2.17.tar.gz
/libblockdev-2.18.tar.gz
/libblockdev-2.19.tar.gz
/libblockdev-2.20.tar.gz
/libblockdev-2.21.tar.gz
/libblockdev-2.22.tar.gz
/libblockdev-2.23.tar.gz
/libblockdev-2.24.tar.gz

View File

@ -0,0 +1,27 @@
From 2da13152619ee7233650339797657b45088b2219 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Tue, 18 Aug 2020 09:44:29 +0200
Subject: [PATCH] dm: Fix comparing DM RAID member devices UUID
There is no "UUID" property in UDev we must use the "ID_FS_UUID"
one.
This comparison works only because most DM RAID members don't have
UUID so the check is skipped, but it fails for DDF RAID members
which have a special GUID/UUID in UDev database.
---
src/plugins/dm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/plugins/dm.c b/src/plugins/dm.c
index a6412028..4ab0d2a4 100644
--- a/src/plugins/dm.c
+++ b/src/plugins/dm.c
@@ -482,7 +482,7 @@ static gboolean raid_dev_matches_spec (struct raid_dev *raid_dev, const gchar *n
context = udev_new ();
device = udev_device_new_from_subsystem_sysname (context, "block", dev_name);
- dev_uuid = udev_device_get_property_value (device, "UUID");
+ dev_uuid = udev_device_get_property_value (device, "ID_FS_UUID");
major_str = udev_device_get_property_value (device, "MAJOR");
minor_str = udev_device_get_property_value (device, "MINOR");

View File

@ -0,0 +1,119 @@
From a29d25fdfdcd7b133052eab1a3d1defe12c1733f Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Wed, 10 Jun 2020 17:03:28 +0200
Subject: [PATCH] exec: Fix setting locale for util calls
This actually fixes two issue. The _utils_exec_and_report_progress
function didn't set the LC_ALL=C environment variable to make sure
we get output in English. And also we shouldn't use setenv in the
GSpawnChildSetupFunc, it's actually example of what not to do in
g_spawn_async documentation. This fix uses g_environ_setenv and
passes the new environment to the g_spawn call.
---
src/utils/exec.c | 26 +++++++++++++++++---------
tests/utils_test.py | 7 +++++++
2 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/src/utils/exec.c b/src/utils/exec.c
index 9293930..37bd960 100644
--- a/src/utils/exec.c
+++ b/src/utils/exec.c
@@ -140,11 +140,6 @@ static void log_done (guint64 task_id, gint exit_code) {
return;
}
-static void set_c_locale(gpointer user_data __attribute__((unused))) {
- if (setenv ("LC_ALL", "C", 1) != 0)
- g_warning ("Failed to set LC_ALL=C for a child process!");
-}
-
/**
* bd_utils_exec_and_report_error:
* @argv: (array zero-terminated=1): the argv array for the call
@@ -194,6 +189,8 @@ gboolean bd_utils_exec_and_report_status_error (const gchar **argv, const BDExtr
const BDExtraArg **extra_p = NULL;
gint exit_status = 0;
guint i = 0;
+ gchar **old_env = NULL;
+ gchar **new_env = NULL;
if (extra) {
args_len = g_strv_length ((gchar **) argv);
@@ -219,16 +216,20 @@ gboolean bd_utils_exec_and_report_status_error (const gchar **argv, const BDExtr
args[i] = NULL;
}
+ old_env = g_get_environ ();
+ new_env = g_environ_setenv (old_env, "LC_ALL", "C", TRUE);
+
task_id = log_running (args ? args : argv);
- success = g_spawn_sync (NULL, args ? (gchar **) args : (gchar **) argv, NULL, G_SPAWN_SEARCH_PATH,
- (GSpawnChildSetupFunc) set_c_locale, NULL,
- &stdout_data, &stderr_data, &exit_status, error);
+ success = g_spawn_sync (NULL, args ? (gchar **) args : (gchar **) argv, new_env, G_SPAWN_SEARCH_PATH,
+ NULL, NULL, &stdout_data, &stderr_data, &exit_status, error);
if (!success) {
/* error is already populated from the call */
+ g_strfreev (new_env);
g_free (stdout_data);
g_free (stderr_data);
return FALSE;
}
+ g_strfreev (new_env);
/* g_spawn_sync set the status in the same way waitpid() does, we need
to get the process exit code manually (this is similar to calling
@@ -297,6 +298,8 @@ static gboolean _utils_exec_and_report_progress (const gchar **argv, const BDExt
gboolean err_done = FALSE;
GString *stdout_data = g_string_new (NULL);
GString *stderr_data = g_string_new (NULL);
+ gchar **old_env = NULL;
+ gchar **new_env = NULL;
/* TODO: share this code between functions */
if (extra) {
@@ -325,7 +328,10 @@ static gboolean _utils_exec_and_report_progress (const gchar **argv, const BDExt
task_id = log_running (args ? args : argv);
- ret = g_spawn_async_with_pipes (NULL, args ? (gchar**) args : (gchar**) argv, NULL,
+ old_env = g_get_environ ();
+ new_env = g_environ_setenv (old_env, "LC_ALL", "C", TRUE);
+
+ ret = g_spawn_async_with_pipes (NULL, args ? (gchar**) args : (gchar**) argv, new_env,
G_SPAWN_DEFAULT|G_SPAWN_SEARCH_PATH|G_SPAWN_DO_NOT_REAP_CHILD,
NULL, NULL, &pid, NULL, &out_fd, &err_fd, error);
@@ -333,9 +339,11 @@ static gboolean _utils_exec_and_report_progress (const gchar **argv, const BDExt
/* error is already populated */
g_string_free (stdout_data, TRUE);
g_string_free (stderr_data, TRUE);
+ g_strfreev (new_env);
g_free (args);
return FALSE;
}
+ g_strfreev (new_env);
args_str = g_strjoinv (" ", args ? (gchar **) args : (gchar **) argv);
msg = g_strdup_printf ("Started '%s'", args_str);
diff --git a/tests/utils_test.py b/tests/utils_test.py
index 4bec3db..2bec5ed 100644
--- a/tests/utils_test.py
+++ b/tests/utils_test.py
@@ -170,6 +170,13 @@ class UtilsExecLoggingTest(UtilsTestCase):
# exit code != 0
self.assertTrue(BlockDev.utils_check_util_version("libblockdev-fake-util-fail", "1.1", "version", "Version:\\s(.*)"))
+ @tag_test(TestTags.NOSTORAGE, TestTags.CORE)
+ def test_exec_locale(self):
+ """Verify that setting locale for exec functions works as expected"""
+
+ succ, out = BlockDev.utils_exec_and_capture_output(["locale"])
+ self.assertTrue(succ)
+ self.assertIn("LC_ALL=C", out)
class UtilsDevUtilsTestCase(UtilsTestCase):
@tag_test(TestTags.NOSTORAGE, TestTags.CORE)
--
2.26.2

15
libblockdev-gcc11.patch Normal file
View File

@ -0,0 +1,15 @@
diff --git a/src/plugins/kbd.c b/src/plugins/kbd.c
index a2908ec..97abd3b 100644
--- a/src/plugins/kbd.c
+++ b/src/plugins/kbd.c
@@ -732,6 +732,10 @@ static gboolean wait_for_file (const char *filename) {
*
* Tech category: %BD_KBD_TECH_BCACHE-%BD_KBD_TECH_MODE_CREATE
*/
+/* This triggers a known false positive warning in gcc-11. It's being
+ addressed upstream, but until the fix is available, this works around
+ the false positive. */
+__attribute__ ((optimize ("-O1")))
gboolean bd_kbd_bcache_create (const gchar *backing_device, const gchar *cache_device, const BDExtraArg **extra, const gchar **bcache_device, GError **error) {
const gchar *argv[6] = {"make-bcache", "-B", backing_device, "-C", cache_device, NULL};
gboolean success = FALSE;

2214
libblockdev.spec Normal file

File diff suppressed because it is too large Load Diff

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (libblockdev-2.24.tar.gz) = 92b7d734ea2cefbb67e626bef369d6785ba2a4bbbf09a4f59345febe977bc32319fb44f38b3c3177b8652abbc1f87b6cc76d41fdd2d70783c1c168049bdcb1d6

1
tests/.fmf/version Normal file
View File

@ -0,0 +1 @@
1

5
tests/provision.fmf Normal file
View File

@ -0,0 +1,5 @@
---
standard-inventory-qcow2:
qemu:
m: 3G

31
tests/tests.yml Normal file
View File

@ -0,0 +1,31 @@
---
# No tests suitable for atomic environment
# No tests suitable for container environment
# Tests suitable for classic environment
- hosts: localhost
roles:
- role: standard-test-source
tags:
- always
- role: standard-test-basic
tags:
- classic
tests:
- upstream_test_suite:
dir: source
run: python3 tests/run_tests.py --installed
required_packages:
- volume_key
- nss-tools
- targetcli
- xfsprogs
- dosfstools
- e2fsprogs
- cryptsetup
- glibc-all-langpacks
- python3-six
- python3-dbus
- python3-yaml
- python3-bytesize