Skip to content

Commit

Permalink
rpm2cpio.sh: strip null bytes with tr
Browse files Browse the repository at this point in the history
to avoid warnings
  • Loading branch information
ffesti authored and dmnks committed Jul 13, 2022
1 parent a18a119 commit d499887
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/rpm2cpio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ calcsize() {
offset=$(($offset + $rsize))
}

case "$(_dd 0 bs=8 count=1)" in
case "$(_dd 0 bs=8 count=1 | tr -d '\0')" in
"$(printf '\355\253\356\333')"*) ;; # '\xed\xab\xee\xdb'
*) fatal "File doesn't look like rpm: $pkg" ;;
esac
Expand All @@ -54,7 +54,7 @@ sigsize=$rsize
calcsize $(($offset + (8 - ($sigsize % 8)) % 8))
hdrsize=$rsize

case "$(_dd $offset bs=3 count=1)" in
case "$(_dd $offset bs=3 count=1 | tr -d '\0')" in
"$(printf '\102\132')"*) _dd $offset | bunzip2 ;; # '\x42\x5a'
"$(printf '\037\213')"*) _dd $offset | gunzip ;; # '\x1f\x8b'
"$(printf '\375\067')"*) _dd $offset | xzcat ;; # '\xfd\x37'
Expand Down

0 comments on commit d499887

Please sign in to comment.