File 0450-Strip-NUL-bytes-in-stream-before-push-in-string.patch of Package dracut.10716
From 8ebcb9c3ded888ecd5c6fc0bbf4c9f490c3cdb56 Mon Sep 17 00:00:00 2001
From: Daniel Molkentin <dmolkentin@suse.de>
Date: Tue, 1 Mar 2016 21:03:18 +0100
Subject: [PATCH] Strip NUL bytes in stream before push in string
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Based on a patch by Tomasz Paweł Gajc <tpgxyz@gmail.com>
Workaround for bsc989218, the next upstream release
fixes this properly.
---
dracut.sh | 2 +-
modules.d/50drm/module-setup.sh | 6 +++---
modules.d/90kernel-modules/module-setup.sh | 6 +++---
modules.d/90kernel-network-modules/module-setup.sh | 6 +++---
modules.d/90multipath/module-setup.sh | 6 +++---
modules.d/95iscsi/module-setup.sh | 6 +++---
6 files changed, 16 insertions(+), 16 deletions(-)
Index: dracut-044/dracut.sh
===================================================================
--- dracut-044.orig/dracut.sh
+++ dracut-044/dracut.sh
@@ -1641,7 +1641,7 @@ if [[ $do_strip = yes ]] && ! [[ $DRACUT
# strip kernel modules, but do not touch signed modules
find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
| while read -r -d $'\0' f || [ -n "$f" ]; do
- SIG=$(tail -c 28 "$f")
+ SIG=$(tail -c 28 "$f" | tr -d '\000')
[[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
done | xargs -r -0 strip -g
Index: dracut-044/modules.d/50drm/module-setup.sh
===================================================================
--- dracut-044.orig/modules.d/50drm/module-setup.sh
+++ dracut-044/modules.d/50drm/module-setup.sh
@@ -24,9 +24,9 @@ installkernel() {
local _fname _fcont
while read _fname || [ -n "$_fname" ]; do
case "$_fname" in
- *.ko) _fcont="$(< $_fname)" ;;
- *.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
- *.ko.xz) _fcont="$(xz -dc $_fname)" ;;
+ *.ko) _fcont="$(cat "$_fname" | tr -cd '[:print:]')" ;;
+ *.ko.gz) _fcont="$(gzip -dc "$_fname" | tr -cd '[:print:]')" ;;
+ *.ko.xz) _fcont="$(xz -dc "$_fname" | tr -cd '[:print:]')" ;;
esac
[[ $_fcont =~ $_drm_drivers
&& ! $_fcont =~ iw_handler_get_spy ]] \
Index: dracut-044/modules.d/90kernel-modules/module-setup.sh
===================================================================
--- dracut-044.orig/modules.d/90kernel-modules/module-setup.sh
+++ dracut-044/modules.d/90kernel-modules/module-setup.sh
@@ -10,9 +10,9 @@ installkernel() {
function bmf1() {
local _f
while read _f || [ -n "$_f" ]; do case "$_f" in
- *.ko) [[ $(< $_f) =~ $_blockfuncs ]] && echo "$_f" ;;
- *.ko.gz) [[ $(gzip -dc <$_f) =~ $_blockfuncs ]] && echo "$_f" ;;
- *.ko.xz) [[ $(xz -dc <$_f) =~ $_blockfuncs ]] && echo "$_f" ;;
+ *.ko) [[ $(cat "$_f" | tr -cd '[:print:]') =~ $_blockfuncs ]] && echo "$_f" ;;
+ *.ko.gz) [[ $(gzip -dc <"$_f" | tr -cd '[:print:]') =~ $_blockfuncs ]] && echo "$_f" ;;
+ *.ko.xz) [[ $(xz -dc <"$_f" | tr -cd '[:print:]') =~ $_blockfuncs ]] && echo "$_f" ;;
esac
done
return 0
Index: dracut-044/modules.d/90kernel-network-modules/module-setup.sh
===================================================================
--- dracut-044.orig/modules.d/90kernel-network-modules/module-setup.sh
+++ dracut-044/modules.d/90kernel-network-modules/module-setup.sh
@@ -45,9 +45,9 @@ installkernel() {
while read _fname; do
[[ $_fname =~ $_unwanted_drivers ]] && continue
case "$_fname" in
- *.ko) _fcont="$(< $_fname)" ;;
- *.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
- *.ko.xz) _fcont="$(xz -dc $_fname)" ;;
+ *.ko) _fcont="$(cat "$_fname" | tr -cd '[:print:]')" ;;
+ *.ko.gz) _fcont="$(gzip -dc "$_fname" | tr -cd '[:print:]')" ;;
+ *.ko.xz) _fcont="$(xz -dc "$_fname" | tr -cd '[:print:]')" ;;
esac
[[ $_fcont =~ $_net_drivers
&& ! $_fcont =~ iw_handler_get_spy ]] \
Index: dracut-044/modules.d/90multipath/module-setup.sh
===================================================================
--- dracut-044.orig/modules.d/90multipath/module-setup.sh
+++ dracut-044/modules.d/90multipath/module-setup.sh
@@ -49,9 +49,9 @@ installkernel() {
local _f
while read _f || [ -n "$_f" ]; do
case "$_f" in
- *.ko) [[ $(< $_f) =~ $_funcs ]] && echo "$_f" ;;
- *.ko.gz) [[ $(gzip -dc <$_f) =~ $_funcs ]] && echo "$_f" ;;
- *.ko.xz) [[ $(xz -dc <$_f) =~ $_funcs ]] && echo "$_f" ;;
+ *.ko) [[ $(cat "$_f" | tr -cd '[:print:]') =~ $_funcs ]] && echo "$_f" ;;
+ *.ko.gz) [[ $(gzip -dc <"$_f" | tr -cd '[:print:]') =~ $_funcs ]] && echo "$_f" ;;
+ *.ko.xz) [[ $(xz -dc <"$_f" | tr -cd '[:print:]') =~ $_funcs ]] && echo "$_f" ;;
esac
done
return 0
Index: dracut-044/modules.d/95iscsi/module-setup.sh
===================================================================
--- dracut-044.orig/modules.d/95iscsi/module-setup.sh
+++ dracut-044/modules.d/95iscsi/module-setup.sh
@@ -189,9 +189,9 @@ installkernel() {
local _f
while read _f || [ -n "$_f" ]; do
case "$_f" in
- *.ko) [[ $(< $_f) =~ $_funcs ]] && echo "$_f" ;;
- *.ko.gz) [[ $(gzip -dc <$_f) =~ $_funcs ]] && echo "$_f" ;;
- *.ko.xz) [[ $(xz -dc <$_f) =~ $_funcs ]] && echo "$_f" ;;
+ *.ko) [[ $(< "$_f" | tr -cd '[:print:]') =~ $_funcs ]] && echo "$_f" ;;
+ *.ko.gz) [[ $(gzip -dc <"$_f" | tr -cd '[:print:]') =~ $_funcs ]] && echo "$_f" ;;
+ *.ko.xz) [[ $(xz -dc <"$_f" | tr -cd '[:print:]') =~ $_funcs ]] && echo "$_f" ;;
esac
done
return 0