From 35fcd55f76564c1984a4c763098c43d6c92edf32 Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Mon, 3 Apr 2023 13:32:20 +0200 Subject: [PATCH] Fix test_swapon_pagesize on systems with 64k pages Resolves: rhbz#2138698 --- ...wapon_pagesize-on-systems-with-64k-p.patch | 41 +++++++++++++++++++ libblockdev.spec | 8 +++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 0002-tests-Fix-test_swapon_pagesize-on-systems-with-64k-p.patch diff --git a/0002-tests-Fix-test_swapon_pagesize-on-systems-with-64k-p.patch b/0002-tests-Fix-test_swapon_pagesize-on-systems-with-64k-p.patch new file mode 100644 index 0000000..4712539 --- /dev/null +++ b/0002-tests-Fix-test_swapon_pagesize-on-systems-with-64k-p.patch @@ -0,0 +1,41 @@ +From 6700dfded31219c99fea054aa10fd68b90bace82 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Mon, 31 Oct 2022 12:43:17 +0100 +Subject: [PATCH] tests: Fix test_swapon_pagesize on systems with 64k pages + +--- + tests/swap_test.py | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/tests/swap_test.py b/tests/swap_test.py +index 0a0f333d..e350f8e8 100644 +--- a/tests/swap_test.py ++++ b/tests/swap_test.py +@@ -1,5 +1,6 @@ + import unittest + import os ++import resource + import overrides_hack + + from utils import create_sparse_tempfile, create_lio_device, delete_lio_device, fake_utils, fake_path, run_command, run, TestTags, tag_test +@@ -102,8 +103,15 @@ class SwapTestCase(SwapTest): + def test_swapon_pagesize(self): + """Verify that activating swap with different pagesize fails""" + +- # create swap with 64k pagesize +- ret, out, err = run_command("mkswap --pagesize 65536 %s" % self.loop_dev) ++ # pick some wrong page size: 8k on 64k and 64k everywhere else ++ pagesize = resource.getpagesize() ++ if pagesize == 65536: ++ wrong_pagesize = 8192 ++ else: ++ wrong_pagesize = 65536 ++ ++ # create swap with "wrong" pagesize ++ ret, out, err = run_command("mkswap --pagesize %s %s" % (wrong_pagesize, self.loop_dev)) + if ret != 0: + self.fail("Failed to prepare swap for pagesize test: %s %s" % (out, err)) + +-- +2.39.2 + diff --git a/libblockdev.spec b/libblockdev.spec index 1feefb7..314d146 100644 --- a/libblockdev.spec +++ b/libblockdev.spec @@ -125,12 +125,13 @@ Name: libblockdev Version: 2.28 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A library for low-level manipulation with block devices License: LGPLv2+ URL: https://github.com/storaged-project/libblockdev Source0: https://github.com/storaged-project/libblockdev/releases/download/%{version}-%{release}/%{name}-%{version}.tar.gz Patch0: 0001-crypto-Fix-GError-overwrite-from-libvolume_key.patch +Patch1: 0002-tests-Fix-test_swapon_pagesize-on-systems-with-64k-p.patch BuildRequires: make BuildRequires: glib2-devel @@ -685,6 +686,7 @@ A meta-package that pulls all the libblockdev plugins as dependencies. %prep %setup -q -n %{name}-%{version} %patch0 -p1 +%patch1 -p1 %build autoreconf -ivf @@ -988,6 +990,10 @@ find %{buildroot} -type f -name "*.la" | xargs %{__rm} %files plugins-all %changelog +* Mon Apr 03 2023 Vojtech Trefny - 2.28-3 +- Fix test_swapon_pagesize on systems with 64k pages + Resolves: rhbz#2138698 + * Wed Nov 30 2022 Vojtech Trefny - 2.28-2 - Fix double free in write_escrow_data_file Resolves: rhbz#2142660