commit:     b11a0316d954d186df8c61aee62402ff6026c7dc
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 23 19:13:04 2021 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Fri Jul 23 19:13:04 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b11a0316

sys-kernel/dracut: fix quoting issues

Closes: https://bugs.gentoo.org/803548
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 .../{dracut-055.ebuild => dracut-055-r1.ebuild}    |  2 ++
 ...ase-do-not-quote-initargs-for-switch_root.patch | 32 ++++++++++++++++++
 ...x-crypt-remove-quotes-from-cryptsetupopts.patch | 39 ++++++++++++++++++++++
 3 files changed, 73 insertions(+)

diff --git a/sys-kernel/dracut/dracut-055.ebuild 
b/sys-kernel/dracut/dracut-055-r1.ebuild
similarity index 97%
rename from sys-kernel/dracut/dracut-055.ebuild
rename to sys-kernel/dracut/dracut-055-r1.ebuild
index 3b042f3de74..e45745cf50f 100644
--- a/sys-kernel/dracut/dracut-055.ebuild
+++ b/sys-kernel/dracut/dracut-055-r1.ebuild
@@ -60,6 +60,8 @@ BDEPEND="
 QA_MULTILIB_PATHS="usr/lib/dracut/.*"
 
 PATCHES=(
+       "${FILESDIR}"/055-fix-crypt-remove-quotes-from-cryptsetupopts.patch
+       "${FILESDIR}"/055-fix-base-do-not-quote-initargs-for-switch_root.patch
        "${FILESDIR}"/gentoo-ldconfig-paths-r1.patch
 )
 

diff --git 
a/sys-kernel/dracut/files/055-fix-base-do-not-quote-initargs-for-switch_root.patch
 
b/sys-kernel/dracut/files/055-fix-base-do-not-quote-initargs-for-switch_root.patch
new file mode 100644
index 00000000000..5568c22aede
--- /dev/null
+++ 
b/sys-kernel/dracut/files/055-fix-base-do-not-quote-initargs-for-switch_root.patch
@@ -0,0 +1,32 @@
+From 285e2ad01035743ff51005a74e486e09fcbb0a0d Mon Sep 17 00:00:00 2001
+From: Mike Gilbert <[email protected]>
+Date: Fri, 23 Jul 2021 14:35:07 -0400
+Subject: [PATCH] fix(base): do not quote $initargs for switch_root
+
+We want word splitting to occur so that the arguments are passed
+separately, and we don't end up passing an empty string if no arguments
+are specified.
+
+Bug: https://bugs.gentoo.org/803548
+Fixes: 2fabaaa62dcfd31e593ca45e1374e55adae29d6b
+---
+ modules.d/99base/init.sh | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
+index 978adb6f..ab62bb44 100755
+--- a/modules.d/99base/init.sh
++++ b/modules.d/99base/init.sh
+@@ -387,7 +387,8 @@ if [ -f /etc/capsdrop ]; then
+         }
+ else
+     unset RD_DEBUG
+-    exec "$SWITCH_ROOT" "$NEWROOT" "$INIT" "$initargs" || {
++    # shellcheck disable=SC2086
++    exec "$SWITCH_ROOT" "$NEWROOT" "$INIT" $initargs || {
+         warn "Something went very badly wrong in the initramfs.  Please "
+         warn "file a bug against dracut."
+         emergency_shell
+-- 
+2.32.0
+

diff --git 
a/sys-kernel/dracut/files/055-fix-crypt-remove-quotes-from-cryptsetupopts.patch 
b/sys-kernel/dracut/files/055-fix-crypt-remove-quotes-from-cryptsetupopts.patch
new file mode 100644
index 00000000000..355cdc461ab
--- /dev/null
+++ 
b/sys-kernel/dracut/files/055-fix-crypt-remove-quotes-from-cryptsetupopts.patch
@@ -0,0 +1,39 @@
+From e0abf88a15d23fbf793cf872397016ad86aeaaa8 Mon Sep 17 00:00:00 2001
+From: lapseofreason <[email protected]>
+Date: Tue, 8 Jun 2021 16:01:58 +0200
+Subject: [PATCH] fix(crypt): remove quotes from cryptsetupopts
+
+Fixes #1528.
+---
+ modules.d/90crypt/cryptroot-ask.sh | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/modules.d/90crypt/cryptroot-ask.sh 
b/modules.d/90crypt/cryptroot-ask.sh
+index 37a4deea..b1f8df81 100755
+--- a/modules.d/90crypt/cryptroot-ask.sh
++++ b/modules.d/90crypt/cryptroot-ask.sh
+@@ -138,8 +138,9 @@ unset allowdiscards
+ ask_passphrase=1
+ 
+ if [ -n "$luksfile" -a "$luksfile" != "none" -a -e "$luksfile" ]; then
++    # shellcheck disable=SC2086
+     if readkey "$luksfile" / "$device" \
+-        | cryptsetup -d - "$cryptsetupopts" luksOpen "$device" "$luksname"; 
then
++        | cryptsetup -d - $cryptsetupopts luksOpen "$device" "$luksname"; then
+         ask_passphrase=0
+     fi
+ elif [ "$is_keysource" -ne 0 ]; then
+@@ -164,8 +165,9 @@ else
+         unset tmp
+ 
+         info "Using '$keypath' on '$keydev'"
++        # shellcheck disable=SC2086
+         readkey "$keypath" "$keydev" "$device" \
+-            | cryptsetup -d - "$cryptsetupopts" luksOpen "$device" 
"$luksname" \
++            | cryptsetup -d - $cryptsetupopts luksOpen "$device" "$luksname" \
+             && ask_passphrase=0
+         unset keypath keydev
+         break
+-- 
+2.32.0
+

Reply via email to