]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(img-lib): ignored null byte in input
authorLev Veyde <lveyde@redhat.com>
Wed, 21 Apr 2021 22:11:55 +0000 (01:11 +0300)
committerHarald Hoyer <harald@hoyer.xyz>
Thu, 22 Apr 2021 09:23:22 +0000 (11:23 +0200)
The system currently throws numerous nasty warning messages during
the boot, about ignored null bytes in input.

This patch adds a filter to the dd command, to filter these null
bytes out, and thus to prevent these warning messages.

Signed-off-by: Lev Veyde <lveyde@redhat.com>
modules.d/99img-lib/img-lib.sh
modules.d/99img-lib/module-setup.sh

index fa117adfab2c767e6a4c71bc3490c12abe1bc6ee..d8b95d60a4d74356ea86b12c746e97ba0bbc7908 100755 (executable)
@@ -13,7 +13,7 @@ det_archive() {
     xz="$(/bin/echo -e '\xfd7zXZ')"
     gz="$(/bin/echo -e '\x1f\x8b')"
     zs="$(/bin/echo -e '\x28\xB5\x2F\xFD')"
-    headerblock="$(dd ${1:+if=$1} bs=262 count=1 2> /dev/null)"
+    headerblock="$(dd ${1:+if=$1} bs=262 count=1 2> /dev/null | tr -d '\0')"
     case "$headerblock" in
         $xz*) echo "xz" ;;
         $gz*) echo "gzip" ;;
index 61c1103854047584704b762ccbba55908a25732a..558a9256a9f26c10396f0d986aa70d1302564495 100755 (executable)
@@ -3,7 +3,7 @@
 
 # called by dracut
 check() {
-    require_binaries tar gzip dd echo || return 1
+    require_binaries tar gzip dd echo tr || return 1
     return 255
 }
 
@@ -14,7 +14,7 @@ depends() {
 
 # called by dracut
 install() {
-    inst_multiple tar gzip dd echo
+    inst_multiple tar gzip dd echo tr
     # TODO: make this conditional on a cmdline flag / config option
     inst_multiple -o cpio xz bzip2 zstd
     inst_simple "$moddir/img-lib.sh" "/lib/img-lib.sh"