summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Festi <ffesti@redhat.com>2022-07-01 14:49:09 +0200
committerPanu Matilainen <pmatilai@redhat.com>2022-09-02 08:48:10 +0300
commit3eb1d72c3c95f51394acab4f9b68116d055b9c50 (patch)
tree0f576ecedab76524a2eae1f39190c6731de947ec
parentc743e1107b11225da157be517372130ff3a38727 (diff)
downloadrpm-3eb1d72c3c95f51394acab4f9b68116d055b9c50.tar.gz
rpm2cpio.sh: strip null bytes with tr
to avoid warnings (cherry picked from commit d499887c9261fdab4d03ea29316ea5e8fc646bd3)
-rwxr-xr-xscripts/rpm2cpio.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/rpm2cpio.sh b/scripts/rpm2cpio.sh
index f77d5f8cd..59e8bc518 100755
--- a/scripts/rpm2cpio.sh
+++ b/scripts/rpm2cpio.sh
@@ -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
@@ -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'