Skip to content

Commit

Permalink
fix(img-lib): ignored null byte in input
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
lveyde authored and haraldh committed Apr 22, 2021
1 parent 782ac8f commit 85eb968
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules.d/99img-lib/img-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" ;;
Expand Down
4 changes: 2 additions & 2 deletions modules.d/99img-lib/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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"
Expand Down

0 comments on commit 85eb968

Please sign in to comment.