Package: initramfs-tools-core Version: 0.142 Severity: normal Tags: patch File: /usr/bin/unmkinitramfs
Dear Maintainer, With the default COMPRESS=zstd lsmkinitramfs fails on unsplit /initrd.img: $ lsmkinitramfs /initrd.img cpio: premature end of archive $ unmkinitramfs /initrd.img /tmp/initramfs cpio: premature end of archive This is because zstd(1) refuses to operate on symlinks without `-f`: $ zstd -t /initrd.img Warning : /initrd.img is a symbolic link, ignoring (This is with an unsplit initramfs, so xcpio() processes the input file directly.) That behavior seems to be specific to zstd(1), at least unmkinitramfs(8) does seem work with COMPRESS=gzip, bzip2, lz4, lzma, lzop, xz. All these utilities do process standard input though, so a simple fix (attached) is to merely redirect it. Thanks for maintaining initramfs-tools! -- Guilhem. -- System Information: Debian Release: bookworm/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 5.18.0-2-amd64 (SMP w/8 CPU threads; PREEMPT) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages initramfs-tools-core depends on: ii coreutils 8.32-4.1 ii cpio 2.13+dfsg-7 ii e2fsprogs 1.46.5-2 ii klibc-utils 2.0.10-4 ii kmod 30+20220630-2 ii logsave 1.46.5-2 ii udev 251.3-1 Versions of packages initramfs-tools-core recommends: ii busybox 1:1.35.0-1 ii zstd 1.5.2+dfsg-1 Versions of packages initramfs-tools-core suggests: ii bash-completion 1:2.11-6 -- Configuration Files: /etc/initramfs-tools/initramfs.conf changed [not included] -- no debconf information
--- a/unmkinitramfs +++ b/unmkinitramfs @@ -29,18 +29,18 @@ dir="$2" shift 2 - if gzip -t "$archive" >/dev/null 2>&1 ; then - gzip -c -d "$archive" - elif zstd -q -c -t "$archive" >/dev/null 2>&1 ; then - zstd -q -c -d "$archive" - elif xzcat -t "$archive" >/dev/null 2>&1 ; then - xzcat "$archive" + if gzip -t < "$archive" >/dev/null 2>&1 ; then + gzip -c -d < "$archive" + elif zstd -q -c -t < "$archive" >/dev/null 2>&1 ; then + zstd -q -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 bzip2 -t "$archive" >/dev/null 2>&1 ; then - bzip2 -c -d "$archive" - elif lzop -t "$archive" >/dev/null 2>&1 ; then - lzop -c -d "$archive" + lz4cat < "$archive" + elif bzip2 -t < "$archive" >/dev/null 2>&1 ; then + bzip2 -c -d < "$archive" + elif lzop -t < "$archive" >/dev/null 2>&1 ; then + lzop -c -d < "$archive" # Ignoring other data, which may be garbage at the end of the file fi | ( if [ -n "$dir" ]; then
signature.asc
Description: PGP signature