From 61fb1e8e40cb065d15c0cc0d4634f3adc8f73592 Mon Sep 17 00:00:00 2001 From: Pavel Valena Date: Fri, 24 Feb 2023 19:48:28 +0100 Subject: [PATCH] fix(dracut.sh): handle --kmoddir with trailing / https://github.com/dracutdevs/dracut/pull/2237 Resolves: #2173100 --- ...r-fix-trailing-forwardslash-handling.patch | 28 +++++++++++++++++++ dracut.spec | 9 +++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 2237-kmoddir-fix-trailing-forwardslash-handling.patch diff --git a/2237-kmoddir-fix-trailing-forwardslash-handling.patch b/2237-kmoddir-fix-trailing-forwardslash-handling.patch new file mode 100644 index 0000000..4a02d1a --- /dev/null +++ b/2237-kmoddir-fix-trailing-forwardslash-handling.patch @@ -0,0 +1,28 @@ +From 6fb0f4b4d54eeb1b1e89c06cc54bdcab504138da Mon Sep 17 00:00:00 2001 +From: Pavel Valena +Date: Fri, 24 Feb 2023 19:19:59 +0100 +Subject: [PATCH] fix(dracut.sh): kmoddir does not handle trailing / + +Fixes https://github.com/dracutdevs/dracut/issues/2236 + ++(/) only works in bash interactive mode. Using any non-interactive +bash run simply doesn't remove anything. + +The solution is copied from dracut-lib.sh, trim(). +--- + dracut.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dracut.sh b/dracut.sh +index 1aa3f8e1f..0c0f85c2d 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -1033,7 +1033,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l)) + ((stdloglvl < 0)) && stdloglvl=0 + + [[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l +-drivers_dir="${drivers_dir%%+(/)}" ++drivers_dir="${drivers_dir%"${drivers_dir##*[!/]}"}" + [[ $do_strip_l ]] && do_strip=$do_strip_l + [[ $do_strip ]] || do_strip=yes + [[ $aggressive_strip_l ]] && aggressive_strip=$aggressive_strip_l diff --git a/dracut.spec b/dracut.spec index 9dae606..c3c2e6b 100644 --- a/dracut.spec +++ b/dracut.spec @@ -7,7 +7,7 @@ %global __requires_exclude pkg-config # rpmdev-bumpspec and releng automation compatible variable -%global baserelease 2 +%global baserelease 3 Name: dracut Version: 059 @@ -44,6 +44,10 @@ Patch3: 2218-add-module-driver-support-for-macbook-keyboards.patch # https://bugzilla.redhat.com/show_bug.cgi?id=2172269#c3 Patch4: 1934-revert-add-overlayfs-module.patch +# Fix: dracut --kmoddir fails on paths with traling / +# https://bugzilla.redhat.com/show_bug.cgi?id=2173100 +Patch5: 2237-kmoddir-fix-trailing-forwardslash-handling.patch + BuildRequires: bash BuildRequires: git-core BuildRequires: pkgconfig(libkmod) >= 23 @@ -449,6 +453,9 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/ %{_prefix}/lib/kernel/install.d/51-dracut-rescue.install %changelog +* Fri Feb 24 2023 Pavel Valena - 059-3 +- fix(dracut.sh): handle --kmoddir with trailing / + * Tue Feb 21 2023 Pavel Valena - 059-2 - Revert: PR#1934 add overlayfs module