Package: initramfs-tools Version: 0.133 Severity: normal Tags: patch Dear Maintainer,
unmkinitramfs fails to unpack lz4 compressed initrd, ie.: $ sudo apt install initramfs-tools lz4 file $ mkinitramfs -c lz4 -o foo.img $ unmkinitramfs foo.img bar cpio: premature end of archive $ echo $? 2 I think this is because lz4cat is strict with file extensions: $ file foo.img foo.img: LZ4 compressed data (v0.1-v0.9) $ lz4cat -t foo.img File extension doesn't match expected LZ4_EXTENSION (.lz4); will not process file: foo.img I propose the attached patch to change 'lz4cat -t $archive' invocations to become 'lz4cat -t <$archive' instead. As lz4cat does not / cannot enforce extension checking on streams. Regards, Dimitri.
diff -Nru initramfs-tools-0.133ubuntu6/unmkinitramfs initramfs-tools-0.133ubuntu8/unmkinitramfs --- initramfs-tools-0.133ubuntu6/unmkinitramfs 2019-06-07 19:22:58.000000000 +0000 +++ initramfs-tools-0.133ubuntu8/unmkinitramfs 2019-06-09 23:21:17.000000000 +0000 @@ -33,8 +33,8 @@ gzip -c -d "$archive" elif xzcat -t "$archive" >/dev/null 2>&1 ; then xzcat "$archive" - elif lz4cat -t "$archive" >/dev/null 2>&1 ; then - lz4cat "$archive" + elif lz4cat -t <"$archive" >/dev/null 2>&1 ; then + lz4cat <"$archive" elif bzip2 -t "$archive" >/dev/null 2>&1 ; then bzip2 -c -d "$archive" elif lzop -t "$archive" >/dev/null 2>&1 ; then